Compare Means
Analyze → Compare Means. These procedures ask whether the mean of a scale variable differs — between groups, against a fixed value, or across paired measurements.
Means
When to use it. To get summary statistics for a scale variable broken down by the categories of one or more factors — a descriptive breakdown, not a test.
Dialog. A Dependent scale variable and one or more Independent (grouping) variables.
Output. A table of the dependent's mean, N and standard deviation within each group (and overall).
Example. Mean SystolicBP by StudyZone and by SmokingStatus.
T Tests
All three live under Compare Means and each can be run one- or two-tailed (set in the Options section).
One-Sample T Test
When. Compare a variable's mean against a known test value.
Dialog. The Test Variable(s) and the Test Value.
Output. The mean, the t statistic, degrees of freedom, the significance, and the confidence interval of the difference.
Example. Is mean BMI different from 25 (the overweight threshold)?
Independent-Samples T Test
When. Compare the means of two independent groups.
Dialog. A Test Variable and a Grouping Variable (define the two groups by their values).
Output. Group statistics, Levene's test for equal variances, and the t-test reported both ways (equal and unequal variances assumed) with the CI of the difference.
Example. Does mean FastingGlucose_mmolL differ between Diabetic = Yes and No?
Permutation test
Tick Permutation test to also test the mean difference by randomization: the group labels are reshuffled over and over, and the permutation p is simply the share of relabelings whose mean difference is at least as extreme as the one observed. Nothing is assumed about distributions — no normality, no equal variances — which makes it the methods-course answer for small samples and odd-shaped data, while still testing the mean difference (unlike Mann–Whitney, which tests a rank-based shift).
How it runs, automatically:
- Small samples are exact: when every possible group assignment can be enumerated (up to a million arrangements — balanced designs up to about n = 22), the table says Exact with the arrangement count, and the p is the exact share, not an estimate. An exact p can never be 0 — the observed assignment is always one of the arrangements.
- Larger samples are Monte Carlo: the table says Monte Carlo with the resample count (default 10,000, adjustable in the dialog), the p is estimated as (b+1)/(m+1), and Lower/Upper bracket the simulation uncertainty of that p at 99% — how much it could move with a different seed, not an interval for the effect. A fixed Seed makes the run exactly reproducible; rerunning with the same seed gives the same p to the last digit.
The test direction follows the dialog's tails setting (one-tailed counts extremes in the observed direction, like the t test's one-tailed p). Permutation is about rearranging the observed cases, so it is not available while Weight Cases is on.
Paired-Samples T Test
When. Compare two measurements on the same cases.
Dialog. One or more variable pairs.
Output. The paired differences' mean, the t statistic, df, significance and CI.
Example. SystolicBP vs DiastolicBP (illustrative paired comparison).
Comparing two measurement methods on the same subjects? The paired t answers only whether the average difference is zero — the agreement question (how far apart the methods get case by case) is the Bland-Altman analysis's job.
Equivalence T Test (TOST)
Analyze → Compare Means → Equivalence T Test (TOST)…
When to use it. To show two means are practically equivalent — a question a t test cannot answer: "not significantly different" is not "equivalent". You declare how big a difference would still be negligible (the equivalence bounds), and the TOST procedure (two one-sided tests) tests whether the true difference lies inside those bounds. Clinical and, increasingly, psychology journals ask for exactly this when a study's point is that a difference is absent or ignorable.
Dialog. The same three designs as the classical t tests, behind a One-Sample / Paired / Independent selector, plus:
- Bounds — the lower and upper equivalence bounds (lower < upper; they need not be symmetric). For a one-sample test they are centered on the Test Value — bounds of −1.5 to 1.5 with test value 100 declare "anything between 98.5 and 101.5 is equivalent to 100".
- Bound units — Raw units (the default: the variable's own scale) or Cohen's d, converted to raw units per design with the sample standardizer. Raw bounds are preferred when the scale is meaningful: d-scale bounds move with the sample's own spread, a caution the output note repeats.
- Alpha — the level of each one-sided test (default 0.05). The interval shown is the 1 − 2α confidence interval (90% at the default), the standard TOST presentation.
Output. Two tables:
- Equivalence Test (TOST) — per variable (or pair; the independent design keeps the familiar two rows, equal variances assumed / not assumed): the mean difference, its standard error and df, both one-sided tests (t and one-sided significance against each bound), the TOST Sig. — the larger of the two one-sided p's — and a printed Decision: Equivalent when TOST Sig. < α, else Not equivalent.
- Equivalence Bounds and Confidence Interval — the bounds in raw units (as converted, when declared in Cohen's d) beside the 1 − 2α CI of the difference. The two views agree by construction: the difference is equivalent at α exactly when the interval lies inside the bounds.
Example. A generic drug's mean SystolicBP effect vs the brand compound, with equivalence declared as ±3 mmHg: TOST Sig. = 0.02 → Equivalent — the 90% CI of the difference sits entirely inside −3…3.
Reading it with the t test. The four corners are all possible: a difference can be significant yet equivalent (precisely estimated and trivially small), or non-significant yet not equivalent (too little data to claim anything). Run both when the audience expects both.
One-Way ANOVA
When to use it. Compare the means of a scale variable across three or more groups.
Dialog. A Dependent scale variable and a Factor (the grouping variable). The Options section adds:
- Levene's test of homogeneity of variances;
- the Welch robust test (for unequal variances);
- post-hoc comparisons — Bonferroni, Scheffé, Tukey HSD;
- a-priori contrasts (custom weighted comparisons).
Output. The ANOVA table (between/within sums of squares, F, significance), plus any homogeneity test, post-hoc table and contrast results you requested.
Example. Mean SystolicBP across the levels of EducationLevel, with Tukey HSD to see which education levels differ.
Bayesian t test
A Bayesian counterpart to the three t tests, under Analyze → Bayesian → t Test…. Where a classical t test gives a p-value — which can only ever fail to reject the null, never support it — a Bayesian t test reports a Bayes factor that grades the evidence in either direction.
When to use it. Whenever you would run a one-sample, paired or independent-samples t test but want to quantify evidence for the null as well as against it, or want a posterior on the effect size rather than a confidence interval. (To argue equivalence against declared bounds — the frequentist route journals usually ask for — see the Equivalence T Test (TOST) above.)
Dialog. A One-Sample / Paired / Independent selector (the same three designs as the classical t tests), the test variables, and:
- Prior scale r — the width of the Cauchy prior on the standardized effect size δ; the default 0.707 (≈ 1/√2) is the standard "medium" scale.
- Credible % — the level for the posterior interval of δ (default 95).
Output. A Bayesian t Test table with, per variable/pair:
- BF₁₀ — the evidence for a difference, and BF₀₁ = 1/BF₁₀ — the evidence for the null. A BF₁₀ of 6 means the data are 6× more likely under a real effect; a BF₁₀ of 0.2 (BF₀₁ = 5) means they are 5× more likely under the null.
- Evidence — a verbal category for the Bayes factor (Anecdotal, Moderate, Strong, Very strong, Extreme), tagged with the favoured hypothesis.
- Median δ and its credible interval — the posterior for the standardized effect size.
Example. A paired Bayesian t test of Pre vs Post: a BF₁₀ of 0.3 ("Moderate (H0)") is positive evidence that the intervention made no difference — a conclusion a non-significant p-value could not have supported.
Bayesian correlation
Also under Analyze → Bayesian → Correlation…: the Bayesian counterpart to bivariate correlation. Pick two or more numeric variables; each pair is reported with its Pearson r, the BF₁₀ / BF₀₁ (evidence for / against a correlation) and evidence category, and the posterior median and credible interval of ρ.
- Prior width κ — the stretched-beta prior on ρ; the default 1 is a uniform prior on −1…1. (Smaller κ pulls the prior toward 0.)
- Credible % — the level for the posterior interval of ρ.
A BF₁₀ well above 1 is evidence the two variables are correlated; a BF₀₁ above 1 is evidence they are not — the latter being something a significance test on r cannot deliver.
Bayesian ANOVA
Under Analyze → Bayesian → ANOVA…: the Bayesian counterpart to the one-way ANOVA. Pick one or more numeric dependent variables and a factor; each is reported with its group count, η² (the variance explained), and the BF₁₀ / BF₀₁ for the group-means model against the no-effect null — i.e. whether the factor matters at all.
- Prior scale r — the Cauchy prior on the standardized group effects; the default 0.5 is the standard "medium" fixed-effect scale.
A BF₁₀ above 1 is evidence the groups differ; a BF₀₁ above 1 is evidence they do not — direct support for a null that an ANOVA F test cannot provide.
Bayesian linear regression
Under Analyze → Bayesian → Linear Regression…: the Bayesian counterpart to linear regression. Pick a dependent variable and one or more numeric predictors. It reports:
- Coefficients — each predictor's posterior mean (the OLS estimate under the diffuse prior) and its credible interval.
- Model summary — N, the predictor count, R², and the residual variance posterior (mean and credible interval).
- Bayes factor — BF₁₀ / BF₀₁ for the full model against the intercept-only null: whether the predictors collectively matter.
Controls: a Prior scale r (the g-prior on the effects; default √2/4 ≈ 0.354) and a Credible % for the intervals. A BF₁₀ above 1 favours the predictors; a BF₀₁ above 1 is evidence that an intercept-only model suffices.
How this is computed
This section names which method each procedure prints — the estimator, the statistic, its degrees of freedom, and the tie, missing-value and weight rules — and links the recorded convention that explains the choice. The full index is the convention inventory; every number here is validated against independent packages per the validation suite.
- T tests — one-sample, paired and independent t with t confidence intervals; the independent test prints both the pooled row (df n₁ + n₂ − 2) and the Welch row (Welch–Satterthwaite df) beside Levene's test, and never switches for you (both rows). Cohen's d uses the pooled n − 1 SD (paired: d_z on the SD of the differences), Hedges' g the factor 1 − 3/(4df − 1), and the CI on d the noncentral t (effect sizes).
- Levene's test — mean-centred, the original form (R and SciPy default to the median-centred Brown–Forsythe; set the centre to reproduce) (Levene).
- Equivalence (TOST) — bounds centred on the test value, the 1 − 2α interval, Welch by default (TOST).
- One-way ANOVA — the classic between / within partition (k − 1, N − k df); η², ε² and ω² in the Olejnik–Algina forms (ANOVA effect sizes); Welch's robust F*; planned contrasts both pooled and Welch–Satterthwaite; post hoc Bonferroni, Scheffé and Tukey HSD on the pooled within MS (post hoc).
- Bayesian t test / correlation / ANOVA / regression — JZS Bayes factors with the Cauchy prior scale r = 0.707, the stretched-beta prior width κ = 1 for ρ, the Zellner–Siow g-prior (validation).
Choosing among them
| Situation | Procedure |
|---|---|
| One mean vs a fixed number | One-Sample T Test |
| Two independent groups | Independent-Samples T Test |
| Two measurements, same cases | Paired-Samples T Test |
| Three or more groups | One-Way ANOVA |
| Just a breakdown, no test | Means |
| Show a difference is negligible (declared bounds) | Equivalence T Test (TOST) |
| Evidence for a null, or a Bayes factor | Bayesian t test |
| Two groups, no distributional assumptions, testing the mean itself | Independent-Samples T Test with the permutation test |
If a normality or variance assumption looks shaky (check it in Explore), consider the nonparametric equivalents — or keep the mean as the statistic and add the permutation test.