For the following small data set of survival time: 3, 4, 5+, 6, 6+, 8, 11+, 14+,
ID: 2922085 • Letter: F
Question
For the following small data set of survival time: 3, 4, 5+, 6, 6+, 8, 11+, 14+, 15, 16+, where “+” means a right censored survival time, do the following by hand: (a) Find the Kaplan-Meier estimate of the survival function and its variance at each event time. (b) Use the above Kaplan-Meier estimate to get an estimate and its variance of the cumulative hazard function at each event time. (c) Find the Nelson-Aalen estimate of the cumulative hazard function and its variance at each event time. (d) Find an estimate and its variance of the survival function using the Nelson-Aalen estimate you got in (c) at each event time.
Explanation / Answer
(a)
rm(list=ls(all=TRUE))
library(survival);
time<-c( 3, 4, 5, 6, 6, 8, 11, 14, 15, 16)
length(time);
status<-c(0,0,1,0,1,0,1,1,0,1)
df<-data.frame(time,status)
fit1<-survfit(Surv(time ,status)~1,type="kaplan-meier")
summary(fit1)
par(font=2,font.axis=2,font.lab =2 ,lwd=2)
plot(fit1,xlab="Time to survival",ylab="survival function", main="kaplan-meier")
Call: survfit(formula = Surv(time, status) ~ 1, type = "kaplan-meier")
time n.risk n.event survival std.err lower 95% CI upper 95% CI
5 8 1 0.875 0.117 0.673 1
6 7 1 0.750 0.153 0.503 1
11 4 1 0.562 0.199 0.281 1
14 3 1 0.375 0.203 0.130 1
16 1 1 0.000 NaN NA NA
(b)
var<-(fit1$surv^2)*cumsum(fit1$n.event/((fit1$n.risk)*(fit1$n.risk-1)))
> var
[1] 0.00000000 0.00000000 0.01367188 0.02343750 0.02343750 0.03955078 0.04101562
[8] 0.04101562 NaN
cbind(fit1$time,-log(fit1$surv),cumsum(fit1$n.event/((fit1$n.risk)*(fit1$n.risk-1))))
[,1] [,2] [,3]
[1,] 3 0.0000000 0.00000000
[2,] 4 0.0000000 0.00000000
[3,] 5 0.1335314 0.01785714
[4,] 6 0.2876821 0.04166667
[5,] 8 0.2876821 0.04166667
[6,] 11 0.5753641 0.12500000
[7,] 14 0.9808293 0.29166667
[8,] 15 0.9808293 0.29166667
[9,] 16 Inf Inf
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.