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

From |
"Daniel Waxman" <dan@amplecat.com> |

To |
<statalist@hsphsun2.harvard.edu> |

Subject |
st: simulated data for logistic regression... remedial algebra help? |

Date |
Sat, 17 Nov 2007 18:44:26 -0500 |

I am trying to create a series of simulated data sets for use in logistic regression with the following properties: Mortality (outcome) remains constant. There is a single dichotomous independent variable whose odds ratio (coefficient) and proportion of positives can vary between the sets. It all comes down to solving for the intercept (`b0'), given the following relationships: probability_negative=invlogit(`b0’) probability_positive=invlogit(log(`odds’)+`b0’) `proportion_positive’*probability_positive+(1-`proportion_positive’)*probabi lity_negative=`mortality’ Sad to admit, but I am bumping up against the limitations of my algebra skills. I'd imagine this is trivial for many of you... i.e.: ************** clear set obs 1000 local odds=2 local proportion_positive= .10 local mortality = .05 gen test=uniform()<`proportion_positive’ /* ************solve for `b0' here************ */ gen probability_negative=invlogit(`b0’) gen probability_positive=invlogit(log(`odds’)+`b0’) gen died=uniform() < cond(test==0,probability_negative,probability_positive) logistic died test ************************ Thanks. Dan No virus found in this outgoing message. Checked by AVG Free Edition. Version: 7.5.503 / Virus Database: 269.16.0/1136 - Release Date: 11/17/2007 2:55 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/

**Follow-Ups**:**st: RE: simulated data for logistic regression... remedial algebra help?***From:*"Daniel Waxman" <dan@amplecat.com>

**st: mle programming problem***From:*"Jitian Sheu" <jtsheu@mail.cgu.edu.tw>

- Prev by Date:
**Re: st: scaling** - Next by Date:
**st: mle programming problem** - Previous by thread:
**st: How to obtain the solution of a quintic polynomial equation using Stata** - Next by thread:
**st: mle programming problem** - Index(es):

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