Linear regression

Simple and multiple linear regression from a spreadsheet

Ordinary least squares is the most used and most misapplied regression there is. Magic Stat runs simple and multiple linear regression from your spreadsheet and, instead of hiding the assumptions, prints the diagnostics that tell you whether the straight line was a fair choice.

The honest part

OLS assumes the error is in Y. Check that it is.

Ordinary least squares finds the line that minimises the squared vertical distances from the points. It estimates a slope for each predictor with a standard error, a t statistic and a confidence interval, and an overall F test for whether the model explains anything. Magic Stat reports all of that, plus an ANOVA table and the coefficients with their variance inflation factors.

The method carries assumptions: the relationship is linear, the residuals are independent and roughly constant in spread, and — for the tests — approximately normal. These are checkable, and Magic Stat checks them: Shapiro–Wilk on the residuals for normality, Breusch–Pagan for changing variance, and Durbin–Watson for autocorrelation.

Two situations call for a different tool. If X is also measured with error, OLS understates the slope — that is what Model II regression is for, and it is in the same dialog. If a few points dominate the fit, the honest answer is robust regression, also in Magic Stat.

What it does

What Magic Stat gives you for linear regression

How it works

Fit the line, then read the diagnostics

  1. Load the data. outcome and predictors as columns.
  2. Choose the analysis. Statistics → Correlation and Linear Regression.
  3. Select predictors and outcome. one X gives a simple regression, several give one multiple model.
  4. Run it. coefficients, ANOVA and diagnostics appear together — no separate check step.
  5. Export. the fitted line, the tables and the interpretation go into the report.
Options

The settings, not buried in a summary call

Model: simple (one predictor), multiple (all predictors entered), or stepwise selection forward and backward with entry and removal p-value thresholds.

Model II: OLS · MA (major axis) · SMA (standardised major axis) · RMA (reduced major axis), for regression when both variables carry measurement error.

Output: coefficient table with intervals, ANOVA, VIF, residual diagnostics, and prediction intervals from the model.

Frequently asked

Linear regression questions, answered honestly

When should I use multiple instead of simple regression?

When you want the effect of each predictor holding the others fixed — for example the effect of age while controlling for sex. Fitting separate simple regressions does not do that, and the coefficients can even change sign when predictors are correlated.

What if the diagnostics flag a problem?

Changing variance or non-normal residuals often improves with a transformation or by using robust standard errors. Outliers that dominate the fit are better handled by robust regression, which Magic Stat also provides.

What is Model II regression for?

Ordinary least squares assumes the error is only in Y. When both variables are measured with error — two field instruments, two assays — the slope from OLS is biased toward zero. Model II regression (MA, SMA, RMA) estimates the line under error in both variables.

Should I trust stepwise selection?

Treat it as a tool, not an oracle. Stepwise selection reacts to noise in the sample and its p-values are optimistic. It is useful for narrowing a large set, but the final model should be interpreted with care.

Do I need R?

No. If you use R comfortably, keep it. The value here is that the fit, the diagnostics, the Model II line and the report come out of one dialog.

Correlation analysis → Polynomial regression → Robust regression →