Homework One. Due Sept. 9, 2009 1. Plot the hazard function h(t) for the following distributions on [0, \infty), and with parameter taking several values of your choice. [Try Weibull, Gamma, log-normal] 2. Use a 5 point pure discrete distribution F(t) to verify that: The inversion formula for discrete hazard: if we define cumulative hazard H(t) = as in class, then $ 1-F(t) = \prod_{s <= t} (1 - \Delta H(s) ) $. Given t1 < t2 < t3 < t4 < t5 and p1 > 0, p2 > 0, p3 > 0, p4 > 0, p5 > 0 with \sum p = 1 this defines a CDF F(t) = 0 for t < t1 p1 for t1 <= t < t2 p1+p2 for t2 <= t < t3 p1+p2+p3 for t3 <= t < t4 p1+p2+p3+p4 for t4 <= t < t5 1 for t5 <= t (a) find the H(t) for this F(t). (b) Use the product limit inversion formula to verify we can get F(t) back from this H(t). (c) What if we use the "wrong formula"? i.e. see how much the difference there is between 1- F(t) and exp( - H(t) ). 3. Suppose r.v. X has cumulative hazard H1(t); Y has cumulative hazard H2(t) and assume X and Y are independent. Suppose also that both X and Y are continuous. Show min(X,Y) has cumulative hazard H1(t) + H2(t). [what if they are discrete?] Homework 2 Due 9/21 1. For a continuous random variable X, with CDF F(x), we know that F(X) is a uniform (0,1) random variable. Again, assume X is any continuous random variable. Is there an (increasing) transform g( ) that can make g(X) distributed as exp(1)? (if YES, find such g( ) ) (hint: what is the CDF of the log of a uniform(0,1) r.v. ?) 2. Refer to the data set MYEL, it is the data set in the book "Survival Analysis Using SAS". It is the first data if you click the link on our course web page. Use SAS proc lifereg to fit a weibull distribution, modeling the "dur" (take into account the censoring status) but no covariate. (i.e. ignor "treat", "renal" etc.). Find the MLE and 90% confidence interval (Wald type) for lambda and beta [or some transformation of them], the two parameters of the weibull distribution. (We want their individual confidence intervals, and a joint confidence region). Use R to find the same confidence intervals via likelihood ratio test. Use R or SAS to find the joint confidence region via likelihood ratio test. Following are two R functions to calculate log lik extremeloglik2d <- function(time, status, mu, sigma) { sum(status*((time-mu)/sigma)) -log(sigma)*sum(status) - sum(exp((time -mu)/sigma)) } [corrected 9/21] weibullloglik <- function(time, status, lam, shape) { sum(status*log(lam^shape*shape*(time)^(shape-1))) - sum((lam*time)^shape) } The following is R-code to generate a contour plot > murange <- seq(from=4, to=12, by=0.1) > sigmarange <- seq( from =0.8, to = 7, by =0.1) > zmat <- matrix(NA, ncol=length(murange), nrow=length(sigmarange) ) > dim(zmat) [1] 63 81 > for(i in 1:63) { for(j in 1:81) zmat[i,j]<- extremeloglik2d(time=log(myelmat[,2]), status=myelmat[,3], mu=murange[j], sigma=sigmarange[i])} > > contour(x=murange, y=sigmarange, z=t(zmat), levels=c(-55,-51.008, -50.058, -48.71))