Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • estimated covariance matrix of moment conditions not of full rank when using "xtivreg2", please help me

    Hello everyone, I deal with a problem when I want to use an instrument in my regression.
    I use a panel data, and I want to use a Bartik instrument in my analysis, however, I read all in terms of the
    Code:
    gen shock = log10(1+cases_pop)
    Code:
    gen shock_recession=.
    
    replace shock_recession = ( dum_recession * shock )
    
    replace shock_recession = 0 if shock_recession ==.
    Code:
    gen ydummy =.
    replace ydummy=1 if (year==2003 | year==2009 | year==2012 | year==2014 | year==2016) 
    replace ydummy=0 if ydummy==.
    Code:
    bys ifscode: egen mean_temp =mean(temperature)
    
    gen instrument = ydummy * mean_temp
    
    xtset ifscode year 
    tab year, gen (tt)
    Code:
    xtset ifscode year 
    
    foreach v in "ltotalfertility" {            
    foreach vart in "0" "1" "2" "3" "4" "5"           {     
    
    xi: xtivreg2  d`vart'`v' (shock_recession = instrument) l(0/2).shock_recession l(1/1).d0`v' tt*, fe partial(tt*) robust  kernel(tru) bw(1)
    
    }
    }
    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:
    covariance matrix of moment conditions not positive definite
    covariance matrix uses too many lags
    singleton dummy variable (dummy with one 1 and N-1 0s or vice versa)
    partial option may address problem.
    even when I exclude the partial part in my estimation I get again an error, and this error comes after the third time horizon. I try to understand that where is the problem and where I get zero in my matrixes:
    Code:
    . mat S=e(S)
    
    . mat Sinv=invsym(S)
    
    . mat list S
    
    symmetric S[5,5]
                                                         L.           L2.            L.
                    instrument  shock_rece~n  shock_rece~n  shock_rece~n  d0ltotalfe~y
      instrument     .03508023
    shock_rece~n    -.00002694     .00001338
    L.shock_re~n    -.00001444     7.438e-06     .00001412
    L2.shock_r~n     -.0000263    -5.952e-07     7.192e-06     8.740e-06
    L.d0ltotal~y    -.00003291     2.896e-08     1.648e-07     2.675e-08     5.736e-06

    I hope I receive your assistance.

    thank you so much in advance for your valuable time and advice.

    regards,



  • #2
    dear all I think I could overcome on my mistake. when I do a regression :
    Code:
     
     xtset ifscode year   foreach v in "ltotalfertility" {             foreach vart in "0" "1" "2" "3" "4" "5"           {       xi: xtivreg2  d`vart'`v' (shock_recession = instrument) l(1/2).shock_recession l(1/1).d0`v' tt*, fe partial(tt*) robust  kernel(tru) bw(1)  } }
    I have to consider l(1/1) because in the first stage we use an instrument.

    would you please advise me if I am right?


    regards,

    Comment

    Working...
    X