Lesson 4
The t Distribution in Regression
Big question
Why do regression tests use t instead of z?
Lesson progress
Complete checkpoints as you learn
Learning objectives
- Explain the t distribution in regression in plain language.
- Use t statistic correctly in an interpretation.
- Connect the lesson idea to a formula, graph, Python result, or real example.
Simple explanation
Because the error variance is estimated, a standardized coefficient follows a t distribution with residual degrees of freedom.
Key terms
- t statistic
- An estimate minus a hypothesized value divided by its standard error.
- significance level
- The chosen probability of rejecting a true null hypothesis.
- standard error
- The estimated sampling standard deviation of an estimator.
Core formula
Use plain-language interpretation before algebra.
Example
WAGE1 gives students a real-data setting for the t distribution in regression. The lesson emphasizes inference mechanics and interpretation, not memorized output.
Interactive visual
TDistributionExplorer
Original Module 4 visual for The t Distribution in Regression.
y variable
wage
The dependent variable. It is the outcome students want to explain.
x variable
education
The explanatory variable. It is used to describe changes in wage.
Live Python
The t Distribution in Regression Python example
The t Distribution in Regression Python example
Stdout
Run Python to see results here.
Status / stderr
Ready to run Python in your browser.
Line-by-line guide
- Line 1Load a Python library needed for data work or regression.
- Line 2Load a Python library needed for data work or regression.
- Line 3Load a Python library needed for data work or regression.
- Line 4Load a Python library needed for data work or regression.
- Line 6Create or update a Python object used in the analysis.
- Line 7Create or update a Python object used in the analysis.
- Line 8Run this Python instruction as part of the lesson workflow.
- Line 9Run this Python instruction as part of the lesson workflow.
- Line 10Create or update a Python object used in the analysis.
- Line 11Create or update a Python object used in the analysis.
- Line 12Create or update a Python object used in the analysis.
- Line 13Add an intercept column to the regression design matrix.
- Line 14Create or update a Python object used in the analysis.
- Line 15Display a result so students can inspect the output.
- Line 16Create or update a Python object used in the analysis.
- Line 17Run this Python instruction as part of the lesson workflow.
Python walkthrough
- 1Set a reproducible random seed for the simulation.
- 2Generate many samples so the repeated-sampling pattern is visible.
- 3Estimate the model in each sample.
- 4Plot or summarize the distribution of estimates or test statistics.
Live notebook
Run this lesson as a notebook
Open an editable notebook cell-by-cell, run Python in the browser, and download the `.ipynb` file for later.
Related dataset
WAGE1
Estimated time
25 to 40 min
Packages
pandas, numpy, statsmodels, patsy
Expected output
A regression or inference table with coefficients, uncertainty, and short interpretation notes.
Learning goals
- Load and inspect WAGE1.
- Run the Python cells connected to Testing a Single Coefficient Against Zero.
- Interpret the output using t tests and WAGE1.
Common errors
- File not found: check that WAGE1.DTA is installed or use the course data folder.
- Package import error: use the browser notebook first, then download for local Jupyter if your local packages differ.
- Column name error: compare your variable names with the dataset variables listed for this notebook.
Dataset path helper
import pandas as pd
df = pd.read_stata("/data/WAGE1.DTA")
df.head()Interactive activity
TDistributionExplorer
Explore degrees of freedom
Move the degrees of freedom and watch critical values change.
Inputs
Try it yourself
Write one plain-English sentence explaining the main idea from this lesson.
Common mistakes
Check these before you move on.
A regression coefficient describes a pattern unless the assumptions or research design support a causal interpretation.
Quick quiz
What is the safest inference focus in The t Distribution in Regression?
Quick quiz
Which reporting habit is most important in The t Distribution in Regression?
Quick quiz
Why is MEAP93 a reasonable practice dataset here?
Key takeaway
The t Distribution in Regression turns regression output into evidence only when the hypothesis, assumptions, and magnitude are stated clearly.