Using R or Rstudio, 1. The command X=rbinom(1000,5,0.7) generates a sample of si
ID: 3241696 • Letter: U
Question
Using R or Rstudio,
1. The command X=rbinom(1000,5,0.7) generates a sample of size 1000 from the Bin(5,0.7) distribution.
(a) Try mean(X).
i. Give the outcome.
ii. What you achieved in part (i) is an empirical outcome. Find the value that this empirical outcome is supposed to get close to. Find the value without using any computer or calculator.
iii. Explain what you observed in part (i) and (ii) .
(b) The command table(X)/1000 will return the proportions of 0, . . . , 5 in your sample.
i. Give the outcome.
ii. What you achieved in part (i) is an empirical outcome. Use one line of R command to achieve what this empirical outcome is supposed to get close to.
iii. Explain what you would do if you want to make the outcome in part (i) get further closer to the outcome in part (ii)?
Explanation / Answer
X=rbinom(1000,5,0.7)
X
mean(X)
#1.a)i)
#The uocome is : 3.49
#ii)
#the value that this empirical outcome is supposed to get close to = 5*0.7=3.5
#as, formula for Binomial Mean is n*p . here n=5, p=0.7
#iii)The aboslute error is :3.5-3.49=.01
#b
table(X)/1000
#i ) outcome :
# 0 1 2 3 4 5
# 0.003 0.036 0.120 0.307 0.377 0.157
#ii)
#what this empirical outcome is supposed to get close to
#r code:
for(i in 0:5)
{
f= choose(5,i)*(0.7)^i*((0.3)^(5-i))
print(f)
}
#outcome
0 0.00243
1 0.02835
2 0.1323
3 0.3087
4 0.36015
5 0.16807
#iii)
#Instead of 1000 samples i'd take even more samples.
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.