[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

From |
Kit Baum <baum@bc.edu> |

To |
statalist@hsphsun2.harvard.edu |

Subject |
st: re: 3 equations, 2 endogenous Variables, 1 endogenous variable related to |

Date |
Wed, 2 Dec 2009 21:36:46 -0500 |

<> Some of the issues here are d-f issues; -ivreg2- and -reg3, 3sls- assume no d.f. correction. Putting 'small' and 'dfk' options on causes the reg32sls and ivreg2 columns to agree perfectly. Likewise, the iq equation is the same in the second block, and the same as the 'byhand0' in the first block. Why does this work? Because the 3sls system is recursive, in that iq enters each of the other equations, but contains no RHS endogenous variables. Thus the iq equation can be consistently estimated with OLS. What does not agree is 'byhand1'. The IV formula in a very simple y = a + B x + u, z as instrument for x does not say compute xhat and throw x away. The IV estimator is (Z'X)^-1 (Z'y), in matrix terms. Both Z and X enter the equation. At the bottom of the program below I compute the correct 'by hand' estimates for the lw equation, given the restrictions you have imposed on age and kww. They are not equal to the ivreg2 (or reg2, 2sls) estimates, nor should they be given the restrictione embedded in them. If you remove the comments on the FSR reg commands, the Mata coefficients match the ivreg2/reg3,2sls perfectly. clear est clear use http://fmwww.bc.edu/ec-p/data/hayashi/griliches76.dta quietly reg3 (lw=s expr med iq tenure) (iq=s expr med kww ) (tenure = iq s expr med age), 2sls est store reg32sls quietly reg3 (lw=s expr med iq tenure) (iq=s expr med kww ) (tenure = iq s expr med age), 3sls dfk est store reg33sls quietly ivreg2 lw s expr med (tenure iq=kww age), first small est store ivreg2 quietly reg iq s expr med kww // age est store byhand0 rename iq iq_was predict double iq quietly reg tenure iq s expr med age // kww est store byhand1 rename tenure tenure_was predict double tenure quietly reg lw s expr med tenure iq est store byhand2 estout *, cells(b(star fmt(3)) t(par fmt(2))) g iota = 1 tomata lw s expr med tenure iq iq_was tenure_was iota mata: Z=(tenure, iq, s, expr, med, iota) X=(tenure_was, iq_was, s, expr, med, iota) "These are the correct 2SLS coefficients for the 'byhand' approach" "To calculate them, you still need to use the original endogenous variables" b = invsym(Z' * X) * (Z' * lw) b end Kit Baum | Boston College Economics & DIW Berlin | http://ideas.repec.org/e/pba1.html An Introduction to Stata Programming | http://www.stata-press.com/books/isp.html An Introduction to Modern Econometrics Using Stata | http://www.stata-press.com/books/imeus.html * * For searches and help try: * http://www.stata.com/help.cgi?search * http://www.stata.com/support/statalist/faq * http://www.ats.ucla.edu/stat/stata/

- Prev by Date:
**st: RE: Simple loop problem?** - Next by Date:
**st: Re: Question about kwallis p-value** - Previous by thread:
**st: Simple loop problem?** - Next by thread:
**st: It's too time-consuming for a simple cumulation** - Index(es):

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