Statalist


[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: RE: Output summary stats before doing other iteration


From   Larraine Becker <[email protected]>
To   [email protected]
Subject   st: RE: Output summary stats before doing other iteration
Date   Fri, 12 Sep 2008 16:59:58 +1000

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

 


From: [email protected] [mailto:[email protected]] On Behalf Of Larraine Becker
Sent: Friday, 12 September 2008 4:35 PM
To: [email protected]
Subject: st: Output summary stats before doing other iteration

 

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




© Copyright 1996–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index