Hi All,

 

I'm learning the R codes for Cox PH modeling. Could I ask you what the
function of "factor" in modeling? Thank you!

 

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: 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?

 

 

Here is the code example: 

 

curve2=survfit(Surv(CR, statcr) ~ factor(X1),data=dat1)

where X1 have three categories.

 

Thanks!

 


	[[alternative HTML version deleted]]

