library(tidyverse)
library(tidymodels)
library(knitr)
football <- read_csv("data/ncaa-football-exp.csv")AE 03: Inference
NCAA Football Expenditures
Go to the course GitHub organization and locate your ae-03 repo to get started.
Render, commit, and push your responses to GitHub by the end of class to submit your AE.
Set up
Data
Regression model
exp_fit <- lm(total_exp_m ~ enrollment_th + type, data = football)
tidy(exp_fit)|>
kable(digits = 3)| term | estimate | std.error | statistic | p.value |
|---|---|---|---|---|
| (Intercept) | 19.332 | 2.984 | 6.478 | 0 |
| enrollment_th | 0.780 | 0.110 | 7.074 | 0 |
| typePublic | -13.226 | 3.153 | -4.195 | 0 |
Hypothesis test
We want to conduct a hypothesis test to determine if there is a linear relationship between enrollment and football expenditures after accounting for institution type.
We’ll start by getting estimates for statistics we’ll need for inference.
Exercise 1
We will use the vector of responses \(\mathbf{y}\) and the design matrix \(\mathbf{X}\) to calculate the values needed for inference.
Get \(\mathbf{y}\) and \(\mathbf{X}\) from the football data frame. What are their dimensions?
Exercise 2
Next, let’s calculate \(\hat{\sigma}_\epsilon^2\) the estimated regression standard error. Use \(\mathbf{y}\) and \(\mathbf{X}\) from the previous exercise to calculate this value.
Exercise 3
Now we’re ready to conduct the hypothesis test between enrollment and football expenditures. State the null and alternative hypotheses in words and using mathematical notation.
Exercise 4
Calculate \(SE(\hat{\beta}_j)\), then use this value to calculate the test statistic for the hypothesis test.
Exercise 5
Now we need to calculate p-value to help make our final conclusion.
State the distribution used to calculate the p-value.
Fill in the code below to calculate the p-value. Remove
#| eval: falseonce you’ve filled in the code.
2 * pt([test-statistic], [df], lower.tail = FALSE)Exercise 6
State your conclusion in the context of the data. Use a threshold of \(\alpha = 0.05\).
To submit the AE:
Render the document to produce the PDF with all of your work from today’s class.
Push all your work to your AE repo on GitHub. You’re done! 🎉