File: testscale.s

package info (click to toggle)
survival 2.29-1
  • links: PTS
  • area: main
  • in suites: etch, etch-m68k
  • size: 3,204 kB
  • ctags: 1,077
  • sloc: asm: 8,713; ansic: 6,928; sh: 22; makefile: 2
file content (26 lines) | stat: -rw-r--r-- 924 bytes parent folder | download | duplicates (3)
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
#
# Verify that scale can be fixed at a value
#    coefs will differ slightly due to different iteration paths
tol <- survreg.control()$rel.tolerance

# Intercept only models
fit1 <- survreg(Surv(time,status) ~ 1, lung)
fit2 <- survreg(Surv(time,status) ~ 1, lung, scale=fit1$scale)
all.equal(fit1$coef, fit2$coef, tolerance= tol)
all.equal(fit1$loglik, fit2$loglik, tolerance= tol)

# multiple covariates
fit1 <- survreg(Surv(time,status) ~ age + ph.karno, lung)
fit2 <- survreg(Surv(time,status) ~ age + ph.karno, lung,
		scale=fit1$scale)
all.equal(fit1$coef, fit2$coef, tolerance=tol)
all.equal(fit1$loglik[2], fit2$loglik[2], tolerance=tol)

# penalized models
fit1 <- survreg(Surv(time, status) ~ pspline(age), lung)
fit2 <- survreg(Surv(time, status) ~ pspline(age), lung, scale=fit1$scale)
all.equal(fit1$coef, fit2$coef, tolerance=tol)
all.equal(fit1$loglik[2], fit2$loglik[2], tolerance=tol)

rm(fit1, fit2, tol)