2026-03-03

Interval Estimation

Interval estimation is a statistical method where an interval made from sample data estimates a possible interval for the parameter of interest.

The estimation finds an interval that we would believe the parameter of the population would fall in. The probability the parameter falls in the interval is based on the confidence level of the interval.

The interval estimation for this presentation will use mean as our parameter of interest.

Margin of Error

The margin of error (MoE) consists of the critical z value that corresponds to the confidence level we are looking for. Because we know that the sample size is over 30, we use the z value. The value that the critical z value is being multiplied with is the standard error which is found by the standard deviation divided the square root of the sample size. Because we are looking for a confidence interval of 95%, the corresponding z value is 1.96 which we will be using in the example.

\[ MoE ~=~ z^* \times \frac {\sigma} {\sqrt{n}} \] \(z^*\) = critical z value

\(\sigma\) = standard deviation

\(n\) = sample size

Confidence Interval

The interval the interval estimation makes is called the confidence interval. The confidence interval determines the probability that the parameter of interest will fall in a certain interval. The interval is calculated with the sample statistic and the margin or error found from the previous equation.

Confidence Interval = \((\bar{x} - MoE~~,~ \bar{x} + MoE)\)

\(\bar{x}\) = sample mean

Dataset

The dataset used for this example of interval estimation is the chickwts dataset. The dataset lists the chick’s feed type and weight. We will also being finding a 95% confidence interval for this example.

weight feed
179 horsebean
160 horsebean
136 horsebean
227 horsebean
217 horsebean

Plotly Plot

GGPlot 1

GGPlot 2 with Confidence Interval

Code for plot with confidence interval

altered = chickwts %>% 
  group_by(feed) %>%
  summarise(n = n(), avg_wt = mean(weight), sd = sd(weight)) %>% 
  mutate(moe = 1.96*(sd/(sqrt(n)))) 

ggplot(altered) + geom_bar(aes(x = feed, y = avg_wt), 
  stat = 'identity') + 
  geom_errorbar(aes(x = feed, ymin = (avg_wt - moe), 
  ymax = (avg_wt+moe)), width = .4, color = 'darkblue') +
ggtitle('Weight vs Feed Type with 95% Confidence Interval')