set.seed(227)
#generate a Normal population
popN = rnorm(1000, 2, .5)
hist(popN, main = "Population Distribution", col = "orange",
xlab = "Population Values")
samp1<- sample(popN,10)
samp1
## [1] 2.2575012 1.0999705 2.4816464 1.1459739 2.0370396 1.7974007 1.9254852
## [8] 2.2111885 1.5673064 0.9111571
mean_samp1= mean(samp1)
samp2 = sample(popN, 10)
mean_samp2= mean(samp2)
These means are not the same.
samp3 = sample(popN, 10)
mean_samp3 = mean(samp3)
All of the sample means are not the same.
samp.means10 = NULL
set.seed(227)
for(i in 1:1000){
samp = sample(popN, 10)
samp.means10[i] = mean(samp)
}
hist(samp.means10, main = "Sample Mean Distribution", col = "blue",
xlab = "Sample Means")
mean_10samps=mean(samp.means10)
std_10samps=sqrt(var(samp.means10))
The histogram is symmetric with a mean of 2 and a standard deviation of 0.16.
samp.means100 = NULL
set.seed(227)
for(i in 1:1000){
samp = sample(popN, 100)
samp.means100[i] = mean(samp)
}
hist(samp.means100, main = "Sample Mean Distribution", col = "aquamarine",
xlab = "Sample Means")
mean_samp100=mean(samp.means100)
The histogram is symmetric with a mean of 2 and a standard deviation of 0.05.
From the parent distribution, the 10 and 100 sample distributions become more and more normal and symmetric as the number of samples increases. The 100 distribution has a clearly more uniform curve on either side than the 10 sample distribution, just as the 10 sample is to the parent distribution.
Yes, it is plausible that they are normally distributed, as the Sampling distribution is the distributions of the means, which would make the total distribution of those means normal. If we were to increase the number of samples even further, the normal pattern would become more and more clear as that number increased.
The Law of Large Numbers makes sense because as the number of samples or observations increases, the mean of those samples will become closer and closer to the total mean of the parent population. Smaller sample sizes can have more variability, whereas with large quantities of samples, the outliers that account for that variability are overwhelmed and don’t count as much.
set.seed(112)
popE = rexp(1000, 0.5)
hist(popE, main = "Population Distribution", col = "skyblue")
samp.means10exp = NULL
set.seed(112)
for(i in 1:1000){
samp = sample(popE, 10)
samp.means10exp[i] = mean(samp)
}
mean10exp = mean(samp.means10exp)
hist(samp.means10exp, main = "Sample Mean Distribution Exponential",xlab = "Mean Values",
col = "purple")
samp.means100exp = NULL
set.seed(112)
for(i in 1:1000){
samp = sample(popE, 100)
samp.means100exp[i] = mean(samp)
}
mean100exp = mean(samp.means100exp)
hist(samp.means100exp, main = "Sample Mean Distribution Exponential",xlab = "Mean Values",
col = "pink")
The histogram of sample size 10 wouldn’t be considered normally distributed as it is skewed slightly right, with the slope of the graph being clearly higher on the left than on the right. However, the graph of the 100 samples is much closer to normal, and could be considered as such. It still has a slight right skew like the 10 sample graph, but is much less defined.
The Normal distributions are center around the mean of the distribution, while the exponential distributions are skewed slightly to the right.
The sampling distribution of X̄ is approximately Normal(4, √(4/60)).
prob <- pnorm(4.5, mean = 4, sd = sqrt(4/60)) - pnorm(3, mean = 4, sd = sqrt(4/60))
print(prob)
## [1] 0.9735425
percentile_value <- qnorm(0.98, mean = 4, sd = sqrt(4/60))
print(percentile_value)
## [1] 4.530276
p=.35
n1=15
n2=40
randBern = rbinom(1000,1,p)
samp_means_randBern_n1 = NULL
for(j in 1:1000){
samp_randBern_n1=sample(randBern,n1)
samp_means_randBern_n1[j] = mean(samp_randBern_n1)
}
hist(samp_means_randBern_n1, main = "Sample Mean Distribution", col = "red",
xlab = "Sample Means")
samp_means_randBern_n2 = NULL
for(k in 1:1000){
samp_randBern_n2=sample(randBern,n2)
samp_means_randBern_n2[k] = mean(samp_randBern_n2)
}
hist(samp_means_randBern_n2, main = "Sample Mean Distribution", col = "green",
xlab = "Sample Means")
In this simulation you can see that the sample with sample size 10 that does not meet the criteria has gaps in the distribution of the mean showing that it is not a normal distribution. However for the sample that does meet the sample size requirements it has a complete and normal distribution.