PSPP Inferential and Modeling Procedures
Navigational Index
Exploratory Data Procedures
Inferential & Modeling Procedures (this page)
PSPP Inferential Analysis Procedures
This page presents PSPP’s inferential and modeling procedures — commands used to compare groups, test hypotheses, and fit simple statistical models. It includes PSPP t‑test syntax, PSPP one‑way ANOVA syntax, the PSPP GLM version of ANOVA, a short example showing how to compute the p‑value for an F‑statistic, and an overview of PSPP’s nonparametric test syntax. Each section provides minimal, practical PSPP syntax and output so you can apply these methods directly to your own data.
This page explains how to run inferential tests in PSPP using syntax. The focus is entirely on syntax, not the GUI. psppire is mentioned only to show where the equivalent menu item is located, so users who prefer the GUI can find the same procedure. All examples, instructions, and workflows on this page use PSPP syntax I added some screenshots of the psppire menus to help.
A short example of PSPP syntax for running a t‑test is:
T-TEST /TESTVAL=0 /VARIABLES=score.How to Run a T-TEST in PSPP
This section shows a PSPP t-test example using syntax.
The T-TEST procedure compares means between one or two groups or between two related measurements. PSPP supports one-sample, independent samples, and paired-samples T-tests.
Three Examples of T-test
Data:
group score pretest posttest 1 42 40 48 1 55 52 58 1 47 45 50 2 60 58 62 2 65 63 68 2 70 67 72How to Run the One-sample T-test
This command can be found in the PSPPIRE GUI Data Editor menu at Analyze->Compare Means->One Sample T Test.
Code:
T-TEST /TESTVAL = 50 /VARIABLES = score. T-TEST /GROUPS = group(1 2) /VARIABLES = score. T-TEST /PAIRS = pretest WITH posttest.Output:
DATA LIST LIST /group score pretest posttest. Reading free-form data from INLINE. ╭────────┬──────╮ │Variable│Format│ ├────────┼──────┤ │group │F8.0 │ │score │F8.0 │ │pretest │F8.0 │ │posttest│F8.0 │ ╰────────┴──────╯ BEGIN DATA 1 42 40 48 1 55 52 58 1 47 45 50 2 60 58 62 2 65 63 68 2 70 67 72 END DATA. LIST. Data List ╭─────┬─────┬───────┬────────╮ │group│score│pretest│posttest│ ├─────┼─────┼───────┼────────┤ │ 1.00│42.00│ 40.00│ 48.00│ │ 1.00│55.00│ 52.00│ 58.00│ │ 1.00│47.00│ 45.00│ 50.00│ │ 2.00│60.00│ 58.00│ 62.00│ │ 2.00│65.00│ 63.00│ 68.00│ │ 2.00│70.00│ 67.00│ 72.00│ ╰─────┴─────┴───────┴────────╯ T-TEST /TESTVAL = 50 /VARIABLES = score. One-Sample Statistics ╭─────┬─┬─────┬──────────────┬─────────╮ │ │N│ Mean│Std. Deviation│S.E. Mean│ ├─────┼─┼─────┼──────────────┼─────────┤ │score│6│56.50│ 10.67│ 4.36│ ╰─────┴─┴─────┴──────────────┴─────────╯ One-Sample Test ╭─────┬──────────────────────────────────────────────────────────────────────────────────╮ │ │ Test Value = 50 │ │ ├────┬──┬───────────────┬───────────────┬──────────────────────────────────────────┤ │ │ │ │ │ │ 95% Confidence Interval of the Difference│ │ │ │ │ │ ├─────────────────────┬────────────────────┤ │ │ t │df│Sig. (2-tailed)│Mean Difference│ Lower │ Upper │ ├─────┼────┼──┼───────────────┼───────────────┼─────────────────────┼────────────────────┤ │score│1.49│ 5│ .196│ 6.50│ -4.70│ 17.70│ ╰─────┴────┴──┴───────────────┴───────────────┴─────────────────────┴────────────────────╯How to Do the Independent Samples T-Test
This command can be found in the PSPPIRE Data Editor menus at Analyze-> Compare Means->Independent Samples T Test.
T-TEST /GROUPS = group(1 2) /VARIABLES = score. Group Statistics ╭───────────┬─┬─────┬──────────────┬─────────╮ │ Group│N│ Mean│Std. Deviation│S.E. Mean│ ├───────────┼─┼─────┼──────────────┼─────────┤ │score 1.00 │3│48.00│ 6.56│ 3.79│ │ 2.00 │3│65.00│ 5.00│ 2.89│ ╰───────────┴─┴─────┴──────────────┴─────────╯ Independent Samples Test ╭─────────────────────────────────┬────────────────────────────────────────┬───────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │ │ Levene's Test for Equality of Variances│ T-Test for Equality of Means │ │ ├──────────────────┬─────────────────────┼─────┬────┬───────────────┬───────────────┬─────────────────────┬──────────────────────────────────────────┤ │ │ │ │ │ │ │ │ │ 95% Confidence Interval of the Difference│ │ │ │ │ │ │ │ │ ├─────────────────────┬────────────────────┤ │ │ F │ Sig. │ t │ df │Sig. (2-tailed)│Mean Difference│Std. Error Difference│ Lower │ Upper │ ├─────────────────────────────────┼──────────────────┼─────────────────────┼─────┼────┼───────────────┼───────────────┼─────────────────────┼─────────────────────┼────────────────────┤ │score Equal variances assumed │ .29│ .621│-3.57│4.00│ .023│ -17.00│ 4.76│ -30.22│ -3.78│ │ Equal variances not assumed│ │ │-3.57│3.74│ .026│ -17.00│ 4.76│ -30.59│ -3.41│ ╰─────────────────────────────────┴──────────────────┴─────────────────────┴─────┴────┴───────────────┴───────────────┴─────────────────────┴─────────────────────┴────────────────────╯How to Do the Paired Samples T-test
This command can be found in the PSPPIRE Data Editor menus at Analyze-> Compare Means->Paired Samples T Test.
T-TEST /PAIRS = pretest WITH posttest. Paired Sample Statistics ╭───────────────┬─┬─────┬──────────────┬─────────╮ │ │N│ Mean│Std. Deviation│S.E. Mean│ ├───────────────┼─┼─────┼──────────────┼─────────┤ │Pair 1 pretest │6│54.17│ 10.46│ 4.27│ │ posttest│6│59.67│ 9.58│ 3.91│ ╰───────────────┴─┴─────┴──────────────┴─────────╯ Paired Samples Correlations ╭─────────────────────────┬─┬───────────┬────╮ │ │N│Correlation│Sig.│ ├─────────────────────────┼─┼───────────┼────┤ │Pair 1 pretest & posttest│6│ .994│.000│ ╰─────────────────────────┴─┴───────────┴────╯ Paired Samples Test ╭─────────────────────────┬─────────────────────────────────────────────────────────────────────────┬─────┬──┬───────────────╮ │ │ Paired Differences │ │ │ │ │ ├─────┬──────────────┬─────────┬──────────────────────────────────────────┤ │ │ │ │ │ │ │ │ 95% Confidence Interval of the Difference│ │ │ │ │ │ │ │ ├─────────────────────┬────────────────────┤ │ │ │ │ │ Mean│Std. Deviation│S.E. Mean│ Lower │ Upper │ t │df│Sig. (2-tailed)│ ├─────────────────────────┼─────┼──────────────┼─────────┼─────────────────────┼────────────────────┼─────┼──┼───────────────┤ │Pair 1 pretest - posttest│-5.50│ 1.38│ .56│ -6.95│ -4.05│-9.77│ 5│ .000│ ╰─────────────────────────┴─────┴──────────────┴─────────┴─────────────────────┴────────────────────┴─────┴──┴───────────────╯The T‑test compares means and reports whether the observed difference is larger than what would be expected by chance. PSPP reports the t‑value, degrees of freedom, and the two‑tailed significance level (p‑value). A small p‑value indicates that the difference between means is unlikely to be due to sampling variation alone. For independent‑samples tests, PSPP also reports Levene’s test for equality of variances; use the appropriate row based on that result. For paired‑samples tests, the difference is computed within subjects.
Back to topHow to Run a Oneway Analysis of Variance (ONEWAY)
The PSPP
ONEWAYprocedure tests whether the mean of a numeric variable differs across two or more independent groups. It is the simplest form of ANOVA and is useful when you have one factor (a categorical variable) and one dependent variable. PSPP produces the standard ANOVA table along with optional descriptive statistics, homogeneity tests, and post‑hoc comparisons.ONEWAYoperates on the active dataset, so you must read data into PSPP before running the procedure. Once the data is loaded,ONEWAYprovides a quick way to compare group means and determine whether any differences are statistically significant.Using psppire for Oneway: Run a one-way ANOVA through Analyze-> Compare Means ->One-Way ANOVA.
PSPPIRE supports selecting the dependent variable and factor, requesting descriptive statistics, and choosing post‑hoc tests. Options not available in the GUI can still be added using PSPP syntax in the Syntax Editor.
psppire displays the same tables as the syntax version.
DATA LIST LIST /group score hours gpa passed major age. BEGIN DATA 1 72 3 2.8 1 1 19 1 75 4 3.0 1 1 20 1 68 2 2.5 0 1 18 2 81 5 3.4 1 2 21 2 79 4 3.2 1 2 22 2 74 3 3.0 0 2 20 3 90 6 3.8 1 3 23 3 88 5 3.6 1 3 22 3 85 5 3.5 1 3 21 END DATA. LIST. * Save the data. SAVE OUTFILE='example2.sav'. ONEWAY score BY group /STATISTICS DESCRIPTIVES /POSTHOC = TUKEY ALPHA(.05).Reading free-form data from INLINE. Data List +-----+-----+-----+----+------+-----+-----+ |group|score|hours| gpa|passed|major| age | +-----+-----+-----+----+------+-----+-----+ | 1.00|72.00| 3.00|2.80| 1.00| 1.00|19.00| | 1.00|75.00| 4.00|3.00| 1.00| 1.00|20.00| | 1.00|68.00| 2.00|2.50| .00| 1.00|18.00| | 2.00|81.00| 5.00|3.40| 1.00| 2.00|21.00| | 2.00|79.00| 4.00|3.20| 1.00| 2.00|22.00| | 2.00|74.00| 3.00|3.00| .00| 2.00|20.00| | 3.00|90.00| 6.00|3.80| 1.00| 3.00|23.00| | 3.00|88.00| 5.00|3.60| 1.00| 3.00|22.00| | 3.00|85.00| 5.00|3.50| 1.00| 3.00|21.00| +-----+-----+-----+----+------+-----+-----+ +--------+------+ |Variable|Format| +--------+------+ |group |F8.0 | |score |F8.0 | |hours |F8.0 | |gpa |F8.0 | |passed |F8.0 | |major |F8.0 | |age |F8.0 | +--------+------+ Descriptives +-----------+-+-----+-----------+-------+---------------------+-------+-------+ | | | | | | 95% Confidence | | | | | | | | | Interval for Mean | | | | | | | | +----------+----------+ | | | | | | Std. | Std. | Lower | Upper | | | | group|N| Mean| Deviation | Error | Bound | Bound |Minimum|Maximum| +-----------+-+-----+-----------+-------+----------+----------+-------+-------+ |score 1.00 |3|71.67| 3.51| 2.03| 62.94| 80.39| 68.00| 75.00| | 2.00 |3|78.00| 3.61| 2.08| 69.04| 86.96| 74.00| 81.00| | 3.00 |3|87.67| 2.52| 1.45| 81.42| 93.92| 85.00| 90.00| | Total|9|79.11| 7.52| 2.51| 73.33| 84.89| 68.00| 90.00| +-----------+-+-----+-----------+-------+----------+----------+-------+-------+ ANOVA +--------------------+--------------+--+-----------+-----+----+ | |Sum of Squares|df|Mean Square| F |Sig.| +--------------------+--------------+--+-----------+-----+----+ |score Between Groups| 389.56| 2| 194.78|18.45|.003| | Within Groups | 63.33| 6| 10.56| | | | Total | 452.89| 8| | | | +--------------------+--------------+--+-----------+-----+----+ Multiple Comparisons (score) +--------------------------+-----------------+--------+----+------------------+ | | | | | 95% Confidence | | | | | | Interval | | | | | +---------+--------+ | (I) (J) | Mean Difference | Std. | | Lower | Upper | | Family Family | (I - J) | Error |Sig.| Bound | Bound | +--------------------------+-----------------+--------+----+---------+--------+ |Tukey 1.00 2.00 | -6.33| 2.65|.118| -14.47| 1.81| |HSD 3.00 | -16.00| 2.65|.002| -24.14| -7.86| | -------------------+-----------------+--------+----+---------+--------+ | 2.00 1.00 | 6.33| 2.65|.118| -1.81| 14.47| | 3.00 | -9.67| 2.65|.025| -17.81| -1.53| | -------------------+-----------------+--------+----+---------+--------+ | 3.00 1.00 | 16.00| 2.65|.002| 7.86| 24.14| | 2.00 | 9.67| 2.65|.025| 1.53| 17.81| +--------------------------+-----------------+--------+----+---------+--------+The data set read correctly. The ONEWAY procedure ANOVA table shows that the group means are significantly different (p=0.003). Tukey post hoc comparisons indicate that family 1 and 3 differ signifcantly as do family 2 and 3. But family 1 and 2 do not differ significantly.
Back to topHow to Run a Oneway Analysis of Variance with GLM
Another way to run a Oneway Analysis of Variance is with the
GLMprocedure.GLMstands for General Linear Model. For a single factor the model is the same as for theONEWAYcommand.GLMdoesn't have all the extra statistics and comparisons, though.PSPPIRE does not have a menu for GLM. Thus in order to run this command it needs to be entered in the Syntax Editor and Run from there.
DATA LIST LIST /group score hours gpa passed major age. BEGIN DATA 1 72 3 2.8 1 1 19 1 75 4 3.0 1 1 20 1 68 2 2.5 0 1 18 2 81 5 3.4 1 2 21 2 79 4 3.2 1 2 22 2 74 3 3.0 0 2 20 3 90 6 3.8 1 3 23 3 88 5 3.6 1 3 22 3 85 5 3.5 1 3 21 END DATA. LIST. * Save the data. SAVE OUTFILE='example2.sav'. GLM score BY group /DESIGN = group. EXECUTE.Reading free-form data from INLINE. +--------+------+ |Variable|Format| +--------+------+ |group |F8.0 | |score |F8.0 | |hours |F8.0 | |gpa |F8.0 | |passed |F8.0 | |major |F8.0 | |age |F8.0 | +--------+------+ Data List +-----+-----+-----+----+------+-----+-----+ |group|score|hours| gpa|passed|major| age | +-----+-----+-----+----+------+-----+-----+ | 1.00|72.00| 3.00|2.80| 1.00| 1.00|19.00| | 1.00|75.00| 4.00|3.00| 1.00| 1.00|20.00| | 1.00|68.00| 2.00|2.50| .00| 1.00|18.00| | 2.00|81.00| 5.00|3.40| 1.00| 2.00|21.00| | 2.00|79.00| 4.00|3.20| 1.00| 2.00|22.00| | 2.00|74.00| 3.00|3.00| .00| 2.00|20.00| | 3.00|90.00| 6.00|3.80| 1.00| 3.00|23.00| | 3.00|88.00| 5.00|3.60| 1.00| 3.00|22.00| | 3.00|85.00| 5.00|3.50| 1.00| 3.00|21.00| +-----+-----+-----+----+------+-----+-----+ Tests of Between-Subjects Effects +---------------+-----------------------+--+-----------+-------+----+ | |Type III Sum Of Squares|df|Mean Square| F |Sig.| +---------------+-----------------------+--+-----------+-------+----+ |Corrected Model| 389.56| 2| 194.78| 18.45|.003| |Intercept | 56327.11| 1| 56327.11|5336.25|.000| |group | 389.56| 2| 194.78| 18.45|.003| |Error | 63.33| 6| 10.56| | | |Total | 56780.00| 9| | | | |Corrected Total| 452.89| 8| | | | +---------------+-----------------------+--+-----------+-------+----+GLM includes an Intercept term that
ONEWAYdoes not display, but ANOVA results are identical when the intercept is left in. On this dataset both procedures give F = 18.45 with 2 and 6 degrees of freedom) and p=0.003.The default sum of squares are SSTYPE 3. Types 1 and 2 are also available as options to the GLM command.
Yes, GLM has a subcommand to remove the intercept, but doing so changes the model and the results dramatically. Keeping the intercept produces output that matches
Back to topONEWAY.How to Run NPAR TESTS (PSPP Non-parametric syntax)
Nonparametric tests generally work on ranks rather than raw values, although some nonparametric procedures operate on counts, medians, or signs (such as the median or signs tests) instead. They make few assumptions about the data distributions, so if you have data that is not normally-distributed, consider a nonparametric test.
PSPP includes exact methods for nonparametric tests when exact computation is feasible. Exact tests are useful for small samples where asymptotic approximations may not be reliable.
The following examples show several commonly used nonparametric tests available in PSPP, including the Mann–Whitney, Wilcoxon signed‑rank, Kruskal–Wallis, and Median tests.
This command cannot be found in the PSPPIRE Data Editor menus at Analyze->Non-Parametric Statistic. It is syntax only, but can be run in the Syntax Editor.
How to Compute the MANN-WHITNEY (M-W) Test (Two Independent Groups)
Code:
DATA LIST LIST /score group. BEGIN DATA 12 1 15 1 18 1 20 1 14 2 17 2 19 2 22 2 END DATA. NPAR TESTS /MANN-WHITNEY = score BY group(1, 2).Output:
DATA LIST LIST /score group. Reading free-form data from INLINE. ╭────────┬──────╮ │Variable│Format│ ├────────┼──────┤ │score │F8.0 │ │group │F8.0 │ ╰────────┴──────╯ BEGIN DATA 12 1 15 1 18 1 20 1 14 2 17 2 19 2 22 2 END DATA. NPAR TESTS /MANN-WHITNEY = score BY group(1, 2). Ranks ╭───────────┬─┬─────────┬────────────╮ │ │N│Mean Rank│Sum of Ranks│ ├───────────┼─┼─────────┼────────────┤ │score 1.00 │4│ 4.00│ 16.00│ │ 2.00 │4│ 5.00│ 20.00│ │ Total│8│ │ │ ╰───────────┴─┴─────────┴────────────╯ Test Statistics ╭─────┬──────────────┬──────────┬────┬──────────────────────╮ │ │Mann-Whitney U│Wilcoxon W│ Z │Asymp. Sig. (2-tailed)│ ├─────┼──────────────┼──────────┼────┼──────────────────────┤ │score│ 6.00│ 16.00│-.58│ .564│ ╰─────┴──────────────┴──────────┴────┴──────────────────────╯PSPP will report:
The U statistic, the Z value, the asymptotic significance and, when requested using the
/EXACTsubcommand, the exact significance.A small p‑value indicates that the two groups differ in their distributions. A large p-value suggest that that two groups don't differ.
How to Compute the WILCOXON SIGNED-RANK (Matched Pairs)
The Wilcoxon signed‑rank test compares two related measurements from the same subjects. It is a nonparametric alternative to the paired‑samples t‑test.
This command appears in the PSPPIRE Data Editor menus at Analyze-> Non-Parametric Statistics->2 Related Samples and select Wilcoxon.
Code:
DATA LIST LIST /before after. BEGIN DATA 12 15 18 20 14 17 19 21 16 18 END DATA. NPAR TESTS /WILCOXON = before WITH after (PAIRED).Output:
DATA LIST LIST /before after. Reading free-form data from INLINE. ╭────────┬──────╮ │Variable│Format│ ├────────┼──────┤ │before │F8.0 │ │after │F8.0 │ ╰────────┴──────╯ BEGIN DATA 12 15 18 20 14 17 19 21 16 18 END DATA. NPAR TESTS /WILCOXON = before WITH after (PAIRED). Ranks ╭─────────────────────────────┬─┬─────────┬────────────╮ │ │N│Mean Rank│Sum of Ranks│ ├─────────────────────────────┼─┼─────────┼────────────┤ │before - after Negative Ranks│5│ 3.00│ 15.00│ │ Positive Ranks│0│ NaN│ .00│ │ Ties │0│ │ │ │ Total │5│ │ │ ╰─────────────────────────────┴─┴─────────┴────────────╯ Test Statistics ╭──────────────────────┬──────────────╮ │ │before - after│ ├──────────────────────┼──────────────┤ │Z │ -2.07│ │Asymp. Sig. (2-tailed)│ .038│ ╰──────────────────────┴──────────────╯PSPP reports:
- the Z statistic
- the number of positive ranks, negative ranks, and ties
- the sum of ranks and mean ranks for each direction
PSPP reports the Z value, along with the mean ranks and sum of ranks for positive and negative differences. In this example all differences are negative, so PSPP will show zero positive ranks and a nonzero sum of negative ranks. Exact significance values are available when requested using the /EXACT subcommand.
A small p‑value indicates that the paired measurements differ systematically.
How to Compute a One-Sample Wilcoxon Test (Special Case of Paired Samples)
PSPP does not provide a separate one‑sample Wilcoxon command. However, the one‑sample test is a special case of the paired Wilcoxon signed‑rank test (Conover, Practical Nonparametric Statistics, 1971).
To test whether the median of a single variable equals a hypothesized value, compute a constant variable equal to the hypothesized value and use the paired form of the test:
PSPP Syntax:DATA LIST LIST /score. BEGIN DATA 12 15 18 14 17 END DATA. COMPUTE null = 15. NPAR TESTS /WILCOXON = score WITH null (PAIRED).PSPP Output:Reading free-form data from INLINE. +--------+------+ |Variable|Format| +--------+------+ |score |F8.0 | +--------+------+ Ranks +---------------------------+-+---------+------------+ | |N|Mean Rank|Sum of Ranks| +---------------------------+-+---------+------------+ |score - null Negative Ranks|2| 2.25| 4.50| | Positive Ranks|2| 2.75| 5.50| | Ties |1| | | | Total |5| | | +---------------------------+-+---------+------------+ Test Statistics +----------------------+------------+ | |score - null| +----------------------+------------+ |Z | -.18| |Asymp. Sig. (2-tailed)| .854| +----------------------+------------+This produces the same signed‑rank statistics as the one‑sample Wilcoxon test.
Verifying PSPP One-Sample Wilcoxon Results
R verification code:
> > x <- c(12, 15, 18, 14, 17) > wilcox.test(x, mu = 15, exact = FALSE, correct = FALSE) Wilcoxon signed rank test data: x V = 5.5, p-value = 0.8539 alternative hypothesis: true location is not equal to 15 > > proc.time() user system elapsed 0.089 0.049 0.127SAS and Python do not compute the Wilcoxon Signed‑Rank test for very small samples containing zero differences. PSPP and R both compute the test and produce identical results, confirming the correctness of PSPP’s paired‑with‑constant method.
Fortunately R, with some convincing, does produce the results that PSPP produces.
This also shows that you need enough sample size to compute some statistics, and both SAS and Python complain if the sample size is small.
How to Run the KRUSKAL-WALLIS Test
The Kruskal–Wallis test compares three or more independent groups using ranked data. It is a nonparametric alternative to one‑way ANOVA.
This command can be found in the PSPPIRE Data Editor menus at Analyze-> Non-Parametric Statistics->K Independent Samples and select Kruskal-Wallis H.
DATA LIST LIST /score group. BEGIN DATA 12 1 15 1 18 1 14 2 17 2 19 2 20 3 22 3 24 3 END DATA.Output:
NPAR TESTS /KRUSKAL-WALLIS = score BY group(1, 3). DATA LIST LIST /score group. Reading free-form data from INLINE. ╭────────┬──────╮ │Variable│Format│ ├────────┼──────┤ │score │F8.0 │ │group │F8.0 │ ╰────────┴──────╯ BEGIN DATA 12 1 15 1 18 1 14 2 17 2 19 2 20 3 22 3 24 3 END DATA. NPAR TESTS /KRUSKAL-WALLIS = score BY group(1, 3). Ranks ╭──────────────┬─┬─────────╮ │ │N│Mean Rank│ ├──────────────┼─┼─────────┤ │score 1.00│3│ 3.00│ │ 2.00│3│ 4.00│ │ 3.00│3│ 8.00│ │ Total │9│ │ ╰──────────────┴─┴─────────╯ Test Statistics ╭───────────┬─────╮ │ │score│ ├───────────┼─────┤ │Chi-Square │ 5.60│ │df │ 2│ │Asymp. Sig.│ .061│ ╰───────────┴─────╯PSPP reports the Chi‑square statistic, the mean ranks for each group, and the asymptotic significance. Exact significance values are available only when requested using the /EXACT subcommand.
A small p‑value indicates evidence that at least one group differs from the others in its distribution. A large p-value indicates no evidence that the two groups differ.
How to Compute the MEDIAN TEST
The Median test compares two independent groups by splitting the combined data at the overall median and testing whether the groups differ in how many observations fall above or below that median. It is a simple nonparametric alternative to the independent‑samples t‑test.
This command can be found in the PSPPIRE Data Editor menus at Analyze->Non-Parametric Statistics->K Independent Samples and select Median.
Code:
DATA LIST LIST /score group. BEGIN DATA 12 1 15 1 18 1 20 1 14 2 17 2 16 2 16 2 END DATA. NPAR TESTS /MEDIAN = score BY group(1, 2).Output:
DATA LIST LIST /score group. Reading free-form data from INLINE. ╭────────┬──────╮ │Variable│Format│ ├────────┼──────┤ │score │F8.0 │ │group │F8.0 │ ╰────────┴──────╯ BEGIN DATA 12 1 15 1 18 1 20 1 14 2 17 2 16 2 16 2 END DATA. NPAR TESTS /MEDIAN = score BY group(1, 2). Frequencies ╭──────────────┬─────────╮ │ │ group │ │ ├────┬────┤ │ │1.00│2.00│ ├──────────────┼────┼────┤ │score > Median│ 2│ 1│ │ ≤ Median│ 2│ 3│ ╰──────────────┴────┴────╯ Test Statistics ╭─────┬─┬──────┬──────────┬──┬───────────╮ │ │N│Median│Chi-Square│df│Asymp. Sig.│ ├─────┼─┼──────┼──────────┼──┼───────────┤ │score│8│ 16.00│ .53│ 1│ .465│ ╰─────┴─┴──────┴──────────┴──┴───────────╯PSPP reports:
- the overall median
- the counts above and below the median for each group
- the Chi‑square statistic
- the asymptotic significance
Exact significance values are available only when requested using the /EXACT subcommand.
A small p‑value indicates that the groups differ in how their values are distributed relative to the median.
See: PSPP Utilities which shows one way to compute statistics that are not in pspp.
Back to topPSPP Syntax - Modeling Procedures
After the inferential procedures, basic PSPP modeling commands are presented for fitting statistical relationships rather than testing group differences. The Modeling Procedures begin with PSPP’s
REGRESSIONcommand, which performs ordinary least squares estimation. This section presents a simple regression example and the standard output produced by PSPP.How to Run a Linear Regression
While
CROSSTABSsummarizes how categories combine, many analyses require modeling a quantitative outcome using one or more predictors.The
REGRESSIONcommand fits an ordinary least squares model to a continuous dependent variable using one or more numeric predictors. After checking the variables withFREQUENCIESandCROSSTABS, regression shows how the outcome relates to the predictors. PSPP provides the standard coefficients and model statistics used in OLS (ordinary least squares).This command can be found in the PSPPIRE Data Editor menus at Analyze-> Regression->Linear.
This is what the psppire Regression menu along with the sub-menu Statistics looks like.
![]()
Regression Menu with Statistics Menu
DATA LIST LIST / y x1 x2. BEGIN DATA 10 1 4.1 12 2 5.0 13 3 6.2 15 4 7.1 16 5 8.0 END DATA. LIST. REGRESSION /DEPENDENT = y /METHOD = ENTER x1 x2 /STATISTICS = COEFF R ANOVA /SAVE = PRED RESID.Output:
This
/SAVEoption above creates two additional variables:PRED1(predicted values) andRES1(residuals).Workflow Tip: Many statistics courses require students to examine and plot the residuals and predicted values to check model assumptions. Saving these values in PSPP's regression procedure provides exactly what those assignments need.
Data List ╭─────┬────┬────╮ │ y │ x1 │ x2 │ ├─────┼────┼────┤ │10.00│1.00│4.10│ │12.00│2.00│5.00│ │13.00│3.00│6.20│ │15.00│4.00│7.10│ │16.00│5.00│8.00│ ╰─────┴────┴────╯ Model Summary (y) ╭───┬────────┬─────────────────┬──────────────────────────╮ │ R │R Square│Adjusted R Square│Std. Error of the Estimate│ ├───┼────────┼─────────────────┼──────────────────────────┤ │.99│ .99│ .98│ .37│ ╰───┴────────┴─────────────────┴──────────────────────────╯ ANOVA (y) ╭──────────┬──────────────┬──┬───────────┬─────┬────╮ │ │Sum of Squares│df│Mean Square│ F │Sig.│ ├──────────┼──────────────┼──┼───────────┼─────┼────┤ │Regression│ 22.53│ 2│ 11.27│84.50│.012│ │Residual │ .27│ 2│ .13│ │ │ │Total │ 22.80│ 4│ │ │ │ ╰──────────┴──────────────┴──┴───────────┴─────┴────╯ Coefficients (y) ╭──────────┬────────────────────────────┬─────────────────────────┬────┬────╮ │ │ Unstandardized Coefficients│Standardized Coefficients│ │ │ │ ├───────────┬────────────────┼─────────────────────────┤ │ │ │ │ B │ Std. Error │ Beta │ t │Sig.│ ├──────────┼───────────┼────────────────┼─────────────────────────┼────┼────┤ │(Constant)│ 12.16│ 6.92│ .00│1.76│.177│ │x1 │ 2.60│ 2.20│ 1.72│1.18│.359│ │x2 │ -1.11│ 2.22│ -.73│-.50│.667│ ╰──────────┴───────────┴────────────────┴─────────────────────────┴────┴────╯ LIST. Data List ╭─────┬────┬────┬────┬─────╮ │ y │ x1 │ x2 │RES1│PRED1│ ├─────┼────┼────┼────┼─────┤ │10.00│1.00│4.10│-.20│10.20│ │12.00│2.00│5.00│ .20│11.80│ │13.00│3.00│6.20│-.07│13.07│ │15.00│4.00│7.10│ .33│14.67│ │16.00│5.00│8.00│-.27│16.27│ ╰─────┴────┴────┴────┴─────╯The output includes the standard tables for an ordinary least squares model. The Model Summary shows an R of 0.99 and an R‑square of 0.99 for this small example. The Coefficients table lists each predictor along with its estimate, standard error, t-statistic, and p‑value. These values confirm that the procedure ran correctly and that PSPP produced the expected regression statistics. Interpretation of the coefficients depends on the context and the analyst’s goals; the purpose here is simply to show how PSPP fits the model and reports the results.
Code and Examples of residual plots appear in the PSPP Graphics: Examples and Notes page
How to Run a Larger Linear Regression
The initial example regression on this page is very small so diagnostics are somewhat ambiguous. This example uses the Auto-MPG data set from the UC Irvine Machine Learning Repository Auto MPG data set. This data set has a few corrections including the removal of 8 mpg values that were missing. See the UC Irvine Machine Learning Repository page for all details, if you are curious. Note: some auto-mpg data sets contain tab characters, which will cause issues for pspp's
DATA LISTcommand.In psppire, again the path is Analysis->Regression->Linear. Here is the regression menu where you select the dependent and independent variables for the regression. In this case MPG is the dependent variable (what we are trying to predict) and CYLINDERS, DISPLACEMENT, HORSEPOWER, WEIGHT, ACCELERAION, MODELYEAR, and ORIGIN are the independent variables (what we measured and hope will predict mpg).
![]()
Regression Menu
Code
DATA LIST FIXED FILE="auto-mpg2.data" / mpg 1-4 cylinders 8-8 displacement 12-17 horsepower 23-28 weight 34-39 acceleration 45-49 modelyear 52-54 origin 56-57 carname 61-102 (A). *DISPLAY DICTIONARY. *LIST. REGRESSION /DEPENDENT mpg /METHOD=ENTER cylinders displacement horsepower weight acceleration modelyear origin /STATISTICS = COEFF R ANOVA TOL /SAVE PRED RESID. DISPLAY DICTIONARY. *LIST. SAVE OUTFILE='regression2.sav'. SAVE TRANSLATE /OUTFILE="regression2.csv" /TYPE=CSV /FIELDNAMES /REPLACE /CELLS=VALUES.Workflow Tip Since this data file has over 300 cases, using
LISTcan make the output unnecessarily long and slow to review.LISTis useful initially to confirm that the data are being read correctly, but once you’ve verified that, it’s best to comment it out. Leaving it in will produce pages of raw case listings that don’t help with regression diagnostics and only make the output harder to navigate.Output
Reading 1 record from `auto-mpg2.data'. +------------+------+-------+------+ |Variable |Record|Columns|Format| +------------+------+-------+------+ |mpg | 1|1-4 |F4.0 | |cylinders | 1|8-8 |F1.0 | |displacement| 1|12-17 |F6.0 | |horsepower | 1|23-28 |F6.0 | |weight | 1|34-39 |F6.0 | |acceleration| 1|45-49 |F5.0 | |modelyear | 1|52-54 |F3.0 | |origin | 1|56-57 |F2.0 | |carname | 1|61-102 |A42 | +------------+------+-------+------+ Variables +------------+--------+--------------+-----+-----+---------+--------+---------+ | | | Measurement | | | | Print | Write | |Name |Position| Level | Role|Width|Alignment| Format | Format | +------------+--------+--------------+-----+-----+---------+--------+---------+ |mpg | 1|Unknown |Input| 8|Right |F4.0 |F4.0 | |cylinders | 2|Unknown |Input| 8|Right |F1.0 |F1.0 | |displacement| 3|Unknown |Input| 8|Right |F6.0 |F6.0 | |horsepower | 4|Unknown |Input| 8|Right |F6.0 |F6.0 | |weight | 5|Unknown |Input| 8|Right |F6.0 |F6.0 | |acceleration| 6|Unknown |Input| 8|Right |F5.0 |F5.0 | |modelyear | 7|Unknown |Input| 8|Right |F3.0 |F3.0 | |origin | 8|Unknown |Input| 8|Right |F2.0 |F2.0 | |carname | 9|Nominal |Input| 32|Left |A42 |A42 | +------------+--------+--------------+-----+-----+---------+--------+---------+ Model Summary (mpg) +---+--------+-----------------+--------------------------+ | R |R Square|Adjusted R Square|Std. Error of the Estimate| +---+--------+-----------------+--------------------------+ |.91| .82| .82| 3.33| +---+--------+-----------------+--------------------------+ ANOVA (mpg) +----------+--------------+---+-----------+------+----+ | |Sum of Squares| df|Mean Square| F |Sig.| +----------+--------------+---+-----------+------+----+ |Regression| 19566.78| 7| 2795.25|252.43|.000| |Residual | 4252.21|384| 11.07| | | |Total | 23818.99|391| | | | +----------+--------------+---+-----------+------+----+ Coefficients (mpg) +------------+------------------+----------------+-----+----+-----------------+ | | Unstandardized | Standardized | | | Collinearity | | | Coefficients | Coefficients | | | Statistics | | +--------+---------+----------------+ | +----------+------+ | | | Std. | | | | | | | | B | Error | Beta | t |Sig.| Tolerance| VIF | +------------+--------+---------+----------------+-----+----+----------+------+ |(Constant) | -17.22| 4.64| .00|-3.71|.000| | | |cylinders | -.49| .32| -.11|-1.53|.128| .09| 10.74| |displacement| .02| .01| .27| 2.65|.008| .05| 21.84| |horsepower | -.02| .01| -.08|-1.23|.220| .10| 9.94| |weight | -.01| .00| -.70|-9.93|.000| .09| 10.83| |acceleration| .08| .10| .03| .82|.415| .38| 2.63| |modelyear | .75| .05| .35|14.73|.000| .80| 1.24| |origin | 1.43| .28| .15| 5.13|.000| .56| 1.77| +------------+--------+---------+----------------+-----+----+----------+------+Ordinary least squares regression is a BLUE (best linear unbiased) estimator, meaning the fitted line remains unbiased even when the residuals have different scatter or variance from high to low values. In such cases the standard errors and p‑values may not be trustworthy, but predictions from the model remain unbiased.
Another thing to watch out for is multicollinearity in variables. This data set has several highly correlated variables (horsepower, displacement, weight) which can produce an overall significant model while leaving the individual coefficients non-significant.
Because the data are skewed, this model is a candidate for a transformation (ln, Box-Cox, etc.). Transformations could be applied to the dependent variable and to horsepower, displacement, and weight. The origin variable explains nothing of the variation in the model and thus adds nothing for predictions. Origin can be dropped from the model, in other words.
Workflow Tip: Looking for the variance inflation factor (VIF) in your regression output? PSPP computes both values called TOL (tolerance) and VIF now. VIF is related to TOL: VIF=1/TOL. For psppire, you need to tell PSPP you want the COEFF and TOL values reported in your REGRESSION /STATISTICS command. The example output above in the example now shows both Tolerance and VIF in the Coefficients table.
How to Run a FACTOR Analysis
This example uses the Fisher Iris data. The
PLOT=EIGENsubcommand produces a scree plot of the eigenvalues. PSPP supports both Principal Components (PC) and Principal Axis Factoring (PAF) extraction methods, along with several orthogonal rotations (Varimax, Quartimax, Equamax).Code
GET FILE="Iris.sav". FACTOR /VARIABLES = sepallengthcm sepalwidthcm petallengthcm petalwidthcm /CRITERIA = FACTORS(2) /EXTRACTION = PC /ROTATION = VARIMAX /PLOT=EIGEN.Output
Communalities +-------------+-------+----------+ | |Initial|Extraction| +-------------+-------+----------+ |SepalLengthCm| 1.00| .92| |SepalWidthCm | 1.00| .99| |PetalLengthCm| 1.00| .98| |PetalWidthCm | 1.00| .94| +-------------+-------+----------+ Total Variance Explained +-+-------------------------+-------------------------+--------------- | | | Extraction Sums of | Rotation Sums | | Initial Eigenvalues | Squared Loadings | Loadin | +-----+--------+----------+-----+--------+----------+-----+--------+ | | | % of |Cumulative| | % of |Cumulative| | % of | | |Total|Variance| % |Total|Variance| % |Total|Variance| +-+-----+--------+----------+-----+--------+----------+-----+--------+ |1| 2.91| 72.8%| 72.8%| 2.91| 72.8%| 72.8%| 2.70| 67.6%| |2| .92| 23.0%| 95.8%| .92| 23.0%| 95.8%| 1.13| 28.2%| |3| .15| 3.7%| 99.5%| | | | | | |4| .02| .5%| 100.0%| | | | | | +-+-----+--------+----------+-----+--------+----------+-----+--------+ +-+----------+ | |of Squared| | |gs | | +----------+ | |Cumulative| | | % | +-+----------+ |1| 67.6%| |2| 95.8%| |3| | |4| | +-+----------+ See factor-1.png for a chart. Component Matrix +-------------+----------+ | | Component| | +-----+----+ | | 1 | 2 | +-------------+-----+----+ |SepalLengthCm| -.89| .36| |SepalWidthCm | .45| .89| |PetalLengthCm| -.99| .02| |PetalWidthCm | -.96| .06| +-------------+-----+----+ Rotated Component Matrix +-------------+---------+ | |Component| | +----+----+ | | 1 | 2 | +-------------+----+----+ |SepalLengthCm| .96| .05| |SepalWidthCm |-.14| .99| |PetalLengthCm| .95|-.30| |PetalWidthCm | .93|-.25| +-------------+----+----+SCREE plot of Eigenvalues.
How to Run a RELIABILITY Analysis
The
RELIABILITYcommand computes internal consistency statistics for a set of variables. PSPP currently supports Cronbach’s alpha and split‑half reliability. This example shows a simple alpha calculation for a group of items. The PSPP GUI does not have Reliability in its menus but the code can be run in the Syntax Editor or from the command line.This command can be found in the PSPPIRE Data Editor menus at Analyze->Reliability.
Here is the psppire Reliability Analysis menu.
![]()
Reliability Analysis Menu
PSPP Code:
SET FORMAT=F8.5. SET WIDTH=132 /LENGTH=59 /MXLOOPS=100 /RESULTS=BOTH. TITLE 'Reliability Analysis'. GET FILE='study.sys'. RELIABILITY /VARIABLES=FEELRUSH TO FEELSMAL. FINISH.Output:
Scale: ANY Case Processing Summary +--------+--+-------+ |Cases | N|Percent| +--------+--+-------+ |Valid |93| 93.9%| |Excluded| 6| 6.1%| |Total |99| 100.0%| +--------+--+-------+ Reliability Statistics +----------------+----------+ |Cronbach's Alpha|N of Items| +----------------+----------+ | .84949| 20| +----------------+----------+PSPP’s reliability procedure provides a case summary and Cronbach’s alpha for the specified variables. This is sufficient for checking basic internal consistency in most datasets. A high value of Cronback's alpha means the items are correlated, but not necessarily that the scale is valid or meaningful.
Back to top
[PSPP Syntax] [PSPP Analysis-Exploratory] [[PSPP Analysis-Inferential & Modeling]] [PSPP Merging] [PSPP Multi-Record] [PSPP Utils] [PSPP Graphics]Feedback
If you have suggestions, comments, or corrections, you can open an issue on the Github repository Issues list
SCREE plot of Eigenvalues.