I need to wite a code in r studio using markdown that does the following: 1. Sim
ID: 3326971 • Letter: I
Question
I need to wite a code in r studio using markdown that does the following: 1. Simulate m= 100 samples 2.vary sample sizes n=? , until finding the smallest size for which the conditions of central limit theorem are satisfied. 3. Confirm choice of n by replicating my analysis no less than ten times. 4. Justify selection using probability plots, hypothesis test and descriptive statistics.I need to do this for the following probability distribution : rpois(lamda=4) I need to wite a code in r studio using markdown that does the following: 1. Simulate m= 100 samples 2.vary sample sizes n=? , until finding the smallest size for which the conditions of central limit theorem are satisfied. 3. Confirm choice of n by replicating my analysis no less than ten times. 4. Justify selection using probability plots, hypothesis test and descriptive statistics.
I need to do this for the following probability distribution : rpois(lamda=4) 1. Simulate m= 100 samples 2.vary sample sizes n=? , until finding the smallest size for which the conditions of central limit theorem are satisfied. 3. Confirm choice of n by replicating my analysis no less than ten times. 4. Justify selection using probability plots, hypothesis test and descriptive statistics.
I need to do this for the following probability distribution : rpois(lamda=4)
Explanation / Answer
rm(list=ls(all=TRUE))
m=1000
n=c(10,20,30,40,50,60,70,80,90,100,200,500,1000)
xx=list();nn=c();v=c();n1=c();v1=c();
for ( j in 1:length(n)){
for ( i in 1:1000){
xx[[i]]=rpois(n[j], 4)
nn[i]=mean(xx[[i]])
v[i]=var(xx[[i]])
}
n1[j]=mean(nn[i])
v1[j]=mean(v[i])
}
n1
v1
n1
[1] 4.000000 4.450000 3.833333 3.525000 3.800000 3.800000 3.842857 3.975000
[9] 4.188889 3.900000 4.120000 3.998000 3.998000
> v1
[1] 2.222222 5.628947 3.867816 4.050641 4.122449 4.467797 3.844513 3.315823
[9] 3.660549 3.282828 3.834774 4.110216 4.024020