Quick answer: In R Commander: Statistics → Fit models → Linear regression, move the outcome into the response field and predictors into the model formula, and the full model summary appears — coefficients, R², F-test and p-values — with the exact lm() call shown in the script window. Regression predicts one numeric variable from one or more others; this guide covers the setup, the four output lines that matter, and the diagnostics that keep the model honest. Test catalog first: statistical tests in R Commander.
Simple regression, step by step
Worked example: predicting exam score from study hours. Statistics → Fit models → Linear regression → name the model, enter score as response and hours as predictor. The summary reports: slope b = 6.1 (each hour predicts +6.1 points), intercept, standard errors, and the coefficient p-values. The model line reads: “Hours predicted scores, b = 6.1, t(38) = 6.4, p < .001; R² = .52.” — the same numbers jamovi produces in our jamovi workflow comparison, and the p-value logic is unpacked in the p-value explainer.
Multiple predictors and the formula language
Switch to Linear model in the same submenu for the general case, and the R formula syntax unlocks everything: score ~ hours + attendance adds predictors, score ~ hours * method adds an interaction (does the payoff of hours differ by teaching method?), and score ~ hours + I(hours^2) adds curvature. The Models menu then works on the fitted object: hypothesis tests for term-by-term ANOVA tables, Confidence intervals for every coefficient, and stepwise selection when predictor pruning is justified.
The four diagnostics before you report
| Diagnostic (Models → Graphs) | What it catches |
|---|---|
| Basic diagnostic plots (4-panel) | Curvature (fit line vs residuals), funnel shapes (unequal variance), heavy tails (non-normality), leverage points |
| Residual quantile-comparison | Non-normal residuals — the confidence intervals lose honesty |
| Cook’s distance / leverage | Single observations steering the whole fit |
| VIFs (via the car plug-in) | Predictors so correlated that coefficients turn unstable |
Regression needs tidy data — one row per observation, clean numeric columns — and the import-and-cleaning path is in our data import guide. The data-handling foundations under R’s data frames are in the data frames guide. For one-to-one coaching from first regression to defended thesis model, Ampersand Academy teaches R and statistics one-to-one.
Frequently asked questions
How do I run linear regression in R Commander?
Statistics, Fit models, Linear regression. Name the model, enter the response variable and predictors in the formula, and OK. The summary shows coefficients, standard errors, t-values, p-values and R-squared.
What is the difference between Linear regression and Linear model?
Linear regression dialog handles one numeric predictor quickly; Linear model exposes the full R formula syntax for multiple predictors, interactions and transformed terms – both fit with lm underneath.
How do I add an interaction between two predictors?
In the Linear model dialog use the asterisk: score ~ hours * method fits main effects plus the interaction. The Models menu then lets you test the interaction term explicitly.
Which diagnostic plots should I check before reporting?
The four-panel basic diagnostic plots: residuals vs fitted for linearity and equal variance, the quantile-comparison for normal residuals, and scale-location plus Cook’s distance for influential points.
What does R-squared tell me about my model?
The share of outcome variance explained by the predictors. Useful for comparing models on the same data, but it says nothing about causation and inflates with every added predictor – adjusted R-squared corrects for that.

