Shahjalal University of Science and Technology,
Sylhet
Assignment on Parametric and Non Parametric Survival
Distribution
Name: Meftahul Zannat
Reg. No.: 2015134010
Course Title: Advanced Bio-statistics
Course Code: STA 522
Ans to the ques no. :1(a)
The hazard curve of the Weibull distribution is given below:
Figure: Hazard curve of the Weibull Distribution
From the above figure the red line represents the median survival line. And we can see that the curve and the median
survival line intersects at point one. So, the median hazard time is one.
The survival curve of the Weibull Distribution is given below:
Figure: Survival Function of Weibull Distribution
Here it can be said that the median survival time is approximately two.
Ans to the ques no.:1(b)
The hazard curve of the Gompertz distribution is given below:
Figure: Hazard Function of Gompertz Distribution
Here, the median hazard time is approximately 2.
The survival curve of the Gompertz Distribution is given below:
Figure: Survival curve of Gompertz Distribution
Here, the median survival time is two.
Ans to the ques no.:1(c)
The hazard curve of Gompertz distribution is given below:
Figure: Hazard curve of Log -logistic Distribution
From the above figure the median hazard time is four.
The Survival curve of Log-logistic Distribution is given below:
Figure: Survival curve of Log-logistic Distribution
From the above figure the median survival time is one.
Ans to the ques no.:2(a)
The number of censored observations and events for all patients by the menopausal status and grade is shown below:
From the result we found that we have 232 censored patients and 568 death events.
We also found that we have 139 pre-menopausal censored patients, 285 pre-menopausal death patients and 93 post-
menopausal censored patients and 283 post-menopausal death patients.
Again from this result we have got 50 censored patients and 36 death patients for Grade 0 cancer, 132 censored patients
and 251 death patients for Grade 1 cancer, 50 censored patients and 281 death patients for Grade 2 respectively.
Ans to the ques no.:2(b)
The Kaplan-Meier plot is shown below:
Figure: Kaplan-Meier Plot
Ans to the ques no.:2(c)
Here, we have found the median survival time of Kaplan Meier which is 2429 days and the lower limit and upper limit
are 2210 and 2813 respectively.
The survival probability and confidence interval at 3 and 5 years is shown below:
Median (3 years: 1095 days, 5 years: 1825 days)
Ans to the ques no.:2(d)
The Kaplan Meer plot by menopausal status is shown below:
Figure: Kaplan-Meier curve by Menopausal Status
Here the median survival time is about 2874 days.
Here, we can see the survival probability at 3 and 5 years.
Ans to the ques no.:2(e)
The Kaplan-Meier plot of Grade 0 cancer is shown below:
Figure: Kaplan-Meier Plot of Grade 0 Cancer Patient
From the above figure it can be clearly seen that the survival probability of Grade 0 patients is gradually decreasing.
The Nelson Aalen curve of Grade 0 cancer patients is shown below:
From the above two figures it can be said that there is no significant difference as the survival probability of Grade 0
patients is gradually decreasing in both the cases.
Codes of question no. 1:
1(a) Weibull Distribution
ht<-function(t){ro*lambda*t^(ro-1)}
t<-0:10
lambda<-.5
ro<-3
round(ht(t),2)
plot(t,ht(t),type="l",xlab="time",ylab="h(t)",col="green",las=2,lwd=5)
abline(h=.5,col="red",las=2,lwd=5)
st<-function(t){exp(-lambda*t^ro)}
t<-0:10
lambda<-.5
ro<-3
st(t)
plot(t,st(t),type="l",xlab="time",ylab="s(t)",col="blue",las=2,lwd=5)
abline(h=.5,col="red",las=2,lwd=5)
1(b) Gompertz Distribution
ht<-function(t){lambda*exp(gamma*t)}
t<-0:10
lambda<-2
gamma<--1
ht(t)
plot(t,ht(t),type="l",xlab="time",ylab="h(t)",col="green",las=2,lwd=6)
abline(h=.5,col="red",las=2,lwd=6)
st<-function(t){exp(-lambda*gamma^(-1)*exp(gamma*t)-1)}
t<-0:10
lambda<-2
gamma<--1
st(t)
plot(t,st(t),type="l",xlab="time",ylab="s(t)",col="blue",las=2,lwd=6)
abline(h=.5,col="red",las=2,lwd=6)
1(c) Log Logistic Distribution
ht<-function(t){(k*t^(k-1)*lambda^k)/(1+(lambda*t)^k)}
t<-0:10
lambda<-1.5
k<-2
ht(t)
plot(t,ht(t),type="l",xlab="time",ylab="h(t)",col="green",las=2,lwd=5)
abline(h=.5,col="red",las=2,lwd=5)
st<-function(t){
1/(1+(lambda*t)^k)
}
t<-0:10
lambda<-1.5
k<-2
st(t)
plot(t,st(t),type="l",xlab="time",ylab="s(t)",col="blue",las=2,lwd=5)
abline(h=.5,col="red",las=2,lwd=5)
Codes of question no. 2:
Required library:
library(survminer)
library(ggplot2)
library(survival)
2(a)
table(Cancer$censt)
table(Cancer$censt, Cancer$menop)
table(Cancer$censt, Cancer$grade)
2(b)
kapm <- Surv(time = Cancer$survt, event = Cancer$censt)
kapm7<-survfit(kapm~1,data=Cancer,type='kaplan-meier',conf.type='log')
ggsurvplot(kapm7, conf.int = T)
2(c)
kapm7
summary(kapm7,time=c(1095, 1825))
2(d)
kapm_menop<-survfit(kapm~menop,data=Cancer,type='kaplan-meier',conf.type='log')
ggsurvplot(kapm_menop, conf.int = F)
kapm_menop
summary(kapm_menop,time=c(1095, 1825))
2(e)
kapm_grade0<-survfit(kapm~grade,data=Cancer,type='kaplan-meier',conf.type='log', subset = (grade==0))
ggsurvplot(kapm_grade0, conf.int = T)
son<-survfit(kapm~grade,data=Cancer,type='fleming-harrington',conf.type='log', subset = (grade==0))
ggsurvplot(son, conf.int = T)
fits<- list(kapm_grade0, son)
ggsurvplot_combine(fits, Cancer)