Hey guys,
I am running a two-step joint dynamic panel GMM estimator on Mata, with the stacked formula: b = (inv(x'*z*inv(z'*(e*e')*z)*z'*x))*(x'*z*inv(z'*(e* e')*z)*z'*y), where x refers to matrix of regressors, z refers to matrix of instrumental variables and e refers to vector of (1st-Step) residuals.
For the above two step formula, for a single equation, I calculate the variance of the moment conditions (z'*(e*e')*z), (let's call it S) as first step towards deriving cross-section heteroscedasticity robust weighing matrix
k = cols(z)
st_view(id=. , . , ("id"))
info = panelsetup(id,1)
nc = rows(info)
S= J(k,k,0)
for(i=1; i<=nc; i++) {
panelsubview(zi = . , z , i , info)
panelsubview(ei = . , e , i , info)
S = S + zi'*(ei*ei')*ei
}
The problem arises since I have a large number of cross-sections in my panel dataset, which has 2941 cross-sectional units spread across 14 years. Thus the matrix S at the end of the loop is giving null values. Where am I going wrong ? On datasets with shorter cross-sectional counts, I can calculate S just fine, but in this instance the S matrix is returning null / no values. Any other way I may derive the S matrix ?
Related Posts with Two - step dynamic panel GMM estimator weight Matrix returning blank value after Mata loop
Stata not showing results/command/log window?Hi Everyone, I'm running into a weird issue with Stata - the main results/command/log window is ~in…
Help with clock() functionDear all, I had a time variable in string format. I use clock() function to change it to Stata read…
Is there a way to format variable?Hello friends, I am currently using data that has one variable that shows the value of the date, fo…
Twoway subtitle options using -by-How to adjust text options for subtitles in a simple twoway plot using -by- ? Code: sysuse auto, c…
merging data with different time frequenciesHello, I have looked for guidance from other posts but could not solve this: I have two datasets- 'D…
Subscribe to:
Post Comments (Atom)
0 Response to Two - step dynamic panel GMM estimator weight Matrix returning blank value after Mata loop
Post a Comment