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

From |
"Sharon Johnatty" <Sharon.Johnatty@qimr.edu.au> |

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

Subject |
RE: st: St: How to fit a cox PH model for categorical outcome variable with 3 levels in the same model |

Date |
Fri, 5 Oct 2007 14:30:36 +1000 |

Hi, thanks for the input. .xi: stcox works, but only if variable is coded 1, 2 or 3. It doesn't work if the variable is coded 0, 1, 2. Sharon -----Original Message----- From: owner-statalist@hsphsun2.harvard.edu [mailto:owner-statalist@hsphsun2.harvard.edu] On Behalf Of Maarten buis Sent: Wednesday, 3 October 2007 5:25 PM To: statalist@hsphsun2.harvard.edu Subject: Re: st: St: How do fit a cox PH model for categorical outcome variable with 3 levels in the same model --- Sharon Johnatty <Sharon.Johnatty@qimr.edu.au> wrote: > I've stset my data and I'm able to run cox models, no problem. The > question is how do I obtain HRs for an outcome variable with three > levels, e.g. var_1_2 coded 0, 1, 2 in the same model, and obtain > separate estimates for 0 vs. 1 and 0 vs. 2. Right now I'm able to do > this using stcoxkm, by(var_1_2), then type stcox. But Stata does not > allow me to run an adjusted model in this way. Is there another way to > fit a single model for a categorical variable with more than 2 levels > for both univariate and multivariate cox regression? -stcox- is the Stata command for estimating a cox model, and it allows multiple independent variables, and the output immediately gives you hazard ratios. See the example below. The -xi:- prefix used in this example is a convenience program that makes dummy variables from the variable drug. So both _Idrug_2 and _Idrug_3 compare with _Idrug_1 (the category left out, or the reference category). *---------- begin example --------- sysuse cancer stset studytim, failure(died) xi: stcox i.drug age *--------- end example ------------ (For more on how to use examples I sent to the Statalist, see http://home.fsw.vu.nl/m.buis/stata/exampleFAQ.html ) Hope this helps, Maarten ----------------------------------------- Maarten L. Buis Department of Social Research Methodology Vrije Universiteit Amsterdam Boelelaan 1081 1081 HV Amsterdam The Netherlands visiting address: Buitenveldertselaan 3 (Metropolitan), room Z434 +31 20 5986715 http://home.fsw.vu.nl/m.buis/ ----------------------------------------- ___________________________________________________________ Yahoo! Answers - Got a question? Someone out there knows the answer. Try it now. http://uk.answers.yahoo.com/ * * 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/ * * 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**:**RE: st: St: How to fit a cox PH model for categorical outcome variable with 3 levels in the same model***From:*Maarten buis <maartenbuis@yahoo.co.uk>

**References**:**Re: st: St: How do fit a cox PH model for categorical outcome variable with 3 levels in the same model***From:*Maarten buis <maartenbuis@yahoo.co.uk>

- Prev by Date:
**st: RE: How to use Postfile without using a new Stata dataset** - Next by Date:
**RE: st: St: How to fit a cox PH model for categorical outcome variable with 3 levels in the same model** - Previous by thread:
**Re: st: St: How do fit a cox PH model for categorical outcome variable with 3 levels in the same model** - Next by thread:
- Index(es):

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