Professional Documents
Culture Documents
SE
## (b)-(e)
> round(c(NelsAal = cumsum(tongfit$n.ev/tongfit$n.risk)[14], lgKM =
-log(tongfit$surv[14]), SE = tongfit$std.err[14]),5)
NelsAal lgKM
SE
error="tsiatis")
## Linear CI: this time using Greenwood SE to match book
> tongfit$surv[14]*(1 + 1.96*c(-1,1)*tongfit$std.err[14])
[1] 0.5245377 0.7831546
## Log-trans CI: called "log-log" in R, using Greenwood SE
> tongfit$surv[14]^exp(1.96*c(-1,1)*tongfit$std.err[14]/
log(tongfit$surv[14]))
[1] 0.5082759 0.7658557
> sin(asin(sqrt(tongfit$surv[14]))+0.5*1.96*c(-1,1)*
tongfit$std.err[14]*sqrt(1/(1/tongfit$surv[14]-1)))^2
[1] 0.5204761 0.7759203
#(f) want to consider bands for time interval "3 to 6 years" but
## since the book translates that to times 36-71, we also do that
## so the time range is 32 to 72 corr., to 12th to 18th evt-times.
> aLU = 1/(1+1/(52*tongfit$std.err[c(12,18)])) ## = c(.8278,.8567)
## with these values, the c05 constant is read off (approximately)
## from Table C.3b, p.464 using linear extrapolations as
## 2.6973-((.86-.8567)/.02)*.0322-((.8278-.6)/.02)*(.016) = 2.5
## Here used "tsiatis" in place of Greenwood to match book's answer
> for(i in 12:18) cat(round(tongft2$surv[i]^exp(2.5*c(-1,1)*
tongft2$std.err[i]/log(tongft2$surv[i])),5), "\n")
0.5056 0.82015
0.4861 0.80471
0.46686 0.78899
0.46686 0.78899
0.44707 0.77267
0.42757 0.75608
0.40837 0.73923
#4.2 Here used only Gp=2 and 3 (resp AML low and Hi risk), Dtime & Dind
# After storing the 137 lines of data in BMT.data, and storing as
## MS-DOS text to strip tabs:
> BMT = read.table("BMT.data", col.names=c("Gp","Dtime","Rtime",
"Dind","Rind", paste("V",6:22,sep="")))[,c(1,2,4)] ## 137 x 3
> table(BMT[,1])
1 2 3
38 54 45 ## only groups 2(Low) and 3 (High) are of interest to us
## 54 patients in AML Low-risk group, but only 23 unique death times
##(a)
> BMTlo = survfit(Surv(Dtime, Dind), data=BMT[BMT$Gp==2,2:3])
> rbind(time= BMTlo$time[BMTlo$n.ev>0], surv = round(BMTlo$surv[
BMTlo$n.ev>0],4), SE = round((BMTlo$surv*BMTlo$std.err)[BMTlo$n.event>0],4))
time 10.0000 35.0000 48.0000 53.0000 79.0000 80.0000 105.0000 222.0000 288.0000
surv 0.9815 0.9630 0.9444 0.9259 0.9074 0.8889 0.8704 0.8519 0.8333
SE 0.0183 0.0257 0.0312 0.0356 0.0394 0.0428 0.0457 0.0483 0.0507
## (b)
> round(cumsum(BMTlo$n.event/BMTlo$n.risk)[BMTlo$n.ev>0],4)
[1] 0.0185 0.0374 0.0566 0.0762 0.0962 0.1166 0.1375 0.1587 0.1805 0.2027
[11] 0.2254 0.2487 0.2725 0.2969 0.3219 0.3475 0.3738 0.4009 0.4286 0.4631
[21] 0.4988 0.5359 0.7025 ### Nelson-Aalen at distinct BMTlo death-times
> round(BMTlo$std.err[BMTlo$n.ev>0],4)
[1] 0.0187 0.0267 0.0330 0.0385 0.0435 0.0481 0.0525 0.0568 0.0609 0.0649
[11] 0.0688 0.0727 0.0766 0.0805 0.0844 0.0883 0.0922 0.0962 0.1003 0.1062
[21] 0.1123 0.1185 0.2176
### standard errors
> round(cumsum(BMThi$n.event/BMThi$n.risk)[BMThi$n.ev>0],4)
[1] 0.0222 0.0449 0.0682 0.0920 0.1164 0.1414 0.1670 0.1934 0.2204 0.2759
[11] 0.3054 0.3357 0.3669 0.3992 0.4325 0.4670 0.5027 0.5397 0.5782 0.6182
[21] 0.6599 0.7033 0.7488 0.7964 0.8464 0.8990 0.9546 1.0134 1.0759 1.1426
[31] 1.2140 1.2909 1.4021
> round(BMThi$std.err[BMThi$n.ev>0],4)
[1] 0.0225 0.0321 0.0398 0.0466 0.0527 0.0585 0.0640 0.0693 0.0745 0.0848
[11] 0.0899 0.0950 0.1002 0.1054 0.1107 0.1162 0.1217 0.1274 0.1333 0.1394
[21] 0.1458 0.1524 0.1594 0.1667 0.1744 0.1826 0.1913 0.2007 0.2108 0.2218
[31] 0.2339 0.2472 0.2739
## (c)
> plot(BMThi$time, cumsum(BMThi$n.event/BMThi$n.risk), pch=18)
> points(BMTlo$time, cumsum(BMTlo$n.event/BMTlo$n.risk), pch=5)
### "Crude" hazards (Cum hazard per unit time)
### For low-risk group:
> cumsum(BMTlo$n.event/BMTlo$n.risk)[BMTlo$n.ev>0][23]/
BMTlo$time[BMTlo$n.ev>0][23]
[1] 0.0003187612
### For hi-risk group:
> cumsum(BMThi$n.event/BMThi$n.risk)[BMThi$n.ev>0][33]/
BMThi$time[BMThi$n.ev>0][33]
[1] 0.001080166
## (e)
Median survival-time estimators, each followed by three kinds of
confidence intervals:
> BMTlo$time[min((1:54)[BMTlo$surv <= 0.5])]
[1] 2204
> range(BMTlo$time[(1:54)[abs(BMTlo$surv-0.5)< qnorm(0.975)*
GreenwdSE.lo]]) ### 1063 2569 linear interval, lo-risk
> range(BMTlo$time[(1:54)[abs(log(-log(BMTlo$surv))-log(-log(0.5)))<
qnorm(0.975)*GreenwdSE.lo/abs(BMTlo$surv*log(BMTlo$surv))]])
[1] 1063 2569 ### log-transformed interval, lo-risk
> range(BMTlo$time[(1:54)[abs(asin(sqrt(BMTlo$surv))-asin(sqrt(0.5)))<
0.5*qnorm(0.975)*GreenwdSE.lo/sqrt(BMTlo$surv*(1-BMTlo$surv))]])
[1] 1063 2569 ### asin-sqrt-transformed interval, lo-risk
> range(BMThi$time[(1:44)[abs(asin(sqrt(BMThi$surv))-asin(sqrt(0.5)))<
0.5*qnorm(0.975)*GreenwdSE.hi/sqrt(BMThi$surv*(1-BMThi$surv))]])
[1] 162 469 ### asin-sqrt-transformed interval, hi-risk
## (f)
Last jump before 300 days was at 288 days (the 9th jump) in the
low-risk group, and at 265 days (22nd jump) in the high-risk group.
> Shat = c(BMTlo$surv[9], BMThi$surv[22]) ### .8333 and .4889
sigShat = c((BMTlo$surv*BMTlo$std.err)[9], (BMThi$surv*BMThi$std.err)[22])
thet = exp(qnorm(.975)*sigShat/(Shat*log(Shat)))
> Shat[1]^c(1/thet[1],thet[1]) #Lo-risk log interval: 0.7042 0.9096
Shat[2]^c(1/thet[2],thet[2]) #Hi-risk log interval: 0.3374 0.6241
45*(BMThi$std.err)[c(9,26)]^2)),
nrow=2, dimnames=list(c("L","U",),c("lo","hi")))
lo hi
L 0.1111111 0.2
U 0.2037037 0.6
## Get confidence coefs for alpha=.05 case from table via lin.interp.
## resp. 2.536 for "lo" and 2.767 for "hi"
> for (i in 6:11) cat(round(BMTlo$surv[i]^exp(2.536*c(-1,1)*
BMTlo$std.err[i]/log(BMTlo$surv[i])),5), "\n")
0.71758 0.95906
0.69605 0.94819
0.67474 0.93674
0.65372 0.92478
0.63298 0.91237
0.61254 0.89955
> for (i in 9:26) cat(round(BMThi$surv[i]^exp(2.767*c(-1,1)*
BMThi$std.err[i]/log(BMThi$surv[i])),5), "\n")
0.56989 0.91526
0.52343 0.88571
0.50076 0.87015
0.47847 0.85413
0.45654 0.83767
0.43498 0.82079
0.41378 0.80351
0.39294 0.78585
0.37245 0.76782
0.35231 0.74942
0.33252 0.73068
0.31307 0.71159
0.29398 0.69215
0.27523 0.67237
0.25685 0.65225
0.23882 0.63179
0.22115 0.61098
0.20387 0.58981