Re: [R] use "factor" for categorical covariate in Cox PH model

From: Dieter Menne <>
Date: Tue 18 Jul 2006 - 17:09:36 EST

Linda Lei <llei <at>> writes:

> When dealing with the categorical covariates (for example 3 groups), it
> will come out different results if we add the command "factor" in front
> of the categorical covariate or not

The catch is here: the covariate is not a "categorial", but a number. In that case a regression is computed, and the ONE ration printed out has the meaning of a slope.

> if we don't add "factor", there is
> only one hazard ratio; if we add "factor", there are two hazard ratios.
> So does the "factor" actually create some dummy variables for the
> calculation?

Factor make the covariate a categorial one, and two contrasts are printed out, relative to the first level of the covariate.

Dieter mailing list PLEASE do read the posting guide! Received on Tue Jul 18 17:19:08 2006

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.1.8, at Tue 18 Jul 2006 - 18:16:36 EST.

Mailing list information is available at Please read the posting guide before posting to the list.