Hi, Please use R code to solve the question. An example is above as well. Thanks
ID: 3074517 • Letter: H
Question
Hi, Please use R code to solve the question. An example is above as well. Thanks
2. Central Limit Theorem: If one rolls a dice 6 times, what is the probability that the sum of the numbers is less than 25? To answer this, you need to consider three approaches. In the first one, you need to consider an MC approach, in which you randomly generate numbers from a uniform distribution. In the second case, you need to compute the exact answer to this problem (not necessarily analytical). Note that the exact solution of this problem should consider all possible permutations in this experiment, i.e. 60 46,656. In the third case, you need to refer to the Central Limit Theorem (CLT) to approximate this probability. Hint: recall if Xi has an iid distribution with mean E(X) and variance V(X) for all i = 1,..,M. then according to CLT it follows that (10)Explanation / Answer
the required answers are
CASE 1 is 0.7961
CASE 2 is 0.7941
CASE 3 is 0.590399
REQUIRED R CODE IS:
n<-10000
# case 1
sum<-c()
for (i in 1:n)
{
sum<-c(sum,sum(sample(c(1:6),6,rep<-T)))
}
prob1<-sum(sum<25)/n
print(prob1)
# case 2
prob2<-c()
for (a in 1:6)
for (b in 1:6)
for (c in 1:6)
for (d in 1:6)
for (e in 1:6)
for (f in 1:6)
{
prob2<-c(prob2,sum(c(a,b,c,d,e,f)))
}
prob2<-mean(prob2<25)
print(prob2)
# case 3
x<-c(1:6)
m<-mean(x)
var<-(sum(x*x)/6)-(mean(x))^2
m<-m*6
var<-var*6
pnorm(25,m,var)
_____________________________-
AS THE ANSWER TO CASE 1 IS RANDOM IT WILL CHANGE SLIGHTLY ON EACH RUN OF THE CODE.
_____________________________________________
DON'T FORGET TO RATE THE ANSWER BY THUMBS UP TO SUPPORT MY WORK.
THANKS FOR ASKING THE PROBLEM .
CHEERS!
HAPPY CHEGGING!
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.