Just a correction, the program below is
wrong…it should be:
forvalues i=1(1)10 {
use "U:\CS\combined
dataset_2006.dta", clear
generate random`i' =
uniform()
sort anyprevcs random`i'
generate dropouts = 0
replace dropouts =1 if
anyprevcs==1 & (_N - _n) < 3575
logit
…….(I’ve deleted the variables, as there are too many to put
here!)
replace anyprevcs=0 if
dropouts==1
predict onehat`i'
summarize onehat`i'
drop dropouts n
}
Hi all,
I’m doing 1000 iterations of a logistic
regression. I have to output the predicted value each time before it
carries on with the next iteration, otherwise I lose the
first 999 predicted values! I’m sure there is a
way to go about this, but how can I save the predicted value each time so I end
up with a table with 1000 predicted values?
My program is as follows:
forvalues i=1(1)10 {
use "U:\CS\combined
dataset_2006.dta", clear
generate random`i' =
uniform()
sort anyprevcs random`i'
generate dropouts = 0
replace dropouts =1 if
anyprevcs==1 & (_N - _n) < 3575
logit
…….(I’ve deleted the variables, as there are too many to put
here!)
replace anyprevcs=0 if
dropouts==1
predict onehat`i'
summarize onehat`i'
gen n=_n
egen predicted`i'=mean(onehat`i')*n
drop dropouts n
}
Thanks,
Larraine