Question: Answer question 1 below. Let Y > 0 be a continuous random variable representing time from regimen start to bone-marrow transplant. Everyone does not survive

Answer question 1 below.

Let Y > 0 be a continuous random variable representing time from regimen start to bone-marrow transplant. Everyone does not survive long enough to get the transplant. Let X > 0 be a continuous random variable representing time from regimen start to death. We can assume X Y and model time to death as X Exp(rate = ) and time to transplant as Y Exp(rate = ). Where Exp(rate = ) denotes the exponential distribution with density f(z | ) = ez for z > 0 and 0 elsewhere - with > 0.

1. ) Assume that we have = 1/10 and = 1/15. Use the rexp() function in R for i = 1, 2, . . . , 10000 in simulating death and transplant times for 10,000 patients Xi Exp(1/10) and Yi Exp(1/15). Show R code in your answer.

What is the proportion of simulated patients who receive transplant before death?

The code should be similar in similar form to the code below, but using the rexp function instead of rbinom and gamma

set.seed(1)

x = rbinom( n = 1000, size = 1, prob = .5 )

y = x*rgamma(1000, 5, 1)

hist(y, breaks = 10, freq=F, col='white',

main='Marginal Distribution of Y, f(y)')

marginal_density = function(x){

.5*( x == 0) + .5*dgamma(x, 5, 1)

}

curve(dgamma(x, 5, 1), add=T, col='red', lwd=2)

curve(marginal_density(x), add=T, col='blue', lwd=2)

legend('topright', col = c('red', 'blue'),

bty='n', lty=c(1,1), lwd=c(2,2),

legend = c('Gamma Density', 'Mixture Gamma Density'))

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Mathematics Questions!