[go: up one dir, main page]

0% found this document useful (0 votes)
46 views28 pages

Lecture Three

Uploaded by

Irene Ilado
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
46 views28 pages

Lecture Three

Uploaded by

Irene Ilado
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 28

Lecture Three

Dr. Mutua Kilai


Department of Pure and Applied Sciences

Jan-April 2024

Dr. Mutua Kilai | Lecture Three 1/28


Kaplan Meier Example 2
The data: remission times (weeks) for two groups of leukemia
patients.
Group 1 (n = 21) the treatment group and Group II (n = 21) the
control group. Construct and plot the KM curves.

Group 1
6 6 6 7 10 13 16 22 23 6+ 9+
10+ 11+ 17+ 19+ 20+ 25+ 32+ 32+ 34+ 35+
Group II
1 1 2 2 3 4 4 5 5 8 8
8 8 11 11 12 12 15 17 22 23

Dr. Mutua Kilai | Lecture Three 2/28


Solution

For group 1

Dr. Mutua Kilai | Lecture Three 3/28


Solution Cont’d

Dr. Mutua Kilai | Lecture Three 4/28


Survival Curves

• Notice that the KM curve for group 1 is consistently higher than


the KM curve for group 2.
• These figures indicate that group 1, which is the treatment
group, has better survival prognosis than group 2, the placebo
group.
• Moreover, as the number of weeks increases, the two curves
appear to get farther apart, suggesting that the beneficial effects
of the treatment over the placebo are greater the longer one
stays
Dr. Mutua Kilai | Lecturein remission.
Three 5/28
R Codes
# reading in the data
times <- c(6,6,6,7,10,13,16,22,23,6,9,10,11,17,19,20,25,32,3
1,1,2,2,3,4,4,5,5,8,8,8,8,11,11,12,12,15,17,22,23
status <- c(1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,
1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1)
group <- c(1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2)
# data frame
data <- data.frame(times, status,group)
# fitting the model
fit <- survfit(Surv(times, status) ~ group, data = data)
# plotting
ggsurvplot(fit, data = data)
Dr. Mutua Kilai | Lecture Three 6/28
Likelihood Function

• Suppose that we have n units with lifetime governed by a


survivor function S(t, θ) with associated density f (t, θ) and
hazard function h(t, θ).
• Suppose unit i is observed for a time ti . If the unit died at ti its
contribution to the likelihood function is the density at that
duration.
• If the unit is still alive at ti all we know is that the lifetime
exceeds ti . The probability of the event is Li = S(ti ) which
becomes the contribution of a censored observation to the
likelihood

Dr. Mutua Kilai | Lecture Three 7/28


Cont’d
• For the vector of unknown parameters θ = (θ1 , θ2 , ..., θp )′ the
likelihood function is:
n
L(x , θ) = f (xi , θ)δi S(xi , θ)1−δi
Y

i=1
δi is 1 if the failure of item i is observed and 0 if the failure of
item i is right censored.
• We can express the likelihood function as:
n
L(x , θ) = = f (xi , θ)
Y Y Y
S(xi , θ)
i=1 i∈U i∈C

where S(xi , θ) is the survivor function of the population


distribution with parameters θ evaluated at censoring time
xi , i ∈ C
Dr. Mutua Kilai | Lecture Three 8/28
Cont’d
• Taking the logarithm we have:
ln L(x , θ) = ln f (xi , θ) + ln S(xi , θ)
X X

i∈U i∈C

• Since the probability density function is the product of the


hazard function and the survivor function, the log likelihood
function can be simplified to
ln L(x , θ) = ln h(xi , θ) + ln S(xi , θ) + ln S(xi , θ)
X X X

i∈U i∈U i∈C

• Which can be expressed as:


n
ln L(x , θ) = ln h(xi , θ) + ln S(xi , θ)
X X

i∈U i=1

Dr. Mutua Kilai | Lecture Three 9/28


Log-Rank Test

• Are KM curves statistically equivalent?


• We now describe how to evaluate whether or not KM curves for
two or more groups are statistically equivalent.
• When we state that two KM curves are "statistically equivalent"
we mean that, based on a testing procedure that compares the
two curves in some "overall sense," we do not have evidence to
indicate that the true (population) survival curves are different.
• The log–rank test is a large-sample chi-square test that uses as
its test criterion a statistic that provides an overall comparison of
the KM curves being compared.

Dr. Mutua Kilai | Lecture Three 10/28


Log-Rank Test Cont’d

• This (log–rank) statistic, like many other statistics used in other


kinds of chi-square tests, makes use of observed versus expected
cell counts over categories of outcomes.
• The categories for the log–rank statistic are defined by each of
the ordered failure times for the entire set of data being
analyzed.
• For each ordered failure time t(f ) in the entire set of data we
show the number of subjects mif failing at that time separately
by group i followed by the number of subjects nif in the risk set
at that time also separately by group.

Dr. Mutua Kilai | Lecture Three 11/28


Expected Cell Counts

n1f
 
e1f = × (m1f + m2f )
n1f + n2f
n2f
 
e2f = × (m1f + m2f )
n1f + n2f
• Proportion in risk set.
• Number of failures over both groups. (m1f + m2f )

Dr. Mutua Kilai | Lecture Three 12/28


Assumptions of Log-Rank Test

• Independence: The survival times or event times of individuals in


each group should be independent to each other.
• Non-Informative Censoring: Censoring should not be related to
the event being studied or to the group assignment. The
log-rank test assumes that the probability of censoring should be
the same for all individuals within each group.
• Proportional Hazards: The hazard rates (the risk of an event
occurring) for the compared groups should be consistent over
time. The ratio of the hazard rates should remain constant.

Dr. Mutua Kilai | Lecture Three 13/28


Example

Using the data below, compare the two groups using log-rank test at
5% level of significance.

Group 1
6 6 6 7 10 13 16 22 23 6+ 9+
10+ 11+ 17+ 19+ 20+ 25+ 32+ 32+ 34+ 35+
Group II
1 1 2 2 3 4 4 5 5 8 8
8 8 11 11 12 12 15 17 22 23

Dr. Mutua Kilai | Lecture Three 14/28


Solution

Dr. Mutua Kilai | Lecture Three 15/28


Solution Cont’d

(O2 − E2 )2
log Rank Stats =
Var (O2 − E2 )

• We can use either the values from group 1 or the values from
group 2.
• The variance is given by:

X n1f n2f (m1f + m2f )(n1f + n2f − m1f − m2f )


Variance(O2 −E2 ) =
(n1f + n2f )2 (n1f + n2f − 1)

Dr. Mutua Kilai | Lecture Three 16/28


Cont’d
• The hypothesis is:
H0 : No difference between survival curves
Ha : There is difference between survival curves
• The log-rank statistic follows χ21 distribution under H0
• Variance = 6.2685
• The log rank statistic
(O2 − E2 )2 (10.26)2
= = 16.793
Var (O2 − E2 ) 6.2685

• The tabulated value is 3.84 less than 16.793 hence we reject H0


Dr. Mutua Kilai | Lecture Three 17/28
Cont’d

• An approximate formula is given by:

(Oi − Ei )2
χ2 =
X

i Ei

• We can compute for the above example as:

(−10.26)2 (10.26)2
χ =
2
+ = 15.276
19.26 10.74

Dr. Mutua Kilai | Lecture Three 18/28


R Code

# reading in the data


times <- c(6,6,6,7,10,13,16,22,23,6,9,10,11,17,19,20,25,32,3
1,1,2,2,3,4,4,5,5,8,8,8,8,11,11,12,12,15,17,22,23
status <- c(1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,
1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1)
group <- c(1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2)
# data frame
data <- data.frame(times, status,group)
# fitting the model
fit <- survdiff(Surv(times, status) ~ group, data = data)
fit

Dr. Mutua Kilai | Lecture Three 19/28


Output

• The p-value is less than 0.05 hence we reject H0 and conclude


that the survival time are different.

Dr. Mutua Kilai | Lecture Three 20/28


Example 2

Suppose we have Group 1 and Group 2 and we want to test whether


the two groups have the same survival function or not.
The data is as given:

Group 1
2 3 5+ 7 7 8
Group II
2 2 4 4 6 8

Dr. Mutua Kilai | Lecture Three 21/28


Solution

Dr. Mutua Kilai | Lecture Three 22/28


Solution Cont’d

• Log rank = 1.32


1.78
= 0.74
• The calculated value is less than tabulated value hence we reject
the null hypothesis.

Dr. Mutua Kilai | Lecture Three 23/28


R Code
# reading the data
time <- c(2,3,5,7,7,8,2,2,4,4,6,8)

status <- c(1,1,0,1,1,1,1,1,1,1,1,1)

group <- c(1,1,1,1,1,1,2,2,2,2,2,2)

# data frame
library(survival)

data <- data.frame(time, status,group)

fit2 <- survdiff(Surv(time, status) ~ group, data = data)


fit2
Dr. Mutua Kilai | Lecture Three 24/28
Output

Dr. Mutua Kilai | Lecture Three 25/28


Exercise

The following data are a sample from the 1967-1980 Evans County
study. Survival times (in years) are given for two study groups, each
with 24 participants. Group 1 has no history of chronic disease
(CHR¼ 0), and group 2 has a positive history of chronic disease
(CHR ¼ 1):

Dr. Mutua Kilai | Lecture Three 26/28


Data

Group 1
12.3+ 5.4 8.2 12.2+ 11.7 10.0 5.7 9.8 2.6 11.0 9.2 12.1
2.2 1.8 10.2 10.7 11.1 5.3 3.5 9.2 2.5 8.7 3.8 3.0
Group 2
5.8 2.9 8.4 8.3 9.1 4.2 4.1 1.8 3.1 11.4 2.4 1.4
1.6 2.8 4.9 3.5 6.5 9.9 3.6 5.2 8.8 7.8 4.7 3.9

• Compute the K-M estimate for the two groups and plot
• Compute the log-rank test statistic
• Write an R code that does the above two.

Dr. Mutua Kilai | Lecture Three 27/28


Thank You!

Dr. Mutua Kilai | Lecture Three 28/28

You might also like