Section 1

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

A.

mean_samp1= mean(samp1)

B.

samp2 = sample(popN, 10)
mean_samp2= mean(samp2)

These means are not the same.

C.

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)
}

D.

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.

E.

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.

f.

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.

g.

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.

h.

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.

i.

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.

j.

The Normal distributions are center around the mean of the distribution, while the exponential distributions are skewed slightly to the right.

Section 2

a.

i. Population is N (µ = −5, σ = 2.25); taking samples of size 25.
  • Sampling distribution: Approximately Normally distributed (n is large enough for CLT).
  • μXÌ„ (mean of the sampling distribution) = population mean = -5
  • σXÌ„ (stdev of the sampling distribution) = population standard deviation / √n σXÌ„ = 2.25 / √25 = 2.25 / 5 = 0.45
ii. Population is Poisson(λ = 6); taking samples of size 45.
  • Sampling distribution: Approximately Normally distributed (n is large enough for CLT).
  • μXÌ„ = population mean = λ = 6
  • σXÌ„ = √(population variance/n)=√(6/45)=0.6928
iii. Population is Erlang(n = 2, β = 3); taking samples of size 100.
  • Sampling distribution: Approximately Normally distributed (n is large enough for CLT).
  • μXÌ„ = population mean = n* β = 2*3 = 6
  • σXÌ„ = √(population variance/n)=√(2*3/100)=√(0.06)=0.2449
iv. Population is Binomial(n = 500, p = 0.65); taking samples of size 20.
  • Sampling distribution: Approximately Normally distributed (n is large enough for CLT).
  • μXÌ„ = population mean = n * p = 500*0.65 = 325
  • σXÌ„ = √(population variance / n) = √(500 * 0.65 * (1 - 0.65) / 20) ≈ 5.377

b.

i.

The sampling distribution of X̄ is approximately Normal(4, √(4/60)).

ii.
prob <- pnorm(4.5, mean = 4, sd = sqrt(4/60)) - pnorm(3, mean = 4, sd = sqrt(4/60))
print(prob)
## [1] 0.9735425
iii.
percentile_value <- qnorm(0.98, mean = 4, sd = sqrt(4/60))


print(percentile_value)
## [1] 4.530276

Section 3

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.