Due date: Wednesday, February 14
##Answer to Question 1##
Let \(T\) be a positive continuous random variable. Because \(T\) is assumed to be positive, its support is from \(0\) to \(\infty\) (as seen in integral below). We can write \(f(t)\), the probability density function, as:
\[\begin{align*} P(0 \leq T \leq \infty)&=\int_{0}^{\infty} f(t)dt \\ &=\int_{0}^{\infty}dF(t) \end{align*}\]
We know that \(F(t)=1-S(t)\). Therefore: \[\begin{align*} dF(t)&=d(1-S(t)) \\ &=d1-dS(t) \\ &=0-dS(t) \\ &=-dS(t) \end{align*}\] \[\therefore f(t)dt=-dS(t) \] Using substitution, we find that: \[ \int_{0}^{\infty}dF(t)=\int_{0}^{\infty}-dS(t) \] Now, we find the expected value of \(f(t)\) by multiplying the density by t: \[\begin{align*} E(T)&=\int_{0}^{\infty}tf(t)dt \\ &=\int_{0}^{\infty}-tdS(t) \end{align*}\]
We will now use integration by parts. Let \(u=-t\) and \(v=S(t)\). \[\begin{align*} \therefore E(T)&=\left[-tS(t)\right]_0^\infty - \int_{0}^{\infty}S(t)d(-t)\\ &=0+\int_{0}^{\infty}S(t)dt \end{align*}\] \[\therefore E[T]=\int_{0}^{\infty}S(t)dt\]
Question 1 suggests that the area under the survival curve can be interpreted as the expected survival time. Consider the following hypothetical data set with 10 death times (no censoring).
> dat <- c(43, 110, 113, 28, 73, 31, 89, 65, 66, 76)
##Answer to Question 2## ##Part a##
##Part b##
We can simply add the area of the rectangles under the survival curve to find the expected survival time for the hypothetical data set is 69.4 time units.
##Part a##
##Part B##
We first must derive the survivor function, as shown below:
\[ \begin{aligned} S(t) & =\exp \{-H(t)\} \\ & =\exp \left\{-\int_0^t h(t) d t\right\} \\ & =\exp \left\{-\int_0^t \frac{1}{10-x} d x\right\} \\ & =\exp \{-[-\ln (|x-10|)] \\ & =\exp \left\{\int_0^t[\ln (x-10 \mid)]\right. \\ & =\exp \{\ln (t-10 \mid)-\ln |0-10|\} \\ & =\exp \{\ln |t-10|-\ln 10\} \\ & =\exp \left\{\ln (10-t)-\ln 10\right\} \\ & =\exp \left\{\ln \left(\frac{10-t}{10}\right)\right\} \\ & =\frac{10-t}{10} \end{aligned} \] We now plot the survival function:
##Part A. Plot Hazard Function##
##Part B. Plot Survival Function##
obs, delta):> n <- 500
> set.seed(1); Time <- rexp(n, .15)
> summary(Time) ## Should coincide with the summary results on page 11
Min. 1st Qu. Median Mean 3rd Qu. Max.
0.01134 2.09635 4.76495 6.36739 8.61652 42.20856
> Cen <- runif(n, 0, 10)
> mean(Time > Cen) ## censoring rate (this should be 0.526)
[1] 0.526
> obs <- pmin(Time, Cen)
> delta <- 1 * (Time < Cen)