File: expected2.R

package info (click to toggle)
survival 2.36-14-1
  • links: PTS
  • area: main
  • in suites: wheezy
  • size: 3,500 kB
  • sloc: asm: 7,352; ansic: 5,369; makefile: 2
file content (16 lines) | stat: -rw-r--r-- 572 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
library(survival)
#
# 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])