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: [email protected]
[mailto:[email protected]] On Behalf Of Maarten buis
Sent: Wednesday, 3 October 2007 5:25 PM
To: [email protected]
Subject: Re: st: St: How do fit a cox PH model for categorical outcome
variable with 3 levels in the same model
--- Sharon Johnatty <[email protected]> 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/