*Success*
Steven,
Thank you very much for the help.
Quadratic formula ... brings back memories.
There was a wicked exponentiation problem that took a few hours to figure
out (beware of how Stata evaluates the exponentiation of a negative
number... e.g. -2^2 evaluates to -4)
Anyway, here is the result:
****
clear
set obs 1000
local odds=2
local proportion_positive= .10
local mortality = .05
gen test=uniform()<`proportion_positive'
local k1=`mortality'/(1-`proportion_positive')
local k2=(`proportion_positive'/(1-`proportion_positive'))
di `k1'
di `k2'
local a=`k2'
local b=(-2)*`k2'-`k1'-1
local c=2*`k1'
gen probability_positive = ((-`b') - (sqrt((`b')^2-(4*`a'*`c'))))/(2*`a')
gen probability_negative = (`k1')-((`k2')*probability_positive)
gen died=uniform() < cond(test==0,probability_negative,probability_positive)
logistic died test
******************
Thanks much!
Dan
-----Original Message-----
From: [email protected]
[mailto:[email protected]] On Behalf Of Steven Joel
Hirsch Samuels
Sent: Monday, November 19, 2007 12:07 PM
To: [email protected]
Subject: Re: st: RE: simulated data for logistic regression... remedial
algebra help?
>
>> On Nov 19, 2007, at 9:49 AM, Steven Joel Hirsch Samuels wrote:
>>>
> p1 = (p -(1 -w)p2)/w =B (you left out the 1-w term in your k2
> coefficient)
>>>
No you didn't, Daniel. Sorry.
-Steven
*
* 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/
No virus found in this incoming message.
Checked by AVG Free Edition.
Version: 7.5.503 / Virus Database: 269.16.0/1139 - Release Date: 11/19/2007
12:35 PM
No virus found in this outgoing message.
Checked by AVG Free Edition.
Version: 7.5.503 / Virus Database: 269.16.0/1139 - Release Date: 11/19/2007
12:35 PM
*
* 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/