[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

From |
"Brian P. Poi" <bpoi@stata.com> |

To |
statalist@hsphsun2.harvard.edu |

Subject |
Re: st: 2SLAD - qreg - how to obtain t-stat and p-value |

Date |
Wed, 7 Apr 2004 15:41:50 -0500 (CDT) |

Earlier today (Apr 7, 2004) Thi Minh asked > I am now estimating a 2SLAD model, and follow the instructions given by > Statacorp's Brian P. Poi in the statalist dated 26 Sep 2003. Is there a > way to retrieve the p-value and the t-stat as they appear when using the > command bsqreg? As Brian Poi explains, the s.e. need to be bootstrapped > for _both_ stages of the estimation so that it is the command > _bootstrap_ which needs to be used. > program bootit2 > version 8.0 > //region 2 - stage 1 > reg Y2 X1 Z if reg7==2 > predict double phat2, xb > > //region 2 - stage 2 > qreg Y1 X1 phat2 if reg7==2 > drop phat2 > end > bootstrap "bootit2" _b, reps (200) dots In [R] -qreg- we give the following example of -bsqreg-: sysuse auto, clear set seed 1001 bsqreg price weight length foreign , reps(1000) We can replicate the output table including t-statistics, p-values and confidence intervals ourselves using -bootstrap- and -qreg-. This code does just that: set seed 1001 bootstrap "qreg price weight length foreign" _b, reps(1000) // The following code should work after any call to // -bootstrap- matrix b = e(b) matrix se = e(se) local names : colnames(se) local df = e(N) - colsof(b) tempname t lb ub local i = 1 foreach var of local names { scalar `t' = (b[1, `i'] / se[1, `i']) scalar `lb' = b[1, `i'] - se[1, `i']*invttail(`df', 0.025) scalar `ub' = b[1, `i'] + se[1, `i']*invttail(`df', 0.025) di "`var'" _col(15) %9.0g b[1,`i'] /// _col(26) %9.0g se[1, `i'] /// _col(38) %6.2f `t' /// _col(46) %6.3f 2*ttail(`df', abs(`t')) /// _col(56) %9.0g `lb' /// _col(68) %9.0g `ub' local i = `i' + 1 } These results agree with -bsqreg-, since all we've really done is replicate what -bsqreg- does automatically. The same code that appears after my call to -bootstrap- can be used any bootstrapping job, including bootstrapping the 2SLAD estimator that Thi Minh mentioned. Hope this helps -- Brian Poi -- bpoi@stata.com * * 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/

**References**:**st: 2SLAD - qreg - how to obtain t-stat and p-value***From:*"Ngo,PT (pgr)" <P.T.Ngo@lse.ac.uk>

- Prev by Date:
**st: mode** - Next by Date:
**st: SSC activity, March 2004** - Previous by thread:
**st: 2SLAD - qreg - how to obtain t-stat and p-value** - Next by thread:
**Re: st: 2SLAD - qreg - how to obtain t-stat and p-value** - Index(es):

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