File: mpip.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 (37 lines) | stat: -rw-r--r-- 1,631 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
27
28
29
30
31
32
33
34
35
36
37
temp <- matrix(scan("data.mpip", skip=23), ncol=13, byrow=T)
dimnames(temp) <- list(NULL, c('ved', 'angina', 'education', 'prior.mi',
                     'nyha', 'rales', 'ef', 'ecg', 'angina2', 'futime', 
                     'status', 'admit', 'betab'))
 
mpip <- data.frame(temp)
lved <- log(mpip$ved + .02)

fit1 <- coxph(Surv(futime, status) ~ pspline(lved) + factor(nyha) + 
	      rales + pspline(ef), mpip)

temp <- predict(fit1, type='terms', se.fit=T)
yy <- cbind(temp$fit[,4], temp$fit[,4] + 1.96*temp$se[,4],
	                  temp$fit[,4] - 1.96*temp$se[,4])
index <- order(mpip$ef)
matplot(mpip$ef[index], yy[index,], type='l', lty=c(1,2,2), col=1)
title(xlab="Ejection Fraction", ylab="Cox model risk", 
      main="Post-Infarction Survival")

fit2 <- coxph(Surv(futime, status) ~ lved + factor(nyha) + rales +
	      pspline(ef, df=0), mpip)
temp <- predict(fit2, type='terms', se.fit=T)
yy <- cbind(temp$fit[,4], temp$fit[,4] + 1.96*temp$se[,4],
	                  temp$fit[,4] - 1.96*temp$se[,4])
matplot(mpip$ef[index], yy[index,], type='l', lty=c(1,2,2), col=1)
title(xlab="Ejection Fraction", ylab="Cox model risk", 
      main="Post-Infarction Survival, AIC")


fit3 <- survreg(Surv(futime, status) ~ lved + factor(nyha) + rales +
		pspline(ef, df=2), mpip, dist='lognormal')
temp <- predict(fit3, type='terms', se.fit=T)
yy <- cbind(temp$fit[,4], temp$fit[,4] + 1.96*temp$se[,4],
	                  temp$fit[,4] - 1.96*temp$se[,4])
matplot(mpip$ef[index], yy[index,], type='l', lty=c(1,2,2), col=1)
title(xlab="Ejection Fraction", ylab="Log-normal model predictor", 
      main="Post-Infarction Survival")