2025-10-20

Topic and Dataset

  • My statistics topic that I chose was interval estimation
  • My Dataset that I am using to represent this is with the Movies data set
## # A tibble: 6 × 24
##   title      year length budget rating votes    r1    r2    r3    r4    r5    r6
##   <chr>     <int>  <int>  <int>  <dbl> <int> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl>
## 1 $          1971    121     NA    6.4   348   4.5   4.5   4.5   4.5  14.5  24.5
## 2 $1000 a …  1939     71     NA    6      20   0    14.5   4.5  24.5  14.5  14.5
## 3 $21 a Da…  1941      7     NA    8.2     5   0     0     0     0     0    24.5
## 4 $40,000    1996     70     NA    8.2     6  14.5   0     0     0     0     0  
## 5 $50,000 …  1975     71     NA    3.4    17  24.5   4.5   0    14.5  14.5   4.5
## 6 $pent      2000     91     NA    4.3    45   4.5   4.5   4.5  14.5  14.5  14.5
## # ℹ 12 more variables: r7 <dbl>, r8 <dbl>, r9 <dbl>, r10 <dbl>, mpaa <chr>,
## #   Action <int>, Animation <int>, Comedy <int>, Drama <int>,
## #   Documentary <int>, Romance <int>, Short <int>

GGplot one

  • shows the average movie budgets have changed over time, shaded protion shows the 95% interval estimate

GGplot two

  • how movie ratings change across the year with 95% interval

Slide with Plotly

  • represents mean movie rating per year, the vertical bars represent the bars with 95% confidence

Confidence Interval Example (Movies Dataset)

Estimating the true average movie rating using a sample from the Movies dataset.

A 95% confidence interval for the population mean rating is:

\[ \bar{X} \pm t_{n-1,0.975} \cdot \frac{s}{\sqrt{n}} \]

Where: - \(\bar{X}\) = average movie rating from the sample
- \(s\) = sample standard deviation of ratings
- \(n\) = number of movies
- \(t_{n-1,0.975}\) = t-value for 95% confidence

This gives a range where the true average movie rating likely falls.

Interval Estimation (Movies Data)

In the plot Budget vs Year, there is 95% confidence band around the regression line.

The confidence interval for the predicted movie budget at a given year \(x\) is:

\[ \hat{y} \pm t_{n-2,0.975} \cdot SE(\hat{y}) \]

Where: - \(\hat{y}\) = predicted budget - \(SE(\hat{y})\) = standard error - \(t_{n-2,0.975}\) = t-value with \(n - 2\) degrees of freedom

R code with Movie Dataset

library(ggplot2)

movieBudget <- movies %>%
  filter(!is.na(budget), !is.na(year), budget > 0)


ggplot(movieBudget, aes(x = year, y = budget)) + 
  geom_smooth(method = "lm", se = TRUE, color = "pink") + 
  labs( 
    title = "Interval Estimation: 95% Confidence Interval 
    for Budget vs Year", 
    x = "Year", 
    y = "Movie Budget") + 
  theme_minimal()