R statistics Survival

The survival times (in years) of female breast cancer patients after mastectomy are given in Survival. txt.
For 1 < i < n, let Xi, the survival time of the ith patient, follow a Log-Normal distribution, i.e. Xi ~ IN(N, 02). We are interested in estimating & = eH+0?/2, the expected lifetime of female breast cancer patients after mastectomy. Suppose also that we have the following prior distributions for u and T(4) ~ N(a0,1/ w0), -2|10) ~ Exp(No) where u and o-2 (and thus g?) are assumed to be apriori independent and ao and wo are assumed to be known hyperparameters. A is unknown so a Gamma(Bo, v0 hyperprior, with both ßo and yo known, is also assumed. 1. Denote Yi = log (Xi). Write down the likelihood function L(u, 02 y) and use it to find the conditional posterior distributions of mo?, 10, y; g2 u, 10, y and do 4, 02, y, where y are the log-transformed survival time data. 2. Write a Gibbs sampler program to obtain samples from the joint distribution of (u, o2). 3. Apply the Gibbs sampler to the 100 observations from x in Survival. txt. Obtain the Monte Carlo estimate of » (with standard deviation) through your Gibbs sample. Now, suppose that some of the survival times are missing due to right censoring (this can happen if pa- tients survive beyond the length of a study). Then we can rearrange the data as 21, ., I'm, 25419. where af = c (e is the censoring time). Similarly, y = (Y1, ..., Um, Um+1%..-, UM), where y = log(c). The amended data, including censored survival times, can be found in Survivalcensored.txt. 4. Let 2 = (am+1,..., En) represent the true but unobserved values of ym+1%..-, un. Write down the likelihood function L(4, 2 w*) based on the augmented data w* = (y,2) and use it to find the conditional posterior distributions of ,02, An, W*: 024, 10, w* and 10 1, 02, w* 5. Give an expression (up to proportionality) for T(Zil4,0?,y,2;-) and hence deduce the distribution of zilM, 02, y, zi- , where zi_ ., Zi-1.2it1. 6. Write a data augmentation Gibbs sampler program to obtain samples from the joint distribution of (u. 02).