Problem: Cox-regression in R for pneumonia data
Eksempel
Problem
At an intensive care unit at a hospital one is interested in whether the presence or no presence of pneumonia for a patient at admission has an impact on the length of the hospital stay, \(T\), i.e. time from entry to discharge from the hospital unit. Below are times (in days) to discharge from the hospital for 8 patients without pneumonia at admission (\(x = 0\)), and 7 patients with pneumonia at admission (\(x = 1\)).
- No pneumonia at admission: 2, 3*, 6, 6, 10, 11, 12*, 23
- Pneumonia at admission: 4*, 9, 12*, 17, 24, 26*, 32
Here * means a right censored observation, and right censoring occurred if a patient was still in hospital at the end of the study or if a patient died in hospital. It was decided to analyse the data by a Cox regression model with the single covariate \(x\) defined above, representing the status of pneumonia at admission.
(a)
Write down an expression for the hazard function of a patient with pneumonia status \(x\).
(b)
Write down an expression for the partial likelihood and use R to plot the partial likelihood as a function of \(\beta\). Note: you may load the data into R by the command
(c)
Estimate \(\beta\) using R (see commands below). Note the tied events at time 6. The simplest approach here is to use Breslow’s approximation, which considers multiple event times as different events with the same risk set. Thus, each failure at a certain tied time produces a factor in the partial likelihood, with all having the same risk set (i.e. using the same denominator in the factors). You will have to write method=”breslow” (see below), since the default method in R is slightly different (method=”efron”) You may use the following R commands:
(d)
Is there a significant difference between the discharge times for patients without and with pneumonia? Formulate the question as a testing problem regarding \(\beta\) and derive the conclusion with the significance level \(5\%\).
Compute the estimate of the relative risk of a patient without pneumonia compared to a patient with pneumonia. What is the practical interpretation of this number in the current situation?
(e)
Discuss the difference between the test for \(H_0: \beta = 0\) as considered above, and a logrank test for the equality of the hazard functions of the two groups (with and without pneumonia at admission).
Perform the logrank test by hand using the given data. Hint: the computed expected number of discharges under the null hypothesis should be 3.20 and 6.80 for the patients without and with pneumonia at admission, respectively.
(f)
Perform the logrank test also by using R, for example using the command
How does the conclusion of the logrank test fit with the conclusion of the corresponding problem in (d)?