library(tidyverse)
library(tidymodels)
library(knitr)
<- read_csv("data/ncaa-football-exp.csv") football
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
<- lm(total_exp_m ~ enrollment_th + type, data = football)
exp_fit
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.
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?
# add code here
Next, let’s calculate \(\hat{\sigma}_\epsilon^2\) the estimate. Use \(\mathbf{y}\) and \(\mathbf{X}\) from the previous exercise to calculate this value.
## add code here
Now we’re ready to conduct the hypothesis test. State the null and alternative hypotheses in words and using mathematical notation.
. . .
Calculate \(SE(\beta_j)\), then use this value to calculate the test statistic for the hypothesis test.
## add code here
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: false
once you’ve filled in the code.
pt([test-statistic], [df], lower.tail = FALSE)
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! 🎉