Skip to content

need help with understanding coxph encoding

2 messages · summer, David Winsemius

#
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?
Thank you.

--
View this message in context: http://r.789695.n4.nabble.com/need-help-with-understanding-coxph-encoding-tp4367514p4367514.html
Sent from the R help mailing list archive at Nabble.com.
#
On Feb 7, 2012, at 9:11 PM, summer wrote:

            
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.