library(tidyverse)   # Only needed for the plot below

# Example - Theory-Based Sampling Distribution for Samples of 75 Dragons
########################################################################################

# CLT: SE = sigma/sqrt(n), using the population standard deviation 2.23
SE <- 2.23/sqrt(75)
SE

# Plot of the N(7.34,(.257)^2) Sampling Distribution
x_axis <- tibble(
  xlim = c(6, 8.7)
)
ggplot(x_axis , aes(x = xlim)) +
  stat_function(fun = dnorm, args = list(mean = 7.34, sd = .257)) +
  labs(x = "Sample Means", y = "Density")


# Example - Probability that a Sample Mean is Between 6.96 and 7.72
########################################################################################

# tail area to the left of 7.72 - tail area to the left of 6.96
pnorm(7.72, mean=7.34, sd=.257) -  pnorm(6.96, mean=7.34, sd=.257)
# 1 - twice the tail area to the left of 6.96
1 - 2 * pnorm(6.96, mean=7.34, sd=.257)


# Example - Size of a Sampling Space
########################################################################################

choose(100, 25)    # Distinct subsets of size 25 from 100 objects
