Home / Tools / Regression Diagnostic Plot Calculator

Regression Diagnostic Plot Calculator

R's plot.lm() draws four pictures that tell you whether a linear model's assumptions hold. Paste your data, and this tool fits the model, draws those four plots, and runs the formal test behind each one: constant variance, linearity, normality and independence, plus influential points. Everything runs in your browser.

Your data
Examples:
Outlier cutoff |std. resid| >
Cook's flag D > k/n, k =
 

 

 

Residuals vs Fitted
Normal Q-Q
Scale-Location
Residuals vs Leverage
Constant variance
-
Linearity
-
Normality
-
Independence
-
Influence
-

 

Inference

 
How this is computed
1
2
3
4
The same diagnostics in R

  

No data leaves your browser Verified against R's lm(), plot.lm(), bptest() and shapiro.test() Free, no sign-up

The four diagnostic plots

R draws these four panels when you call plot(fit). Each one targets a different assumption, and each has a matching formal test.

Residuals vs Fitted

Residuals against the fitted values. You want a flat, patternless band around zero. A curve means the model is missing structure; a funnel means the spread of errors changes with the prediction.

linearity · constant variance
Normal Q-Q

Standardized residuals against the quantiles you would expect if they were normal. Points on the diagonal mean the normality assumption holds; ends curving away signal heavy tails or skew.

normality of residuals
Scale-Location

The square root of the absolute standardized residuals against fitted values. A rising or falling red smoother is the clearest sign of non-constant variance (heteroscedasticity).

constant variance
Residuals vs Leverage

Standardized residuals against leverage, with Cook's distance contours. Points in the top-right or bottom-right past a contour are influential: dropping them would visibly move the fitted line.

influential points

The test behind each plot

The pictures are for the eye; the tests put a number on each assumption. This tool reports all of them, computed the way lmtest and base R compute them.

AssumptionTestR callFlag when
Constant varianceStudentized Breusch-Paganbptest(fit)p ≤ 0.05: variance changes with the fitted values
LinearityRamsey RESETresettest(fit)p ≤ 0.05: fitted powers add signal, so curvature is missing
NormalityShapiro-Wilkshapiro.test(residuals(fit))p ≤ 0.05: residuals depart from normal
IndependenceDurbin-Watsondwtest(fit)statistic far from 2: residuals are autocorrelated
InfluenceCook's distancecooks.distance(fit)D > 4/n (or 0.5, 1): a row is dragging the fit

Frequently asked questions

How do I read a residuals vs fitted plot?

Look for a flat, structureless band of points around the horizontal zero line. A curved trend means the model is missing curvature (nonlinearity); a funnel that widens or narrows means the error variance is not constant (heteroscedasticity). The red smoother should stay roughly flat and near zero.

What does a normal Q-Q plot tell me about my regression?

It checks whether the standardized residuals are normally distributed. Points that hug the diagonal reference line indicate normal residuals. Points curving away at the ends signal heavy tails or skew, which the Shapiro-Wilk test quantifies with a p-value.

When should I worry about Cook's distance?

Cook's distance measures how much the fitted coefficients would move if a single row were dropped. A common screen flags points with Cook's distance above 4/n; values above 0.5 or 1 are stronger warnings. Investigate flagged rows for data errors before deciding whether they are genuine.

My data is not a linear model. Can I still use this?

Fit mode assumes an ordinary least squares linear model, lm(y ~ x1 + ...). For a glm(), use deviance residuals and the link-scale predictions in residuals mode, and treat the normality read as informational. For time series or mixed models, the independence check via Durbin-Watson is the relevant one; see the linked tutorials for model-specific diagnostics.

Does this calculator match R?

Yes. The fit, hat values, standardized residuals and Cook's distances match stats::lm, hatvalues, rstandard and cooks.distance; the assumption tests match lmtest::bptest, lmtest::resettest, lmtest::dwtest and stats::shapiro.test, all verified against R 4.6.0 to at least seven decimal places.

What data do I paste?

In fit mode, paste the response in the first column and one or more predictor columns after it, and the tool fits lm(y ~ x1 + x2 + ...) for you. In residuals mode, paste the residuals and fitted values you already have from any model and the tool diagnoses those two columns directly.

Keep learning