Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.

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

From |
Manish Srivastava <manishi_sri@yahoo.com> |

To |
"statalist@hsphsun2.harvard.edu" <statalist@hsphsun2.harvard.edu> |

Subject |
st: Computing Murphy-Topel-corrected variances in a heckprobit model |

Date |
Wed, 30 Oct 2013 11:08:19 -0700 (PDT) |

Dear Statalist serve members, I am trying to replicate the procedure described by Muro,Suarez, and Zambora in their article 'Computing Murphy-Topel-corrected variances in a heckprobit model with endogeniety' published in the Stata Journal (2010,10,Number 2,pp 252-258) using a Stata dataset. But I am not able to get the partitioning (the beginning and the end ) of the matrices (C and R) right , and because of that, I guess, I'm getting this error 'conformatibility error' when computing the matrix M. The article makes reference to Hole (2006, 6 (4). pp 521-529). I was able to replicate her results but I am not able to get this one right. Here is a copy of the do file I am using the replicate their procedure. In using the school Stata dataset, I'm assuming that the variable 'school' is endogenous and, variable 'vote' is the selection variable just to replicate this procedure. I will greatly appreciate any help. I'm using Stata SE 12.1 on a Windows 7 machine. Thank you. Sincerely Manish _____________________________________________________________ set more off webuse school,clear gen byte cons=1 local x1 years loginc logeduc logptax cons probit school `x1' matrix v1=e(V) predict double y1hat predict s0,score local x2 years logptax cons y1hat local x3 years loginc logptax cons heckprob private `x2',select (vote=`x3') matrix v2=e(V) scalar TP=_b[y1hat] /* coefficient of endogeneous var*/ matrix coef= e(b) predict s1 s2 s3,score generate const=1 local x2 years logptax cons y1hat foreach a1 of local x2 { generate `a1'_s = `a1'*s1/s2 } /* s2 is the true score */ generate a_s = s1/s2 generate s3_s = s3/s2 /* Auxiliary parameter */ local x2_s years_s logptax_s cons_s y1hat_s gen y1= school /* For main and selection equations */ matrix accum C = `x1' `x2_s' a_s `x3' s3_s [iw=s1*s2*(s0*((1-y1)+(2*y1-1)*y1hat)*(2*y1-1))*TP], nocons /*For main and selection equations*/ matrix accum R = `x1' `x2_s' a_s `x3' s3_s /* */ [iw=s2*s0], noconstant /* Get only the desired partition; see Hole (2006) */ matrix C = C[6..15,1..5] matrix R = R[6..15,1..5] /* For Murphy-Topel matrix */ matrix Ct=C' matrix Rt=R' matrix M = v2 + (v2 * (C*v1*Ct -R*v1*Ct -C*v1*Rt)*v2) capture program drop doit matrix b = e(b) program doit, eclass ereturn post b M ereturn local vcetype "Mtopel" ereturn display end doit * * For searches and help try: * http://www.stata.com/help.cgi?search * http://www.stata.com/support/faqs/resources/statalist-faq/ * http://www.ats.ucla.edu/stat/stata/

- Prev by Date:
**st: Stata 13.1** - Next by Date:
**st: RE: Stata 13.1** - Previous by thread:
**st: Stata 13.1** - Next by thread:
**st: Stata + unix shell + AppleScript = Happy, productive geek** - Index(es):