# load packages
library(tidyverse)
library(tidymodels)
library(knitr)
library(kableExtra)
library(patchwork)
# set default theme in ggplot2
::theme_set(ggplot2::theme_bw()) ggplot2
Inference for regression
Announcements
Lab 03 due TODAY at 11:59pm
Click here to learn more about the Academic Resource Center
Statistics experience due Tuesday, April 22
Poll: Office hours availability
Topics
Understand statistical inference in the context of regression
Describe the assumptions for regression
Understand connection between distribution of residuals and inferential procedures
Conduct inference on a single coefficient
Computing setup
Data: NCAA Football expenditures
Today’s data come from Equity in Athletics Data Analysis and includes information about sports expenditures and revenues for colleges and universities in the United States. This data set was featured in a March 2022 Tidy Tuesday.
We will focus on the 2019 - 2020 season expenditures on football for institutions in the NCAA - Division 1 FBS. The variables are :
total_exp_m
: Total expenditures on football in the 2019 - 2020 academic year (in millions USD)enrollment_th
: Total student enrollment in the 2019 - 2020 academic year (in thousands)type
: institution type (Public or Private)
<- read_csv("data/ncaa-football-exp.csv") football
Univariate EDA
Bivariate EDA
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 |
For every additional 1,000 students, we expect an institution’s total expenditures on football to increase by $780,000, on average, holding institution type constant.
From sample to population
For every additional 1,000 students, we expect an institution’s total expenditures on football to increase by $780,000, on average, holding institution type constant.
. . .
- This estimate is valid for the single sample of 127 higher education institutions in the 2019 - 2020 academic year.
- But what if we’re not interested quantifying the relationship between student enrollment, institution type, and football expenditures for this single sample?
- What if we want to say something about the relationship between these variables for all colleges and universities with football programs and across different years?
Inference for regression
Statistical inference
Statistical inference provides methods and tools so we can use the single observed sample to make valid statements (inferences) about the population it comes from
For our inferences to be valid, the sample should be representative (ideally random) of the population we’re interested in
Inference for linear regression
Inference based on ANOVA
Hypothesis test for the statistical significance of the overall regression model
Hypothesis test for a subset of coefficients
Inference for a single coefficient
(today’s focus)Hypothesis test for a coefficient
Confidence interval for a coefficient
Linear regression model
. . .
We have discussed multiple ways to find the least squares estimates of
- None of these approaches depend on the distribution of
- None of these approaches depend on the distribution of
Now we will use statistical inference to draw conclusions about
that depend on particular assumptions about the distribution of
Linear regression model
such that the errors are independent and normally distributed.
. . .
- Independent: Knowing the error term for one observation doesn’t tell us about the error term for another observation
- Normally distributed: The distribution follows a particular mathematical model that is unimodal and symmetric
Describing random phenomena
There is some uncertainty in the error terms (and thus the response variable), so we use mathematical models to describe that uncertainty.
Some terminology:
Sample space: Set of all possible outcomes
Random variable: Function (mapping) from the sample space onto real numbers
Event: Subset of the sample space, i.e., a set of possible outcomes (possible values the random variable can take)
Probability density function: Mathematical function that produces probability of occurrences for events in the sample space for a continuous random variable
Distribution of error terms
The error terms follow a (multivariate) normal distribution with mean
Visualizing distribution of
Expected value
Let
. . .
Then
Expected value
Let
. . .
Expected value of the response
Show
Variance
Let
. . .
Then
Variance
Let
. . .
Variance of the response
Show
Linear transformation of normal random variable
Suppose
A linear transformation of
Explain why
Recap
Introduced statistical inference in the context of regression
Described the assumptions for regression
Connected the distribution of residuals and inferential procedures
Next class
Confidence intervals for
Hypothesis testing based on ANOVA