Prediction Interval Calculator

Compute prediction intervals for linear regression models. Enter your (x, y) data points, specify a prediction x₀, and get the predicted value, 95% prediction interval, regression equation, R², and standard error — all visualized on an interactive scatter plot with prediction bands.

#xy
5 points
Load example: ? Linear (y ≈ 2x + 1) ? Quadratic trend ? Random scatter ?️ Temperature vs Ice Cream
Bulk Data Input Paste multiple rows, each row: x, y (comma, space, or tab separated)
Local only
Data points
Regression line
95% Prediction band
Prediction (x₀, ŷ)
PI bounds at x₀

What Is a Prediction Interval?

A prediction interval (PI) is a range of values that is likely to contain the actual value of a new observation from the same population, given a specific predictor value. Unlike a confidence interval — which estimates the mean response — a prediction interval accounts for both the uncertainty in the estimated regression line and the inherent randomness of individual observations. As a result, prediction intervals are always wider than confidence intervals for the same level of confidence.

For a simple linear regression ŷ = a + b·x₀, the 100(1−α)% prediction interval is:

ŷ ± tα/2, n−2 · s · √(1 + 1/n + (x₀ − x̄)² / Sxx)

where s is the residual standard error, n is the sample size, is the mean of x, and Sxx = Σ(xᵢ − x̄)².

Prediction Interval vs. Confidence Interval

It is a common misconception that prediction intervals and confidence intervals are interchangeable. The table below clarifies the distinction:

AspectConfidence Interval (CI)Prediction Interval (PI)
What it estimatesMean response E(y|x₀)Individual new observation y₀ at x₀
WidthNarrowerWider (includes residual variance)
Formulaŷ ± t·s·√(1/n + (x₀−x̄)²/Sxx)ŷ ± t·s·√(1 + 1/n + (x₀−x̄)²/Sxx)
InterpretationPlausible range for the average responsePlausible range for a single new response
Use caseEstimating population meanPredicting individual outcomes

When to Use a Prediction Interval

  • Forecasting: Predicting future sales, temperature, stock prices, or demand based on historical data.
  • Quality Control: Determining acceptable ranges for individual product measurements in manufacturing.
  • Medical Diagnostics: Estimating a patient's individual biomarker level from a regression model.
  • Engineering: Predicting the strength or durability of a specific material sample.
  • Finance: Estimating the range of possible returns for a single investment.

How the Calculator Works

This calculator fits a simple linear regression model y = a + bx using ordinary least squares (OLS). The slope b and intercept a are computed from your data points. It then calculates the predicted value at the specified x₀, along with the 95% prediction interval using the t-distribution with n−2 degrees of freedom.

The residual standard error s is computed as:

s = √( Σ(yᵢ − ŷᵢ)² / (n − 2) )

The prediction interval formula incorporates three sources of uncertainty: (1) the variance of the estimated mean response, (2) the uncertainty from the residual variance, and (3) the leverage effect of the prediction point x₀ relative to the data center.

The interactive chart displays the data points (blue circles), the fitted regression line (blue solid line), the 95% prediction band (green dashed curves), and the specific prediction at x₀ with its interval bounds (red and orange markers).

Step-by-Step Walkthrough

  1. Enter at least 3 data points (x, y) in the table. You can add or remove rows as needed.
  2. Optionally load an example dataset using the preset buttons.
  3. Specify the prediction value x₀ (the x-coordinate for which you want a prediction).
  4. Click Calculate — the regression equation, predicted value, and 95% prediction interval appear instantly.
  5. The scatter plot updates automatically, showing the regression line and prediction band.

Key Statistical Outputs Explained

  • R² (Coefficient of Determination): The proportion of variance in y explained by the model. Ranges from 0 to 1; higher values indicate better fit.
  • Standard Error (s): The typical distance between observed values and the regression line. Smaller s means more precise predictions.
  • Slope (b): The change in y for a 1-unit increase in x. A positive slope indicates a positive relationship.
  • Intercept (a): The predicted value of y when x = 0. Interpret with caution if x=0 is outside the data range.
  • Degrees of Freedom (df): n − 2, used in the t-distribution for interval estimation.

Beyond R²: Interpreting Residuals and Model Diagnostics

While R² and Standard Error are essential, a robust regression analysis always involves examining residuals (the differences between observed and predicted values). Although this calculator does not currently generate a residual plot, understanding residual patterns is critical for trusting your prediction interval.

  • Random Scatter: If residuals appear randomly scattered around zero, the model is well-specified.
  • Funnel Shape: If residuals fan out as x increases (heteroscedasticity), your prediction interval will be too narrow for larger x values. Consider transforming your data (e.g., log transformation).
  • Curved Pattern: If residuals show a U-shape or inverted U-shape, a simple linear model is insufficient. Your prediction interval for the extremes will be inaccurate.

Pro Tip: The prediction interval is most reliable when your chosen x₀ is within the range of your observed x-data. Extrapolating far beyond your data range (e.g., predicting at x=20 when your data only goes up to x=10) violates the model assumptions and renders the interval mathematically invalid, even if the formula still produces a number.

Case Study: Predicting House Prices

A real estate analyst collects data on 10 houses, recording the size (in 1000 sq ft) and the sale price (in $1000). The data are: (1.0, 120), (1.2, 135), (1.4, 145), (1.6, 160), (1.8, 170), (2.0, 185), (2.2, 195), (2.4, 210), (2.6, 220), (2.8, 235). The analyst wants to predict the price of a new house with 2,000 sq ft (x₀ = 2.0) and provide a 95% prediction interval.

Using this calculator, the regression equation is price = 42.5 + 68.75 × size. At x₀ = 2.0, the predicted price is $180,000, and the 95% PI is [$165,200, $194,800]. This means we are 95% confident that a single new house of 2,000 sq ft will sell between $165,200 and $194,800. The width of the interval reflects both the model uncertainty and the natural variability in house prices.

The analyst can use this interval to set expectations for buyers and sellers, and to evaluate whether a particular offer is within the typical range.

Real-World Application: Inventory Management with Prediction Intervals

A supply chain manager uses historical sales data (units sold vs. advertising spend) to predict future demand. Instead of relying solely on the point estimate (e.g., "We will sell exactly 500 units"), they use the prediction interval (e.g., "We are 95% confident sales will be between 450 and 550 units"). This interval directly informs safety stock levels: ordering for the upper bound (550 units) ensures they avoid stockouts during high-variance periods, while the lower bound (450 units) helps negotiate flexible supplier contracts. This approach turns statistical uncertainty into actionable business risk management.

Assumptions and Limitations

For prediction intervals to be valid, the following assumptions should be met:

  • Linearity: The relationship between x and y is approximately linear.
  • Independence: Observations are independent of each other.
  • Homoscedasticity: The variance of residuals is constant across all levels of x.
  • Normality: Residuals are approximately normally distributed (important for small samples).

If these assumptions are violated, the prediction interval may be inaccurate. The calculator provides the regression diagnostics (R², standard error) to help you assess the model fit.

Common Misconceptions

  • "A 95% PI contains 95% of the data." — Not exactly. It means that if we repeated the sampling and prediction process many times, 95% of the intervals would contain the true new observation.
  • "Prediction intervals are always symmetric." — They are symmetric around the predicted value when the model is linear and errors are normal.
  • "More data always gives narrower PIs." — Yes, as n increases, the term 1/n decreases, but the residual variance s² may also decrease if the model is correct.
  • "PI and CI are interchangeable." — No, PI is always wider than CI for the same confidence level because it accounts for individual variability.

Applications Across Disciplines

  • Business & Economics: Forecasting sales, inventory demand, and market trends with uncertainty bounds.
  • Environmental Science: Predicting pollutant concentrations, species abundance, or climate variables.
  • Healthcare: Estimating patient recovery times, drug efficacy, or risk scores for individual patients.
  • Sports Analytics: Predicting player performance metrics or game outcomes.
  • Supply Chain: Estimating lead times and delivery windows for logistics planning.

Grounded in Statistical Theory — This tool implements the standard formula for prediction intervals in simple linear regression, as taught in introductory and intermediate statistics courses. The methodology is consistent with the works of Montgomery, Peck, and Vining (Introduction to Linear Regression Analysis), Kutner et al. (Applied Linear Statistical Models), and the NIST/SEMATECH e-Handbook of Statistical Methods. The interactive visualization is built with Canvas API. Reviewed by the GetZenQuery tech team, last updated June 2026.

Frequently Asked Questions

A prediction interval estimates where a single future observation will fall, given a specific x₀. A tolerance interval estimates a range that contains a specified proportion (e.g., 95%) of the entire population distribution. Prediction intervals are more common in regression contexts.

The term (x₀ − x̄)² / Sxx increases as x₀ moves away from the center of the data. This inflates the variance of the predicted mean and, consequently, the prediction interval. Extrapolation beyond the data range is inherently more uncertain.

This version supports simple linear regression (one predictor). For multiple linear regression, please see our dedicated Multiple Regression Calculator.

At least 3 points are required to estimate residual variance and compute a valid prediction interval. More points generally lead to more precise estimates and narrower intervals, assuming the model is correct.

The calculator uses a 95% confidence level by default, which corresponds to α = 0.05. The t-critical value is adjusted based on the degrees of freedom (n − 2).

Explore authoritative resources: Penn State STAT 501, NIST Engineering Statistics Handbook, and Khan Academy. For a deep dive, see Applied Linear Regression by Weisberg.

An extremely wide prediction interval is a signal from your data. It usually indicates one of three things: (1) The residual standard error (s) is large, meaning your data points are highly scattered around the regression line. (2) Your sample size (n) is very small, providing little statistical power. (3) Your prediction point x₀ is far away from the mean (leverage effect). Instead of discarding the wide interval, use it as a diagnostic — it tells you that predictions at that specific x₀ are inherently uncertain and should be treated with caution in decision-making.
References: Wikipedia: Prediction Interval; Montgomery, D.C., Peck, E.A., & Vining, G.G. (2012). Introduction to Linear Regression Analysis. Wiley; Kutner, M.H., et al. (2005). Applied Linear Statistical Models. McGraw-Hill; NIST Handbook: Prediction Intervals.