| |
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]
st: How to save multiple predictions?
Hi,
I've got stuck last night. Please excuse my ignorance, but I am not a
programmer.
I am running a 100 regressions on 2 subsets in order to validate my model.
I know how to save statistics form the first subset 9and second as
well), however I am not sure how to save estimated values from the second?
This is what I have so far...
I know there is _predict command however I don't know how to save
multiple estimations into column-wise file
Any help is more then welcome.
Cheers,
Tash
tempname myfile1
tempname results1
tempname myfile2
tempname results2
local i = 1
postfile myfile1 R2_1 Ra2_1 SE_1 using results1
postfile myfile2 R2_2 Ra2_2 SE_2 ADF using results2
while `i' <=100 {
generate random = uniform()
sort random
gen group = 1 + (_n > 157)
quietly regress adf crosswind_15kts mintemp_min fog snow hail thunder
seasonwinter seasonsummer seasonspring wsadf htwadf vadf gfadf radf if
group==1
post myfile1 (e(r2)) (e(r2_a)) (e(rmse))
quietly regress adf crosswind_15kts mintemp_min fog snow hail thunder
seasonwinter seasonsummer seasonspring wsadf htwadf vadf gfadf radf if
group==2
post myfile2 (e(r2)) (e(r2_a)) (e(rmse)) (adf)
drop group random
local i = `i' + 1
}
postclose myfile1
postclose myfile2
*
* 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/