Re: [R] Coxph with factors

From: Thomas Lumley <>
Date: Sat 16 Jul 2005 - 00:31:17 EST

On Fri, 15 Jul 2005, Kylie-Anne Richards wrote:


> FIRST Q: The default uses the mean of 'vo' and mean of 'po', but what is it
> using for the factors?? Is it the sum of the coef of the factors divided by
> the number of factors??

It uses the mean of each factor variable. The $means component of the fit gives the values it uses.

> SECOND Q: For a model with covariates I would normally specify:
> final.surv<-survfit((final), data.frame(po=0,vo=0,pom=0,individual=T)) to
> get the baseline survival prob.; what would I specify for a model with a
> factor, i.e., 'f.pom' ??

I would first note that the survival function at zero covariates is not a very useful thing and is usually numerically unstable, and it's often more useful to get the survival function at some reasonable set of covariates.

In any case, to specify f.pom You need it to be a factor with the same set of levels. You don't say what the lowest level of pom is, but if it is, say, -3.

f.pom=factor(-3, levels=seq(-3,2.5, by=0.5))

         =thomas mailing list PLEASE do read the posting guide! Received on Sat Jul 16 00:39:00 2005

This archive was generated by hypermail 2.1.8 : Fri 03 Mar 2006 - 03:33:45 EST