File: update.R

package info (click to toggle)
survival 3.8-6-1
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 15,496 kB
  • sloc: ansic: 8,088; makefile: 77
file content (17 lines) | stat: -rw-r--r-- 487 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
library(survival)

# the way a +cluster() term is handled in coxph has implications for update.

fit1 <- coxph(Surv(time, status) ~ age, cluster= inst, lung)
fit2 <- coxph(Surv(time, status) ~ age + cluster(inst), lung)
all.equal(fit1, fit2)

fit3 <- coxph(Surv(time, status) ~ age + sex + cluster(inst), lung)

test1 <- update(fit1, .~ .+ sex)
all.equal(test1, fit3)

# Gives a spurious warning message
test2 <- update(fit1, . ~ age + sex + cluster(inst), lung)
all.equal(test2, fit3)