Scroll down
Technical: 95% of samples of size \(n\) will produce a 95% CI that contains the true population parameter value
Simpler: we are 95% confident that the true population parameter value lies in our interval
Before we took quantiles from the Bootstrap Distribution.
This time we will take quantiles from the Sampling Distribution estimated via CLT.
qnorm(0.025, mu, sigma)
qnorm(0.975, mu, sigma)
Standard normal distribution
Scroll down
ci_lower <- qnorm(0.025, phat, sqrt(phat*(1-phat)/n))
ci_upper <- qnorm(0.975, phat, sqrt(phat*(1-phat)/n))
Scroll down
\[ \text{CI}\left(p, 1-\alpha\right) = \widehat{p}\pm z^*_{(1+C)/2}\sqrt{\frac{\widehat{p}(1-\widehat{p})}{n}} \]
\(1-\alpha\) represents the confidence level
\(z^*_{(1+C)/2}\): is the right quantile for the Normal distribution;
qnorm(0.975)
\(\sqrt{\frac{\widehat{p}(1-\widehat{p})}{n}}\) is the estimated std. error;
\(z^*_{(1+C)/2}\sqrt{\frac{\widehat{p}(1-\widehat{p})}{n}}\) is called Margin of Error;
sample_students
.Scroll down
\[ \text{CI}\left(\theta, 1-\alpha\right) = \widehat{\theta}\pm q^*_{(1+C)/2}\widehat{SE}(\widehat{\theta}) \]
\(\theta\) is a generic parameter (e.g., proportion, mean, difference in prop, difference in means);
\(q^*_{(1+C)/2}\): is the right quantile of the sampling distribution of \(\hat{\theta}\);
\(\widehat{SE}(\widehat{\theta})\) is the estimated std. error;
Scroll down
Scroll down
\[ \text{CI}\left(\mu, 1-\alpha\right) = \bar{X}\pm t^*_{n-1, (1+C)/2}\frac{S}{\sqrt{n}} \]
qt((1+C)/2, n - 1)
.penguins_clean
.\[\color{red}{\widehat{p}_1} - \color{blue}{\widehat{p}_2} \pm z^*_{(1+C)/2} \times \sqrt{ \color{red}{\frac{\widehat{p}_1(1-\widehat{p}_1)}{n_1}} + \color{blue}{\frac{\widehat{p}_2(1-\widehat{p}_2)}{n_2}}}\]
Is the proportion of Adelie penguins with more than 4000g the same as Chinstrap penguins?
Let’s calculate the 90% CI for the difference in proportions (Adelie - Chinstrap)!
Is the body_mass_g
of Adelie penguins the same as that of Chinstrap penguins?
Let’s calculate the 95% CI for the difference in means (Adelie - Chinstrap)!
Scroll down
Can calculate CIs for population parameters as:
worksheet_05
We are here to help!
© 2024 Rodolfo Lourenzutti, Melissa Lee, Marie Auger-Méthé – Material Licensed under CC By-SA 4.0