4
$\begingroup$

I was thinking that in a very standard case such as a simple linear model with iid errors and no endogeneity, I would get the same results using the a simple least square estimate (such as provided by lm() in R) and a simple GMM estimator with an identity matrix as the weighting matrix and the matrix of regressors as instruments.

I've just run the following simulation in R to compare the results of the lm() function and of the gmm() function :

> library("gmm")
> set.seed(1234567)
> N  <- 1000
> dd  <- data.frame(id = 1:N)
> dd$u  <- rnorm(N)
> dd$x  <- 1 + rnorm(N)
> dd$y  <- 1 + dd$x + dd$u
> m1  <- lm(y ~ x, data = dd)
> m2  <- gmm(y ~ x, x = ~ x,  wmatrix = "ident", data = dd)

I've got the same coefficients but I don't have exactly the same standard errors :

> coefficients(m1)
(Intercept)           x 
  1.0273856   0.9690455 
> coefficients(m2)
(Intercept)           x 
  1.0273856   0.9690455 
> sqrt(diag(vcov(m1)))
(Intercept)           x 
  0.044285    0.031726 
> sqrt(diag(vcov(m2)))
(Intercept)           x 
 0.04367438  0.03127408 

I'm not sure to understand why the standard errors are different in this case. Is this due to statistical theory or to the gmm() function ?

See my gist file if you want to run the example.

$\endgroup$
  • 1
    $\begingroup$ I think this is due to 'gmm()' function. The general formula of the s.d. of a GMM estimator depends on the weighting matrix and involves some matrix inverse. There might be slight difference due to computational error. $\endgroup$ – semibruin Jul 30 '13 at 17:56
2
$\begingroup$

The standard errors from lm should not be the same as those from GMM, because the assumptions about the regression errors differ. lm assumes homoscedastic regression errors, the gmm function does not. That being said, the HC consistent standard errors from the sandwich package function vcovHC should be equivalent to two-step GMM starting from and identity matrix. When I run them, they still aren't.

So what can account for differing standard errors among what should be equivalent GMM routines? I wrote up a comprehensive answer to a similar question: Gradient in GMM estimation. In this specific case, the problem is likely with the calculation of the gradient or (less likely) matrix inversion. The numerical gradient used by gmm will not perform as well as the direct estimate from the lm function.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.