Question

Please answer in RStudio

2. Complete **Exercise 6.72** of the text. Assess your results by simulation as follows. Reset your random number seed to 4302019, then (a) simulate 10000 realizations of the minimum of two Uniform(0,1) random variables Cuse runif in R, (b) plot their histogram, (c) add the theoretical probability density function that you derived in 6.72(a) to your histogram, (d) compute the empirical mean and variance of the minimum order statistic from your simulation. Finally, compare the theoretical values of SE(U_1)s and SV(U 1)S that you computed in 6.72(b) to your simulation values from

0 0
Add a comment Improve this question Transcribed image text
Answer #1

REQUIRED CODE

set.seed(4302019)
#part a)
a<-runif(1000)
b<-runif(1000)
x<-c()
for(i in 1:1000)
x<-c(x,min(runif(2)))
#part B)
hist(x,breaks = 10)
#part c) HERE CORRECT DENSITY IS 2*(1-X)
d<-c(0:50)/50
e<-2*(1-d)
hist(x,breaks = 10,probability = TRUE)
lines(d,e)
#part d)
mean_min<-mean(x)
var_min<-var(x)
print(mean_min)
print(var_min)
#theoritical mean is 0.33
#theoritical variance is 0.056

______________________________________

R CODE OUTPUT

> source('~/.active-rstudio-document', echo=TRUE)

> set.seed(4302019)

> #part a)
> a<-runif(1000)

> b<-runif(1000)

> x<-c()

> for(i in 1:1000)
+ x<-c(x,min(runif(2)))

> #part B)
> hist(x,breaks = 10)

> #part c) HERE CORRECT DENSITY IS 2*(1-X)
> d<-c(0:50)/50

> e<-2*(1-d)

> hist(x,breaks = 10,probability = TRUE)

> lines(d,e)

> #part d)
> mean_min<-mean(x)

> var_min<-var(x)

> print(mean_min)
[1] 0.3405045

> print(var_min)
[1] 0.06019336

> #theoritical mean is 0.33
> #theoritical variance is 0.056

Add a comment
Know the answer?
Add Answer to:
Please answer in RStudio 2. Complete **Exercise 6.72** of the text. Assess your results by simulation...
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
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