0% found this document useful (0 votes)
15 views63 pages

survival lec 6-1

The document discusses the Delta Method, a statistical technique for approximating the distribution of functions of random variables, particularly useful for maximum likelihood estimators. It covers the application of the Delta Method for estimating means and variances, constructing confidence intervals, and hypothesis testing, along with examples and R code. Additionally, it introduces the Likelihood Ratio Test (LRT) for comparing statistical models and provides a detailed example of its application in assessing model improvement.

Uploaded by

alcinialbob1234
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)
15 views63 pages

survival lec 6-1

The document discusses the Delta Method, a statistical technique for approximating the distribution of functions of random variables, particularly useful for maximum likelihood estimators. It covers the application of the Delta Method for estimating means and variances, constructing confidence intervals, and hypothesis testing, along with examples and R code. Additionally, it introduces the Likelihood Ratio Test (LRT) for comparing statistical models and provides a detailed example of its application in assessing model improvement.

Uploaded by

alcinialbob1234
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/ 63

Survival

Analysis
Parametric Methods
Table of contents

01 Delta Method 02 Likelihood ratio test

03 Likelihood function for


Randomly Censored Data
01
Delta method
What is Delta Method?
•The delta method is a statistical technique used to
approximate the distribution of a function of a random
variable.

•This method is particularly useful when dealing with


maximum likelihood estimators.

•It leverages a first-order Taylor expansion around the mean


of a random variable to approximate the variance of a
function of that variable
Delta Method Types
Delta Method

Multivariate Univariate

The Multivariate Delta The Univariate Delta


Method extends the idea of Method is applied when
the univariate delta method we are dealing with a
to handle multiple single variable
variables simultaneously (univariate)
Apply the Delta Method
Suppose a random variable Z has:
Taylor Expansion Formula:
Mean μ f(x) = f(a) + f'(a)(x - a) + (f''(a)/2!)
Variance σ2 (x - a)2 + (f'''(a)/3!)(x - a)3+...+
and we want to approximate the distribution of function g(Z). (f(n) (a)/n!)(x - a)n + Rn

Taylor Expansion:
Expand g(Z) around μ using the first-order Taylor approximation:

g(Z) ≈ g(μ)+(Z−μ)g′(μ)

The first derivative of g(Z) at


The value of the function at Z=μ
Z=μ
Apply the Delta Method (Contd.)
Now we will use Taylor Expansion to approximate the mean and variance of g(Z)
❖ Approximate the mean of the g(Z):
Take the expectation of both sides of the taylor approximation

E[g(Z)]≈E[g(μ)+(Z−μ)g′(μ)]
Expand Expectation:

E[g(Z)] ≈ E[g(μ)]+E[(Z−μ)g′(μ)]

≈ g(μ)+ E[(Z−μ)]g′(μ)

the approximate mean is:


E[g(Z)] ≈ g(μ).
Note: E[Z−μ]=0
Apply the Delta Method (Contd.)
❖ Approximate the variance of the g(Z):
Take the variance of both sides of the taylor approximation :

Var(g(Z)) ≈ Var(g(μ)+(Z−μ)g′(μ))

≈ Var((Z−μ) g′(μ))
Since g′(μ) is constant:
≈ (g′(μ) )2 Var(Z−μ)

By definition, Var(Z)=E[(Z−μ)2] So:

Var(Z−μ)=Var(Z)
the approximate variance is:
Var(g(Z)) ≈ (g′(μ) )2Var(Z).
Formula for the Delta Method
Final Approximate :
Mean of g(Z) :
mean( g(Z) ) ≈ g(μ)
Variance of g(Z):
var( g(Z) ) ≈ ( g′(μ) )2 σ2
Final Approximate Distribution:
If Z ∼ Normal(μ,σ2),

then:
g(Z)∼Normal( g(μ) , (g′( μ ) )2 σ2)
Applications
The Delta Method is widely used in :

• Variance Estimation: Approximate the variance


of functions of random variables.

• confidence intervals: construct confidence


intervals for transformed parameters.

• Hypothesis Testing: Perform hypothesis tests


on functions of parameters.
Example

Let X1, . . . , X40 be iid from a Poisson distribution with parameter λ.


Then the MLE of λ is λ̂ = x̄ We know that the mean and variance of
Z = x̄ are λ and λ/n, respectively , use delta method to to approximate
distribution of g(z) which is equal √z and what is approximate mean
and variance to g(z)
Solution
Step 1 : calculate mean
g(Z)=√z & μ=λ & σ2=λ/n
➤ mean( g(Z) ) ≈ g(μ)
● g(μ) = g(λ) = √λ

Step2 :calculate variance


➤ var( g(Z) ) ≈ ( g′(μ) )2 σ2
● g′(z)= 1/2√z
● g′(μ)=g′(λ)=1/2√λ
● var( g(Z) )=[1/2√λ]2.(λ/n) = 1/4n

Step3 : final distribution


● The distribution of g(Z) is:
g(Z)∼Normal( √λ , 1/4n)
Delta method in R
Code
Delta method in R
Output
Confidence interval
When constructing the confidence interval of an estimate
based on the Delta Method it uses the estimated variance of
this function to specify the a range of values for a function of an
estimator for example g(θ^), that likely contains the true value of
the function g(θ), with a specified level of confidence (1-𝜶)
Formula for the Confidence interval

g(θ^)±zα/2⋅√( g′(θ) )2 σ2

value of the function


standard error of the transformed
evaluated at the estimated critical value from the estimator
parameter standard normal distribution
Example

Let X1, . . . , X40 be iid from a Poisson distribution with parameter λ.


Then the MLE of λ is λ̂ = x̄ We know that the mean and variance of
Z = x̄ are λ and λ/n, Using g(Z)=√z, construct a 95% confidence interval
for g(λ̂ )
Given that λ̂ =4 , n=40 , z0.025=1.96.
Solution
λ̂ =4 & n=40 & z0.025=1.96

Step1 : Calculate g(λ̂ )


● g(λ^)=√λ̂
➢ By substituting with λ̂ =4
√λ̂= √4=2

Step2 : Standard Error (SE)


From the previous question we calculated
● variance=(g′( λ ) )2 σ2)=1/4n
● Standard Error=√1/4n
➢ By substituting with n= 40
● Standard Error= √1/(4*40)=0.079
Solution

Step3 : Apply the confidence interval formula


● g(λ^)±zα/2⋅√((g’(λ)) )2 σ2 )
=2±1.96×0.079
=2±0.15484

Step4 : Construct the confidence interval


● Lower bound: 2−0.15484=1.85
● Upper bound: 2+5.88=2.15
Conclusion: The 95% confidence interval forg(λ^) is (1.85 , 2.15)
Statistical testing
In survival analysis, we use statistical tests to evaluate the significance of parameters and compare
models. These tests are part of the broader framework of Likelihood-based Inference and include:

Wald Statistic: Tests the significance of individual parameters in the model.

(θ −θ0)′ I(θ0) (θ − θ0) ∼ χ2 (d) under H0

The transpose of the difference


between the estimated parameter The Fisher information matrix
and the null hypothesis parameter.
Example
A pharmaceutical company is testing whether a new medication reduces blood
pressure. The regression model predicts the change in blood pressure (Y) based on
the dosage of the medication (X). The coefficient θ represents the effect of the
medication on blood pressure. The company hypothesizes that the medication has no
effect (H0:θ=0).

After running the experiment and analyzing the data, they estimate:

● θ=−2.5 (the estimated coefficient of the medication's effect).


● The variance of θ, derived from the Fisher information matrix, is I(θ0)=0.4.

The company wants to test if the effect is statistically significant at a 5% level.


Solution
Step 1: Write the Wald Test Formula
W = (θ−θ0)^2 x I(θ0)
Here:

● θ=−2.5
● θ0=0
● I(θ0)=0.4

Step 2: Compute the Difference (θ−θ0)


Θ−θ0 = −2.5−0 = −2.5

Step 3: Apply the Wald Test Formula


W = (−2.5)^2 x 0.4 = 6.25 x 0.4 = 2.5
Step 4: Determine the Critical Value
● Degrees of freedom: d=1 (testing one parameter).
● At a 5% significance level, the critical value from χ2(1) is 3.84

Step 5: Compare W to the Critical Value


● W=2.5, and the critical value is 3.84
● Since W<3.84, we fail to reject H0.

This means the data does not provide sufficient evidence to conclude
that the medication significantly affects blood pressure.
code
Output
Rao Statistic (Score Test): Evaluates the likelihood function slope at the null hypothesis,
providing an alternative way to test parameter significance.

I(θ0) is the Fisher information


∂/θ∂ logL(θ0) is the score function
matrix.
at θ0 (denoted as U(θ0)

Note that Rao’s method does not use the MLE. Hence, no iterative calculation is necessary.
Example
A researcher is studying the effectiveness of two drugs, A and B, in reducing cholesterol levels. They fit a
regression model with two coefficients:

● θ1: The effect of drug A.


● θ2: The effect of drug B.

The null hypothesis is that neither drug has an effect:

The observed log-likelihood function is analyzed, and the following data are
provided:

● The score vector:

● The Fisher information matrix:

The researcher wants to test H0 at a significance level of 5%.


Solution
Step 1: Compute the Inverse of I(θ0)

Step 2: Compute U(θ0)′I−1(θ0)U(θ0)


1- Multiply I−1(θ0) by U(θ0):

2- Compute the dot product of U(θ0)′ and the result:


Step 3: Compare R to the Chi-Squared Distribution Critical Value
● Degrees of freedom (d=2, since there are two parameters).
● At a 5% significance level, the critical value from χ2(2) is approximately 5.99

Since R=26.156>5.99, we reject H0

There is strong evidence to suggest that at least one of the drugs (A or B) has a
significant effect on cholesterol levels.
code
output
Table of contents

01 Delta Method 02 Likelihood ratio test

03 Likelihood function for


Randomly Censored Data
02 Likelihood ratio test (LRT)

The Likelihood Ratio Test (LRT) is a statistical


test used to compare two statistical models in
order to assess the goodness of fit of the data
to one model relative to another.
Reduced model:-This is the
simpler model, which includes
Purpose of the LRT:-
01
certain constraints with The number
of parameter is less than full model
(such as assuming that a
The primary purpose of this test is parameter equals zero).

to compare two models:-

Full model:- This is the more


02 complex model that includes all
parameters without any constraints.
Steps of LRT:- (rule for log likelihood It differs from one distribution to another here we
used rule log likelihood for exponential distribution)

1.Define the two models:-

- Null Hypothesis ( H₀): There is no difference between the reduced model and the full model.

- Alternative Hypothesis ( H₁): The full model is better than the reduced model.

2. Calculate Log-Hazard:-

- Reduced Model: l(reduced)= n . log(λ1) - λ1 . ∑Yi

- Full Model: l(full)=n . log(λ2) - λ2 . ∑Yi


3. Compute the LRT Statistic:-

LRT= -2 . ( l(reduced)-l(full) )

4. Calculate the critical value using chi-square distribution:-


- Determine Degrees of Freedom (df):
parameters in full model - parameters in reduced model
- state level of significance (α)

5. Decision:-

- If LRT > {critical value} , reject (H₀).


- If LRT <= {critical value} , fail to reject ( H₀).
Example:-

A study has been conducted to investigate the factors influencing the time until failure (in hours) of a
specific type of device. Data has been collected on two variables for each device:

Hours of Use (): The total number of hours the device has been used.
Device Age (): The age of the device, measured in years.

The response variable is Time Until Failure (), which represents the duration (in hours) until the device
fails.

Given the data provided below, your task is to assess whether including Device Age () as a predictor
variable significantly improves the model's ability to predict Time Until Failure (), compared to using
Hours of Use () alone. Perform a Likelihood Ratio Test at a significance level of alpha=0.05, λ1=0.06, to
determine whether the inclusion of Device Age adds predictive value to the model.
Solution 1. State the Hypotheses:
● Null Hypothesis (H₀):
Adding( Device Age) does not improve the model. This implies that the
rate parameter for the full model is not significantly different from the
rate parameter for the reduced model.

● Alternative Hypothesis (H₁):


Adding (Device Age) improves the model. This implies that the rate
parameter for the full model is significantly different from the rate
parameter for the reduced model.

● Let: -
- λ₁ be the rate parameter for the reduced model (which only
uses Hours of Use).
- λ₂ be the rate parameter for the full model (which uses both
Hours of Use and Device Age).
2. Reduced Model:-
In this model, only (Hours of Use ( X₁ )) is used as a predictor for Time Until Failure ( Y ):-

Y = X1

2.1 (λ1) for the Reduced Model and (λ1) are given :-

λ1= 0.06
n:no.of devices
∑Yi : sum for Hours of use values
2.2 Calculate the Log-Hazard for the Reduced Model:-
The log-Hazard for the reduced model is calculated using the formula: -

l(reduced)= n . log(λ1) - λ1 .∑Yi

Substituting the values:-

l(reduced)= 7 . log(0.06)- 0.06 . 175

Using (log(0.04) )= -1.221 :-

l(reduced)=7.(-1.221)- 0.06 . 175= -19.047


3.full Model:-
In this model, both Hours of Use (X₁) and Device Age (X₂) are used as predictors for Time
Until Failure:

Y=X1+X2
1)Sum of Y-values for the Full Model:-

The predicted Yi values for the full model are calculated as the sum of x1 and x2 so
Yi=[12,18,24,30,36,42,48]

The sum of these values is: ∑Yi=12+18+24+30+36+42+48=210

2) Calculate the Rate Parameter (λ2) for the Full Model:

We calculate λ2 using the formula:

λ2=n / ∑Yi=7 / 210 ≈ 0.0333


3)Calculate the Log-Hazard for the Full Model:

The log-Hazard for the full model is calculated as:

l(full)=n . log(λ2) - λ2 . ∑Yi

Substituting the values:-

l(full)= 7 . log(0.0333)−0.0333 . 210=−17.3704


4. Likelihood Ratio Test (LRT):-
The LRT statistic is calculated as:-

LRT= -2 . ( l(reduced)-l(full) )

Substitute the values:-

5.Decision Rule: LRT=-2⋅(−19.047−(−17.3704))=3.3532


Set the significance level (α) = 0.05. , df= parameters in full - parameters in reduced
The critical value for a chi-squared distribution with 1 degree of freedom
(df=2-1) at α=0.05 is 3.841.
Now, compare the LRT statistic with the critical value:-
LRT statistic = 3.3532
Critical value = 3.841
Since the LRT statistic (3.3532) is less than the critical value (3.841)
we fail to reject the null hypothesis.
Chi-square table
Code:-
Output:-
Table of contents

01 Delta Method 02 Likelihood ratio test

03 Likelihood function for


Randomly Censored Data
03
The Likelihood function for
Randomly Censored Data
A Quick Recap
• What is Censoring?
⚬ Censoring refers to cases where the exact time an event occurs is unknown.

Types
of
Censoring
Randomly Censored Data
Definition: Occurs when the censoring time is independent of the
survival time, This means that the reason for censoring is not
related to the event of interest.

Examples of Random Censoring:

• A patient drops out of a study for reasons unrelated to


their health (e.g., moving to a different city).
• patient’s data is lost due to unexpected equipment failure,
unrelated to the patient's health or treatment outcome.
Likelihood Functions for Different Censoring Types
Given survival data, the likelihood function is constructed based on both observed events
(uncensored data) and censored data, For a data set of n observations which are assumed
to be independent of each other
1. Right Censoring:

• General Form: (the censoring indicator)


indicates whether the data for
observation i is censored(1:
uncensored, 0: censored).

represents the
is the probability that the event
Parameters of the For uncensored data, Ti is the
has not occurred by time Ti,
statistical model event time
given the parameter θ.
P(T > t)
2. left Censoring:

is the probability that the event


• General Form:
occurs before Ti, given the
For uncensored data, Ti is the event time, parameter θ.
while for left-censored data P(T < t)

3.Interval Censoring:

• General Form:
upper bound
Lower bound

Note
Covariates: such as age and gender, can influence survival times and are modeled using the Cox
proportional hazards approach, as detailed in Chapter 4.
Total Likelihood Function for Mixed Data
• For a dataset with a mixture of left, right, and interval censoring, the likelihood
function combines all these components.
• General Formula:
Steps to Apply Likelihood Functions for
Randomly Censored Data

Identify Data and Form and Calculate the


Total Likelihood Function
Censoring Type

Set Up the Likelihood


Maximizing the
Function for Each
Likelihood
observation to estimate the
parameter
Example
• Suppose you're conducting a study on the survival times of patients undergoing a specific treatment,
and we assume that it follow exponential distribution, and you collect the following data:

PATIENT SURVIVAL TIME (T) Censoring Indicator (δ)

1 5 1 (Uncensored)

2 8 0 (Right Censored)

3 3 1 (Uncensored)

4 (5,7) 0 (Interval Censored)

5 2 0 (Left Censored)
Step2
Solution Set Up the Likelihood Function for
Each observation
Step3: Form and Calculate the Total Likelihood Function
Step4: Maximizing the Likelihood
Code: log likelihood in R
Output
Thanks! Team Work
Mariam Mansour
Norhan Mohamed
Mai Osama
Jilan Mohamed
Mariam Magdy
Aya Esmaeel
Pola Samuel

Helwan University, Faculty of science, Statistics & Cs Department

You might also like