Question
R programming question

a) Do in R OR by hand
b) Do using R only. Don’t forget confidence interval.

. The commute time between LPC and Loop campus is X+ Y, where X is the time in minutes to wait for train and Y is the time in
0 0
Add a comment Improve this question Transcribed image text
Answer #1

(a) Construct two dummy independent random variables U and V such that

P(U=0)=.4 and P(U=1)=.6 and V~Exponential(mean=5). Then for x>0,

P(UV<=x)=P(UV<=x,U=0)+P(UV<=x,U=1)=P(U=0)+P(V<=x,U=1)

=.4+(1-exp(-x/5))*.6

=1-.6 exp(-x/5).

And, for x=0, P(UV<=0)=P(U=0)=.4. Hence X has the same distribution as the product UV.

Then E(X+Y)=E(UV)+E(Y)=E(U)E(V)+E(Y)=.6*5+20=23 (as E(U)=.6 and E(Y)=20).

(b)  ## For the 99% CI, we have constructed a normal approximation based CI.

R Program

nsim=1000
s=numeric(nsim)
for(i in 1:nsim)
{
u=rbinom(1,1,.6)
v=rexp(1,rate=1/5)
x=u*v
y=rnorm(1,20,5)
s[i]=x+y
}
mu.hat=mean(s)
lcl=mean(s)+sd(s)*qnorm(.005)/sqrt(nsim)
ucl=mean(s)-sd(s)*qnorm(.005)/sqrt(nsim)
# Monte Carlo estimate
mu.hat
#99% Confidence interval of mu
lcl
ucl

R Output

> # Monte Carlo estimate
> mu.hat
[1] 22.99667
> #99% Confidence interval of mu
> lcl
[1] 22.82015
> ucl
[1] 23.17318

For any query, comment.

Add a comment
Know the answer?
Add Answer to:
R programming question a) Do in R OR by hand b) Do using R only. Don’t forget confidence interval. . The commute t...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Answers only is okay! Construct the indicated confidence interval for the population mean μ using the​...

    Answers only is okay! Construct the indicated confidence interval for the population mean μ using the​ t-distribution. Assume the population is normally distributed. c=0.99​, x=13.1​, s=3.0​, n= 6 Construct the indicated confidence interval for the population mean μ using the​ t-distribution. Assume the population is normally distributed. c=0.95​, x=14.5​, s=0.55​, n= 15 Use the given confidence interval to find the margin of error and the sample mean. (12.7​,19.9​The sample mean is In a random sample of 18 people, the mean...

  • Question 5-7 2 Gamma waiting times (frequentist) Suppose we model a sample of times between arrivals...

    Question 5-7 2 Gamma waiting times (frequentist) Suppose we model a sample of times between arrivals of the 1 train of the New York City subway at the 116th Street station, y1, . . . , Yn, as IID random variables Y1, ... , Yn sampled from a Gam(v, 1) distribution, for some unknown v and X. 1. What is the joint log-likelihood, In fy ...Y|0,1(91, ... , Yn | v, 4)? [5 mark(s)] 2. For a fixed value of...

  • QUESTION 2 Following scatter plot represents a sample of paired X and Y values. Which of...

    QUESTION 2 Following scatter plot represents a sample of paired X and Y values. Which of the listed values of the linear correlation coefficient r is most likely to represent the given scater plor? r= -0.711 r= 0.667 r= 0.099 r= -0.018 and submit. Click SSare All Anscers to suce all ansers 13 14 Find the 99% confidence interval for the mean time it takes for conducting a job interview for a position of a retail associate in a supermarket...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT