Hello,
I need to get the second order (variance and covariances of state variables(SchmitT Grohe notation)). SchmittGrohe package for 2nd order approximation has an .m file called mom.m which calculates the moments for both control and state variables.
The notation dynare and SGU uses are slightly different. I was wondering if DYNARE actually stores somewhere the 2nd moments of variables other than the exogenous shocks somewhere.
Thanks a lot
After calling stoch_simul
without the periods
option, theoretical moments will be stored in e.g. oo_.var
. See the manual for details
Thanks a lot for the quick response. I appreciate it
I am working on risky steady state and need second order moments to iterate until they converge. I am, using the simplest example, trying see the mapping between the dynare codes you have posted on your website SGU_2004.mod and the NEOCLASSICAL_MODEL_RUN.M that uses the SGU package. When the autocorrelation coefficient is set to 0.
 PHO=0 ar1 coef on exogenous shocks
FOR SGU:______________________________FOR DYNARE SGU_2004.mod
Steady States:
log(kss)=1.7932______________________________log(kss)=1.7932
log(css)=0.8734______________________________log(css)=0.8734
Policy Functions
c_hat=0.2525k{t}+0.8417*a{t}_____________c_hat=0.2525k{t}+0.8417*eps{t}
k{t+1}=0.4191k{t}+1.3970*a{t}______________k{t+1}=0.4191k{t}+1.3970*eps{t}
Covariance Matrix
var(c_hat)=0.8595____________________________var(c_hat)=0.8595
var(k_hat)=2.3676____________________________var(k_hat)=2.3676
var(a_hat)=1_________________________________var(a_hat)=1
cov(k_hat,a_hat)=0____________________________cov(k_hat,a_hat)=0
Steady States:
log(kss)=1.7932_____________________________log(kss)=1.7932
log(css)=0.8734______________________________log(css)=0.8734
Policy Functions
c_hat=0.2525k_{t}+1.0496a_{t} _____ ____c_hat=0.2525k_{t}+0.997161at_{t}+1.049643eps_{t}
here RHO*1.0496=0.997161 DIFFERENT REPRESENTATION SO IT IS ok
k_{t+1}=0.4191k_{t}+0.8755a_{t}_______k{t+1}=0.4191k_{t}+0.831683at_{t1}+0.875456eps_{t}
HERE ALSO SAME LOGIC
Covariance Matrix
var(c_hat)=20.2261_________________________var(c_hat)=20.2261
var(k_hat)=22.1525_________________________var(k_hat)=22.1525
var(a_hat)=14.1732_________________________var(a_hat)=10.2564
cov(k_hat,a_hat)=10.2564____________________cov(k_hat,a_hat)=???
Sorry for writing this long. But I have this huge model with bunch of other variance and covariances and i was wondering if the SGU mom.m function and dynare one is actually different
The covariance matrix is stored in
oo_.gamma_y{1}
And moments should be the same in both packages after accounting for notational differences
Thanks Johannes,
This is the third time I am editing this post.
For the neclassical growth model the moments generated by SGU mom.m file and SGU_2004.mod oo_.gamma_y{1} seems to match.
But when I wanted to test whether the moments of a bigger model (Closing Small Open EconomiesExternal Debt Elastic Interest Rate Model) match with files I get different results. I ran 1 the original SGU package, your code SGU_2003 model 2 and third dynare file from this website soe2.mod
Here are the results
The steady states, parameters are identical in 3 cases. However due to different structure the policy functions seem to differ.
 I can match the policy functions of yt and ht identically with your mod. file but with 3rd dynare file the error coefficient is different
I assume this is because in that file the shocks are set:
shocks;var e; stderr sigmae;end; which scales shocks to whole variables
while in your set up (and i think that is the correct one to compare with SGU) you add the scaling parameter directly in model part of shock equation
 ct poicy function is different. it might be because of the different structurre
AND THE MAIN ISSUE OF COVARIANCE MATRIX
The results
 List item SUMMARY OF THE RESULTS (YOU CAN SKIP TO SEE THE SHORT SUMMARY OF COMPARISON)
 List item Although i am able to match the policy functions of yt and ht and the covariance/variance of these although similar are not totally identical.

Could it be that SGU using analytical derrivatives offers a more robust estimation of moments
or

the discrepancies are mainly due to the fact that rt1 is state variable in dynare specification, which differs with the SGU specification
 List item I could not match the error term coefficent ht and yt with second dynare file but the covariance matrix seems similar but not identical
That could be maybe why i cant converge to a solution when i iterate on moments in different states
Thanks a lot for your help and wish you a wonderful weekend
The mod files I used: SGU_2003.MOD model 2 risk premium on interest rate
And soe.2mod file from this link
http://www.dynare.org/phpBB3/download/file.php?id=1450&sid=41a33f96c18d27f61fc0776353e2aab8
Dynare also uses analytical derivatives, so that should not be the difference. My hunch is that for the SOEpaper, the specifications are not identical.