Bookmark and Share

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]

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


From   Tirthankar Chakravarty <[email protected]>
To   [email protected]
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 <[email protected]>:
>
> <>
>
> 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: [email protected]
> [mailto:[email protected]] On Behalf Of Lin, Bill
> Sent: Montag, 26. April 2010 22:54
> To: [email protected]
> 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/


© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index