edit: i figured it out hehe.
I ran the example from the GMM documentation, specifically "example 1" about linear regression using GMM.
and i got identical results.
I noticed that that the predicted values I got from `predict ... , xb` are different between the gmm one and the regress one. I further noticed that the GMM predicted values is the OLS one minus the constant. Here some example of the predicted values I got:
.
.
why are they different?
Thanks in advance.
I ran the example from the GMM documentation, specifically "example 1" about linear regression using GMM.
Code:
. gmm (mpg- {xb: weight length}- {b0}), instruments(weight length) . regress mpg weight length, vce(robust)
Code:
. gmm (mpg- {xb: weight length}- {b0}), instruments(weight length) Step 1 Iteration 0: GMM criterion Q(b) = 475.4138 Iteration 1: GMM criterion Q(b) = 2.696e-20 Iteration 2: GMM criterion Q(b) = 2.622e-27 Step 2 Iteration 0: GMM criterion Q(b) = 4.001e-28 Iteration 1: GMM criterion Q(b) = 1.368e-31 note: model is exactly identified. GMM estimation Number of parameters = 3 Number of moments = 3 Initial weight matrix: Unadjusted Number of obs = 74 GMM weight matrix: Robust ------------------------------------------------------------------------------ | Robust | Coefficient std. err. z P>|z| [95% conf. interval] -------------+---------------------------------------------------------------- weight | -.0038515 .0019472 -1.98 0.048 -.0076679 -.0000351 length | -.0795935 .0677532 -1.17 0.240 -.2123873 .0532003 -------------+---------------------------------------------------------------- /b0 | 47.88487 7.506024 6.38 0.000 33.17334 62.59641 ------------------------------------------------------------------------------ Instruments for equation 1: weight length _cons
Code:
. regress mpg weight length, vce(robust) Linear regression Number of obs = 74 F(2, 71) = 55.38 Prob > F = 0.0000 R-squared = 0.6614 Root MSE = 3.4137 ------------------------------------------------------------------------------ | Robust mpg | Coefficient std. err. t P>|t| [95% conf. interval] -------------+---------------------------------------------------------------- weight | -.0038515 .0019879 -1.94 0.057 -.0078152 .0001122 length | -.0795935 .0691697 -1.15 0.254 -.217514 .0583271 _cons | 47.88487 7.662958 6.25 0.000 32.60537 63.16438 ------------------------------------------------------------------------------
.
mpg | weight | length | gmm | ols |
22 | 2,930 | 186 | -26.08 | 21.79 |
17 | 3,350 | 173 | -26.67 | 21.21 |
why are they different?
Thanks in advance.
Comment