Dear Tom,
Thank for your guide. I have an issue when specifying moment conditions.
Taking indivisible RBC as an example, it has 13 moment conditions as in Craig Burnside (1999) notes:
Mom1: E[theta - alpha*Y_t/(N_t*C_t)] = 0
Mom2: E[log(A_t) - log(A)*(1-rhoA) - rhoA*log(A_{t-1})] = 0
Mom3: E[[log(A_t) - log(A)*(1-rhoA) - rhoA*log(A_{t-1})]*log(A_{t-1})] = 0
Mom4: E[log(A_t) - log(A)*(1-rhoA) - rhoA*log(A_{t-1}) - sigmaA^2] = 0
Mom5: E[log(Y_t) - Ay - lnGammaX)*t] = 0
Mom6: E[[log(Y_t) - Ay - lnGammaX)*t]*t/T] = 0
Mom7: E[delta - 1 + (K_{t+1} - I_t)/K_t] = 0
Mom8: E[1 - beta*(C_t/C_{t+1})*[(1-alpha)Y_{t+1}/K_{t+1} + (1-delta)]
Mom9: E[hpy_t^2 - sigma_y^2]
Mom10: E[hpc_t^2 - (sigma_c/sigma_y)^2*hpy_t^2] = 0
Mom11: E[hpi_t^2 - (sigma_i/sigma_y)^2*hpy_t^2] = 0
Mom12: E[hpn_t^2 - (sigma_n/sigma_y)^2*hpy_t^2] = 0
Mom13: E[hpn_t^2 - (sigma_n/sigma_yn)^2*hpyn_t^2] = 0
where parameters are: Theta, lnA, rhoA, sigmaA, Ay, lnGammX, Delta, Alpha, sigma_y, and four ratio sigma_.../sigma_y.
Observables are: C I Y N K and corresponding hp filtered of log(.): hpc hpi hpy hpn hpk, and hpyn = hpy - hpn
Writing moment in frml is trivial as I can write:
Code: Select all
nonlin Theta lnA rhoA sigmaA Ay lnGammX Delta Alpha sigmaY sigmaCY sigmaIY sigmaNY sigmaNYN
* setting initial paramater values
compute Theta = ...
...
frml mom1 = theta - alpha*Y/(C*N)
frml mom2 = logA - logA*(1-rhoA) - rhoA*logA{1}
...
But Solow residual A_t is not observed, hence, it is estimated before the NLSYSTEM command as:
Code: Select all
set trend = t
set logA = log(Y) - log(K)*(1-alpha) - log(N)*alpha - trend*lnGammX*alpha
The problem is that series logA depends upon lnGammX and alpha which are the parameters would be estimated.
Since we need to set up initial values of 13 parameters so the series logA will be computed at the outset but it will not be updated during the optimization. In the Burnside (1999) matlab code, the function gamerr.m has a line as follows (with my annotations):
Code: Select all
function mom=gmmerr(b)
global xdata;
loga = log(xdata(1:115,var_y))-log(xdata(1:115,var_k))*(1-b(8,1)) ...
- log(xdata(1:115,var_n))*b(8,1)-t0*b(6,1)*b(8,1) ;
...
%Moment 2: E[log(A_t) - log(A)*(1-rhoA) - rhoA*log(A_{t-1})] = 0
mom1 = ...
mom2 = loga(2:114,1)-b(2,1)-loga(1:113,1)*b(3,1) ;
...
mom13= ...
mom = [mom1 mom2 ... mom13];
How can I set up the dynamic series logA for GMM estimation? I think it is the need of a helper function. Could you please show me a tip?
Thank you and best regards,