Lesson 18

Prediction Intervals and Uncertainty

Big question

Why is a prediction not just one number?

Lesson progress

Complete checkpoints as you learn

0% complete0 checkpoint streak
Progress tracking available after sign-in. Sign in to save your work.
Big question
Concept
Activity
Quiz

Learning objectives

  • Explain prediction intervals and uncertainty in plain language.
  • Use standardized coefficient correctly in an interpretation.
  • Connect the lesson idea to a formula, graph, Python result, or real example.

Simple explanation

A fitted value estimates an average outcome for a profile. A prediction interval is wider because an individual outcome has random variation around that average.

Key terms

Standardized coefficient
A slope measured in standard deviation units for both the explanatory variable and the dependent variable.
Turning point
The value of x where the fitted quadratic slope is zero.
Bad control
A control variable that changes the target estimand or can introduce bias.

Core formula

individualpredictionuncertainty>meanpredictionuncertaintyindividual prediction uncertainty > mean prediction uncertainty

Use plain-language interpretation before algebra.

Example

M6_STARTUP_PREDICTION is a synthetic teaching dataset for prediction intervals and uncertainty. It is designed to practice prediction intervals without presenting fabricated real-world empirical findings.

Interactive visual

Compare a confidence interval for the mean and a prediction interval for an individual observation.

Original Module 6 visual for Prediction Intervals and Uncertainty.

wage_sample.csv

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

Prediction Intervals and Uncertainty Python example

Prediction Intervals and Uncertainty Python example

Stdout

Run Python to see results here.

Status / stderr

Ready to run Python in your browser.

Line-by-line guide

  1. Line 1Load a Python library needed for data work or regression.
  2. Line 2Load a Python library needed for data work or regression.
  3. Line 4Load the dataset into a pandas DataFrame.
  4. Line 5Add an intercept column to the regression design matrix.
  5. Line 6Create or update a Python object used in the analysis.
  6. Line 7Display a result so students can inspect the output.

Python walkthrough

  1. 1Load the synthetic teaching dataset from the Module 6 public data folder.
  2. 2Create transformed variables only after checking their meaning and valid support.
  3. 3Fit a regression that matches the lesson's interpretation target.
  4. 4Print coefficient or prediction summaries that students can connect to the formula.
  5. 5Use comments and output labels so no empirical result is presented without context.

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

M6_STARTUP_PREDICTION

Estimated time

25 to 40 min

Packages

pandas, numpy

Expected output

Printed Python results that can be compared with the lesson explanation.

Learning goals

  • Load and inspect M6_STARTUP_PREDICTION.
  • Run the Python cells connected to Prediction with Multiple Regression.
  • Interpret the output using prediction and prediction intervals.

Common errors

  • File not found: check that M6_STARTUP_PREDICTION.csv 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_csv("/data/module-6/M6_STARTUP_PREDICTION.csv")
df.head()

Interactive activity

PredictionIntervalBuilder

Compare prediction intervals

Separate a mean interval from an individual prediction interval.

M6_STARTUP_PREDICTION

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 main mistake to avoid in Prediction Intervals and Uncertainty?

Quick quiz

What is the main mistake to avoid in Prediction Intervals and Uncertainty?

Quick quiz

Why is M6_POLICY_CONTROLS a reasonable practice dataset here?

Key takeaway

Prediction Intervals and Uncertainty helps students make multiple regression more flexible while keeping interpretation precise and honest.