[R] using survexp and ratetable with coxph object that includes a factor term
Erik Iverson
eriki at ccbr.umn.edu
Mon Sep 13 20:30:06 CEST 2010
Hello,
I'm attempting to use the ratetable argument to
survexp in the survival package. I use
the example from the ?survexp help page below,
and then slightly modify it to produce an error.
library(survival)
data(pbc)
#fit a model without any factors
pfit1 <- coxph(Surv(time, status > 0) ~ trt + log(bili) +
log(protime) + age + platelet, data=pbc)
#this works as expected
survexp(~ trt, ratetable = pfit1, data = pbc)
#now I fit a similar model, simply adding the 'sex' term
#note sex is now the only factor in the model
pfit2 <- coxph(Surv(time, status > 0) ~ trt + log(bili) +
log(protime) + age + platelet + sex, data = pbc)
#however, I now get an error with survexp
survexp(~ trt, ratetable = pfit2, data = pbc)
Error in ratetable(trt = trt, bili = bili, protime = protime, age = age,
: object 'sexf' not found
Does anyone have any suggestions?
Thank you,
Erik Iverson
sessionInfo()
R version 2.11.1 (2010-05-31)
x86_64-unknown-linux-gnu
locale:
[1] LC_CTYPE=en_US.UTF-8 LC_NUMERIC=C
[3] LC_TIME=en_US.UTF-8 LC_COLLATE=en_US.UTF-8
[5] LC_MONETARY=C LC_MESSAGES=en_US.UTF-8
[7] LC_PAPER=en_US.UTF-8 LC_NAME=C
[9] LC_ADDRESS=C LC_TELEPHONE=C
[11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C
attached base packages:
[1] grDevices datasets splines graphics utils stats methods
[8] base
other attached packages:
[1] Hmisc_3.7-0 survival_2.35-8
loaded via a namespace (and not attached):
[1] cluster_1.12.3 grid_2.11.1 lattice_0.18-8 tools_2.11.1
More information about the R-help
mailing list