Jamovi Guide: Linear Regression
Use these steps to fit a line that predicts one number from another. You start with a scatterplot, then Linear Regression in Jamovi gives the intercept and slope, r and R², the residual plot, and the test and confidence interval for the slope. The example uses the practice survey data, so if you follow along with that file open you should see the same numbers.
The worked example
The survey asked how tall you are (height_in) and how tall you would be if you could magically change your height (height_ideal_in), both in inches.
Research question: among the students in the survey, can you predict how tall a student wishes they were from how tall they are?
Height is the predictor (\(x\)) and ideal height is the response (\(y\)), both in inches.
What you need
- Jamovi 2.7.38, with the Randomize module for Step 6. If Randomize is not in your Analyses ribbon, see the Jamovi Setup Guide.
- The practice survey file, practice_survey.csv. Open it with the hamburger menu (three lines, top left), Open, then Browse.
No filter is needed. Two students skipped both height questions, and Jamovi leaves them out, so 158 students remain.
Step 1: The scatterplot
- Click Analyses → Exploration → Scatter Plot.
- Put
height_inin X-Axis andheight_ideal_inin Y-Axis. The predictor goes on the x-axis. - Expand General Options. Under Regression Line, check Show line and uncheck Confidence interval.
The relationship is positive, linear, and fairly strong. Heights are whole numbers, so many students share a point, and the plot shows fewer than 158 dots.
Step 2: The line
- Click Analyses → Regression → Linear Regression.
- Put
height_ideal_inin Dependent Variable andheight_inin Covariates. Leave Factors empty, because that box is for categories.
| Predictor | Estimate | SE | t | p |
|---|---|---|---|---|
| Intercept | 6.95608 | 3.513021 | 1.9801 | .049453 |
| height_in | 0.91909 | 0.051956 | 17.6897 | 4.0614e−39 |
The Estimate column holds \(b_0\) (the Intercept row) and \(b_1\) (the row named for the predictor):
\[\widehat{\text{ideal height}} = 6.96 + 0.919 \times \text{height}\]
For each extra inch of height, predicted ideal height is about 0.92 inches higher. A student 64 inches tall has a predicted ideal height of \(6.96 + 0.919 \times 64 = 65.78\) inches.
The intercept is the predicted ideal height for a student 0 inches tall. Nobody is 0 inches tall, so the intercept is there to position the line and we don’t interpret it.
Heights in the data run from 58 to 78 inches. Predicting for someone 90 inches tall would be extrapolation, because the line may not hold outside the data.
Check your work. The note under Model Fit Measures reads N=158. If your intercept is 17.4 and your slope is 0.726, the two variables are swapped. Ideal height goes in Dependent Variable.
Step 3: r and R²
Model Fit Measures, in the same output, shows R = 0.81690 and R² = 0.66733.
Jamovi’s R is always positive, so give r the sign of the slope. Here the slope is positive and r = 0.817. R² = 0.667, so about 67% of the variability in ideal height is explained by the line with height.
Step 4: The residual plot
- Expand Assumption Checks and check Residual plots.
Jamovi draws three plots. Use the first one, with Fitted on the x-axis. The second plots the residuals against height_ideal_in and slopes upward for any data, so skip it. With one predictor, the third looks like the first.
The residuals show no curve, so linearity looks fine. Their spread is about the same from left to right, so constant variance looks fine too. For normality, n = 158 is at least 30 and no residual is far from the rest. For independence, each student answered the survey once, on their own. The students were not a random sample of a larger group, so the results describe the students who answered.
The point farthest from the line is a student 61 inches tall who wishes to be 58, with residual \(58 - (6.96 + 0.919 \times 61) = -5.02\).
Step 5: The test for the slope
\[H_0: \beta_1 = 0 \qquad H_A: \beta_1 \neq 0\]
Compute T by hand from the estimate and SE in the height_in row:
\[T = \frac{b_1}{SE} = \frac{0.91909}{0.051956} = 17.69 \qquad df = n - 2 = 158 - 2 = 156\]
Jamovi’s t column gives the same 17.69. Its p column gives the two-sided p-value as 4.0614e−39, which is far below 0.001. You can also get it from Model-Based Inference with the t distribution and 156 degrees of freedom, as in the one and two means guide.
The p-value is below α = 0.05, so we reject \(H_0\). There is convincing evidence of a positive linear relationship between height and ideal height among the students who answered the survey.
Step 6: The confidence interval for the slope
- Find t* in Analyses → Randomize → Model-Based Inference, with the t distribution, 156 degrees of freedom, and a 95% confidence level: \(t^* = 1.975\).
- Build the interval by hand:
\[b_1 \pm t^* \times SE = 0.91909 \pm 1.975 \times 0.051956 = 0.919 \pm 0.103 = (0.816,\ 1.022)\]
- Check it in Jamovi. Expand Model Coefficients and, under Estimate, check Confidence interval.
The height_in row reads Lower 0.816462 and Upper 1.0217, which matches.
In context, we are 95% confident that, among the students who answered the survey, each extra inch of height goes with between 0.82 and 1.02 more inches of ideal height, on average. Zero is not in the interval, which agrees with the test in Step 5. One is in the interval, so a slope of 1 (an extra inch of ideal height for each extra inch of height) is a plausible value.
If your numbers don’t match
| What you see | What went wrong |
|---|---|
| Intercept 17.4, slope 0.726 | The variables are swapped: ideal height is the dependent variable |
| A row for each height in the coefficients table, and no single slope | The predictor is in Factors. Move it to Covariates |
| The residual plot slopes upward | You’re looking at the second plot, residuals against the response. Use the first, against Fitted |
| Your r is positive but your slope is negative | Jamovi’s R is never negative. Give r the slope’s sign |
| Your interval is 0.919 ± 0.102 | You used \(z^* = 1.96\). Use \(t^*\) with df \(= n - 2 = 156\) |
| df 157 | Two parameters are estimated, the intercept and the slope, so df \(= n - 2\) |
Practice on a second question
Can you predict how many minutes a student exercised yesterday (exercise_min) from how much sleep they get on a school night (sleep_weeknight)? Sleep is the predictor. Two students skipped the sleep question, so 158 remain.
- You should get \(\widehat{\text{exercise}} = 6.84 + 6.54 \times \text{sleep}\), with \(R^2 = 0.019\).
- For the slope, \(T = 6.5445 / 3.8127 = 1.72\) on 156 df, with \(p = 0.088\).
- The 95% interval for the slope is \(6.54 \pm 1.975 \times 3.8127\), about \(-0.99\) to \(14.08\) minutes per hour of sleep.
The p-value is above 0.05 and the interval contains 0, so there isn’t convincing evidence of a linear relationship between sleep and exercise. A flat line fits these data about as well.