Imagine a population of paper clips of varying size. Are the following true?
\(\frac{ \bar{X} - \mu }{\frac{\sigma}{\sqrt{n}}} \sim \mathcal{Z}\)
\(\frac{ \bar{X} - \mu }{\frac{s}{\sqrt{n}}} \sim \mathcal{Z}\) ?????
population <-rnorm(100000,5,2)
len <- 1000000
n <- 5
x <- vector(mode="numeric", length = len)
i <- 1
for( i in 1:len) {
x[i] <-( mean(sample(population,n)) - 5 ) / (2 / sqrt(n))
}
hist(x)

How can we tell if this is the Z distribution?
quantile(x,.975)
## 97.5%
## 1.9551
Now the realistic situation when we do not know the population standard deviation.
#population <-rnorm(10000,5,2)
len <- 1000000
#n <- 5
y <- vector(mode="numeric", length = len)
j <- 1
for( j in 1:len) {
data <- sample(population,n)
y[j] <-( mean(data) - 5 ) / (sd(data) / sqrt(n))
}
hist(y)

How can we tell if this is the Z distribution?
quantile(y,.975)
## 97.5%
## 2.757499