Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: IV: calculating manually unbiased standard errors for 2sls.


From   Alvaro Angeriz <aa314@cam.ac.uk>
To   statalist@hsphsun2.harvard.edu
Subject   st: IV: calculating manually unbiased standard errors for 2sls.
Date   Sun, 15 Jan 2006 21:35:19 +0000

Dear colleagues,
I'm trying to understand how ivreg calculates standard errors for the estimators calculated by 2sls. I haven't been successful so far.

I do as follows

*step 1
reg x z1 z2
predict xhat

* step 2
reg y xhat
scalar alphahat = _coef[_cons]
scalar betahat = _coef[xhat]


scalar n = e(N)
su x
scalar var_x = r(sd)^2
g res_iv_2 = (y - (alphahat + betahat * x))^2
su res_iv_2
scalar sigmau_hat_iv_2 = _result(18)/(n-2)
scalar sigma_beta_iv = sqrt(sigmau_hat_iv_2/(n*var_x))
di "sigma beta iv = " sigma_beta_iv


Could anyone help me explaining what i'm doing wrong?

Thanks!

Alvaro

*
* For searches and help try:
* http://www.stata.com/support/faqs/res/findit.html
* http://www.stata.com/support/statalist/faq
* http://www.ats.ucla.edu/stat/stata/




© Copyright 1996–2021 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index