[R] need help with understanding coxph encoding
David Winsemius
dwinsemius at comcast.net
Wed Feb 8 06:31:08 CET 2012
On Feb 7, 2012, at 9:11 PM, summer wrote:
> Hi, in coxph,
> coxph(Surv(time, status)~x,data=alm).
> How to encode x? For example, if x has two groups, the treatment
> group and
> control group. if I encode them as 1 and 2. Is the HR results
> treatment/control? What if I encode them as 0 and 1. I am confused
> with how
> survival package works for HR. What should I do to get a treatment/
> control
> HR?
The proper way would be to construct "x" is as a factor. Then you will
not be implicitly telling the function that it is dealing with a
numeric value. (In this simple case it probably doesn't really
matter. The coefficient for the effect would be the same.
--
David Winsemius, MD
West Hartford, CT
More information about the R-help
mailing list