# All functions in this script are Core R (no package needed).

# Example - 95% CI for the Mean Dragon Wingspan, Population Known
########################################################################################

# 95% CI multiplier
qnorm(.975, mean=0, sd=1)   # qnorm(.025, mean=0, sd=1) gives -1.96

# Dragon Population
mu <- 7.34
sigma <- 2.23

# n=75 sample
xbar <- 6.96

# Standard Error of the Sampling Distribution
SE <- sigma/sqrt(75)
SE

# 95% Confidence Interval - Lower and Upper endpoints stored in a vector
c(xbar - 1.96*SE , xbar + 1.96*SE)


# Example - Multipliers for Common Confidence Levels
########################################################################################

qnorm(.95, mean=0, sd=1)    # 90% - left tail area .95 = 1 - .05
qnorm(.975, mean=0, sd=1)   # 95% - left tail area .975 = 1 - .025
qnorm(.995, mean=0, sd=1)   # 99% - left tail area .995 = 1 - .005
