I am running fixed-effect instrumental variable panel regression. The data is unbalanced panel. The cross-sectional unit is bond. I run regression in daily frequency. The variable on the left hand side is bond yield. Instead of running xtivreg, I use ivreg2 and manually add fixed effect terms for bonds (i.bond_id). It is because I want to use the post-estimation command "weakivtest". I cannot use "weakivtest" after xtivreg.

I am having hard time figuring out why I am getting the warning message below. Could you help?

code:

set matsize 10000
eststo clear

bysort bond_id: drop if _N <= 2
ivreg2 yield x1 i.bond_id x2 (x3 = z), cluster (bond_quarter_id)
weakivtest


Then I get the following warning message:

Warning: estimated covariance matrix of moment conditions not of full rank.
overidentification statistic not reported, and standard errors and
model tests should be interpreted with caution.
Possible causes:
number of clusters insufficient to calculate robust covariance matrix
singleton dummy variable (dummy with one 1 and N-1 0s or vice versa)
partial option may address problem.


I tried to fix problems on my own.

(1) I do not have any singleton dummy. As you can see in my code, I drop all bonds that appear no more than 2 times in the data. Hence, any i.bond_ID cannot be singleton.

(2) I cannot use partial out option, unfortunately. If I do that, then I have a problem with "weakivtest". I get the message that "weakivtest" cannot be used with noconstant option.

(3) number of clusters: this is why I am clustering at the bond-month level, instead of bond-level. I have about 3000 bonds. I have about 30,000 unique pairs of bond and quarters. The number of clusters is far larger than the number of indicator variables.

I want to use "weakivtest" because the usual rule-of-thumb (F statistic should be greater than 10) holds only for homoskedastic errors without auto-correlation. I am following the NBER SI http://conference.nber.org/confer/20...18/ML/Note.pdf.

At this point, I have no idea where the problem is coming from. Any suggestions?