Date: September 24, 2026
The Linear Model — the same machine, driven by point-and-click
Note
This is the JAMOVI version of this week’s lecture. The concepts, the data, and every number are identical to the R version — only the buttons change. Use whichever you like; the exam-room skill is reading the output, not producing it.
In Lab 5 you ran three things:
lm() — the “sneak peek” 👀And the numbers came back the same.
That was not a bug, and it was not a coincidence.
Important
Regression is not a new test that sits next to t-tests and correlations. It is the general machine that both of them are special cases of. In JAMOVI, that machine is Analyses → Regression → Linear Regression.
Regression is a general data analytic system
Lots of things fall under the umbrella of regression
It handles many forms of relations and types of variables
The output gives you effect sizes and statistical significance
We can add multiple predictors and account for their intercorrelations
Learn one machine well, then add parts to it. That is the whole plan for the next eight weeks.
Adjustment: Take into account (control) known effects in a relationship
Prediction: Develop a model based on what has happened previously to predict what will happen in the future
Explanation: Examine the influence of one or more variables on some outcome
With regression, we are building a model that we think best represents the data, and the broader world
\[ Data = Model + error \]
Every model we build for the rest of the semester is a variation on this sentence.
At the simplest form we draw a line to characterize the linear relationship between two variables, so that for any value of x we have an estimate of y
\[ Y = mX + b \]
Y = Outcome Variable (DV)
m = Slope Term
X = Predictor (IV)
b = Intercept
\[ Y_i = b_0 + b_1X_i + e_i \]
This captures how we calculate each observation ( \(Y_i\) )
\[ \hat{Y_i} = b_0 + b_1X_i \]
This gives the “best guess” or expected value of \(Y\) given \(X\)
\[Y_i = b_{0} + b_{1}X_i + e_i \qquad \hat{Y_i} = b_{0} + b_{1}X_i\]
\(\hat{Y}\) signifies the fitted score — no error. We interpret it as “on average.”
The difference between the fitted and the observed score is the residual:
\[Y_i - \hat{Y_i} = e_i\]
Note
JAMOVI will hand you both of these if you ask: in Linear Regression → Save, tick Predicted values and Residuals, and two new columns appear in your spreadsheet.
How do we find the regression estimates?
Ordinary Least Squares estimation
Minimizes deviations
Other estimation procedures are possible (and necessary in some cases)
The line that yields the smallest sum of squared deviations
\[\Sigma(Y_i - \hat{Y_i})^2\] \[= \Sigma(Y_i - (b_0+b_{1}X_i))^2\] \[= \Sigma(e_i)^2\]
You could try many different coefficients until you find the pair with the smallest sum of squared deviations. Luckily, there are simple calculations that yield the OLS solution every time — and JAMOVI does them the moment you drop a variable in a box.
Drag the points around and watch the line chase them:
https://setosa.io/ev/ordinary-least-squares-regression/
https://observablehq.com/@yizhe-ang/interactive-visualization-of-linear-regression
Remember covariance from last week:
\[cov_{xy} = \frac{\sum(x-\bar{x})(y-\bar{y})}{N-1}\]
and the correlation, which standardizes it:
\[r_{xy} = \frac{cov_{xy}}{s_x s_y}\]
The regression coefficient is built from exactly the same pieces.
\[b_{1} = \frac{cov_{XY}}{s_{x}^{2}} = r_{xy} \frac{s_{y}}{s_{x}}\]
What units is the regression coefficient in?
The slope equals the estimated change in Y for a 1-unit change in X
Tip
A correlation is unitless. A slope is in the units of your study. That is why a slope is often the more useful number to report to a human being.
\[\Large b_{1} = r_{xy} \frac{s_{y}}{s_{x}}\]
If the standard deviation of both X and Y is equal to 1:
\[\Large b_1 = r_{xy} \frac{s_{y}}{s_{x}} = r_{xy} \frac{1}{1} = r_{xy} = \beta_{yx}\]
Standardize both variables and the slope becomes the correlation. In JAMOVI that is the Standardized estimate checkbox under Model Coefficients — tick it and watch it equal r.
\[\hat{Y_i} = \bar{Y} + r_{xy} \frac{s_{y}}{s_{x}}(X_i-\bar{X})\]
It is where the regression line crosses the y-axis, at \(X = 0\)
It ensures the line runs through the point \((\bar{X}, \bar{Y})\)
\[\Large b_0 = \bar{Y} - b_1\bar{X}\]
Cards Against Humanity: Pulse of the Nation — a national poll that asked serious demographic questions and some very strange ones.
☰ Menu > Open > Browse >
CAH.csv
JAMOVI will guess the measure type for each column. Check the icons at the top of each column:
age, transformers, books should be continuous (ruler icon)gender should be nominal (three circles)Click the column header to fix any it guessed wrong.
We need the scatr module for scatterplots.
➕ Modules > jamovi library > install scatr
Then:
Analyses > Exploration > scatr > Scatterplot
age · Y-Axis: transformersTalk about it (2 min)
The line slopes down. Before we fit anything: how strong does that relationship look to you? If you had to guess r, what would you say? Write your guess down.
Analyses > Exploration > Descriptives
Drag age and transformers into Variables.
| Variable | N | Mean | SD | Min | Max |
|---|---|---|---|---|---|
age |
1000 | 49.41 | 16.63 | 18 | 99 |
transformers |
938 | 1.33 | 1.56 | 0 | 5 |
Warning
Notice the two different Ns. 62 people did not answer the Transformers question. JAMOVI, like R, will quietly use only the complete cases when it fits the model. Worth knowing before you report an N.
Analyses > Regression > Correlation Matrix
Drag in age and transformers. Tick Pearson, p-value, and (optionally) Correlation matrix under Plot.
| age | transformers | |
|---|---|---|
| transformers | r = −0.266 | — |
| p < .001 |
How close was your guess?
Analyses > Regression > Linear Regression
transformersage (continuous predictors go in Covariates)Open Model Coefficients and tick Standardized estimate.
Model Fit
| R | R² |
|---|---|
| 0.266 | 0.071 |
Model Coefficients
| Predictor | Estimate | SE | t | p | Stand. Estimate |
|---|---|---|---|---|---|
| Intercept | 2.577 | 0.155 | 16.63 | < .001 | — |
| age | −0.0254 | 0.0030 | −8.46 | < .001 | −0.266 |
\[\widehat{transformers} = 2.58 - 0.025(age)\]
“Each additional year of age is associated with 0.025 fewer Transformers movies seen.”
That sounds like nothing. So rescale it to a unit people care about:
Note the word associated. Nobody was randomly assigned an age.
\(b_0 = 2.58\) = the predicted number of Transformers movies for a person aged zero.
Careful
Nobody in this sample is under 18. A prediction at age 0 is extrapolation — the model has never seen data anywhere near there.
The intercept is an anchor for the line, not a finding.
When zero is not meaningful, centering the predictor fixes the interpretation (we will do this for real in Week 9).
By hand: \(2.577 + (-0.0254 \times 20) = 2.07\) movies for a 20-year-old.
By JAMOVI: in Linear Regression → Save, tick Predicted values and Residuals. Two new columns appear in the Data tab — one row per person.
A 20-year-old in the data who has seen 4 movies:
\[e_i = Y_i - \hat{Y_i} = 4 - 2.07 = +1.93\]
Positive residual → above the line → the model under-predicted this person.
Tip
Part A: Follow along · ~20 min · Pairs
We fit this model together, from the top:
10 minutes
When we come back: how do we know if this line is any good?
The way the world is = our model + error
How good is our model? Does it “fit” the data well?
To assess fit, we examine the proportion of variance in our outcome that is “explained” by our model.
To do that, we partition the variance into two categories: variability captured by the model, and variability that is not.
Start with the relationship between observed \(Y\) and fitted \(\hat{Y}\):
\[Y_i = \hat{Y}_i + e_i\]
Variances are additive when two variables are independent. If C = A + B, then the variance of C is the sum of the variances of A and B.
Why can we use that rule here?
\(\hat{Y}_i\) and \(e_i\) are independent of each other. So the variance of \(Y\) equals the variance of \(\hat{Y}\) plus the variance of \(e\).
\[\large s^2_Y = s^2_{\hat{Y}} + s^2_{e}\]
Variances are sums of squares divided by N−1, and all have the same sample size here, so:
\[\large SS_Y = SS_{\hat{Y}} + SS_{\text{e}}\]
\[ SS_Y = SS_{\text{Model}} + SS_{\text{Residual}}\]
Note
Want to see those sums of squares? In Linear Regression, open Model Fit → Overall Model Test (F test). That F is \(SS_{Model}\) and \(SS_{Residual}\), each divided by its degrees of freedom.
\[\Large \frac{SS_{Model}}{SS_{Y}} = \frac{s_{Model}^2}{s_{y}^2} = R^2\]
\(R^2\) is the proportion of variance in Y explained by the model
\[\large \sqrt{R^2} = r_{Y\hat{Y}}\]
With one predictor, that is just our old friend \(r\).
Look back at the two tables you already have open:
Correlation Matrix
r = −0.266
(−0.266)² = 0.071
Linear Regression → Model Fit
R = 0.266
R² = 0.071
And the Standardized estimate for age? −0.266. The same number, wearing a third hat.
The \(p\)-value tells us the effect is likely not zero. It says nothing about whether the effect is large or meaningful.
Important
With a large enough sample, a tiny, trivial effect becomes statistically significant. Our n here is 938.
Statistical Significance \(\neq\) Practical Significance
The slope itself — in the units of your study. The most concrete thing you have.
Standardized estimate / \(r\) — Cohen’s rough guide: small (|.10|), medium (|.30|), large (|.50|)
Coefficient of determination \(R^2\) — proportion of variance accounted for
For our model: \(r = -.27\), so \(R^2 = .071\)
“Approximately 7% of the variability in Transformers movies seen is accounted for by age.”
Template: b = slope, t(df) = statistic, p = p-value, plus \(R^2\)
Age significantly predicted the number of Transformers movies a respondent had seen, b = −0.03, t(936) = −8.46, p < .001. Each additional decade of age was associated with about a quarter of a movie fewer, and age accounted for 7.1% of the variance in movies seen (\(R^2\) = .07).
Tip
Notice what the good version includes: the estimate in real units, the test, and a statement of how much it matters. All three.
JAMOVI’s tables are nearly APA-formatted already — right-click any table → Export (or copy) to drop it into Word.
Linear Regression > Assumption Checks
The residuals-vs-fitted plot should look like a shapeless cloud with no trend. Flat. By construction — and in Week 10 we will use that fact to catch models that are lying to us.
First the test you already know:
Analyses > T-Tests > Independent Samples T-Test
transformers · Grouping Variable: gender(Filter to Male/Female first — Data → Filters → gender != "Other")
| Test | statistic | df | p |
|---|---|---|---|
| Student’s t | −2.29 | 911 | 0.022 |
Group means: Female 1.21 · Male 1.44
Analyses > Regression > Linear Regression
transformersgender (categorical predictors go in Factors, not Covariates)| Predictor | Estimate | SE | t | p |
|---|---|---|---|---|
| Intercept | 1.21 | — | — | — |
| gender: Male – Female | 0.23 | 0.10 | 2.29 | 0.022 |
JAMOVI picks the first level alphabetically by default — here, Female.
Linear Regression > Reference Levels
Change it to Male and watch what happens:
The model is the same model. You just asked it to answer from a different starting point.
Note
You do not have to memorize a separate procedure for every design.
Dependent Variable + Covariates/Factors handles the continuous case and the group case. Over the next few weeks we just add more predictors to the same boxes.
Next week: groups as regression, in full — t-tests and ANOVA as one model.
An observation about heights motivated the development of regression: if you selected an exceptionally tall (or short) parent, their child was almost always less extreme.
Regression to the mean: a random variable that produces an extreme score on a first measurement tends to produce a less extreme score on a second measurement.
Warning
This is a threat to internal validity whenever an intervention is assigned based on first-measurement scores.
Tutoring the students who bombed the midterm? They would have improved somewhat anyway.
Tip
One Line, Two Stories · ~35 min · Pairs
Part B (~25 min): Do older people read more books?
books <= 365Part C (~10 min): The t-test / regression equivalence, in your own file
| What you want | JAMOVI | R |
|---|---|---|
| Descriptives | Exploration → Descriptives | describe() / summary() |
| Scatterplot + line | scatr → Scatterplot, Linear | ggplot() + geom_smooth(method = "lm") |
| Correlation | Regression → Correlation Matrix | cor.test() |
| Fit a line | Regression → Linear Regression | lm(y ~ x, data = d) |
| Continuous predictor | Covariates box | just add it |
| Categorical predictor | Factors box | factor() |
| Standardized slope | Model Coefficients → Standardized estimate | lm.beta() / scale the variables |
| R² | Model Fit → R² | summary(fit)$r.squared |
| Predicted values & residuals | Save → Predicted values, Residuals | broom::augment(fit) |
| Drop cases | Data → Filters | filter() |
| Change reference group | Reference Levels | relevel() / fct_relevel() |
Finish these at the bottom of your activity file:
📋 Lab 6 — Reading the Line, due Tuesday 9/29 at 11:59pm
📖 Chapter 15 — ST
Schedule change
The lab schedule has moved up from the PDF syllabus. Lab 6 is due 9/29, the midterm is assigned 10/15 and due 10/27. Website = current version.