1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36
|
R version 2.11.1 (2010-05-31)
Copyright (C) 2010 The R Foundation for Statistical Computing
ISBN 3-900051-07-0
R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.
R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.
Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.
> library(survival)
Loading required package: splines
> #
> # A Cox model with a factor, followed by survexp.
> #
> pfit2 <- coxph(Surv(time, status > 0) ~ trt + log(bili) +
+ log(protime) + age + platelet + sex, data = pbc)
> esurv <- survexp(~ trt, ratetable = pfit2, data = pbc)
>
> temp <- pbc
> temp$sex2 <- factor(as.numeric(pbc$sex), levels=2:0,
+ labels=c("f", "m", "unknown"))
> esurv2 <- survexp(~ trt, ratetable = pfit2, data = temp,
+ rmap=list(sex=sex2))
>
> # The call components won't match, which happen to be first
> all.equal(unclass(esurv)[-1], unclass(esurv2)[-1])
[1] TRUE
>
|