Skip to content
SPSS Tutorials

General Linear Model in SPSS: A Worked ANCOVA Example

Run a general linear model in SPSS with a worked ANCOVA example. Use practice data to compare adjusted means and check assumptions and model limits.

General linear model in SPSS, illustrated by three group bars and a conceptual covariate line on a glass chart.

The general linear model (GLM) is a statistical framework for explaining a numerical outcome using group membership, continuous predictors, or both. Analysis of covariance (ANCOVA) is one application: it compares group means while statistically adjusting for a measured covariate, such as a baseline score. Researchers use ANCOVA when they want to compare groups after accounting for a relevant starting difference, while checking assumptions about the covariate and the study design.

For example, if you want to compare customer-support training formats, your research question could be: Do the formats differ in average post-training response time after accounting for baseline response time? The workbook has 300 employee records, with 100 in each format: a self-paced guide, a live workshop, and a workshop plus coaching. Accounting for baseline helps you compare the formats at the same starting response time.

Data note: The workbook contains simulated employee records for practice.

The outcome is post_response_min, the group variable is training_group, and the covariate is baseline_response_min. Raw means describe the recorded post-training averages; adjusted means describe model predictions at a shared baseline value.

The general model is:

Y = Xβ + ε

Y contains the observed outcomes, X is the design matrix containing the predictors and intercept, and β contains the unknown coefficients. ε contains unexplained variation around the model’s mean. For this common-slope ANCOVA:

yᵢ = β₀ + βbbᵢ + β₁D₁ᵢ + β₂D₂ᵢ + εᵢ

yᵢ is an employee’s post-training response time and bᵢ is baseline response time, both in minutes. D₁ᵢ equals one for self-paced learning and zero otherwise; D₂ᵢ does the same for the live workshop. Workshop plus coaching is the reference group, matching the saved SPSS parameter table. β₁ and β₂ are adjusted differences from coaching in minutes. β₀ is the intercept, βb is the shared baseline slope, and εᵢ is the employee-specific error.

The steps below use SPSS Statistics 27 to check the baseline-by-training interaction before interpreting a common-slope comparison. You can read the GLM model explanation by IBM for more on specifying these terms.

When this general linear model is appropriate

This tutorial uses GLM Univariate for one continuous outcome, a categorical training factor and a baseline covariate. The adjusted comparison is interpreted at a common baseline value under the chosen model.

Your questionRelevant starting point
Compare independent-group means without a covariateOne-way ANOVA
Compare group means while accounting for baselineANCOVA, as demonstrated here
Model a binary outcome or a countConsider an appropriate generalised linear model; this continuous-outcome walkthrough is not that analysis.

A general linear model and a generalised linear model are different terms. For this ANCOVA, consider covariate timing, overlap between groups, residual behaviour and the group-by-baseline interaction. A non-significant interaction does not prove that slopes are identical. Sheffield’s ANCOVA guide discusses the assumptions behind adjusted comparisons.

Step 1: Download and import the Excel data

  1. Use the workbook download button above and download the SPSS/Amos practice files ZIP. Read the workbook’s Guide sheet.
  2. In SPSS, choose File → Open → Data and select the Excel workbook.
  3. Select Demo_Data, read variable names from the first row, and import A1:P301. Click OK.
SPSS Excel import dialog showing Demo_Data, first-row variable names and the A1:P301 range.
Figure 1. Step 1: use the Demo_Data worksheet rather than Guide or Worked_Calcs.

The initial import contains 300 cases and 16 variables. Later, saving diagnostic values adds columns; it does not add new employees.

Step 2: Check the variables and baseline values

  1. Open Variable View. Set training_group to Nominal, with labels 1 self-paced, 2 live workshop, and 3 workshop plus coaching.
  2. Set the two response-time variables to Scale and check that their values are numeric. Keep staff_id as an identifier.
  3. Return to Data View and confirm one employee per row.
SPSS Data View showing the imported customer-support employees and numeric analysis variables.
Figure 2. Step 2: check the imported records before specifying a model.

Inspect one employee. The first record has baseline response time 12.57 minutes and post-training response time 11.36 minutes. Subtracting post from baseline gives 1.21 minutes. That describes one person's observed improvement. It does not compare formats, adjust for baseline differences, or establish what would have happened without training.

SPSS confirms 100 employees in each group and 300 complete cases. Baseline means are 11.750 minutes for self-paced learning, 12.290 for the live workshop, and 11.698 for the workshop plus coaching. The overall baseline mean, used for the adjusted comparison, is 11.913 minutes. These small sample differences are one reason to distinguish observed and adjusted post-training means.

Use Analyze → Descriptive Statistics → Explore to inspect response times and baseline ranges by training group. A scatterplot of baseline against post-training response, distinguished by group, helps assess whether a straight-line relationship is plausible.

The overlap matters. If one format contained only employees with very low baseline times and another only very high times, an adjusted comparison at a common value could depend heavily on extrapolation. A model can print an adjusted mean even when few relevant employees support it. Compare the ranges and the distributions, not just their averages.

Step 3: Open General Linear Model → Univariate

  1. Choose Analyze → General Linear Model → Univariate.
  2. Keep this dialog open while assigning the three roles in the next step.

A general linear model models a numerical outcome as an additive combination of predictors, with extensions such as interactions. Ordinary linear regression, ANOVA, and ANCOVA fit within this family. For conventional confidence intervals and tests, the analysis makes assumptions about the errors around the fitted means.

A generalized linear model extends the framework by specifying an outcome distribution and a link between predictors and the expected outcome. Binary outcomes and counts often need that extension. You can read the Advanced Statistics 27 manual by IBM for more on that distinction. The names are similar, so writing only “GLM” can leave readers unsure which analysis you performed.

Our outcome is a positive time, but positivity alone does not decide the model. Check its distribution, its relationship with baseline, and especially the residuals. A strongly skewed time outcome with an unsuitable error pattern may require a transformation or another model. Choosing Univariate because the outcome happens to contain decimals is insufficient.

Step 4: Assign the outcome, group and covariate

  1. Move post_response_min into Dependent Variable.
  2. Move training_group into Fixed Factor(s).
  3. Move baseline_response_min into Covariate(s).
SPSS Univariate dialog with post_response_min as outcome, training_group as fixed factor and baseline_response_min as covariate.
Figure 3. Step 4: assign variables by their role in this ANCOVA.

The outcome is each employee's average first-response time after training, measured in minutes. Lower values mean quicker initial replies. The group variable identifies the training format. The covariate is average first-response time before training. A covariate is a measured predictor included to account for an existing relationship with the outcome.

VariableRole in this analysisInterpretation
post_response_minDependent variableAverage response time after training
training_groupFixed factor1 self-paced; 2 live; 3 workshop plus coaching
baseline_response_minCovariateAverage response time before training

Calling training a fixed factor means that these three named formats are the comparisons of interest. It does not mean that the values are constant across employees. Each person belongs to one group, and the model estimates group differences. You can read the GLM Univariate documentation by IBM for details on factors, covariates, and a single numerical outcome; the walkthrough here uses version 27.

ANCOVA adds a group comparison across all employees. Its adjusted means answer a specific question: what mean post-training response would this fitted model predict for each format at the same selected baseline value? Here we use the overall sample baseline mean. The software is making a model-based comparison, rather than changing anyone's recorded response time.

ANCOVA uses the same baseline reference for all three training groups before comparing predicted post-training response times.
Figure 4. The common baseline is a reference for prediction. The diagram is conceptual and contains no fitted effect sizes.

Step 5: Add and test the baseline-by-training interaction

  1. Click Model, select Build terms, and keep the intercept and Type III sums of squares.
  2. Set Type to Main effects. Select training_group and baseline_response_min in the left Factors & Covariates list, then click the middle transfer arrow to add them as separate main terms.
  3. Reselect both variables in the left list using Ctrl-click, choose Interaction, and click the middle transfer arrow to add their product. Do not leave the two right-hand model terms selected when adding the interaction. Check that the model contains the two main terms and baseline_response_min × training_group.
  4. Click Continue, then OK to run this interaction model.
SPSS Model dialog using Build terms, with baseline, training group and their interaction included.
Figure 5. Step 5: the interaction is added explicitly; the default factor model does not add this covariate interaction.

The standard common-slope ANCOVA assumes that the relationship between baseline and post-training response has the same slope in every training group. In ordinary language, an extra minute at baseline is associated with the same expected increase after training for each format. Group-specific intercepts still allow the fitted levels to differ.

An interaction asks whether the group difference changes across baseline values. Read its row in Tests of Between-Subjects Effects and inspect the relationships, rather than treating a nonsignificant test as proof of identical slopes. You can read the model specification guidance by IBM for more on these choices.

The actual interaction test gives F(2, 294) = 0.519, p = .596. The estimated baseline slopes are approximately 0.586 for self-paced learning, 0.613 for the live workshop, and 0.555 for workshop plus coaching. This run provides little evidence of a slope difference, so we proceed with the prespecified common-slope comparison while retaining the diagnostic caveat.

If a meaningful interaction were present, the next step would be to retain it and compare formats at defensible baseline values, preferably within their shared range. One pooled adjusted difference could hide a benefit for some employees and a disadvantage for others. The supplied common-slope example is interpreted only after this check.

Step 6: Return to the common-slope model

  1. Reopen Analyze → General Linear Model → Univariate, then Model → Build terms.
  2. Select only baseline_response_min × training_group in the right Model list, then click the middle left-pointing transfer arrow to remove it. The bottom Remove button is inactive in Build terms. Keep both main terms and the intercept, then click Continue.
SPSS Model dialog with Build terms selected and only baseline_response_min and training_group retained.
Figure 6. Step 6: retain the two main effects and remove their interaction for the common-slope model.

With the supplied data, the interaction result supports demonstrating the planned common-slope analysis. This simpler model compares training formats with one baseline slope, rather than estimating a different slope for every group.

Step 7: Request output, adjusted means and saved diagnostics

  1. Open Options. Select Descriptive statistics, Estimates of effect size, Parameter estimates, and Homogeneity tests. Click Continue.
  2. Open the separate EM Means dialog. Move training_group to Display Means for, select Compare main effects, and choose Bonferroni. Retain 95% confidence intervals and click Continue.
  3. In Save, request predicted values, residuals, and Cook’s distance, then click Continue. Automatic variable names gain suffixes after reruns, so identify the saved columns by their labels and the model that created them.
SPSS GLM Options dialog with descriptives, effect size, parameter estimates and homogeneity tests selected.
Figure 7. Step 7: request the tables needed for interpretation and diagnostic checks.
SPSS Estimated Marginal Means dialog with training_group, Compare main effects and Bonferroni selected.
Figure 8. Step 7: use EM Means for adjusted comparisons; the Post Hoc dialog is not the route used here.

Step 8: Run the model and read the adjusted comparison

  1. Click Paste to keep the analysis syntax, then run it. Alternatively, click OK in the completed dialog.
  2. In the Output Viewer, read Tests of Between-Subjects Effects for the training test and Estimated Marginal Means for adjusted means.
SPSS 27 output from the fitted customer-support ANCOVA.
Figure 9. Genuine output from the supplied synthetic dataset; use the accompanying tables and interpretation for readable values.
Training formatObserved post meanAdjusted post mean95% CI for adjusted mean
Self-paced guide11.70711.80211.591–12.012
Live workshop11.10010.87910.668–11.090
Workshop plus coaching9.8569.9829.771–10.193

All values are minutes. Adjusted means are evaluated at baseline = 11.913 minutes; each group has n = 100.

The SPSS Estimated Marginal Means table gives adjusted response times of 11.802, 10.879, and 9.982 minutes at the same baseline reference.
Figure 10. SPSS 27 estimated marginal means with 95% confidence intervals. These predictions use baseline response time of 11.9127 minutes.

The descriptive means summarize observed post-training times in each group. The estimated marginal means summarize predictions at the same baseline value. They can differ because the observed groups have slightly different baseline profiles, even with equal sample sizes. Neither set should be labelled “corrected data.” Both answer useful but different questions.

The training comparison gives F(2, 296) = 72.393, p < .001, with partial eta squared = .328. At the same baseline reference, the workshop-plus-coaching group has the lowest predicted post-training response time. Its adjusted mean is 1.820 minutes lower than the self-paced group. The Bonferroni-adjusted 95% confidence interval for that reduction is 1.456–2.184 minutes. The workshop-only group is 0.923 minutes below self-paced learning, with an adjusted interval of 0.558–1.288 minutes. These are results from the synthetic sample.

Notice the live workshop example: its raw mean is 11.100 minutes, whereas its adjusted mean is 10.879. Its employees began with a slightly slower average baseline, so comparing at the overall baseline reference lowers their modelled post-training mean. You can see the purpose of adjustment directly in this difference; it is not an automatic reward or penalty for belonging to a group.

A 95% confidence interval describes uncertainty in an estimated mean or difference under the model and sampling assumptions. It is not an interval containing 95% of employees' response times. Predicting one employee requires an individual prediction interval, which includes variation between people as well as uncertainty in the fitted average.

The training F-test assesses the joint null hypothesis that the adjusted group means are equal. It does not identify which pairs differ or tell you whether a difference matters operationally. Pairwise confidence intervals and the size of a difference in minutes help with those questions. If SPSS prints a significance value of .000, report p < .001 rather than claiming a probability of exactly zero.

Partial eta squared expresses the training sum of squares relative to that sum plus its associated error sum of squares. It is conditional on this model. Avoid saying that training explains that percentage of all real-world response time, or treating a conventional “large” label as a business decision. Minutes saved, uncertainty, workload, training cost, and study design remain relevant.

Step 9: Inspect residuals, overlap and influential observations

  1. For a residual scatterplot, choose Graphs → Legacy Dialogs → Scatter/Dot → Simple Scatter → Define. Put the saved residual on Y and its matching prediction on X.
  2. Use Analyze → Descriptive Statistics → Explore on the saved residual to request a histogram and normal Q-Q plot.
  3. Inspect Levene’s test, the baseline overlap, and Cook’s distance alongside the plots. Use variables saved by the common-slope model, not another run.

A residual is the observed response minus the model's predicted response. Plot residuals against predicted values and against baseline. Look for curves, a widening spread, or isolated observations that dominate the fit. A normal probability plot helps assess substantial departures from the normal-error approximation. Small deviations are less informative than a clear systematic pattern.

Levene's test addresses equality of group error variances in this setting, but a single test is not a full diagnostic assessment. Large samples can detect small departures, while small samples may miss consequential ones. Use the residual plots, group sizes, and substantive context together. You can read the Statistics Base 27 manual by IBM for details on saved predictions, residuals, and influence measures.

For the common-slope model, Levene’s test gives F(2, 297) = 0.246, p = .782. The adjustment reference of 11.913 minutes lies within the groups’ shared baseline interval of 6.60–18.10 minutes, so this reference does not extrapolate beyond any group’s observed range. The largest saved Cook’s distance is .0513, for employee 96. Cook’s distance describes how much an observation can influence the fitted model; inspect that employee’s measurements and position in the plots rather than automatically deleting the record.

The normal Q-Q plot broadly follows its reference line, with modest departures in the tails. The residual-versus-predicted plot shows a cloud around zero without a pronounced curve or funnel. Those observations support using the example to demonstrate the fitted model, but they do not prove normality or rule out influential records. The complete generated sample is retained, and any sensitivity analysis should be reported as an additional analysis rather than silently replacing it.

The native SPSS normal Q-Q plot for ANCOVA residuals broadly follows its reference line with modest tail departures.
Figure 11. Actual SPSS 27 Q-Q plot for the common-slope ANCOVA residuals. Inspect the tails as well as the middle of the plot.
The native SPSS ANCOVA residual-versus-predicted plot is centred around zero without a pronounced curve or funnel.
Figure 12. Actual SPSS 27 residual-versus-predicted plot. The absence of an obvious pattern is useful evidence, not a guarantee that every model assumption holds.

Independence comes mainly from study design. Employees sharing a manager, shift, or support team may have related outcomes. A spreadsheet row per person does not make those observations independent. A real clustered study may require a model that accounts for teams. Likewise, adjustment for one baseline measurement cannot remove every difference between self-selected training groups.

Step 10: Report the analysis and retain the files

Start a report by naming the outcome, group comparison, covariate, sample, and software. State how you assessed the interaction and diagnostics. Give adjusted means with intervals, the training test, an effect size, and the comparisons relevant to the question. Explain the direction using the outcome's units: lower response minutes mean faster replies.

A report of this example could read: “An ANCOVA in SPSS Statistics 27 compared post-training first-response time across three training formats using 300 simulated employee records, adjusting for baseline response time. The baseline-by-training interaction was not supported, F(2, 294) = 0.519, p = .596. In the common-slope model, adjusted means differed across formats, F(2, 296) = 72.393, p < .001, partial η² = .328. At baseline 11.913 minutes, adjusted post-training means were 11.802, 10.879, and 9.982 minutes for self-paced, workshop, and workshop-plus-coaching groups, respectively. The adjusted coaching-versus-self-paced reduction was 1.820 minutes, Bonferroni-adjusted 95% CI [1.456, 2.184].”

The example demonstrates a model workflow, not a finding about employees. For a real study, describe recruitment, allocation, measurement timing, missing-data handling, and any departures from the planned analysis. If training was not randomly allocated, use language about adjusted associations unless a defensible causal design supports stronger claims.

Before applying the steps to your own work, try this check: would the analysis still answer your question if training differences changed sharply across baseline? It would require the interaction model and conditional comparisons. Recognizing that change is more useful than memorizing which box to tick. Save the workbook, syntax, output, and a short explanation of the model together so that someone else can follow the same reasoning.

Frequently asked questions

Are adjusted means the observed group averages?

No. Observed means describe the actual groups. Estimated marginal means are model-based predictions at specified covariate values. Report which values were used and avoid interpreting predictions far outside the groups’ observed baseline ranges.

What if the group-by-covariate interaction matters?

The group comparison then depends on the covariate. Retain a justified interaction model and examine conditional comparisons at meaningful, supported covariate values. A single common-slope adjusted difference may conceal that variation.

Does adjusting for baseline establish a causal training effect?

Adjustment alone does not establish causation. Allocation, timing, measurement and remaining confounding affect interpretation. In an observational study, describe adjusted associations unless the design and assumptions justify a causal claim.

Check collinearity when adding several related covariates, and define the predictor and outcome roles before choosing variables.

Found this guide useful? Share on LinkedIn

Discussion

Leave a Reply

Your email address will not be published. Required fields are marked *