Statistics & Data Analysis

Regression Inference & Residuals

Extend simple OLS with an intercept using coefficient standard errors, t/F inference, confidence intervals and residual plots.

Question, try, then observe

A clear fitted line: a reliable model?

Illustrative output X and cost Y. Change the generating slope, noise or endpoint outlier; trace residual segments and read coefficient inference. The generating and estimated slopes need not coincide.

01 · Make a predictionDoes a significant slope prove that output causes cost?
Significance level α

Residual sum of squares divided by n−2, then square root

sₑ=99.854910≈3.16

Test the fitted slope against a null slope of zero

t=1.958−00.2643≈7.4098
  1. Use the slope fitted to the current data, not the generating slope. Do not invent t when SE is zero or inference is undefined.

Observations, fitted line and residual segments

Observations, fitted line and residual segmentsCircle marks show observations. Exact fitted values and residuals are in the table below.1830.9243.8416.512X
Solid line: OLS fit. Dotted vertical segments: observed minus fitted.

Residuals versus fitted values

Residuals versus fitted valuesCircle marks show observations. Exact fitted values and residuals are in the table below.-4.762-0.26674.22822.333.0743.84Fitted value
Dashed horizontal line: zero residual. Patterns prompt investigation; this is not a formal diagnostic test.

X=1 · Y=18 · ŷ=22.3 · e=-4.297

Read observations, fitted values and residuals
XYŷe
11822.3-4.297
226.424.262.145
326.826.210.5865
432.428.174.228
527.230.13-2.93
633.632.091.512
732.834.05-1.246
839.6363.596
933.237.96-4.762
1042.839.922.88
1140.441.88-1.478
1243.643.84-0.2359
Estimated slope b₁1.958SE=0.264
R²0.846
t7.41df=10 · F=54.905
p-value2.289e-5

95% confidence interval: 1.369 to 2.547

Reject H₀ at the selected α; assumptions and practical magnitude still matter.

Conventional constant-variance OLS standard errors only. Residual plots are clues, not formal normality, heteroskedasticity or autocorrelation tests. Robust, HAC and Newey–West estimates are not included.

What did you just see?

Two equally steep lines can have observations tightly clustered around one and widely dispersed around the other. Equal slopes do not imply equal SEs or p-values. One point far along the X axis can shift the whole line.

Read the residuals

Segments connect each observation to its fitted value at the same X. The second plot places fitted values on the horizontal axis and residuals on the vertical axis. Curvature may suggest a wrong functional form; a funnel may suggest changing variance. The display itself performs no formal diagnostic test.

Assumptions of conventional inference

The conditional mean should be linear, errors should have zero conditional mean given X, and observations should be independent with equal error variance. Normal errors justify exact small-sample t/F inference. Financial series often have heavy tails, dependence and clustered volatility; a significant slope alone does not resolve these issues.

When F equals t²

With the same data, one slope, an intercept, conventional OLS assumptions and H₀:β₁=0, the overall F equals the squared slope t, and right-tail F agrees with two-sided t. This does not extend to every regression, directional test or standard-error method.

Beyond fitting

R² is the share of sample variation explained by the fit, not out-of-sample forecast accuracy. Prediction needs new-data validation and care with extrapolation; causation needs a study design and treatment of confounding. This tool adds no multiple regression, causal identification or formal time-series diagnostics.

Another example

  1. Enter X/Y in their original pair order; use at least three pairs with variation in X.
  2. Set α and fit OLS with an intercept; read coefficients, intervals, R² and t/F.
  3. Inspect fitted and residual plots. Check constant variance, independence and model form; significance does not establish causation.
Show formal definition and formula

Simple regression inference estimates coefficient uncertainty and tests a population slope in an OLS model with one predictor and an intercept. Diagnostic plots can reveal possible model problems; they do not automatically certify the model.

Model and residual standard error

Slope test and coefficient interval

Fit and overall test

β₀, β₁, b₀, b₁
Population coefficients and intercept OLS estimates.
ŷᵢ, eᵢ
Fitted value and residual yᵢ−ŷᵢ.
SSE, SSR, SST
Residual, model and total sums of squares.
RSE, SE(bⱼ)
Residual standard error and conventional OLS coefficient SE.
ν, t, F
ν=n−2; F=t² for the same zero-slope test.
ε
Error; conventional inference requires independence, constant variance and appropriate normality.

Common mistakes

Fit, statistical significance, prediction and causation are four different questions. A high R² does not guarantee a correct model; a small p-value does not prove X causes Y; an apparently random residual plot is not a formal certificate of every assumption.

Frequently asked questions

Are robust or Newey–West standard errors included?

No. This version uses conventional constant-variance OLS standard errors, without heteroskedasticity-robust, HAC or Newey–West estimates. Heteroskedasticity, serial dependence or volatility clustering can invalidate nominal p-values and intervals.

Does a perfect straight line give p=0?

With no residual variation the SE is zero, so a finite t ratio is undefined. The tool preserves fit information and marks undefined inference N/A instead of inventing Infinity or an exact p=0.

Is an outlier always influential?

A large residual means Y is far from the fitted line; leverage concerns an X position far from other X values. Influence also depends on how much removing that point changes the fit. They are not synonyms.

You can now explore…

  • Separate fit from coefficient significance
  • Use residuals to examine conventional OLS assumptions