I am trying to write my own GMM program in a different language and want to compare results with Stata to make sure it's right. As a first step, I use an identity matrix W=I in the program:
Code:
θ = inv(x'*z*W*z'*x)*x'*z*W*z'*y
and compare with Stata command
Code:
gmm (y- {xb:x1 x2} - {b0}), inst(x2 z1 z2)
The estimates are identical if the model is just identified (i.e., when there is only z1), but different when the model is over identified. I guess the difference comes from Stata's weight matrix, so tried to impose
. However, the iteration never stops. How can I make this comparison?
Next, I would like to compare results from a 2-step efficient GMM. I use first-stage estimates to estimate a weight matrix S^(-1) to be used in the second stage:
Code:
θ0 = inv(x'*z*W*z'*x)*x'*z*W*z'*y
u = y - x*θ0;
S = z'*u*u'*z;
θ1 = inv(x'*z*inv(S)*z'*x)*(x'*z*inv(S)*z'*y)
Which Stata command would give this?
0 Response to Comparing GMM estimates
Post a Comment