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 |
Zhi Su <su.zh@husky.neu.edu> |

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

Subject |
st: Errors arise when dataset is modified in Bootstrapping |

Date |
Tue, 12 Jul 2011 15:58:36 -0400 |

Dear Statalists, I bootstrap standard error from a written estimation command and get the following warning: "Because NHreg is not an estimation command or does not set e(sample), bootstrap has no way to determine which observations are used in calculating the statistics and so assumes that all observations are used. This means that no observations will be excluded from the resampling because of missing values or other reasons." Here are parts of the program NHreg capture program drop NHreg program define NHreg, eclass syntax varlist(max=1 numeric) tempname b V local T "T1 T2 T3 T4" local basic "AGE FEMALE BLACK HISPANIC MARRIED H3TOTD KID6 HS EVERFT EMP NUMFTMOS PASTERN2 RECASS CAR ARRE HEALPRO" local u "u1 u2 u3 u4" gsort -TR quietly:mvprobit (T1=`basic') (T2=`basic') (T3=`basic') (T4=`basic') if TR==1,robust . *(notes: u1 u2 u3 u4 in the original dataset are all 0. I conduct a process to calculate values of u1 u2 u3 u4 when TR==1) . mata: g_u() quietly: regress `varlist' `basic' `T' `u', robust matrix `b'=e(b) matrix `V'=e(V) ereturn post `b' `V' end clear mata mata: void g_u() { real scalar O, N real vector Y, XBM, D real matrix V, U, Y_si, Y_in, U_s . . . end bootstrap _b _se, reps(50) seed(1234):NHreg e1 The command –NHreg- changes the values stored in variables “u1 u2 u3 u4” and use new value in OLS regression. And the modified dataset is where I used -ereturn post- to specify my -e(sample)-. When the -restore- of -bootstrap- is performed, that -e(sample)- cannot be assumed to be valid. I think that is why bootstrapping fails. How can I modify –NHreg- to let Stata understand that the –NHreg- has changed the dataset, let –restore- of -bootstrap- to restore to the original dataset that all u1 u2 u3 u4 are all 0, and start to –bsample-, modified values of u1 u2 u3 u4, and run the iteration from the very beginning? Thank you! -- Zhi Su 348 Holmes Hall Northeastern University 360 Huntington Avenue Boston, MA 02115 Office:1-617-373-2316 email:su.zh@husky.neu.edu * * 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:
**Re: st: increase digits after decimal point in p value** - Next by Date:
**Re: st: Identify combinations without respect to the order of the elements** - Previous by thread:
**st: increase digits after decimal point in p value** - Next by thread:
**st: a question about percentiles** - Index(es):