Inference for Regression - Complete Interactive Lesson
Part 1: Regression Model Assumptions
📐 Inference for Linear Regression
Part 1 of 7 — Regression Model Assumptions
The Population Regression Model
where — errors are normally distributed with constant spread.
| Symbol | Meaning |
|---|---|
| Population -intercept | |
| Population slope | |
| Sample -intercept (estimate of ) | |
| Sample slope (estimate of ) |
Conditions for Inference (LINE)
| Condition | Check |
|---|---|
| Linear | Scatterplot and residual plot show no pattern |
| Independent | Observations are independent ( of population) |
| Normal | Residuals are approximately normal (histogram or Q-Q plot) |
| Equal variance | Residual plot shows constant spread (no fanning) |
🔑 The residual plot is the most important diagnostic tool. Look for random scatter around zero.
Regression Assumptions 🎯
Part 2: T-Test for Slope
📊 T-Test for Slope
Part 2 of 7 — Is There a Linear Relationship?
Topics in This Part
| Section |
|---|
| 🎯 Hypotheses for the Slope |
| 📐 The -Statistic for |
| ✅ Conditions for Inference |
| 📝 Worked Example |
🔑 Key Concept: The -test for slope tests whether the true population slope is zero (no linear relationship) or nonzero.
The Linear Regression Model
The population model is:
where (errors are independent and Normally distributed with constant variance).
- = true population slope
- = sample slope (our estimate of )
- = standard error of the slope
Hypotheses
⚠️ AP Tip: Most AP problems use the two-sided alternative . One-sided tests are less common but do appear.
The Test Statistic
with (two parameters estimated: and ).
Conditions (LINE)
| Letter | Condition | How to Check |
|---|---|---|
| L | Linear relationship | Scatterplot and residual plot show no curve |
| I | Independent observations | Random sample or of population |
| N | Normal errors | Residual plot approximately symmetric, no strong skew; histogram/QQ plot of residuals |
| E | Equal variance | Residual plot shows constant spread (no fan shape) |
Worked Example
A researcher studies 20 pine trees. = diameter (inches), = height (feet).
Computer output:
| Predictor | Coef | SE Coef | T | P |
|---|---|---|---|---|
| Constant | ||||
| Diameter |
Step 1 — Hypotheses: (no linear relationship between diameter and height) (there is a linear relationship)
Step 2 — Conditions:
- L: Residual plot shows random scatter ✓
- I: Trees randomly selected; of all pine trees ✓
- N: Histogram of residuals approximately Normal ✓
- E: No fan shape in residual plot ✓
Step 3 — Test statistic: , df
Step 4 — P-value: (from the table or computer output)
Step 5 — Conclusion: "Since , we reject . There is convincing evidence of a linear relationship between tree diameter and tree height."
🔑 AP Tip: Always state "convincing evidence" (not "proof") and reference the context.
T-Test for Slope Concepts 🎯
Calculating the -Statistic 🧮
1) , . What is ?
2) data points. What are the degrees of freedom?
3) , . What is ?
Conditions and Conclusions 🔍
Exit Quiz — -Test for Slope ✅
Part 3: Confidence Interval for Slope
📊 Confidence Interval for Slope
Part 3 of 7 — Estimating the True Slope
Topics in This Part
| Section |
|---|
| 📐 CI Formula for |
| 📝 Interpreting the CI |
| 🔗 Connection to the -Test |
| 🧮 Worked Example |
🔑 Key Concept: A confidence interval for gives a range of plausible values for the true population slope.
The Formula
where:
- = sample slope
- = critical value from a -distribution with df
- = standard error of the slope (from computer output)
Interpretation Template
Example: 95% CI for : , = diameter (in), = height (ft).
✅ "We are 95% confident that the true increase in height per additional inch of diameter is between 1.52 and 3.18 feet."
Connection to Hypothesis Testing
| CI contains 0? | Conclusion at |
|---|---|
| Yes | Fail to reject |
| No | Reject |
If the confidence interval does not contain 0, there is evidence of a linear relationship.
Conditions
Same LINE conditions as the -test:
- Linear relationship
- Independent observations
- Normal residuals
- Equal variance of residuals
Worked Example
Study: students. = hours using phone/day, = GPA.
Computer output: ,
Build a 95% CI: df , so .
Interpretation: "We are 95% confident that the true slope of the relationship between daily phone use and GPA is between and . For each additional hour of daily phone use, GPA is predicted to decrease by between 0.034 and 0.206 points."
Connection to test: Since 0 is NOT in the interval, we would reject at .
⚠️ AP Tip: You can read and directly from computer output. The AP formula sheet provides the CI formula.
CI for Slope Concepts 🎯
Building a CI 🧮
, , (95%, df )
1) Margin of error
2) Lower bound of the CI
3) Upper bound of the CI
Interpretation Practice 🔍
Exit Quiz — CI for Slope ✅
Part 4: Computer Output Interpretation
📊 Computer Output Interpretation
Part 4 of 7 — Reading Regression Output Like a Pro
Topics in This Part
| Section |
|---|
| 📋 Standard Regression Table Layout |
| 🔍 Identifying , , , and |
| 📐 Reading , , and |
| 🧮 Building Tests and CIs from Output |
🔑 Key Concept: The AP exam always provides computer output. You must know where to find each number and what it means.
Standard Computer Output Table
| Predictor | Coef | SE Coef | T | P |
|---|---|---|---|---|
| Constant | ||||
| -variable |
Below the table:
What Each Value Means
| Symbol | Location | Meaning |
|---|---|---|
| Coef (Constant row) | -intercept of LSRL | |
| Coef ( row) | Slope of LSRL | |
| SE Coef ( row) | Standard error of the slope | |
| T ( row) | -statistic | |
| P ( row) | -value for (two-sided) | |
| S | Standard deviation of residuals (typical prediction error) | |
| R-sq | Proportion of variability explained |
⚠️ Important: The -value in the table tests vs. (two-sided). For a one-sided test, divide by 2.
Worked Example — Reading Output
| Predictor | Coef | SE Coef | T | P |
|---|---|---|---|---|
| Constant | ||||
| StudyHours |
From this output:
- LSRL:
- Slope: For each additional study hour, predicted score increases by 2.45 points
- ✓ (matches output)
- → reject (strong evidence of a linear relationship)
- → 76.3% of variability in scores is explained by study hours
- → typical prediction error is about 4.12 points
Building a CI from Output
Using the same output with :
- df , (95%)
- CI:
🔑 AP Tip: Verify: the -value in the table is for the two-sided test. The CI and test should agree — if 0 is not in the CI, the -value should be .
Common Mistakes
| Mistake | Correction |
|---|---|
| Using the SE Coef from the Constant row for the slope test | Use the SE Coef from the -variable row |
| Confusing with SE Coef | = residual SD; SE Coef = SD of the slope estimate |
| Not checking if the -value is one- or two-sided | Default output is two-sided; halve it for a one-sided test |
Reading Output 🎯
Extracting Values from Output 🧮
| Predictor | Coef | SE Coef | T | P |
|---|---|---|---|---|
| Constant | ||||
| Rainfall |
,
1) What is the -statistic for the slope?
2) What is the LSRL equation? (Write the slope value only)
3) Degrees of freedom
Output Interpretation 🔍
Exit Quiz — Computer Output ✅
Part 5: Prediction Intervals
📊 Prediction Intervals
Part 5 of 7 — Predicting Individual Values vs. Mean Responses
Topics in This Part
| Section |
|---|
| 🎯 Confidence Interval for Mean Response |
| 📐 Prediction Interval for Individual Response |
| 🔍 Why Prediction Intervals Are Wider |
| ⚠️ Limitations of Predictions |
🔑 Key Concept: A prediction interval for a single future observation is always wider than a confidence interval for the mean response at the same -value.
Two Types of Intervals at a Given
1. Confidence Interval for Mean Response
- Estimates the average -value for all individuals with
- Variability comes only from estimating the line (uncertainty in and )
2. Prediction Interval for Individual Response
- Predicts a single new -value when
- Variability comes from estimating the line AND the natural scatter of individuals around the line
Formulas (Conceptual)
Both center on , but the standard errors differ:
where because:
The extra accounts for the individual-to-individual scatter.
⚠️ AP Note: The formulas for these SEs are not on the AP formula sheet. You should understand the concept — why prediction intervals are wider — but you will not be asked to compute them by hand on the AP exam.
Visual Intuition
At a given :
Both intervals are narrowest near and widen as moves away from .
Why Wider at Extreme ?
The further is from :
- More uncertainty in where the true line is → wider CI for mean
- Same extra scatter for individuals → prediction interval grows similarly
- At the extremes of the data, both intervals are widest
This is related to the concept of extrapolation — predicting outside the data range is unreliable because both intervals become very wide.
Summary Comparison
| Feature | CI for Mean Response | Prediction Interval |
|---|---|---|
| Estimates | $\mu_{y | x^*}$ (average) |
| Width | Narrower | Wider |
| Extra source of variability | No | Yes () |
| Narrowest at | ||
| As | Shrinks to 0 | Shrinks to |
🔑 Key Insight: Even with infinite data, a prediction interval never shrinks to zero width because individual variability () always remains.
Prediction Interval Concepts 🎯
Conceptual Calculations 🧮
at . The CI for the mean is .
1) What is the margin of error of the CI for the mean?
2) Would the prediction interval at be narrower or wider? (narrower/wider)
3) If , the intervals are at their ___ width. (narrowest/widest)
Applying the Concepts 🔍
Exit Quiz — Prediction Intervals ✅
Part 6: Problem-Solving Workshop
📊 Problem-Solving Workshop
Part 6 of 7 — Full Inference for Regression Problems
Workshop Goals
| Skill |
|---|
| 📝 State hypotheses for slope tests |
| ✅ Check LINE conditions |
| 📐 Compute -statistics from output |
| 📊 Build CIs for from output |
| 🎯 Write AP-quality conclusions |
🔑 AP Tip: Inference for regression is one of the most commonly tested topics on the AP exam. Master the 4-step process: hypotheses → conditions → mechanics → conclusion.
Worked Example 1 — Chirps and Temperature
A biology student records cricket chirps per minute () and outdoor temperature (, °F) for 15 observations.
Computer output:
| Predictor | Coef | SE Coef | T | P |
|---|---|---|---|---|
| Constant | ||||
| Chirps |
Step 1 — Hypotheses: (no linear relationship between chirp rate and temperature) (there is a linear relationship)
Step 2 — Conditions (LINE):
- L: Scatterplot shows a linear pattern; residual plot shows random scatter ✓
- I: Observations taken on different days; 15 < 10% of all possible days ✓
- N: Histogram of residuals is approximately Normal ✓
- E: Residual plot shows constant spread ✓
Step 3 — Mechanics: , df
Step 4 — Conclusion: "Since , we reject . There is convincing evidence of a linear relationship between cricket chirps per minute and outdoor temperature."
95% CI for slope: df , "We are 95% confident that for each additional chirp per minute, the true increase in temperature is between 2.06°F and 4.52°F."
Worked Example 2 — Fertilizer and Yield
An agronomist tests 25 plots. = fertilizer (kg/hectare), = crop yield (tons/hectare).
| Predictor | Coef | SE Coef | T | P |
|---|---|---|---|---|
| Constant | ||||
| Fertilizer |
Analysis at :
- , df
- Conclusion: "We fail to reject . There is not convincing evidence of a linear relationship between fertilizer amount and crop yield."
- — fertilizer explains very little of the variability in yield
95% CI: (df ) The interval contains 0, consistent with failing to reject .
Common AP Mistakes
| Mistake | Fix |
|---|---|
| Writing | Use (population slope), not (sample) |
| Skipping conditions | Must check all four LINE conditions |
| "We accept " | Say "fail to reject " |
| Using Constant SE to test slope | Use the SE Coef from the -variable row |
| No context in conclusion | Name the variables — not just "reject " |
Inference Workshop Practice 🎯
Practice from Output 🧮
| Predictor | Coef | SE Coef | T | P |
|---|---|---|---|---|
| Constant | ||||
| Altitude |
1) What is for the slope?
2) What is df?
3) 95% CI margin of error if :
Decision Making 🔍
Exit Quiz — Inference Workshop ✅
Part 7: Review & Applications
📊 Review & Applications
Part 7 of 7 — Comprehensive Inference for Regression Review
Complete Formula Reference
| Concept | Formula |
|---|---|
| Population model | , |
| -test for slope | , df |
| CI for slope | , df |
| Standard error | from computer output |
| (residual SD) |
LINE Conditions Summary
| Condition | Check With | Look For |
|---|---|---|
| Linear | Scatterplot & residual plot | No curves |
| Independent | Study design | Random sample; of population |
| Normal | Histogram/QQ of residuals | Approximate symmetry |
| Equal variance | Residual plot | Constant spread (no fan) |
Interpretation Templates (AP Exam Ready)
-Test Conclusion (Reject): "Since , we reject . There is convincing evidence of a linear relationship between [x in context] and [y in context]."
-Test Conclusion (Fail to Reject): "Since , we fail to reject . There is not convincing evidence of a linear relationship between [x in context] and [y in context]."
CI for Slope: "We are [C]% confident that the true slope is between [lower] and [upper]. For each additional [unit of x], [y in context] changes by between [lower] and [upper] [units of y]."
Key Concept Connections
| Topic | Connection |
|---|---|
| -test and CI | Both use , , df , and LINE conditions |
| CI contains 0 ↔ test result | CI contains 0 = fail to reject; CI excludes 0 = reject |
| One-sided vs. two-sided | Two-sided from output; halve for one-sided (same direction as ) |
| , , and | Testing is equivalent to testing ; same and |
| Prediction intervals | Wider than CI for mean because of individual scatter |
| Computer output | All needed values (, SE, , , , ) come from the output table |
Decision Flowchart
🔑 AP Exam Strategy: Inference for regression appears on the AP exam nearly every year, often as a full free-response question. The 4-step process is your blueprint for full credit.
Comprehensive Review 🎯
Mixed Review Calculations 🧮
| Predictor | Coef | SE Coef | T | P |
|---|---|---|---|---|
| Constant | ||||
| Hours |
,
1) -statistic for the slope
2) df
3) 95% CI lower bound if :
Concept Connections 🔍
Final Exam — Inference for Regression ✅