, , ,

[SOLVED] Statistics 215b assignment 2

$25

File Name: Statistics_215b_assignment_2.zip
File Size: 263.76 KB

5/5 - (1 vote)

Define the hazard function for any disease as
H.t/ D
f .t/
1 F .t/
where F .t / and f .t / are the distribution function and density, respectively, for the time to first
onset. Thus
H.t/ D lim
!0
1

P.Get disease during time t to t C  j Never had disease up to time t/
What is the hazard function if time to first onset is modelled with the exponential distribution? Is
this a reasonable model? Explain.

One alternative is to use the Weibull distribution, which has cumulative distribution function
G˛;ˇ .u/ D 1 exp˚
.u=˛/
ˇ

; u > 0; ˛ > 0; ˇ > 0:
What is the hazard function if time to failure has distribution G˛;ˇ ?

Survival curves
Consider the following stylized model of a study to test the effectiveness of a new surgical
procedure. One thousand individuals are enrolled into the study, half receiving the surgery and
half serving as the control group—no surgery. The time to death by any cause is measured in
years, up to a maximum of five years, at which time the study ends.

The ith participant in the study carries two random values: time to death if assigned to receive
the surgery, Xi
, and time to death if assigned to the control group, Yi
. Assume that f.Xi
; Yi/ W
i D 1; 2 : : : ; Ng are drawn independently with Xi and Yi having distributions G3;2 and G2;2,
respectively, as defined in part one.
Two survival functions can be defined as
SX .t/ D P.Individual i lives past time t j Individual i receives surgery/ D P.Xi > t/
and
SY .t/ D P.Individual i lives past time t j Individual i is in control group/ D P.Yi > t/:
1. Write an R function to simulate draws of a G˛;ˇ random variable. Your function should take
as input a sample size n as well as ˛ and ˇ. It should return a length-n vector of independent
realizations of G˛;ˇ . Your function must not use any of R’s random sampling routines apart
from runif.
2. Write an R function that creates a Kaplan-Meier survival-function estimate. The input is
two length-n vectors. The first contains event times. The second vector, parallel to the first,
contains logical values: TRUE for observed deaths, FALSE for censoring events. The return
value should be the estimated survival function: an R function which, when evaluated at t,
returns the Kaplan-Meier estimate of surviving past t. Your function must not use anything
from the survival package or any similar package: the requirement is for you to build a
Kaplan-Meier estimate “from scratch”. If you are in any doubt about whether a supporting
function is permissible, check with the course staff.

3. Simulate the performance of the clinical trial by drawing a sample of 500 failure times from
G3;2 and 500 from G2;2. Estimate SX and SY using Kaplan-Meier. Graphically compare
these estimates to the true curves. (Recall that the study has a length of five years.) Note: do
not be surprised by low survival rates at the five-year horizon. The people in this study are
very sick.

4. The simulation in (3) did not include the possibility of censoring. Assume that for individual i there is another random variable, denoted Zi
, that gives the time at which i will be
censored—if he lives that long. Consider the case when the Zi are i.i.d. exponential random
variables with mean 10, chosen independently of Xi and Yi
. Simulate censoring times under
this scenario and create new Kaplan-Meier survival curves. Compare these with the true
survival curves.

5. Repeat the previous exercise, but now suppose the Zi are independent exponential random
variables whose mean depends on the individual’s time of death. If the time of death is less
than two years, the mean of the distribution of Zi
is 10; otherwise, the mean is 5. This could
arise in a study where the sicker patients are more likely to remain under the care of their
doctors. Discuss the results. What is the key difference between this censoring scenario and
the previous one?

Shopping Cart

No products in the cart.

No products in the cart.

[SOLVED] Statistics 215b assignment 2
$25