Sorry all, but another problem I’m
running into with my program is the following:
If I do the iterations separately (i.e.
not in the loop), I get different odds ratio values than when I do it in the
loop.
The values I get in the loop seem to be
all the same for every iteration, so obviously something is wrong here!
Any advice would be appreciated.
Larraine
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