Min-Han Tan wrote:> Good afternoon,
>
> I am currently trying to do some work on survival analysis.
>
> - I hope to seek your advice re: 2 questions (1 general and 1 specific)
>
> (1) I'm trying to do a stratified Cox analysis and subsequently
> plot(survfit(object)). It seems to work for some strata, but not for
> others.
>
> I have tumor grade, which is a range of 1 - 4.
>
> When I divide this range of 1:4 into 2 groups, it works fine for
> strata(grade>2) and strata(grade > 3). However, if I do a
> strata(grade>1), there is an error when I do a survfit( <coxph
object>
> )
>
> Call: survfit.coxph(object = s)
>
> Error in print.survfit(structure(list(n = as.integer(46), time = c(22, :
> length of dimnames [1] not equal to array extent
>
> (2) As a general question, is it possible to distinguish between
> confounding and interaction in the Cox proportional hazards model?
>
> Thanks!
>
> Min-Han
The Design package provides another way to use the survival package.
library(Design) # also issues library(Hmisc) so need to install both
d <- datadist(mydataframe); options(datadist='d')
f <- cph(Surv(...) ~ ... + strat(z), surv=TRUE) # note strat instead
of strata
survplot(f, z=vector of strata values to plot survival curves for)
survplot has many options
--
Frank E Harrell Jr Professor and Chair School of Medicine
Department of Biostatistics Vanderbilt University