Notice: On March 31, it was **announced** that Statalist is moving from an email list to a **forum**. The old list will shut down on April 23, and its replacement, **statalist.org** is already up and running.

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

From |
Tirthankar Chakravarty <tirthankar.chakravarty@gmail.com> |

To |
statalist@hsphsun2.harvard.edu |

Subject |
Re: st: RE: using bootstrap for sample splitting and out-of-sample prediction |

Date |
Tue, 27 Apr 2010 04:15:50 +0530 |

Not entirely sure, but I think your use of -clear- within the -program- was having an adverse effect: ********************************************* clear* set obs 10000 gen x=rnormal() gen y=2+3*x+rnormal() capt prog drop myprog prog myprog, rclass vers 11 cap drop forsort cap drop res gen forsort=runiform() sort forsort reg y x in 1/5000 predict res, res su res in 5001/10000, mean return scalar mean=r(mean) end bs mean=r(mean), reps(100) nodrop: myprog ********************************************* T 2010/4/27 Martin Weiss <martin.weiss1@gmx.de>: > > <> > > Try this: (BTW, why is it not possible to -bootstrap r(mean), reps(50) > nodrop: myprog- on this thing? I have now searched for a solid hour for my > mistake, and cannot find it...) > > ******* > > > clear* > set obs 10000 > gen x=rnormal() > //true model > gen y=2+3*x+rnormal() > sa myfile, replace > > > capt prog drop myprog > > prog myprog > vers 10.1 > u myfile, clear > gen forsort=runiform() > sort forsort > reg y x in 1/5000 > predict res, res > su res in 5001/10000, mean > end > > > tempname hdle > tempfile info > postfile `hdle' iteration mean using `info' > > qui forv i=0/1000{ > myprog > post `hdle' (`i') (r(mean)) > } > > postclose `hdle' > > use `info', clear > l, abbrev(12) noobs sep(0) > > > > * > *bs mean=r(mean), reps(200) nodrop: myprog > ******* > > > HTH > Martin > > > -----Original Message----- > From: owner-statalist@hsphsun2.harvard.edu > [mailto:owner-statalist@hsphsun2.harvard.edu] On Behalf Of Lin, Bill > Sent: Montag, 26. April 2010 22:54 > To: statalist@hsphsun2.harvard.edu > Subject: st: using bootstrap for sample splitting and out-of-sample > prediction > > Hello All, > > I am trying to split my sample into two halves, use one half for > estimation and another half for out-of sample prediction, and then > calculate the average difference between fitted values and the > observed values. I want to do it repeatedly, say 1000 times, using > bootstrap. My problem is that I don't know how to store the average > difference calculated each time in a matrice as in Matlab. Can any one > give some suggestions? thanks, > > > Bill Lin > * > * 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/ > > * > * 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/ > -- To every ω-consistent recursive class κ of formulae there correspond recursive class signs r, such that neither v Gen r nor Neg(v Gen r) belongs to Flg(κ) (where v is the free variable of r). * * 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/

**Follow-Ups**:**AW: st: RE: using bootstrap for sample splitting and out-of-sample prediction***From:*"Martin Weiss" <martin.weiss1@gmx.de>

**References**:**st: using bootstrap for sample splitting and out-of-sample prediction***From:*"Lin, Bill" <bill.lin.79@gmail.com>

- Prev by Date:
**st: update to ralloc.ado** - Next by Date:
**Re: st: margeff/margins discrepancy** - Previous by thread:
**st: RE: using bootstrap for sample splitting and out-of-sample prediction** - Next by thread:
**AW: st: RE: using bootstrap for sample splitting and out-of-sample prediction** - Index(es):