1 @c PSPP - a program for statistical analysis.
2 @c Copyright (C) 2017, 2020 Free Software Foundation, Inc.
3 @c Permission is granted to copy, distribute and/or modify this document
4 @c under the terms of the GNU Free Documentation License, Version 1.3
5 @c or any later version published by the Free Software Foundation;
6 @c with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts.
7 @c A copy of the license is included in the section entitled "GNU
8 @c Free Documentation License".
13 This chapter documents the statistical procedures that @pspp{} supports so
17 * DESCRIPTIVES:: Descriptive statistics.
18 * FREQUENCIES:: Frequency tables.
19 * EXAMINE:: Testing data for normality.
21 * CORRELATIONS:: Correlation tables.
22 * CROSSTABS:: Crosstabulation tables.
23 * CTABLES:: Custom tables.
24 * FACTOR:: Factor analysis and Principal Components analysis.
25 * GLM:: Univariate Linear Models.
26 * LOGISTIC REGRESSION:: Bivariate Logistic Regression.
27 * MEANS:: Average values and other statistics.
28 * NPAR TESTS:: Nonparametric tests.
29 * T-TEST:: Test hypotheses about means.
30 * ONEWAY:: One way analysis of variance.
31 * QUICK CLUSTER:: K-Means clustering.
32 * RANK:: Compute rank scores.
33 * RELIABILITY:: Reliability analysis.
34 * ROC:: Receiver Operating Characteristic.
43 /VARIABLES=@var{var_list}
44 /MISSING=@{VARIABLE,LISTWISE@} @{INCLUDE,NOINCLUDE@}
45 /FORMAT=@{LABELS,NOLABELS@} @{NOINDEX,INDEX@} @{LINE,SERIAL@}
47 /STATISTICS=@{ALL,MEAN,SEMEAN,STDDEV,VARIANCE,KURTOSIS,
48 SKEWNESS,RANGE,MINIMUM,MAXIMUM,SUM,DEFAULT,
49 SESKEWNESS,SEKURTOSIS@}
50 /SORT=@{NONE,MEAN,SEMEAN,STDDEV,VARIANCE,KURTOSIS,SKEWNESS,
51 RANGE,MINIMUM,MAXIMUM,SUM,SESKEWNESS,SEKURTOSIS,NAME@}
55 The @cmd{DESCRIPTIVES} procedure reads the active dataset and outputs
56 linear descriptive statistics requested by the user. In addition, it can optionally
59 The @subcmd{VARIABLES} subcommand, which is required, specifies the list of
60 variables to be analyzed. Keyword @subcmd{VARIABLES} is optional.
62 All other subcommands are optional:
64 The @subcmd{MISSING} subcommand determines the handling of missing variables. If
65 @subcmd{INCLUDE} is set, then user-missing values are included in the
66 calculations. If @subcmd{NOINCLUDE} is set, which is the default, user-missing
67 values are excluded. If @subcmd{VARIABLE} is set, then missing values are
68 excluded on a variable by variable basis; if @subcmd{LISTWISE} is set, then
69 the entire case is excluded whenever any value in that case has a
70 system-missing or, if @subcmd{INCLUDE} is set, user-missing value.
72 The @subcmd{FORMAT} subcommand has no effect. It is accepted for
73 backward compatibility.
75 The @subcmd{SAVE} subcommand causes @cmd{DESCRIPTIVES} to calculate Z scores for all
76 the specified variables. The Z scores are saved to new variables.
77 Variable names are generated by trying first the original variable name
78 with Z prepended and truncated to a maximum of 8 characters, then the
79 names ZSC000 through ZSC999, STDZ00 through STDZ09, ZZZZ00 through
80 ZZZZ09, ZQZQ00 through ZQZQ09, in that sequence. In addition, Z score
81 variable names can be specified explicitly on @subcmd{VARIABLES} in the variable
82 list by enclosing them in parentheses after each variable.
83 When Z scores are calculated, @pspp{} ignores @cmd{TEMPORARY},
84 treating temporary transformations as permanent.
86 The @subcmd{STATISTICS} subcommand specifies the statistics to be displayed:
90 All of the statistics below.
94 Standard error of the mean.
97 @item @subcmd{VARIANCE}
99 @item @subcmd{KURTOSIS}
100 Kurtosis and standard error of the kurtosis.
101 @item @subcmd{SKEWNESS}
102 Skewness and standard error of the skewness.
112 Mean, standard deviation of the mean, minimum, maximum.
114 Standard error of the kurtosis.
116 Standard error of the skewness.
119 The @subcmd{SORT} subcommand specifies how the statistics should be sorted. Most
120 of the possible values should be self-explanatory. @subcmd{NAME} causes the
121 statistics to be sorted by name. By default, the statistics are listed
122 in the order that they are specified on the @subcmd{VARIABLES} subcommand.
123 The @subcmd{A} and @subcmd{D} settings request an ascending or descending
124 sort order, respectively.
126 @subsection Descriptives Example
128 The @file{physiology.sav} file contains various physiological data for a sample
129 of persons. Running the @cmd{DESCRIPTIVES} command on the variables @exvar{height}
130 and @exvar{temperature} with the default options allows one to see simple linear
131 statistics for these two variables. In @ref{descriptives:ex}, these variables
132 are specfied on the @subcmd{VARIABLES} subcommand and the @subcmd{SAVE} option
133 has been used, to request that Z scores be calculated.
135 After the command has completed, this example runs @cmd{DESCRIPTIVES} again, this
136 time on the @exvar{zheight} and @exvar{ztemperature} variables,
137 which are the two normalized (Z-score) variables generated by the
138 first @cmd{DESCRIPTIVES} command.
140 @float Example, descriptives:ex
141 @psppsyntax {descriptives.sps}
142 @caption {Running two @cmd{DESCRIPTIVES} commands, one with the @subcmd{SAVE} subcommand}
145 @float Screenshot, descriptives:scr
146 @psppimage {descriptives}
147 @caption {The Descriptives dialog box with two variables and Z-Scores option selected}
150 In @ref{descriptives:res}, we can see that there are 40 valid data for each of the variables
151 and no missing values. The mean average of the height and temperature is 16677.12
152 and 37.02 respectively. The descriptive statistics for temperature seem reasonable.
153 However there is a very high standard deviation for @exvar{height} and a suspiciously
154 low minimum. This is due to a data entry error in the
155 data (@pxref{Identifying incorrect data}).
157 In the second Descriptive Statistics command, one can see that the mean and standard
158 deviation of both Z score variables is 0 and 1 respectively. All Z score statistics
159 should have these properties since they are normalized versions of the original scores.
161 @float Result, descriptives:res
162 @psppoutput {descriptives}
163 @caption {Descriptives statistics including two normalized variables (Z-scores)}
172 /VARIABLES=@var{var_list}
173 /FORMAT=@{TABLE,NOTABLE,LIMIT(@var{limit})@}
174 @{AVALUE,DVALUE,AFREQ,DFREQ@}
175 /MISSING=@{EXCLUDE,INCLUDE@}
176 /STATISTICS=@{DEFAULT,MEAN,SEMEAN,MEDIAN,MODE,STDDEV,VARIANCE,
177 KURTOSIS,SKEWNESS,RANGE,MINIMUM,MAXIMUM,SUM,
178 SESKEWNESS,SEKURTOSIS,ALL,NONE@}
180 /PERCENTILES=percent@dots{}
181 /HISTOGRAM=[MINIMUM(@var{x_min})] [MAXIMUM(@var{x_max})]
182 [@{FREQ[(@var{y_max})],PERCENT[(@var{y_max})]@}] [@{NONORMAL,NORMAL@}]
183 /PIECHART=[MINIMUM(@var{x_min})] [MAXIMUM(@var{x_max})]
184 [@{FREQ,PERCENT@}] [@{NOMISSING,MISSING@}]
185 /BARCHART=[MINIMUM(@var{x_min})] [MAXIMUM(@var{x_max})]
187 /ORDER=@{ANALYSIS,VARIABLE@}
190 (These options are not currently implemented.)
195 The @cmd{FREQUENCIES} procedure outputs frequency tables for specified
197 @cmd{FREQUENCIES} can also calculate and display descriptive statistics
198 (including median and mode) and percentiles, and various graphical representations
199 of the frequency distribution.
201 The @subcmd{VARIABLES} subcommand is the only required subcommand. Specify the
202 variables to be analyzed.
204 The @subcmd{FORMAT} subcommand controls the output format. It has several
209 @subcmd{TABLE}, the default, causes a frequency table to be output for every
210 variable specified. @subcmd{NOTABLE} prevents them from being output. @subcmd{LIMIT}
211 with a numeric argument causes them to be output except when there are
212 more than the specified number of values in the table.
215 Normally frequency tables are sorted in ascending order by value. This
216 is @subcmd{AVALUE}. @subcmd{DVALUE} tables are sorted in descending order by value.
217 @subcmd{AFREQ} and @subcmd{DFREQ} tables are sorted in ascending and descending order,
218 respectively, by frequency count.
221 The @subcmd{MISSING} subcommand controls the handling of user-missing values.
222 When @subcmd{EXCLUDE}, the default, is set, user-missing values are not included
223 in frequency tables or statistics. When @subcmd{INCLUDE} is set, user-missing
224 are included. System-missing values are never included in statistics,
225 but are listed in frequency tables.
227 The available @subcmd{STATISTICS} are the same as available
228 in @cmd{DESCRIPTIVES} (@pxref{DESCRIPTIVES}), with the addition
229 of @subcmd{MEDIAN}, the data's median
230 value, and MODE, the mode. (If there are multiple modes, the smallest
231 value is reported.) By default, the mean, standard deviation of the
232 mean, minimum, and maximum are reported for each variable.
235 @subcmd{PERCENTILES} causes the specified percentiles to be reported.
236 The percentiles should be presented at a list of numbers between 0
238 The @subcmd{NTILES} subcommand causes the percentiles to be reported at the
239 boundaries of the data set divided into the specified number of ranges.
240 For instance, @subcmd{/NTILES=4} would cause quartiles to be reported.
243 The @subcmd{HISTOGRAM} subcommand causes the output to include a histogram for
244 each specified numeric variable. The X axis by default ranges from
245 the minimum to the maximum value observed in the data, but the @subcmd{MINIMUM}
246 and @subcmd{MAXIMUM} keywords can set an explicit range.
247 @footnote{The number of
248 bins is chosen according to the Freedman-Diaconis rule:
249 @math{2 \times IQR(x)n^{-1/3}}, where @math{IQR(x)} is the interquartile range of @math{x}
250 and @math{n} is the number of samples. Note that
251 @cmd{EXAMINE} uses a different algorithm to determine bin sizes.}
252 Histograms are not created for string variables.
254 Specify @subcmd{NORMAL} to superimpose a normal curve on the
258 The @subcmd{PIECHART} subcommand adds a pie chart for each variable to the data. Each
259 slice represents one value, with the size of the slice proportional to
260 the value's frequency. By default, all non-missing values are given
262 The @subcmd{MINIMUM} and @subcmd{MAXIMUM} keywords can be used to limit the
263 displayed slices to a given range of values.
264 The keyword @subcmd{NOMISSING} causes missing values to be omitted from the
265 piechart. This is the default.
266 If instead, @subcmd{MISSING} is specified, then the pie chart includes
267 a single slice representing all system missing and user-missing cases.
270 The @subcmd{BARCHART} subcommand produces a bar chart for each variable.
271 The @subcmd{MINIMUM} and @subcmd{MAXIMUM} keywords can be used to omit
272 categories whose counts which lie outside the specified limits.
273 The @subcmd{FREQ} option (default) causes the ordinate to display the frequency
274 of each category, whereas the @subcmd{PERCENT} option displays relative
277 The @subcmd{FREQ} and @subcmd{PERCENT} options on @subcmd{HISTOGRAM} and
278 @subcmd{PIECHART} are accepted but not currently honoured.
280 The @subcmd{ORDER} subcommand is accepted but ignored.
282 @subsection Frequencies Example
284 @ref{frequencies:ex} runs a frequency analysis on the @exvar{sex}
285 and @exvar{occupation} variables from the @file{personnel.sav} file.
286 This is useful to get an general idea of the way in which these nominal
287 variables are distributed.
289 @float Example, frequencies:ex
290 @psppsyntax {frequencies.sps}
291 @caption {Running frequencies on the @exvar{sex} and @exvar{occupation} variables}
294 If you are using the graphic user interface, the dialog box is set up such that
295 by default, several statistics are calculated. Some are not particularly useful
296 for categorical variables, so you may want to disable those.
298 @float Screenshot, frequencies:scr
299 @psppimage {frequencies}
300 @caption {The frequencies dialog box with the @exvar{sex} and @exvar{occupation} variables selected}
303 From @ref{frequencies:res} it is evident that there are 33 males, 21 females and
304 2 persons for whom their sex has not been entered.
306 One can also see how many of each occupation there are in the data.
307 When dealing with string variables used as nominal values, running a frequency
308 analysis is useful to detect data input entries. Notice that
309 one @exvar{occupation} value has been mistyped as ``Scrientist''. This entry should
310 be corrected, or marked as missing before using the data.
312 @float Result, frequencies:res
313 @psppoutput {frequencies}
314 @caption {The relative frequencies of @exvar{sex} and @exvar{occupation}}
321 @cindex Exploratory data analysis
322 @cindex normality, testing
326 VARIABLES= @var{var1} [@var{var2}] @dots{} [@var{varN}]
327 [BY @var{factor1} [BY @var{subfactor1}]
328 [ @var{factor2} [BY @var{subfactor2}]]
330 [ @var{factor3} [BY @var{subfactor3}]]
332 /STATISTICS=@{DESCRIPTIVES, EXTREME[(@var{n})], ALL, NONE@}
333 /PLOT=@{BOXPLOT, NPPLOT, HISTOGRAM, SPREADLEVEL[(@var{t})], ALL, NONE@}
335 /COMPARE=@{GROUPS,VARIABLES@}
336 /ID=@var{identity_variable}
338 /PERCENTILE=[@var{percentiles}]=@{HAVERAGE, WAVERAGE, ROUND, AEMPIRICAL, EMPIRICAL @}
339 /MISSING=@{LISTWISE, PAIRWISE@} [@{EXCLUDE, INCLUDE@}]
340 [@{NOREPORT,REPORT@}]
344 The @cmd{EXAMINE} command is used to perform exploratory data analysis.
345 In particular, it is useful for testing how closely a distribution follows a
346 normal distribution, and for finding outliers and extreme values.
348 The @subcmd{VARIABLES} subcommand is mandatory.
349 It specifies the dependent variables and optionally variables to use as
350 factors for the analysis.
351 Variables listed before the first @subcmd{BY} keyword (if any) are the
353 The dependent variables may optionally be followed by a list of
354 factors which tell @pspp{} how to break down the analysis for each
357 Following the dependent variables, factors may be specified.
358 The factors (if desired) should be preceded by a single @subcmd{BY} keyword.
359 The format for each factor is
361 @var{factorvar} [BY @var{subfactorvar}].
363 Each unique combination of the values of @var{factorvar} and
364 @var{subfactorvar} divide the dataset into @dfn{cells}.
365 Statistics are calculated for each cell
366 and for the entire dataset (unless @subcmd{NOTOTAL} is given).
368 The @subcmd{STATISTICS} subcommand specifies which statistics to show.
369 @subcmd{DESCRIPTIVES} produces a table showing some parametric and
370 non-parametrics statistics.
371 @subcmd{EXTREME} produces a table showing the extremities of each cell.
372 A number in parentheses, @var{n} determines
373 how many upper and lower extremities to show.
374 The default number is 5.
376 The subcommands @subcmd{TOTAL} and @subcmd{NOTOTAL} are mutually exclusive.
377 If @subcmd{TOTAL} appears, then statistics for the entire dataset
378 as well as for each cell are produced.
379 If @subcmd{NOTOTAL} appears, then statistics are produced only for the cells
380 (unless no factor variables have been given).
381 These subcommands have no effect if there have been no factor variables
387 @cindex spreadlevel plot
388 The @subcmd{PLOT} subcommand specifies which plots are to be produced if any.
389 Available plots are @subcmd{HISTOGRAM}, @subcmd{NPPLOT}, @subcmd{BOXPLOT} and
390 @subcmd{SPREADLEVEL}.
391 The first three can be used to visualise how closely each cell conforms to a
392 normal distribution, whilst the spread vs.@: level plot can be useful to visualise
393 how the variance differs between factors.
394 Boxplots show you the outliers and extreme values.
395 @footnote{@subcmd{HISTOGRAM} uses Sturges' rule to determine the number of
396 bins, as approximately @math{1 + \log2(n)}, where @math{n} is the number of samples.
397 Note that @cmd{FREQUENCIES} uses a different algorithm to find the bin size.}
399 The @subcmd{SPREADLEVEL} plot displays the interquartile range versus the
400 median. It takes an optional parameter @var{t}, which specifies how the data
401 should be transformed prior to plotting.
402 The given value @var{t} is a power to which the data are raised. For example, if
403 @var{t} is given as 2, then the square of the data is used.
404 Zero, however is a special value. If @var{t} is 0 or
405 is omitted, then data are transformed by taking its natural logarithm instead of
406 raising to the power of @var{t}.
409 When one or more plots are requested, @subcmd{EXAMINE} also performs the
410 Shapiro-Wilk test for each category.
411 There are however a number of provisos:
413 @item All weight values must be integer.
414 @item The cumulative weight value must be in the range [3, 5000]
417 The @subcmd{COMPARE} subcommand is only relevant if producing boxplots, and it is only
418 useful there is more than one dependent variable and at least one factor.
420 @subcmd{/COMPARE=GROUPS} is specified, then one plot per dependent variable is produced,
421 each of which contain boxplots for all the cells.
422 If @subcmd{/COMPARE=VARIABLES} is specified, then one plot per cell is produced,
423 each containing one boxplot per dependent variable.
424 If the @subcmd{/COMPARE} subcommand is omitted, then @pspp{} behaves as if
425 @subcmd{/COMPARE=GROUPS} were given.
427 The @subcmd{ID} subcommand is relevant only if @subcmd{/PLOT=BOXPLOT} or
428 @subcmd{/STATISTICS=EXTREME} has been given.
429 If given, it should provide the name of a variable which is to be used
430 to labels extreme values and outliers.
431 Numeric or string variables are permissible.
432 If the @subcmd{ID} subcommand is not given, then the case number is used for
435 The @subcmd{CINTERVAL} subcommand specifies the confidence interval to use in
436 calculation of the descriptives command. The default is 95%.
439 The @subcmd{PERCENTILES} subcommand specifies which percentiles are to be calculated,
440 and which algorithm to use for calculating them. The default is to
441 calculate the 5, 10, 25, 50, 75, 90, 95 percentiles using the
442 @subcmd{HAVERAGE} algorithm.
444 The @subcmd{TOTAL} and @subcmd{NOTOTAL} subcommands are mutually exclusive. If @subcmd{NOTOTAL}
445 is given and factors have been specified in the @subcmd{VARIABLES} subcommand,
446 then statistics for the unfactored dependent variables are
447 produced in addition to the factored variables. If there are no
448 factors specified then @subcmd{TOTAL} and @subcmd{NOTOTAL} have no effect.
451 The following example generates descriptive statistics and histograms for
452 two variables @var{score1} and @var{score2}.
453 Two factors are given, @i{viz}: @var{gender} and @var{gender} BY @var{culture}.
454 Therefore, the descriptives and histograms are generated for each
456 of @var{gender} @emph{and} for each distinct combination of the values
457 of @var{gender} and @var{race}.
458 Since the @subcmd{NOTOTAL} keyword is given, statistics and histograms for
459 @var{score1} and @var{score2} covering the whole dataset are not produced.
461 EXAMINE @var{score1} @var{score2} BY
463 @var{gender} BY @var{culture}
464 /STATISTICS = DESCRIPTIVES
469 Here is a second example showing how the @cmd{examine} command can be used to find extremities.
471 EXAMINE @var{height} @var{weight} BY
473 /STATISTICS = EXTREME (3)
478 In this example, we look at the height and weight of a sample of individuals and
479 how they differ between male and female.
480 A table showing the 3 largest and the 3 smallest values of @exvar{height} and
481 @exvar{weight} for each gender, and for the whole dataset as are shown.
482 In addition, the @subcmd{/PLOT} subcommand requests boxplots.
483 Because @subcmd{/COMPARE = GROUPS} was specified, boxplots for male and female are
484 shown in juxtaposed in the same graphic, allowing us to easily see the difference between
486 Since the variable @var{name} was specified on the @subcmd{ID} subcommand,
487 values of the @var{name} variable are used to label the extreme values.
490 If you specify many dependent variables or factor variables
491 for which there are many distinct values, then @cmd{EXAMINE} will produce a very
492 large quantity of output.
498 @cindex Exploratory data analysis
499 @cindex normality, testing
503 /HISTOGRAM [(NORMAL)]= @var{var}
504 /SCATTERPLOT [(BIVARIATE)] = @var{var1} WITH @var{var2} [BY @var{var3}]
505 /BAR = @{@var{summary-function}(@var{var1}) | @var{count-function}@} BY @var{var2} [BY @var{var3}]
506 [ /MISSING=@{LISTWISE, VARIABLE@} [@{EXCLUDE, INCLUDE@}] ]
507 [@{NOREPORT,REPORT@}]
511 The @cmd{GRAPH} command produces graphical plots of data. Only one of the subcommands
512 @subcmd{HISTOGRAM}, @subcmd{BAR} or @subcmd{SCATTERPLOT} can be specified, @i{i.e.} only one plot
513 can be produced per call of @cmd{GRAPH}. The @subcmd{MISSING} is optional.
516 * SCATTERPLOT:: Cartesian Plots
517 * HISTOGRAM:: Histograms
518 * BAR CHART:: Bar Charts
522 @subsection Scatterplot
525 The subcommand @subcmd{SCATTERPLOT} produces an xy plot of the
527 @cmd{GRAPH} uses the third variable @var{var3}, if specified, to determine
528 the colours and/or markers for the plot.
529 The following is an example for producing a scatterplot.
533 /SCATTERPLOT = @var{height} WITH @var{weight} BY @var{gender}.
536 This example produces a scatterplot where @var{height} is plotted versus @var{weight}. Depending
537 on the value of the @var{gender} variable, the colour of the datapoint is different. With
538 this plot it is possible to analyze gender differences for @var{height} versus @var{weight} relation.
541 @subsection Histogram
544 The subcommand @subcmd{HISTOGRAM} produces a histogram. Only one variable is allowed for
546 The keyword @subcmd{NORMAL} may be specified in parentheses, to indicate that the ideal normal curve
547 should be superimposed over the histogram.
548 For an alternative method to produce histograms @pxref{EXAMINE}. The
549 following example produces a histogram plot for the variable @var{weight}.
553 /HISTOGRAM = @var{weight}.
557 @subsection Bar Chart
560 The subcommand @subcmd{BAR} produces a bar chart.
561 This subcommand requires that a @var{count-function} be specified (with no arguments) or a @var{summary-function} with a variable @var{var1} in parentheses.
562 Following the summary or count function, the keyword @subcmd{BY} should be specified and then a catagorical variable, @var{var2}.
563 The values of the variable @var{var2} determine the labels of the bars to be plotted.
564 Optionally a second categorical variable @var{var3} may be specified in which case a clustered (grouped) bar chart is produced.
566 Valid count functions are
569 The weighted counts of the cases in each category.
571 The weighted counts of the cases in each category expressed as a percentage of the total weights of the cases.
573 The cumulative weighted counts of the cases in each category.
575 The cumulative weighted counts of the cases in each category expressed as a percentage of the total weights of the cases.
578 The summary function is applied to @var{var1} across all cases in each category.
579 The recognised summary functions are:
591 The following examples assume a dataset which is the results of a survey.
592 Each respondent has indicated annual income, their sex and city of residence.
593 One could create a bar chart showing how the mean income varies between of residents of different cities, thus:
595 GRAPH /BAR = MEAN(@var{income}) BY @var{city}.
598 This can be extended to also indicate how income in each city differs between the sexes.
600 GRAPH /BAR = MEAN(@var{income}) BY @var{city} BY @var{sex}.
603 One might also want to see how many respondents there are from each city. This can be achieved as follows:
605 GRAPH /BAR = COUNT BY @var{city}.
608 Bar charts can also be produced using the @ref{FREQUENCIES} and @ref{CROSSTABS} commands.
611 @section CORRELATIONS
616 /VARIABLES = @var{var_list} [ WITH @var{var_list} ]
621 /VARIABLES = @var{var_list} [ WITH @var{var_list} ]
622 /VARIABLES = @var{var_list} [ WITH @var{var_list} ]
625 [ /PRINT=@{TWOTAIL, ONETAIL@} @{SIG, NOSIG@} ]
626 [ /STATISTICS=DESCRIPTIVES XPROD ALL]
627 [ /MISSING=@{PAIRWISE, LISTWISE@} @{INCLUDE, EXCLUDE@} ]
631 The @cmd{CORRELATIONS} procedure produces tables of the Pearson correlation coefficient
632 for a set of variables. The significance of the coefficients are also given.
634 At least one @subcmd{VARIABLES} subcommand is required. If you specify the @subcmd{WITH}
635 keyword, then a non-square correlation table is produced.
636 The variables preceding @subcmd{WITH}, are used as the rows of the table,
637 and the variables following @subcmd{WITH} are used as the columns of the table.
638 If no @subcmd{WITH} subcommand is specified, then @cmd{CORRELATIONS} produces a
639 square, symmetrical table using all variables.
641 The @cmd{MISSING} subcommand determines the handling of missing variables.
642 If @subcmd{INCLUDE} is set, then user-missing values are included in the
643 calculations, but system-missing values are not.
644 If @subcmd{EXCLUDE} is set, which is the default, user-missing
645 values are excluded as well as system-missing values.
647 If @subcmd{LISTWISE} is set, then the entire case is excluded from analysis
648 whenever any variable specified in any @cmd{/VARIABLES} subcommand
649 contains a missing value.
650 If @subcmd{PAIRWISE} is set, then a case is considered missing only if either of the
651 values for the particular coefficient are missing.
652 The default is @subcmd{PAIRWISE}.
654 The @subcmd{PRINT} subcommand is used to control how the reported significance values are printed.
655 If the @subcmd{TWOTAIL} option is used, then a two-tailed test of significance is
656 printed. If the @subcmd{ONETAIL} option is given, then a one-tailed test is used.
657 The default is @subcmd{TWOTAIL}.
659 If the @subcmd{NOSIG} option is specified, then correlation coefficients with significance less than
660 0.05 are highlighted.
661 If @subcmd{SIG} is specified, then no highlighting is performed. This is the default.
664 The @subcmd{STATISTICS} subcommand requests additional statistics to be displayed. The keyword
665 @subcmd{DESCRIPTIVES} requests that the mean, number of non-missing cases, and the non-biased
666 estimator of the standard deviation are displayed.
667 These statistics are displayed in a separated table, for all the variables listed
668 in any @subcmd{/VARIABLES} subcommand.
669 The @subcmd{XPROD} keyword requests cross-product deviations and covariance estimators to
670 be displayed for each pair of variables.
671 The keyword @subcmd{ALL} is the union of @subcmd{DESCRIPTIVES} and @subcmd{XPROD}.
679 /TABLES=@var{var_list} BY @var{var_list} [BY @var{var_list}]@dots{}
680 /MISSING=@{TABLE,INCLUDE,REPORT@}
681 /FORMAT=@{TABLES,NOTABLES@}
683 /CELLS=@{COUNT,ROW,COLUMN,TOTAL,EXPECTED,RESIDUAL,SRESIDUAL,
684 ASRESIDUAL,ALL,NONE@}
685 /COUNT=@{ASIS,CASE,CELL@}
687 /STATISTICS=@{CHISQ,PHI,CC,LAMBDA,UC,BTAU,CTAU,RISK,GAMMA,D,
688 KAPPA,ETA,CORR,ALL,NONE@}
692 /VARIABLES=@var{var_list} (@var{low},@var{high})@dots{}
695 The @cmd{CROSSTABS} procedure displays crosstabulation
696 tables requested by the user. It can calculate several statistics for
697 each cell in the crosstabulation tables. In addition, a number of
698 statistics can be calculated for each table itself.
700 The @subcmd{TABLES} subcommand is used to specify the tables to be reported. Any
701 number of dimensions is permitted, and any number of variables per
702 dimension is allowed. The @subcmd{TABLES} subcommand may be repeated as many
703 times as needed. This is the only required subcommand in @dfn{general
706 Occasionally, one may want to invoke a special mode called @dfn{integer
707 mode}. Normally, in general mode, @pspp{} automatically determines
708 what values occur in the data. In integer mode, the user specifies the
709 range of values that the data assumes. To invoke this mode, specify the
710 @subcmd{VARIABLES} subcommand, giving a range of data values in parentheses for
711 each variable to be used on the @subcmd{TABLES} subcommand. Data values inside
712 the range are truncated to the nearest integer, then assigned to that
713 value. If values occur outside this range, they are discarded. When it
714 is present, the @subcmd{VARIABLES} subcommand must precede the @subcmd{TABLES}
717 In general mode, numeric and string variables may be specified on
718 TABLES. In integer mode, only numeric variables are allowed.
720 The @subcmd{MISSING} subcommand determines the handling of user-missing values.
721 When set to @subcmd{TABLE}, the default, missing values are dropped on a table by
722 table basis. When set to @subcmd{INCLUDE}, user-missing values are included in
723 tables and statistics. When set to @subcmd{REPORT}, which is allowed only in
724 integer mode, user-missing values are included in tables but marked with
725 a footnote and excluded from statistical calculations.
727 The @subcmd{FORMAT} subcommand controls the characteristics of the
728 crosstabulation tables to be displayed. It has a number of possible
733 @subcmd{TABLES}, the default, causes crosstabulation tables to be output.
734 @subcmd{NOTABLES}, which is equivalent to @code{CELLS=NONE}, suppresses them.
737 @subcmd{AVALUE}, the default, causes values to be sorted in ascending order.
738 @subcmd{DVALUE} asserts a descending sort order.
741 The @subcmd{CELLS} subcommand controls the contents of each cell in the displayed
742 crosstabulation table. The possible settings are:
758 Standardized residual.
760 Adjusted standardized residual.
764 Suppress cells entirely.
767 @samp{/CELLS} without any settings specified requests @subcmd{COUNT}, @subcmd{ROW},
768 @subcmd{COLUMN}, and @subcmd{TOTAL}.
769 If @subcmd{CELLS} is not specified at all then only @subcmd{COUNT}
772 By default, crosstabulation and statistics use raw case weights,
773 without rounding. Use the @subcmd{/COUNT} subcommand to perform
774 rounding: CASE rounds the weights of individual weights as cases are
775 read, CELL rounds the weights of cells within each crosstabulation
776 table after it has been constructed, and ASIS explicitly specifies the
777 default non-rounding behavior. When rounding is requested, ROUND, the
778 default, rounds to the nearest integer and TRUNCATE rounds toward
781 The @subcmd{STATISTICS} subcommand selects statistics for computation:
787 Pearson chi-square, likelihood ratio, Fisher's exact test, continuity
788 correction, linear-by-linear association.
792 Contingency coefficient.
796 Uncertainty coefficient.
812 Spearman correlation, Pearson's r.
819 Selected statistics are only calculated when appropriate for the
820 statistic. Certain statistics require tables of a particular size, and
821 some statistics are calculated only in integer mode.
823 @samp{/STATISTICS} without any settings selects CHISQ. If the
824 @subcmd{STATISTICS} subcommand is not given, no statistics are calculated.
827 The @samp{/BARCHART} subcommand produces a clustered bar chart for the first two
828 variables on each table.
829 If a table has more than two variables, the counts for the third and subsequent levels
830 are aggregated and the chart is produced as if there were only two variables.
833 @strong{Please note:} Currently the implementation of @cmd{CROSSTABS} has the
834 following limitations:
838 Significance of some symmetric and directional measures is not calculated.
840 Asymptotic standard error is not calculated for
841 Goodman and Kruskal's tau or symmetric Somers' d.
843 Approximate T is not calculated for symmetric uncertainty coefficient.
846 Fixes for any of these deficiencies would be welcomed.
848 @subsection Crosstabs Example
850 @cindex chi-square test of independence
852 A researcher wishes to know if, in an industry, a person's sex is related to
853 the person's occupation. To investigate this, she has determined that the
854 @file{personnel.sav} is a representative, randomly selected sample of persons.
855 The researcher's null hypothesis is that a person's sex has no relation to a
856 person's occupation. She uses a chi-squared test of independence to investigate
859 @float Example, crosstabs:ex
860 @psppsyntax {crosstabs.sps}
861 @caption {Running crosstabs on the @exvar{sex} and @exvar{occupation} variables}
864 The syntax in @ref{crosstabs:ex} conducts a chi-squared test of independence.
865 The line @code{/tables = occupation by sex} indicates that @exvar{occupation}
866 and @exvar{sex} are the variables to be tabulated. To do this using the @gui{}
867 you must place these variable names respectively in the @samp{Row} and
868 @samp{Column} fields as shown in @ref{crosstabs:scr}.
870 @float Screenshot, crosstabs:scr
871 @psppimage {crosstabs}
872 @caption {The Crosstabs dialog box with the @exvar{sex} and @exvar{occupation} variables selected}
875 Similarly, the @samp{Cells} button shows a dialog box to select the @code{count}
876 and @code{expected} options. All other cell options can be deselected for this
879 You would use the @samp{Format} and @samp{Statistics} buttons to select options
880 for the @subcmd{FORMAT} and @subcmd{STATISTICS} subcommands. In this example,
881 the @samp{Statistics} requires only the @samp{Chisq} option to be checked. All
882 other options should be unchecked. No special settings are required from the
883 @samp{Format} dialog.
885 As shown in @ref{crosstabs:res} @cmd{CROSSTABS} generates a contingency table
886 containing the observed count and the expected count of each sex and each
887 occupation. The expected count is the count which would be observed if the
888 null hypothesis were true.
890 The significance of the Pearson Chi-Square value is very much larger than the
891 normally accepted value of 0.05 and so one cannot reject the null hypothesis.
892 Thus the researcher must conclude that a person's sex has no relation to the
895 @float Results, crosstabs:res
896 @psppoutput {crosstabs}
897 @caption {The results of a test of independence between @exvar{sex} and @exvar{occupation}}
904 @cindex custom tables
905 @cindex tables, custom
907 @code{CTABLES} has the following overall syntax. At least one
908 @code{TABLE} subcommand is required:
912 @dots{}@i{global subcommands}@dots{}
913 [@t{/TABLE} @i{axis} [@t{BY} @i{axis} [@t{BY} @i{axis}]]
914 @dots{}@i{per-table subcommands}@dots{}]@dots{}
918 where each @i{axis} may be empty or take one of the following forms:
922 @i{variable} @t{[}@{@t{C} @math{|} @t{S}@}@t{]}
926 @i{axis} @t{[}@i{summary} [@i{string}] [@i{format}]@t{]}
929 The following subcommands precede the first @code{TABLE} subcommand
930 and apply to all of the output tables. All of these subcommands are
935 [@t{MINCOLWIDTH=}@{@t{DEFAULT} @math{|} @i{width}@}]
936 [@t{MAXCOLWIDTH=}@{@t{DEFAULT} @math{|} @i{width}@}]
937 [@t{UNITS=}@{@t{POINTS} @math{|} @t{INCHES} @math{|} @t{CM}@}]
938 [@t{EMPTY=}@{@t{ZERO} @math{|} @t{BLANK} @math{|} @i{string}@}]
939 [@t{MISSING=}@i{string}]
941 @t{VARIABLES=}@i{variables}
942 @t{DISPLAY}=@{@t{DEFAULT} @math{|} @t{NAME} @math{|} @t{LABEL} @math{|} @t{BOTH} @math{|} @t{NONE}@}
943 @ignore @c not yet implemented
944 @t{/MRSETS COUNTDUPLICATES=}@{@t{YES} @math{|} @t{NO}@}
946 @t{/SMISSING} @{@t{VARIABLE} @math{|} @t{LISTWISE}@}
947 @t{/PCOMPUTE} @t{&}@i{postcompute}@t{=EXPR(}@i{expression}@t{)}
948 @t{/PPROPERTIES} @t{&}@i{postcompute}@dots{}
949 [@t{LABEL=}@i{string}]
950 [@t{FORMAT=}[@i{summary} @i{format}]@dots{}]
951 [@t{HIDESOURCECATS=}@{@t{NO} @math{|} @t{YES}@}
952 @t{/WEIGHT VARIABLE=}@i{variable}
953 @t{/HIDESMALLCOUNTS COUNT=@i{count}}
956 The following subcommands follow @code{TABLE} and apply only to the
957 previous @code{TABLE}. All of these subcommands are optional:
961 [@t{POSITION=}@{@t{COLUMN} @math{|} @t{ROW} @math{|} @t{LAYER}@}]
962 [@t{VISIBLE=}@{@t{YES} @math{|} @t{NO}@}]
963 @t{/CLABELS} @{@t{AUTO} @math{|} @{@t{ROWLABELS}@math{|}@t{COLLABELS}@}@t{=}@{@t{OPPOSITE}@math{|}@t{LAYER}@}@}
964 @t{/CATEGORIES} @t{VARIABLES=}@i{variables}
965 @{@t{[}@i{value}@t{,} @i{value}@dots{}@t{]}
966 @math{|} [@t{ORDER=}@{@t{A} @math{|} @t{D}@}]
967 [@t{KEY=}@{@t{VALUE} @math{|} @t{LABEL} @math{|} @i{summary}@t{(}@i{variable}@t{)}@}]
968 [@t{MISSING=}@{@t{EXCLUDE} @math{|} @t{INCLUDE}@}]@}
969 [@t{TOTAL=}@{@t{NO} @math{|} @t{YES}@} [@t{LABEL=}@i{string}] [@t{POSITION=}@{@t{AFTER} @math{|} @t{BEFORE}@}]]
970 [@t{EMPTY=}@{@t{INCLUDE} @math{|} @t{EXCLUDE}@}]
972 [@t{TITLE=}@i{string}@dots{}]
973 [@t{CAPTION=}@i{string}@dots{}]
974 [@t{CORNER=}@i{string}@dots{}]
975 @ignore @c not yet implemented
976 @t{/CRITERIA CILEVEL=}@i{percentage}
977 @t{/SIGTEST TYPE=CHISQUARE}
978 [@t{ALPHA=}@i{siglevel}]
979 [@t{INCLUDEMRSETS=}@{@t{YES} @math{|} @t{NO}@}]
980 [@t{CATEGORIES=}@{@t{ALLVISIBLE} @math{|} @t{SUBTOTALS}@}]
981 @t{/COMPARETEST TYPE=}@{@t{PROP} @math{|} @t{MEAN}@}
982 [@t{ALPHA=}@i{value}[@t{,} @i{value}]]
983 [@t{ADJUST=}@{@t{BONFERRONI} @math{|} @t{BH} @math{|} @t{NONE}@}]
984 [@t{INCLUDEMRSETS=}@{@t{YES} @math{|} @t{NO}@}]
985 [@t{MEANSVARIANCE=}@{@t{ALLCATS} @math{|} @t{TESTEDCATS}@}]
986 [@t{CATEGORIES=}@{@t{ALLVISIBLE} @math{|} @t{SUBTOTALS}@}]
987 [@t{MERGE=}@{@t{NO} @math{|} @t{YES}@}]
988 [@t{STYLE=}@{@t{APA} @math{|} @t{SIMPLE}@}]
989 [@t{SHOWSIG=}@{@t{NO} @math{|} @t{YES}@}]
993 The @code{CTABLES} (aka ``custom tables'') command produces
994 multi-dimensional tables from categorical and scale data. It offers
995 many options for data summarization and formatting.
997 This section's examples use data from the 2008 (USA) National Survey
998 of Drinking and Driving Attitudes and Behaviors, a public domain data
999 set from the (USA) National Highway Traffic Administration and
1000 available at @url{https://data.transportation.gov}. @pspp{} includes
1001 this data set, with a slightly modified dictionary, as
1002 @file{examples/nhtsa.sav}.
1004 @node CTABLES Basics
1007 The only required subcommand is @code{TABLE}, which specifies the
1008 variables to include along each axis:
1010 @t{/TABLE} @i{rows} [@t{BY} @i{columns} [@t{BY} @i{layers}]]
1013 In @code{TABLE}, each of @var{rows}, @var{columns}, and @var{layers}
1014 is either empty or an axis expression that specifies one or more
1015 variables. At least one must specify an axis expression.
1017 @node CTABLES Categorical Variable Basics
1018 @subsubsection Categorical Variables
1020 An axis expression that names a categorical variable divides the data
1021 into cells according to the values of that variable. When all the
1022 variables named on @code{TABLE} are categorical, by default each cell
1023 displays the number of cases that it contains, so specifying a single
1024 variable yields a frequency table, much like the output of the
1025 @code{FREQUENCIES} command (@pxref{FREQUENCIES}):
1028 CTABLES /TABLE=AgeGroup.
1030 @psppoutput {ctables1}
1033 Specifying a row and a column categorical variable yields a
1034 crosstabulation, much like the output of the @code{CROSSTABS} command
1035 (@pxref{CROSSTABS}):
1038 CTABLES /TABLE=AgeGroup BY qns3a.
1040 @psppoutput {ctables2}
1043 The @samp{>} ``nesting'' operator nests multiple variables on a single
1047 CTABLES /TABLE qn105ba BY AgeGroup > qns3a.
1049 @psppoutput {ctables3}
1052 The @samp{+} ``stacking'' operator allows a single output table to
1053 include multiple data analyses. With @samp{+}, @code{CTABLES} divides
1054 the output table into multiple @dfn{sections}, each of which includes
1055 an analysis of the full data set. For example, the following command
1056 separately tabulates age group and driving frequency by gender:
1059 CTABLES /TABLE AgeGroup + qn1 BY qns3a.
1061 @psppoutput {ctables4}
1064 When @samp{+} and @samp{>} are used together, @samp{>} binds more
1065 tightly. Use parentheses to override operator precedence. Thus:
1068 CTABLES /TABLE qn26 + qn27 > qns3a.
1069 CTABLES /TABLE (qn26 + qn27) > qns3a.
1071 @psppoutput {ctables5}
1073 @node CTABLES Scalar Variable Basics
1074 @subsubsection Scalar Variables
1076 For a categorical variable, @code{CTABLES} divides the table into a
1077 cell per category. For a scalar variable, @code{CTABLES} instead
1078 calculates a summary measure, by default the mean, of the values that
1079 fall into a cell. For example, if the only variable specified is a
1080 scalar variable, then the output is a single cell that holds the mean
1084 CTABLES /TABLE qnd1.
1086 @psppoutput {ctables6}
1088 A scalar variable may nest with categorical variables. The following
1089 example shows the mean age of survey respondents across gender and
1093 CTABLES /TABLE qns3a > qnd1 BY region.
1095 @psppoutput {ctables7}
1097 The order of nesting of scalar and categorical variables affects table
1098 labeling, but it does not affect the data displayed in the table. The
1099 following example shows how the output changes when the nesting order
1100 of the scalar and categorical variable are interchanged:
1103 CTABLES /TABLE qnd1 > qns3a BY region.
1105 @psppoutput {ctables8}
1107 Only a single scalar variable may appear in each section; that is, a
1108 scalar variable may not nest inside a scalar variable directly or
1109 indirectly. Scalar variables may only appear on one axis within
1112 @node CTABLES Overriding Measurement Level
1113 @subsubsection Overriding Measurement Level
1115 By default, @code{CTABLES} uses a variable's measurement level to
1116 decide whether to treat it as categorical or scalar. Variables
1117 assigned the nominal or ordinal measurement level are treated as
1118 categorical, and scalar variables are treated as scalar.
1120 When @pspp{} reads data from a file in an external format, such as a
1121 text file, variables' measurement levels are often unknown. If
1122 @code{CTABLES} runs when a variable has an unknown measurement level,
1123 it makes an initial pass through the data to guess measurement levels
1124 using the rules described earlier in this manual (@pxref{Measurement
1125 Level}). Use the @code{VARIABLE LEVEL} command to set or change a
1126 variable's measurement level (@pxref{VARIABLE LEVEL}).
1128 To treat a variable as categorical or scalar only for one use on
1129 @code{CTABLES}, add @samp{[C]} or @samp{[S]}, respectively, after the
1130 variable name. The following example shows the output when variable
1131 @code{qn20} is analyzed as scalar (the default for its measurement
1132 level) and as categorical:
1136 /TABLE qn20 BY qns3a
1137 /TABLE qn20 [C] BY qns3a.
1139 @psppoutput {ctables9}
1142 @node CTABLES Multiple Response Sets
1143 @subsubheading Multiple Response Sets
1145 The @code{CTABLES} command does not yet support multiple response
1149 @node CTABLES Data Summarization
1150 @subsection Data Summarization
1152 The @code{CTABLES} command allows the user to control how the data are
1153 summarized with @dfn{summary specifications}, syntax that lists one or
1154 more summary function names, optionally separated by commas, and which
1155 are enclosed in square brackets following a variable name on the
1156 @code{TABLE} subcommand. When all the variables are categorical,
1157 summary specifications can be given for the innermost nested variables
1158 on any one axis. When a scalar variable is present, only the scalar
1159 variable may have summary specifications.
1161 The following example includes a summary specification for column and
1162 row percentages for categorical variables, and mean and median for a
1167 /TABLE=qnd1 [MEAN, MEDIAN] BY qns3a
1168 /TABLE=AgeGroup [COLPCT, ROWPCT] BY qns3a.
1170 @psppoutput {ctables10}
1172 A summary specification may override the default label and format by
1173 appending a string or format specification or both (in that order) to
1174 the summary function name. For example:
1177 CTABLES /TABLE=AgeGroup [COLPCT 'Gender %' PCT5.0,
1178 ROWPCT 'Age Group %' PCT5.0]
1181 @psppoutput {ctables11}
1183 In addition to the standard formats, @code{CTABLES} allows the user to
1184 specify the following special formats:
1186 @multitable {@code{NEGPAREN@i{w}.@i{d}}} {Encloses all numbers in parentheses.} {@t{(42.96%)}} {@t{(-42.96%)}}
1187 @item @code{NEGPAREN@i{w}.@i{d}}
1188 @tab Encloses negative numbers in parentheses.
1190 @tab @t{@w{ }(42.96)}
1192 @item @code{NEQUAL@i{w}.@i{d}}
1193 @tab Adds a @code{N=} prefix.
1194 @tab @t{@w{ }N=42.96}
1195 @tab @t{@w{ }N=-42.96}
1197 @item @code{@code{PAREN@i{w}.@i{d}}}
1198 @tab Encloses all numbers in parentheses.
1199 @tab @t{@w{ }(42.96)}
1200 @tab @t{@w{ }(-42.96)}
1202 @item @code{PCTPAREN@i{w}.@i{d}}
1203 @tab Encloses all numbers in parentheses with a @samp{%} suffix.
1204 @tab @t{@w{ }(42.96%)}
1208 Parentheses provide a shorthand to apply summary specifications to
1209 multiple variables. For example, both of these commands:
1212 CTABLES /TABLE=AgeGroup[COLPCT] + qns1[COLPCT] BY qns3a.
1213 CTABLES /TABLE=(AgeGroup + qns1)[COLPCT] BY qns3a.
1217 produce the same output shown below:
1219 @psppoutput {ctables12}
1221 The following sections list the available summary functions. After
1222 each function's name is given its default label and format. If no
1223 format is listed, then the default format is the print format for the
1224 variable being summarized.
1226 @node CTABLES Summary Functions for Individual Cells
1227 @subsubsection Summary Functions for Individual Cells
1229 This section lists the summary functions that consider only an
1230 individual cell in @code{CTABLES}. Only one such summary function,
1231 @code{COUNT}, may be applied to both categorical and scale variables:
1234 @item @code{COUNT} (``Count'', F40.0)
1235 The sum of weights in a cell.
1237 If @code{CATEGORIES} for one or more of the variables in a table
1238 include missing values (@pxref{CTABLES Per-Variable Category
1239 Options}), then some or all of the categories for a cell might be
1240 missing values. @code{COUNT} counts data included in a cell
1241 regardless of whether its categories are missing.
1244 The following summary functions apply only to scale variables or
1245 totals and subtotals for categorical variables. Be cautious about
1246 interpreting the summary value in the latter case, because it is not
1247 necessarily meaningful; however, the mean of a Likert scale, etc.@:
1248 may have a straightforward interpreation.
1251 @item @code{MAXIMUM} (``Maximum'')
1254 @item @code{MEAN} (``Mean'')
1257 @item @code{MEDIAN} (``Median'')
1260 @item @code{MINIMUM} (``Minimum'')
1263 @item @code{MISSING} (``Missing'')
1264 Sum of weights of user- and system-missing values.
1266 @item @code{MODE} (``Mode'')
1267 The highest-frequency value. Ties are broken by taking the smallest mode.
1269 @item @code{PTILE} @i{n} (``Percentile @i{n}'')
1270 The @var{n}th percentile, where @math{0 @leq{} @var{n} @leq{} 100}.
1272 @item @code{RANGE} (``Range'')
1273 The maximum minus the minimum.
1275 @item @code{SEMEAN} (``Std Error of Mean'')
1276 The standard error of the mean.
1278 @item @code{STDDEV} (``Std Deviation'')
1279 The standard deviation.
1281 @item @code{SUM} (``Sum'')
1284 @item @code{TOTALN} (``Total N'', F40.0)
1285 The sum of weights in a cell.
1287 For scale data, @code{COUNT} and @code{TOTALN} are the same.
1289 For categorical data, @code{TOTALN} counts missing values in excluded
1290 categories, that is, user-missing values not in an explicit category
1291 list on @code{CATEGORIES} (@pxref{CTABLES Per-Variable Category
1292 Options}), or user-missing values excluded because
1293 @code{MISSING=EXCLUDE} is in effect on @code{CATEGORIES}, or
1294 system-missing values. @code{COUNT} does not count these.
1296 @item @code{VALIDN} (``Valid N'', F40.0)
1297 The sum of valid count weights in included categories.
1299 @code{VALIDN} does not count missing values regardless of whether they
1300 are in included categories via @code{CATEGORIES}. @code{VALIDN} does
1301 not count valid values that are in excluded categories.
1303 @item @code{VARIANCE} (``Variance'')
1307 @node CTABLES Summary Functions for Groups of Cells
1308 @subsubsection Summary Functions for Groups of Cells
1310 These summary functions summarize over multiple cells within an area
1311 of the output chosen by the user and specified as part of the function
1312 name. The following basic @var{area}s are supported, in decreasing
1317 A @dfn{section}. Stacked variables divide sections of the output from
1318 each other. sections may span multiple layers.
1321 A section within a single layer.
1324 A @dfn{subtable}, whose contents are the cells that pair an innermost
1325 row variable and an innermost column variable within a single layer.
1328 The following shows how the output for the table expression @code{qn61
1329 > qn57 BY qnd7a > qn86 + qn64b BY qns3a}@footnote{This is not
1330 necessarily a meaningful table, so for clarity variable labels are
1331 omitted.} is divided up into @code{TABLE}, @code{LAYER}, and
1332 @code{SUBTABLE} areas. Each unique value for Table ID is one section,
1333 and similarly for Layer ID and Subtable ID. Thus, this output has two
1334 @code{TABLE} areas (one for @code{qnd7a} and one for @code{qn64b}),
1335 four @code{LAYER} areas (for those two variables, per layer), and 12
1336 @code{SUBTABLE} areas.
1337 @psppoutput {ctables22}
1339 @code{CTABLES} also supports the following @var{area}s that further
1340 divide a subtable or a layer within a section:
1345 A row or column, respectively, in one layer of a section.
1349 A row or column, respectively, in a subtable.
1352 The following summary functions for groups of cells are available for
1353 each @var{area} described above, for both categorical and scale
1357 @item @code{@i{area}PCT} or @code{@i{area}PCT.COUNT} (``@i{Area} %'', PCT40.1)
1358 A percentage of total counts within @var{area}.
1360 @item @code{@i{area}PCT.VALIDN} (``@i{Area} Valid N %'', PCT40.1)
1361 A percentage of total counts for valid values within @var{area}.
1363 @item @code{@i{area}PCT.TOTALN} (``@i{Area} Total N %'', PCT40.1)
1364 A percentage of total counts for all values within @var{area}.
1367 Scale variables and totals and subtotals for categorical variables may
1368 use the following additional group cell summary function:
1371 @item @code{@i{area}PCT.SUM} (``@i{Area} Sum %'', PCT40.1)
1372 Percentage of the sum of the values within @var{area}.
1375 @node CTABLES Summary Functions for Adjusted Weights
1376 @subsubsection Summary Functions for Adjusted Weights
1378 If the @code{WEIGHT} subcommand specified an adjustment weight
1379 variable, then the following summary functions use its value instead
1380 of the dictionary weight variable. Otherwise, they are equivalent to
1381 the summary function without the @samp{E}-prefix:
1385 @code{ECOUNT} (``Adjusted Count'', F40.0)
1388 @code{ETOTALN} (``Adjusted Total N'', F40.0)
1391 @code{EVALIDN} (``Adjusted Valid N'', F40.0)
1394 @node CTABLES Unweighted Summary Functions
1395 @subsubsection Unweighted Summary Functions
1397 The following summary functions with a @samp{U}-prefix are equivalent
1398 to the same ones without the prefix, except that they use unweighted
1403 @code{UCOUNT} (``Unweighted Count'', F40.0)
1406 @code{U@i{area}PCT} or @code{U@i{area}PCT.COUNT} (``Unweighted @i{Area} %'', PCT40.1)
1409 @code{U@i{area}PCT.VALIDN} (``Unweighted @i{Area} Valid N %'', PCT40.1)
1412 @code{U@i{area}PCT.TOTALN} (``Unweighted @i{Area} Total N %'', PCT40.1)
1415 @code{UMEAN} (``Unweighted Mean'')
1418 @code{UMEDIAN} (``Unweighted Median'')
1421 @code{UMISSING} (``Unweighted Missing'')
1424 @code{UMODE} (``Unweight Mode'')
1427 @code{U@i{area}PCT.SUM} (``Unweighted @i{Area} Sum %'', PCT40.1)
1430 @code{UPTILE} @i{n} (``Unweighted Percentile @i{n}'')
1433 @code{USEMEAN} (``Unweighted Std Error of Mean'')
1436 @code{USTDDEV} (``Unweighted Std Deviation'')
1439 @code{USUM} (``Unweighted Sum'')
1442 @code{UTOTALN} (``Unweighted Total N'', F40.0)
1445 @code{UVALIDN} (``Unweighted Valid N'', F40.0)
1448 @code{UVARIANCE} (``Unweighted Variance'', F40.0)
1451 @node CTABLES Statistics Positions and Labels
1452 @subsection Statistics Positions and Labels
1456 [@t{POSITION=}@{@t{COLUMN} @math{|} @t{ROW} @math{|} @t{LAYER}@}]
1457 [@t{VISIBLE=}@{@t{YES} @math{|} @t{NO}@}]
1460 The @code{SLABELS} subcommand controls the position and visibility of
1461 summary statistics for the @code{TABLE} subcommand that it follows.
1463 @code{POSITION} sets the axis on which summary statistics appear.
1464 With @t{POSITION=COLUMN}, which is the default, each summary statistic
1465 appears in a column. For example:
1468 CTABLES /TABLE=qnd1 [MEAN, MEDIAN] BY qns3a.
1470 @psppoutput {ctables13}
1473 With @t{POSITION=ROW}, each summary statistic appears in a row, as
1477 CTABLES /TABLE=qnd1 [MEAN, MEDIAN] BY qns3a /SLABELS POSITION=ROW.
1479 @psppoutput {ctables14}
1482 @t{POSITION=LAYER} is also available to place each summary statistic in
1485 Labels for summary statistics are shown by default. Use
1486 @t{VISIBLE=NO} to suppress them. Because unlabeled data can cause
1487 confusion, it should only be considered if the meaning of the data is
1488 evident, as in a simple case like this:
1491 CTABLES /TABLE=AgeGroup [TABLEPCT] /SLABELS VISIBLE=NO.
1493 @psppoutput {ctables15}
1495 @node CTABLES Category Label Positions
1496 @subsection Category Label Positions
1499 @t{/CLABELS} @{@t{AUTO} @math{|} @{@t{ROWLABELS}@math{|}@t{COLLABELS}@}@t{=}@{@t{OPPOSITE}@math{|}@t{LAYER}@}@}
1502 The @code{CLABELS} subcommand controls the position of category labels
1503 for the @code{TABLE} subcommand that it follows. By default, or if
1504 @t{AUTO} is specified, category labels for a given variable nest
1505 inside the variable's label on the same axis. For example, the
1506 command below results in age categories nesting within the age group
1507 variable on the rows axis and gender categories within the gender
1508 variable on the columns axis:
1511 CTABLES /TABLE AgeGroup BY qns3a.
1513 @psppoutput {ctables16}
1515 @t{ROWLABELS=OPPOSITE} or @t{COLLABELS=OPPOSITE} move row or column
1516 variable category labels, respectively, to the opposite axis. The
1517 setting affects only the innermost variable or variables, which must
1518 be categorical, on the given axis. For example:
1521 CTABLES /TABLE AgeGroup BY qns3a /CLABELS ROWLABELS=OPPOSITE.
1522 CTABLES /TABLE AgeGroup BY qns3a /CLABELS COLLABELS=OPPOSITE.
1524 @psppoutput {ctables17}
1526 @t{ROWLABELS=LAYER} or @t{COLLABELS=LAYER} move the innermost row or
1527 column variable category labels, respectively, to the layer axis.
1529 Only one axis's labels may be moved, whether to the opposite axis or
1532 @subsubheading Effect on Summary Statistics
1534 @code{CLABELS} primarily affects the appearance of tables, not the
1535 data displayed in them. However, @code{CTABLES} can affect the values
1536 displayed for statistics that summarize areas of a table, since it can
1537 change the definitions of these areas.
1539 For example, consider the following syntax and output:
1542 CTABLES /TABLE AgeGroup BY qns3a [ROWPCT, COLPCT].
1544 @psppoutput {ctables23}
1547 Using @code{COLLABELS=OPPOSITE} changes the definitions of rows and
1548 columns, so that column percentages display what were previously row
1549 percentages and the new row percentages become meaningless (because
1550 there is only one cell per row):
1554 /TABLE AgeGroup BY qns3a [ROWPCT, COLPCT]
1555 /CLABELS COLLABELS=OPPOSITE.
1557 @psppoutput {ctables24}
1559 @subsubheading Moving Categories for Stacked Variables
1561 If @code{CLABELS} moves category labels from an axis with stacked
1562 variables, the variables that are moved must have the same category
1563 specifications (@pxref{CTABLES Per-Variable Category Options}) and the
1566 The following shows both moving stacked category variables and
1567 adapting to the changing definitions of rows and columns:
1570 CTABLES /TABLE (qn105ba + qn105bb) [COLPCT].
1571 CTABLES /TABLE (qn105ba + qn105bb) [ROWPCT]
1572 /CLABELS ROW=OPPOSITE.
1574 @psppoutput {ctables25}
1576 @node CTABLES Per-Variable Category Options
1577 @subsection Per-Variable Category Options
1580 @t{/CATEGORIES} @t{VARIABLES=}@i{variables}
1581 @{@t{[}@i{value}@t{,} @i{value}@dots{}@t{]}
1582 @math{|} [@t{ORDER=}@{@t{A} @math{|} @t{D}@}]
1583 [@t{KEY=}@{@t{VALUE} @math{|} @t{LABEL} @math{|} @i{summary}@t{(}@i{variable}@t{)}@}]
1584 [@t{MISSING=}@{@t{EXCLUDE} @math{|} @t{INCLUDE}@}]@}
1585 [@t{TOTAL=}@{@t{NO} @math{|} @t{YES}@} [@t{LABEL=}@i{string}] [@t{POSITION=}@{@t{AFTER} @math{|} @t{BEFORE}@}]]
1586 [@t{EMPTY=}@{@t{INCLUDE} @math{|} @t{EXCLUDE}@}]
1589 The @code{CATEGORIES} subcommand specifies, for one or more
1590 categorical variables, the categories to include and exclude, the sort
1591 order for included categories, and treatment of missing values. It
1592 also controls the totals and subtotals to display. It may be
1593 specified any number of times, each time for a different set of
1594 variables. @code{CATEGORIES} applies to the table produced by the
1595 @code{TABLE} subcommand that it follows.
1597 @code{CATEGORIES} does not apply to scalar variables.
1599 @t{VARIABLES} is required and must list the variables for the subcommand
1602 There are two way to specify the Categories to include and their sort
1606 @item Explicit categories.
1607 @anchor{CTABLES Explicit Category List}
1608 To explicitly specify categories to include, list the categories
1609 within square brackets in the desired sort order. Use spaces or
1610 commas to separate values. Categories not covered by the list are
1611 excluded from analysis.
1613 Each element of the list takes one of the following forms:
1618 A numeric or string category value, for variables that have the
1623 A date or time category value, for variables that have a date or time
1626 @item @i{min} THRU @i{max}
1627 @itemx LO THRU @i{max}
1628 @itemx @i{min} THRU HI
1629 A range of category values, where @var{min} and @var{max} each takes
1630 one of the forms above, in increasing order.
1633 All user-missing values. (To match individual user-missing values,
1634 specify their category values.)
1637 Any non-missing value not covered by any other element of the list
1638 (regardless of where @t{OTHERNM} is placed in the list).
1640 @item &@i{postcompute}
1641 A computed category name (@pxref{CTABLES Computed Categories}).
1644 Additional forms, described later, allow for subtotals.
1645 If multiple elements of the list cover a given category, the last one
1646 in the list takes precedence.
1648 @item Implicit categories.
1649 Without an explicit list of categories, @pspp{} sorts
1650 categories automatically.
1652 The @code{KEY} setting specifies the sort key. By default, or with
1653 @code{KEY=VALUE}, categories are sorted by default. Categories may
1654 also be sorted by value label, with @code{KEY=LABEL}, or by the value
1655 of a summary function, e.g.@: @code{KEY=COUNT}.
1656 @ignore @c Not yet implemented
1657 For summary functions, a variable name may be specified in
1658 parentheses, e.g.@: @code{KEY=MAXIUM(qnd1)}, and this is required for
1659 functions that apply only to scalar variables. The @code{PTILE}
1660 function also requires a percentage argument, e.g.@:
1661 @code{KEY=PTILE(qnd1, 90)}. Only summary functions used in the table
1662 may be used, except that @code{COUNT} is always allowed.
1665 By default, or with @code{ORDER=A}, categories are sorted in ascending
1666 order. Specify @code{ORDER=D} to sort in descending order.
1668 User-missing values are excluded by default, or with
1669 @code{MISSING=EXCLUDE}. Specify @code{MISSING=INCLUDE} to include
1670 user-missing values. The system-missing value is always excluded.
1673 @subsubheading Totals and Subtotals
1675 @code{CATEGORIES} also controls display of totals and subtotals.
1676 Totals are not displayed with @code{TOTAL=NO}, which is also the
1677 default. Specify @code{TOTAL=YES} to display a total. By default,
1678 the total is labeled ``Total''; use @code{LABEL="@i{label}"} to
1681 Subtotals are also not displayed by default. To add one or more
1682 subtotals, use an explicit category list and insert @code{SUBTOTAL} or
1683 @code{HSUBTOTAL} in the position or positions where the subtotal
1684 should appear. With @code{SUBTOTAL}, the subtotal becomes an extra
1685 row or column or layer; @code{HSUBTOTAL} additionally hides the
1686 categories that make up the subtotal. Either way, the default label
1687 is ``Subtotal'', use @code{SUBTOTAL="@i{label}"} or
1688 @code{HSUBTOTAL="@i{label}"} to specify a custom label.
1690 By default, or with @code{POSITION=AFTER}, totals are displayed in the
1691 output after the last category and subtotals apply to categories that
1692 precede them. With @code{POSITION=BEFORE}, totals come before the
1693 first category and subtotals apply to categories that follow them.
1695 Only categorical variables may have totals and subtotals. Scalar
1696 variables may be ``totaled'' indirectly by enabling totals and
1697 subtotals on a categorical variable within which the scalar variable is
1700 By default, @pspp{} uses the same summary functions for totals and
1701 subtotals as other categories. To summarize totals and subtotals
1702 differently, specify the summary functions for totals and subtotals
1703 after the ordinary summary functions inside a nested set of @code{[]}
1704 following @code{TOTALS}. For example, the following syntax displays
1705 @code{COUNT} for individual categories and totals and @code{VALIDN}
1706 for totals, as shown:
1710 /TABLE qnd7a [COUNT, TOTALS[COUNT, VALIDN]]
1711 /CATEGORIES VARIABLES=qnd7a TOTAL=YES MISSING=INCLUDE.
1713 @psppoutput {ctables26}
1715 @subsubheading Categories Without Values
1717 Some categories might not be included in the data set being analyzed.
1718 For example, our example data set has no cases in the ``15 or
1719 younger'' age group. By default, or with @code{EMPTY=INCLUDE},
1720 @pspp{} includes these empty categories in output tables. To exclude
1721 them, specify @code{EMPTY=EXCLUDE}.
1723 For implicit categories, empty categories potentially include all the
1724 values with value labels for a given variable; for explicit
1725 categories, they include all the values listed individually and all
1726 values with value labels that are covered by ranges or @code{MISSING}
1729 @node CTABLES Titles
1734 [@t{TITLE=}@i{string}@dots{}]
1735 [@t{CAPTION=}@i{string}@dots{}]
1736 [@t{CORNER=}@i{string}@dots{}]
1739 The @code{TITLES} subcommand sets the title, caption, and corner text
1740 for the table output for the previous @code{TABLE} subcommand. Any
1741 number of strings may be specified for each kind of text, with each
1742 string appearing on a separate line in the output. The title appears
1743 above the table, the caption below the table, and the corner text
1744 appears in the table's upper left corner. By default, the title is
1745 ``Custom Tables'' and the caption and corner text are empty. With
1746 some table output styles, the corner text is not displayed.
1748 The strings provided in this subcommand may contain the following
1749 macro-like keywords that @pspp{} substitutes at the time that it runs
1754 The current date, e.g.@: MM/DD/YY. The format is locale-dependent.
1758 The current time, e.g.@: HH:MM:SS. The format is locale-dependent.
1762 The expression specified on the @code{TABLE} command. Summary
1763 and measurement level specifications are omitted, and variable labels are used in place of variable names.
1768 @node CTABLES Table Formatting
1769 @subsection Table Formatting
1773 [@t{MINCOLWIDTH=}@{@t{DEFAULT} @math{|} @i{width}@}]
1774 [@t{MAXCOLWIDTH=}@{@t{DEFAULT} @math{|} @i{width}@}]
1775 [@t{UNITS=}@{@t{POINTS} @math{|} @t{INCHES} @math{|} @t{CM}@}]
1776 [@t{EMPTY=}@{@t{ZERO} @math{|} @t{BLANK} @math{|} @i{string}@}]
1777 [@t{MISSING=}@i{string}]
1780 The @code{FORMAT} subcommand, which must precede the first
1781 @code{TABLE} subcommand, controls formatting for all the output
1782 tables. @code{FORMAT} and all of its settings are optional.
1784 Use @code{MINCOLWIDTH} and @code{MAXCOLWIDTH} to control the minimum
1785 or maximum width of columns in output tables. By default, with
1786 @code{DEFAULT}, column width varies based on content. Otherwise,
1787 specify a number for either or both of these settings. If both are
1788 specified, @code{MAXCOLWIDTH} must be greater than or equal to
1789 @code{MINCOLWIDTH}. The default unit, or with @code{UNITS=POINTS}, is
1790 points (1/72 inch), or specify @code{UNITS=INCHES} to use inches or
1791 @code{UNITS=CM} for centimeters.
1793 By default, or with @code{EMPTY=ZERO}, zero values are displayed in
1794 their usual format. Use @code{EMPTY=BLANK} to use an empty cell
1795 instead, or @code{EMPTY="@i{string}"} to use the specified string.
1797 By default, missing values are displayed as @samp{.}, the same as in
1798 other tables. Specify @code{MISSING="@i{string}"} to instead use a
1801 @node CTABLES Display of Variable Labels
1802 @subsection Display of Variable Labels
1806 @t{VARIABLES=}@i{variables}
1807 @t{DISPLAY}=@{@t{DEFAULT} @math{|} @t{NAME} @math{|} @t{LABEL} @math{|} @t{BOTH} @math{|} @t{NONE}@}
1810 The @code{VLABELS} subcommand, which must precede the first
1811 @code{TABLE} subcommand, controls display of variable labels in all
1812 the output tables. @code{VLABELS} is optional. It may appear
1813 multiple times to adjust settings for different variables.
1815 @code{VARIABLES} and @code{DISPLAY} are required. The value of
1816 @code{DISPLAY} controls how variable labels are displayed for the
1817 variables listed on @code{VARIABLES}. The supported values are:
1821 Use the setting from @code{SET TVARS} (@pxref{SET TVARS}).
1824 Show only a variable name.
1827 Show only a variable label.
1830 Show variable name and label.
1836 @node CTABLES Missing Value Treatment
1837 @subsection Missing Value Treatment
1839 The @code{TABLE} subcommand on @code{CTABLES} specifies two different
1840 kinds of variables: variables that divide tables into cells (which are
1841 always categorical) and variables being summarized (which may be
1842 categorical or scale). @pspp{} treats missing values differently in
1843 each kind of variable:
1847 For variables that divide tables into cells, per-variable category
1848 options determine which data is analyzed. If any of the categories
1849 for such a variable would exclude a case, then that case is not
1853 The treatment of missing values in variables being summarized varies
1854 between scale and scale and categorical variables. The following
1855 section describes their treatment in detail.
1857 By default, each summarized variable is considered separately for
1858 missing value treatment. A section below describes how to consider
1859 missing values listwise for summarizing scale variables.
1862 @node CTABLES Missing Values for Summary Variables
1863 @subsubsection Missing Values for Summary Variables
1865 For summary variables, values that are valid and in included
1866 categories are analyzed, and values that are missing or in excluded
1867 categories are not analyzed, with the following exceptions:
1871 The ``@t{VALIDN}'' summary functions (@code{VALIDN}, @code{EVALIDN},
1872 @code{UVALIDN}, @code{@i{area}PCT.VALIDN}, and
1873 @code{U@i{area}PCT.VALIDN}) only count valid values in included
1874 categories (not missing values in included categories).
1877 The ``@t{TOTALN}'' summary functions (@code{TOTALN}, @code{ETOTALN},
1878 @code{UTOTALN}, @code{@i{area}PCT.TOTALN}), and
1879 @code{U@i{area}PCT.TOTALN} count all values (valid and missing) in
1880 included categories and missing (but not valid) values in excluded
1885 For categorical variables, system-missing values are never in included
1886 categories. For scale variables, there is no notion of included and
1887 excluded categories, so all values are effectively included.
1889 The following table provides another view of the above rules:
1891 @multitable {@w{ }@w{ }@w{ }@w{ }Missing values in excluded categories} {@t{VALIDN}} {other} {@t{TOTALN}}
1892 @headitem @tab @t{VALIDN} @tab other @tab @t{TOTALN}
1893 @item @headitemfont{Categorical variables:}
1894 @item @w{ }@w{ }@w{ }@w{ }Valid values in included categories @tab yes @tab yes @tab yes
1895 @item @w{ }@w{ }@w{ }@w{ }Missing values in included categories @tab --- @tab yes @tab yes
1896 @item @w{ }@w{ }@w{ }@w{ }Missing values in excluded categories @tab --- @tab --- @tab yes
1897 @item @w{ }@w{ }@w{ }@w{ }Valid values in excluded categories @tab --- @tab --- @tab ---
1898 @item @headitemfont{Scale variables:}
1899 @item @w{ }@w{ }@w{ }@w{ }Valid values @tab yes @tab yes @tab yes
1900 @item @w{ }@w{ }@w{ }@w{ }User- or system-missing values @tab --- @tab yes @tab yes
1903 @node CTABLES Scale Missing Values
1904 @subsubsection Scale Missing Values
1907 @t{/SMISSING} @{@t{VARIABLE} @math{|} @t{LISTWISE}@}
1910 The @code{SMISSING} subcommand, which must precede the first
1911 @code{TABLE} subcommand, controls treatment of missing values for
1912 scalar variables in producing all the output tables. @code{SMISSING}
1915 With @code{SMISSING=VARIABLE}, which is the default, missing values
1916 are excluded on a variable-by-variable basis. With
1917 @code{SMISSING=LISTWISE}, when stacked scalar variables are nested
1918 together with a categorical variable, a missing value for any of the
1919 scalar variables causes the case to be excluded for all of them.
1921 As an example, consider the following dataset, in which @samp{x} is a
1922 categorical variable and @samp{y} and @samp{z} are scale:
1924 @psppoutput{ctables18}
1927 With the default missing-value treatment, @samp{x}'s mean is 20, based
1928 on the values 10, 20, and 30, and @samp{y}'s mean is 50, based on 40,
1932 CTABLES /TABLE (y + z) > x.
1934 @psppoutput{ctables19}
1937 By adding @code{SMISSING=LISTWISE}, only cases where @samp{y} and
1938 @samp{z} are both non-missing are considered, so @samp{x}'s mean
1939 becomes 15, as the average of 10 and 20, and @samp{y}'s mean becomes
1940 55, the average of 50 and 60:
1943 CTABLES /SMISSING LISTWISE /TABLE (y + z) > x.
1945 @psppoutput{ctables20}
1948 Even with @code{SMISSING=LISTWISE}, if @samp{y} and @samp{z} are
1949 separately nested with @samp{x}, instead of using a single @samp{>}
1950 operator, missing values revert to being considered on a
1951 variable-by-variable basis:
1954 CTABLES /SMISSING LISTWISE /TABLE (y > x) + (z > x).
1956 @psppoutput{ctables21}
1958 @node CTABLES Computed Categories
1959 @subsection Computed Categories
1962 @t{/PCOMPUTE} @t{&}@i{postcompute}@t{=EXPR(}@i{expression}@t{)}
1965 @dfn{Computed categories}, also called @dfn{postcomputes}, are
1966 categories created using arithmetic on categories obtained from the
1967 data. The @code{PCOMPUTE} subcommand defines computed categories,
1968 which can then be used in two places: on @code{CATEGORIES} within an
1969 explicit category list (@pxref{CTABLES Explicit Category List}), and on
1970 the @code{PPROPERTIES} subcommand to define further properties for a
1973 @code{PCOMPUTE} must precede the first @code{TABLE} command. It is
1974 optional and it may be used any number of times to define multiple
1977 Each @code{PCOMPUTE} defines one postcompute. Its syntax consists of
1978 a name to identify the postcompute as a @pspp{} identifier prefixed by
1979 @samp{&}, followed by @samp{=} and a postcompute expression enclosed
1980 in @code{EXPR(@dots{})}. A postcompute expression consists of:
1983 @item [@i{category}]
1984 This form evaluates to the summary statistic for @i{category}, e.g.@:
1985 @code{[1]} evaluates to the value of the summary statistic associated
1986 with category 1. The @i{category} may be a number, a quoted string,
1987 or a quoted time or date value. All of the categories for a given
1988 postcompute must have the same form. The category must appear in all
1989 the @code{CATEGORIES} list in which the postcompute is used.
1991 @item [@i{min} THRU @i{max}]
1992 @itemx [LO THRU @i{max}]
1993 @itemx [@i{min} THRU HI]
1996 These forms evaluate to the summary statistics for a category
1997 specified with the same syntax, as described in previous section
1998 (@pxref{CTABLES Explicit Category List}). The category must appear in
1999 all the @code{CATEGORIES} list in which the postcompute is used.
2002 The summary statistic for the subtotal category. This form is allowed
2003 only if the @code{CATEGORIES} lists that include this postcompute have
2004 exactly one subtotal.
2006 @item SUBTOTAL[@i{index}]
2007 The summary statistic for subtotal category @i{index}, where 1 is the
2008 first subtotal, 2 is the second, and so on. This form may be used for
2009 @code{CATEGORIES} lists with any number of subtotals.
2012 The summary statistic for the total. The @code{CATEGORIES} lsits that
2013 include this postcompute must have a total enabled.
2016 @itemx @i{a} - @i{b}
2017 @itemx @i{a} * @i{b}
2018 @itemx @i{a} / @i{b}
2019 @itemx @i{a} ** @i{b}
2020 These forms perform arithmetic on the values of postcompute
2021 expressions @i{a} and @i{b}. The usual operator precedence rules
2025 Numeric constants may be used in postcompute expressions.
2028 Parentheses override operator precedence.
2031 A postcompute is not associated with any particular variable.
2032 Instead, it may be referenced within @code{CATEGORIES} for any
2033 suitable variable (e.g.@: only a string variable is suitable for a
2034 postcompute expression that refers to a string category, only a
2035 variable with subtotals for an expression that refers to subtotals,
2038 Normally a named postcompute is defined only once, but if a later
2039 @code{PCOMPUTE} redefines a postcompute with the same name as an
2040 earlier one, the later one take precedence.
2042 @node CTABLES Computed Category Properties
2043 @subsection Computed Category Properties
2046 @t{/PPROPERTIES} @t{&}@i{postcompute}@dots{}
2047 [@t{LABEL=}@i{string}]
2048 [@t{FORMAT=}[@i{summary} @i{format}]@dots{}]
2049 [@t{HIDESOURCECATS=}@{@t{NO} @math{|} @t{YES}@}
2052 The @code{PPROPERTIES} subcommand, which must appear before
2053 @code{TABLE}, sets properties for one or more postcomputes defined on
2054 prior @code{PCOMPUTE} subcommands. The subcommand syntax begins with
2055 the list of postcomputes, each prefixed with @samp{&} as specified on
2058 All of the settings on @code{PPROPERTIES} are optional. Use
2059 @code{LABEL} to set the label shown for the postcomputes in table
2060 output. The default label for a postcompute is the expression used to
2063 The @code{FORMAT} setting sets summary statistics and display formats
2064 for the postcomputes.
2066 By default, or with @code{HIDESOURCECATS=NO}, categories referred to
2067 by computed categories are displayed like other categories. Use
2068 @code{HIDESOURCECATS=YES} to hide them.
2070 @node CTABLES Base Weight
2071 @subsection Base Weight
2074 @t{/WEIGHT VARIABLE=}@i{variable}
2077 The @code{WEIGHT} subcommand is optional and must appear before
2078 @code{TABLE}. If it appears, it must name a numeric variable, known
2079 as the @dfn{effective base weight} or @dfn{adjustment weight}. The
2080 effective base weight variable stands in for the dictionary's weight
2081 variable (@pxref{WEIGHT}), if any, in most calculations in
2082 @code{CTABLES}. The only exceptions are the @code{COUNT},
2083 @code{TOTALN}, and @code{VALIDN} summary functions, which use the
2084 dictionary weight instead.
2086 Weights obtained from the @pspp{} dictionary are rounded to the
2087 nearest integer at the case level. Effective base weights are not
2088 rounded. Regardless of the weighting source, @pspp{} does not analyze
2089 cases with zero, missing, or negative effective weights.
2091 @node CTABLES Hiding Small Counts
2092 @subsection Hiding Small Counts
2095 @t{/HIDESMALLCOUNTS COUNT=@i{count}}
2098 The @code{HIDESMALLCOUNTS} subcommand is optional. If it specified,
2099 then count values in output tables less than the value of @i{count}
2100 are shown as @code{<@i{count}} instead of their true values. The
2101 value of @i{count} must be an integer and must be at least 2. Case
2102 weights are considered for deciding whether to hide a count.
2108 @cindex factor analysis
2109 @cindex principal components analysis
2110 @cindex principal axis factoring
2111 @cindex data reduction
2115 VARIABLES=@var{var_list},
2116 MATRIX IN (@{CORR,COV@}=@{*,@var{file_spec}@})
2119 [ /METHOD = @{CORRELATION, COVARIANCE@} ]
2121 [ /ANALYSIS=@var{var_list} ]
2123 [ /EXTRACTION=@{PC, PAF@}]
2125 [ /ROTATION=@{VARIMAX, EQUAMAX, QUARTIMAX, PROMAX[(@var{k})], NOROTATE@}]
2127 [ /PRINT=[INITIAL] [EXTRACTION] [ROTATION] [UNIVARIATE] [CORRELATION] [COVARIANCE] [DET] [KMO] [AIC] [SIG] [ALL] [DEFAULT] ]
2131 [ /FORMAT=[SORT] [BLANK(@var{n})] [DEFAULT] ]
2133 [ /CRITERIA=[FACTORS(@var{n})] [MINEIGEN(@var{l})] [ITERATE(@var{m})] [ECONVERGE (@var{delta})] [DEFAULT] ]
2135 [ /MISSING=[@{LISTWISE, PAIRWISE@}] [@{INCLUDE, EXCLUDE@}] ]
2138 The @cmd{FACTOR} command performs Factor Analysis or Principal Axis Factoring on a dataset. It may be used to find
2139 common factors in the data or for data reduction purposes.
2141 The @subcmd{VARIABLES} subcommand is required (unless the @subcmd{MATRIX IN}
2142 subcommand is used).
2143 It lists the variables which are to partake in the analysis. (The @subcmd{ANALYSIS}
2144 subcommand may optionally further limit the variables that
2145 participate; it is useful primarily in conjunction with @subcmd{MATRIX IN}.)
2147 If @subcmd{MATRIX IN} instead of @subcmd{VARIABLES} is specified, then the analysis
2148 is performed on a pre-prepared correlation or covariance matrix file instead of on
2149 individual data cases. Typically the matrix file will have been generated by
2150 @cmd{MATRIX DATA} (@pxref{MATRIX DATA}) or provided by a third party.
2151 If specified, @subcmd{MATRIX IN} must be followed by @samp{COV} or @samp{CORR},
2152 then by @samp{=} and @var{file_spec} all in parentheses.
2153 @var{file_spec} may either be an asterisk, which indicates the currently loaded
2154 dataset, or it may be a file name to be loaded. @xref{MATRIX DATA}, for the expected
2157 The @subcmd{/EXTRACTION} subcommand is used to specify the way in which factors
2158 (components) are extracted from the data.
2159 If @subcmd{PC} is specified, then Principal Components Analysis is used.
2160 If @subcmd{PAF} is specified, then Principal Axis Factoring is
2161 used. By default Principal Components Analysis is used.
2163 The @subcmd{/ROTATION} subcommand is used to specify the method by which the
2164 extracted solution is rotated. Three orthogonal rotation methods are available:
2165 @subcmd{VARIMAX} (which is the default), @subcmd{EQUAMAX}, and @subcmd{QUARTIMAX}.
2166 There is one oblique rotation method, @i{viz}: @subcmd{PROMAX}.
2167 Optionally you may enter the power of the promax rotation @var{k}, which must be enclosed in parentheses.
2168 The default value of @var{k} is 5.
2169 If you don't want any rotation to be performed, the word @subcmd{NOROTATE}
2170 prevents the command from performing any rotation on the data.
2172 The @subcmd{/METHOD} subcommand should be used to determine whether the
2173 covariance matrix or the correlation matrix of the data is
2174 to be analysed. By default, the correlation matrix is analysed.
2176 The @subcmd{/PRINT} subcommand may be used to select which features of the analysis are reported:
2179 @item @subcmd{UNIVARIATE}
2180 A table of mean values, standard deviations and total weights are printed.
2181 @item @subcmd{INITIAL}
2182 Initial communalities and eigenvalues are printed.
2183 @item @subcmd{EXTRACTION}
2184 Extracted communalities and eigenvalues are printed.
2185 @item @subcmd{ROTATION}
2186 Rotated communalities and eigenvalues are printed.
2187 @item @subcmd{CORRELATION}
2188 The correlation matrix is printed.
2189 @item @subcmd{COVARIANCE}
2190 The covariance matrix is printed.
2192 The determinant of the correlation or covariance matrix is printed.
2194 The anti-image covariance and anti-image correlation matrices are printed.
2196 The Kaiser-Meyer-Olkin measure of sampling adequacy and the Bartlett test of sphericity is printed.
2198 The significance of the elements of correlation matrix is printed.
2200 All of the above are printed.
2201 @item @subcmd{DEFAULT}
2202 Identical to @subcmd{INITIAL} and @subcmd{EXTRACTION}.
2205 If @subcmd{/PLOT=EIGEN} is given, then a ``Scree'' plot of the eigenvalues is
2206 printed. This can be useful for visualizing the factors and deciding
2207 which factors (components) should be retained.
2209 The @subcmd{/FORMAT} subcommand determined how data are to be
2210 displayed in loading matrices. If @subcmd{SORT} is specified, then
2211 the variables are sorted in descending order of significance. If
2212 @subcmd{BLANK(@var{n})} is specified, then coefficients whose absolute
2213 value is less than @var{n} are not printed. If the keyword
2214 @subcmd{DEFAULT} is specified, or if no @subcmd{/FORMAT} subcommand is
2215 specified, then no sorting is performed, and all coefficients are printed.
2217 You can use the @subcmd{/CRITERIA} subcommand to specify how the number of
2218 extracted factors (components) are chosen. If @subcmd{FACTORS(@var{n})} is
2219 specified, where @var{n} is an integer, then @var{n} factors are
2220 extracted. Otherwise, the @subcmd{MINEIGEN} setting is used.
2221 @subcmd{MINEIGEN(@var{l})} requests that all factors whose eigenvalues
2222 are greater than or equal to @var{l} are extracted. The default value
2223 of @var{l} is 1. The @subcmd{ECONVERGE} setting has effect only when
2224 using iterative algorithms for factor extraction (such as Principal Axis
2225 Factoring). @subcmd{ECONVERGE(@var{delta})} specifies that
2226 iteration should cease when the maximum absolute value of the
2227 communality estimate between one iteration and the previous is less
2228 than @var{delta}. The default value of @var{delta} is 0.001.
2230 The @subcmd{ITERATE(@var{m})} may appear any number of times and is
2231 used for two different purposes. It is used to set the maximum number
2232 of iterations (@var{m}) for convergence and also to set the maximum
2233 number of iterations for rotation.
2234 Whether it affects convergence or rotation depends upon which
2235 subcommand follows the @subcmd{ITERATE} subcommand.
2236 If @subcmd{EXTRACTION} follows, it affects convergence.
2237 If @subcmd{ROTATION} follows, it affects rotation.
2238 If neither @subcmd{ROTATION} nor @subcmd{EXTRACTION} follow a
2239 @subcmd{ITERATE} subcommand, then the entire subcommand is ignored.
2240 The default value of @var{m} is 25.
2242 The @cmd{MISSING} subcommand determines the handling of missing
2243 variables. If @subcmd{INCLUDE} is set, then user-missing values are
2244 included in the calculations, but system-missing values are not.
2245 If @subcmd{EXCLUDE} is set, which is the default, user-missing
2246 values are excluded as well as system-missing values. This is the
2247 default. If @subcmd{LISTWISE} is set, then the entire case is excluded
2248 from analysis whenever any variable specified in the @cmd{VARIABLES}
2249 subcommand contains a missing value.
2251 If @subcmd{PAIRWISE} is set, then a case is considered missing only if
2252 either of the values for the particular coefficient are missing.
2253 The default is @subcmd{LISTWISE}.
2259 @cindex univariate analysis of variance
2260 @cindex fixed effects
2261 @cindex factorial anova
2262 @cindex analysis of variance
2267 GLM @var{dependent_vars} BY @var{fixed_factors}
2268 [/METHOD = SSTYPE(@var{type})]
2269 [/DESIGN = @var{interaction_0} [@var{interaction_1} [... @var{interaction_n}]]]
2270 [/INTERCEPT = @{INCLUDE|EXCLUDE@}]
2271 [/MISSING = @{INCLUDE|EXCLUDE@}]
2274 The @cmd{GLM} procedure can be used for fixed effects factorial Anova.
2276 The @var{dependent_vars} are the variables to be analysed.
2277 You may analyse several variables in the same command in which case they should all
2278 appear before the @code{BY} keyword.
2280 The @var{fixed_factors} list must be one or more categorical variables. Normally it
2281 does not make sense to enter a scalar variable in the @var{fixed_factors} and doing
2282 so may cause @pspp{} to do a lot of unnecessary processing.
2284 The @subcmd{METHOD} subcommand is used to change the method for producing the sums of
2285 squares. Available values of @var{type} are 1, 2 and 3. The default is type 3.
2287 You may specify a custom design using the @subcmd{DESIGN} subcommand.
2288 The design comprises a list of interactions where each interaction is a
2289 list of variables separated by a @samp{*}. For example the command
2291 GLM subject BY sex age_group race
2292 /DESIGN = age_group sex group age_group*sex age_group*race
2294 @noindent specifies the model @math{subject = age_group + sex + race + age_group*sex + age_group*race}.
2295 If no @subcmd{DESIGN} subcommand is specified, then the default is all possible combinations
2296 of the fixed factors. That is to say
2298 GLM subject BY sex age_group race
2301 @math{subject = age_group + sex + race + age_group*sex + age_group*race + sex*race + age_group*sex*race}.
2304 The @subcmd{MISSING} subcommand determines the handling of missing
2306 If @subcmd{INCLUDE} is set then, for the purposes of GLM analysis,
2307 only system-missing values are considered
2308 to be missing; user-missing values are not regarded as missing.
2309 If @subcmd{EXCLUDE} is set, which is the default, then user-missing
2310 values are considered to be missing as well as system-missing values.
2311 A case for which any dependent variable or any factor
2312 variable has a missing value is excluded from the analysis.
2314 @node LOGISTIC REGRESSION
2315 @section LOGISTIC REGRESSION
2317 @vindex LOGISTIC REGRESSION
2318 @cindex logistic regression
2319 @cindex bivariate logistic regression
2322 LOGISTIC REGRESSION [VARIABLES =] @var{dependent_var} WITH @var{predictors}
2324 [/CATEGORICAL = @var{categorical_predictors}]
2326 [@{/NOCONST | /ORIGIN | /NOORIGIN @}]
2328 [/PRINT = [SUMMARY] [DEFAULT] [CI(@var{confidence})] [ALL]]
2330 [/CRITERIA = [BCON(@var{min_delta})] [ITERATE(@var{max_interations})]
2331 [LCON(@var{min_likelihood_delta})] [EPS(@var{min_epsilon})]
2332 [CUT(@var{cut_point})]]
2334 [/MISSING = @{INCLUDE|EXCLUDE@}]
2337 Bivariate Logistic Regression is used when you want to explain a dichotomous dependent
2338 variable in terms of one or more predictor variables.
2340 The minimum command is
2342 LOGISTIC REGRESSION @var{y} WITH @var{x1} @var{x2} @dots{} @var{xn}.
2344 Here, @var{y} is the dependent variable, which must be dichotomous and @var{x1} @dots{} @var{xn}
2345 are the predictor variables whose coefficients the procedure estimates.
2347 By default, a constant term is included in the model.
2348 Hence, the full model is
2351 = b_0 + b_1 {\bf x_1}
2357 Predictor variables which are categorical in nature should be listed on the @subcmd{/CATEGORICAL} subcommand.
2358 Simple variables as well as interactions between variables may be listed here.
2360 If you want a model without the constant term @math{b_0}, use the keyword @subcmd{/ORIGIN}.
2361 @subcmd{/NOCONST} is a synonym for @subcmd{/ORIGIN}.
2363 An iterative Newton-Raphson procedure is used to fit the model.
2364 The @subcmd{/CRITERIA} subcommand is used to specify the stopping criteria of the procedure,
2365 and other parameters.
2366 The value of @var{cut_point} is used in the classification table. It is the
2367 threshold above which predicted values are considered to be 1. Values
2368 of @var{cut_point} must lie in the range [0,1].
2369 During iterations, if any one of the stopping criteria are satisfied, the procedure is
2370 considered complete.
2371 The stopping criteria are:
2373 @item The number of iterations exceeds @var{max_iterations}.
2374 The default value of @var{max_iterations} is 20.
2375 @item The change in the all coefficient estimates are less than @var{min_delta}.
2376 The default value of @var{min_delta} is 0.001.
2377 @item The magnitude of change in the likelihood estimate is less than @var{min_likelihood_delta}.
2378 The default value of @var{min_delta} is zero.
2379 This means that this criterion is disabled.
2380 @item The differential of the estimated probability for all cases is less than @var{min_epsilon}.
2381 In other words, the probabilities are close to zero or one.
2382 The default value of @var{min_epsilon} is 0.00000001.
2386 The @subcmd{PRINT} subcommand controls the display of optional statistics.
2387 Currently there is one such option, @subcmd{CI}, which indicates that the
2388 confidence interval of the odds ratio should be displayed as well as its value.
2389 @subcmd{CI} should be followed by an integer in parentheses, to indicate the
2390 confidence level of the desired confidence interval.
2392 The @subcmd{MISSING} subcommand determines the handling of missing
2394 If @subcmd{INCLUDE} is set, then user-missing values are included in the
2395 calculations, but system-missing values are not.
2396 If @subcmd{EXCLUDE} is set, which is the default, user-missing
2397 values are excluded as well as system-missing values.
2398 This is the default.
2409 [ BY @{@var{var_list}@} [BY @{@var{var_list}@} [BY @{@var{var_list}@} @dots{} ]]]
2411 [ /@{@var{var_list}@}
2412 [ BY @{@var{var_list}@} [BY @{@var{var_list}@} [BY @{@var{var_list}@} @dots{} ]]] ]
2414 [/CELLS = [MEAN] [COUNT] [STDDEV] [SEMEAN] [SUM] [MIN] [MAX] [RANGE]
2415 [VARIANCE] [KURT] [SEKURT]
2416 [SKEW] [SESKEW] [FIRST] [LAST]
2417 [HARMONIC] [GEOMETRIC]
2422 [/MISSING = [INCLUDE] [DEPENDENT]]
2425 You can use the @cmd{MEANS} command to calculate the arithmetic mean and similar
2426 statistics, either for the dataset as a whole or for categories of data.
2428 The simplest form of the command is
2432 @noindent which calculates the mean, count and standard deviation for @var{v}.
2433 If you specify a grouping variable, for example
2435 MEANS @var{v} BY @var{g}.
2437 @noindent then the means, counts and standard deviations for @var{v} after having
2438 been grouped by @var{g} are calculated.
2439 Instead of the mean, count and standard deviation, you could specify the statistics
2440 in which you are interested:
2442 MEANS @var{x} @var{y} BY @var{g}
2443 /CELLS = HARMONIC SUM MIN.
2445 This example calculates the harmonic mean, the sum and the minimum values of @var{x} and @var{y}
2448 The @subcmd{CELLS} subcommand specifies which statistics to calculate. The available statistics
2452 @cindex arithmetic mean
2453 The arithmetic mean.
2454 @item @subcmd{COUNT}
2455 The count of the values.
2456 @item @subcmd{STDDEV}
2457 The standard deviation.
2458 @item @subcmd{SEMEAN}
2459 The standard error of the mean.
2461 The sum of the values.
2466 @item @subcmd{RANGE}
2467 The difference between the maximum and minimum values.
2468 @item @subcmd{VARIANCE}
2470 @item @subcmd{FIRST}
2471 The first value in the category.
2473 The last value in the category.
2476 @item @subcmd{SESKEW}
2477 The standard error of the skewness.
2480 @item @subcmd{SEKURT}
2481 The standard error of the kurtosis.
2482 @item @subcmd{HARMONIC}
2483 @cindex harmonic mean
2485 @item @subcmd{GEOMETRIC}
2486 @cindex geometric mean
2490 In addition, three special keywords are recognized:
2492 @item @subcmd{DEFAULT}
2493 This is the same as @subcmd{MEAN} @subcmd{COUNT} @subcmd{STDDEV}.
2495 All of the above statistics are calculated.
2497 No statistics are calculated (only a summary is shown).
2501 More than one @dfn{table} can be specified in a single command.
2502 Each table is separated by a @samp{/}. For
2506 @var{c} @var{d} @var{e} BY @var{x}
2507 /@var{a} @var{b} BY @var{x} @var{y}
2508 /@var{f} BY @var{y} BY @var{z}.
2510 has three tables (the @samp{TABLE =} is optional).
2511 The first table has three dependent variables @var{c}, @var{d} and @var{e}
2512 and a single categorical variable @var{x}.
2513 The second table has two dependent variables @var{a} and @var{b},
2514 and two categorical variables @var{x} and @var{y}.
2515 The third table has a single dependent variables @var{f}
2516 and a categorical variable formed by the combination of @var{y} and @var{z}.
2519 By default values are omitted from the analysis only if missing values
2520 (either system missing or user missing)
2521 for any of the variables directly involved in their calculation are
2523 This behaviour can be modified with the @subcmd{/MISSING} subcommand.
2524 Three options are possible: @subcmd{TABLE}, @subcmd{INCLUDE} and @subcmd{DEPENDENT}.
2526 @subcmd{/MISSING = INCLUDE} says that user missing values, either in the dependent
2527 variables or in the categorical variables should be taken at their face
2528 value, and not excluded.
2530 @subcmd{/MISSING = DEPENDENT} says that user missing values, in the dependent
2531 variables should be taken at their face value, however cases which
2532 have user missing values for the categorical variables should be omitted
2533 from the calculation.
2535 @subsection Example Means
2537 The dataset in @file{repairs.sav} contains the mean time between failures (@exvar{mtbf})
2538 for a sample of artifacts produced by different factories and trialed under
2539 different operating conditions.
2540 Since there are four combinations of categorical variables, by simply looking
2541 at the list of data, it would be hard to how the scores vary for each category.
2542 @ref{means:ex} shows one way of tabulating the @exvar{mtbf} in a way which is
2543 easier to understand.
2545 @float Example, means:ex
2546 @psppsyntax {means.sps}
2547 @caption {Running @cmd{MEANS} on the @exvar{mtbf} score with categories @exvar{factory} and @exvar{environment}}
2550 The results are shown in @ref{means:res}. The figures shown indicate the mean,
2551 standard deviation and number of samples in each category.
2552 These figures however do not indicate whether the results are statistically
2553 significant. For that, you would need to use the procedures @cmd{ONEWAY}, @cmd{GLM} or
2554 @cmd{T-TEST} depending on the hypothesis being tested.
2556 @float Result, means:res
2558 @caption {The @exvar{mtbf} categorised by @exvar{factory} and @exvar{environment}}
2561 Note that there is no limit to the number of variables for which you can calculate
2562 statistics, nor to the number of categorical variables per layer, nor the number
2564 However, running @cmd{MEANS} on a large numbers of variables, or with categorical variables
2565 containing a large number of distinct values may result in an extremely large output, which
2566 will not be easy to interpret.
2567 So you should consider carefully which variables to select for participation in the analysis.
2573 @cindex nonparametric tests
2578 nonparametric test subcommands
2583 [ /STATISTICS=@{DESCRIPTIVES@} ]
2585 [ /MISSING=@{ANALYSIS, LISTWISE@} @{INCLUDE, EXCLUDE@} ]
2587 [ /METHOD=EXACT [ TIMER [(@var{n})] ] ]
2590 @cmd{NPAR TESTS} performs nonparametric tests.
2591 Non parametric tests make very few assumptions about the distribution of the
2593 One or more tests may be specified by using the corresponding subcommand.
2594 If the @subcmd{/STATISTICS} subcommand is also specified, then summary statistics are
2595 produces for each variable that is the subject of any test.
2597 Certain tests may take a long time to execute, if an exact figure is required.
2598 Therefore, by default asymptotic approximations are used unless the
2599 subcommand @subcmd{/METHOD=EXACT} is specified.
2600 Exact tests give more accurate results, but may take an unacceptably long
2601 time to perform. If the @subcmd{TIMER} keyword is used, it sets a maximum time,
2602 after which the test is abandoned, and a warning message printed.
2603 The time, in minutes, should be specified in parentheses after the @subcmd{TIMER} keyword.
2604 If the @subcmd{TIMER} keyword is given without this figure, then a default value of 5 minutes
2609 * BINOMIAL:: Binomial Test
2610 * CHISQUARE:: Chi-square Test
2611 * COCHRAN:: Cochran Q Test
2612 * FRIEDMAN:: Friedman Test
2613 * KENDALL:: Kendall's W Test
2614 * KOLMOGOROV-SMIRNOV:: Kolmogorov Smirnov Test
2615 * KRUSKAL-WALLIS:: Kruskal-Wallis Test
2616 * MANN-WHITNEY:: Mann Whitney U Test
2617 * MCNEMAR:: McNemar Test
2618 * MEDIAN:: Median Test
2620 * SIGN:: The Sign Test
2621 * WILCOXON:: Wilcoxon Signed Ranks Test
2626 @subsection Binomial test
2628 @cindex binomial test
2631 [ /BINOMIAL[(@var{p})]=@var{var_list}[(@var{value1}[, @var{value2})] ] ]
2634 The @subcmd{/BINOMIAL} subcommand compares the observed distribution of a dichotomous
2635 variable with that of a binomial distribution.
2636 The variable @var{p} specifies the test proportion of the binomial
2638 The default value of 0.5 is assumed if @var{p} is omitted.
2640 If a single value appears after the variable list, then that value is
2641 used as the threshold to partition the observed values. Values less
2642 than or equal to the threshold value form the first category. Values
2643 greater than the threshold form the second category.
2645 If two values appear after the variable list, then they are used
2646 as the values which a variable must take to be in the respective
2648 Cases for which a variable takes a value equal to neither of the specified
2649 values, take no part in the test for that variable.
2651 If no values appear, then the variable must assume dichotomous
2653 If more than two distinct, non-missing values for a variable
2654 under test are encountered then an error occurs.
2656 If the test proportion is equal to 0.5, then a two tailed test is
2657 reported. For any other test proportion, a one tailed test is
2659 For one tailed tests, if the test proportion is less than
2660 or equal to the observed proportion, then the significance of
2661 observing the observed proportion or more is reported.
2662 If the test proportion is more than the observed proportion, then the
2663 significance of observing the observed proportion or less is reported.
2664 That is to say, the test is always performed in the observed
2667 @pspp{} uses a very precise approximation to the gamma function to
2668 compute the binomial significance. Thus, exact results are reported
2669 even for very large sample sizes.
2673 @subsection Chi-square Test
2675 @cindex chi-square test
2679 [ /CHISQUARE=@var{var_list}[(@var{lo},@var{hi})] [/EXPECTED=@{EQUAL|@var{f1}, @var{f2} @dots{} @var{fn}@}] ]
2683 The @subcmd{/CHISQUARE} subcommand produces a chi-square statistic for the differences
2684 between the expected and observed frequencies of the categories of a variable.
2685 Optionally, a range of values may appear after the variable list.
2686 If a range is given, then non integer values are truncated, and values
2687 outside the specified range are excluded from the analysis.
2689 The @subcmd{/EXPECTED} subcommand specifies the expected values of each
2691 There must be exactly one non-zero expected value, for each observed
2692 category, or the @subcmd{EQUAL} keyword must be specified.
2693 You may use the notation @subcmd{@var{n}*@var{f}} to specify @var{n}
2694 consecutive expected categories all taking a frequency of @var{f}.
2695 The frequencies given are proportions, not absolute frequencies. The
2696 sum of the frequencies need not be 1.
2697 If no @subcmd{/EXPECTED} subcommand is given, then equal frequencies
2700 @subsubsection Chi-square Example
2702 A researcher wishes to investigate whether there are an equal number of
2703 persons of each sex in a population. The sample chosen for invesigation
2704 is that from the @file {physiology.sav} dataset. The null hypothesis for
2705 the test is that the population comprises an equal number of males and females.
2706 The analysis is performed as shown in @ref{chisquare:ex}.
2708 @float Example, chisquare:ex
2709 @psppsyntax {chisquare.sps}
2710 @caption {Performing a chi-square test to check for equal distribution of sexes}
2713 There is only one test variable, @i{viz:} @exvar{sex}. The other variables in the dataset
2716 @float Screenshot, chisquare:scr
2717 @psppimage {chisquare}
2718 @caption {Performing a chi-square test using the graphic user interface}
2721 In @ref{chisquare:res} the summary box shows that in the sample, there are more males
2722 than females. However the significance of chi-square result is greater than 0.05
2723 --- the most commonly accepted p-value --- and therefore
2724 there is not enough evidence to reject the null hypothesis and one must conclude
2725 that the evidence does not indicate that there is an imbalance of the sexes
2728 @float Result, chisquare:res
2729 @psppoutput {chisquare}
2730 @caption {The results of running a chi-square test on @exvar{sex}}
2735 @subsection Cochran Q Test
2737 @cindex Cochran Q test
2738 @cindex Q, Cochran Q
2741 [ /COCHRAN = @var{var_list} ]
2744 The Cochran Q test is used to test for differences between three or more groups.
2745 The data for @var{var_list} in all cases must assume exactly two
2746 distinct values (other than missing values).
2748 The value of Q is displayed along with its Asymptotic significance
2749 based on a chi-square distribution.
2752 @subsection Friedman Test
2754 @cindex Friedman test
2757 [ /FRIEDMAN = @var{var_list} ]
2760 The Friedman test is used to test for differences between repeated measures when
2761 there is no indication that the distributions are normally distributed.
2763 A list of variables which contain the measured data must be given. The procedure
2764 prints the sum of ranks for each variable, the test statistic and its significance.
2767 @subsection Kendall's W Test
2769 @cindex Kendall's W test
2770 @cindex coefficient of concordance
2773 [ /KENDALL = @var{var_list} ]
2776 The Kendall test investigates whether an arbitrary number of related samples come from the
2778 It is identical to the Friedman test except that the additional statistic W, Kendall's Coefficient of Concordance is printed.
2779 It has the range [0,1] --- a value of zero indicates no agreement between the samples whereas a value of
2780 unity indicates complete agreement.
2783 @node KOLMOGOROV-SMIRNOV
2784 @subsection Kolmogorov-Smirnov Test
2785 @vindex KOLMOGOROV-SMIRNOV
2787 @cindex Kolmogorov-Smirnov test
2790 [ /KOLMOGOROV-SMIRNOV (@{NORMAL [@var{mu}, @var{sigma}], UNIFORM [@var{min}, @var{max}], POISSON [@var{lambda}], EXPONENTIAL [@var{scale}] @}) = @var{var_list} ]
2793 The one sample Kolmogorov-Smirnov subcommand is used to test whether or not a dataset is
2794 drawn from a particular distribution. Four distributions are supported, @i{viz:}
2795 Normal, Uniform, Poisson and Exponential.
2797 Ideally you should provide the parameters of the distribution against
2798 which you wish to test the data. For example, with the normal
2799 distribution the mean (@var{mu})and standard deviation (@var{sigma})
2800 should be given; with the uniform distribution, the minimum
2801 (@var{min})and maximum (@var{max}) value should be provided.
2802 However, if the parameters are omitted they are imputed from the
2803 data. Imputing the parameters reduces the power of the test so should
2804 be avoided if possible.
2806 In the following example, two variables @var{score} and @var{age} are
2807 tested to see if they follow a normal distribution with a mean of 3.5
2808 and a standard deviation of 2.0.
2811 /KOLMOGOROV-SMIRNOV (normal 3.5 2.0) = @var{score} @var{age}.
2813 If the variables need to be tested against different distributions, then a separate
2814 subcommand must be used. For example the following syntax tests @var{score} against
2815 a normal distribution with mean of 3.5 and standard deviation of 2.0 whilst @var{age}
2816 is tested against a normal distribution of mean 40 and standard deviation 1.5.
2819 /KOLMOGOROV-SMIRNOV (normal 3.5 2.0) = @var{score}
2820 /KOLMOGOROV-SMIRNOV (normal 40 1.5) = @var{age}.
2823 The abbreviated subcommand @subcmd{K-S} may be used in place of @subcmd{KOLMOGOROV-SMIRNOV}.
2825 @node KRUSKAL-WALLIS
2826 @subsection Kruskal-Wallis Test
2827 @vindex KRUSKAL-WALLIS
2829 @cindex Kruskal-Wallis test
2832 [ /KRUSKAL-WALLIS = @var{var_list} BY var (@var{lower}, @var{upper}) ]
2835 The Kruskal-Wallis test is used to compare data from an
2836 arbitrary number of populations. It does not assume normality.
2837 The data to be compared are specified by @var{var_list}.
2838 The categorical variable determining the groups to which the
2839 data belongs is given by @var{var}. The limits @var{lower} and
2840 @var{upper} specify the valid range of @var{var}.
2841 If @var{upper} is smaller than @var{lower}, the PSPP will assume their values
2842 to be reversed. Any cases for which @var{var} falls outside
2843 [@var{lower}, @var{upper}] are ignored.
2845 The mean rank of each group as well as the chi-squared value and
2846 significance of the test are printed.
2847 The abbreviated subcommand @subcmd{K-W} may be used in place of
2848 @subcmd{KRUSKAL-WALLIS}.
2852 @subsection Mann-Whitney U Test
2853 @vindex MANN-WHITNEY
2855 @cindex Mann-Whitney U test
2856 @cindex U, Mann-Whitney U
2859 [ /MANN-WHITNEY = @var{var_list} BY var (@var{group1}, @var{group2}) ]
2862 The Mann-Whitney subcommand is used to test whether two groups of data
2863 come from different populations. The variables to be tested should be
2864 specified in @var{var_list} and the grouping variable, that determines
2865 to which group the test variables belong, in @var{var}.
2866 @var{Var} may be either a string or an alpha variable.
2867 @var{Group1} and @var{group2} specify the
2868 two values of @var{var} which determine the groups of the test data.
2869 Cases for which the @var{var} value is neither @var{group1} or
2870 @var{group2} are ignored.
2872 The value of the Mann-Whitney U statistic, the Wilcoxon W, and the
2873 significance are printed.
2874 You may abbreviated the subcommand @subcmd{MANN-WHITNEY} to
2879 @subsection McNemar Test
2881 @cindex McNemar test
2884 [ /MCNEMAR @var{var_list} [ WITH @var{var_list} [ (PAIRED) ]]]
2887 Use McNemar's test to analyse the significance of the difference between
2888 pairs of correlated proportions.
2890 If the @code{WITH} keyword is omitted, then tests for all
2891 combinations of the listed variables are performed.
2892 If the @code{WITH} keyword is given, and the @code{(PAIRED)} keyword
2893 is also given, then the number of variables preceding @code{WITH}
2894 must be the same as the number following it.
2895 In this case, tests for each respective pair of variables are
2897 If the @code{WITH} keyword is given, but the
2898 @code{(PAIRED)} keyword is omitted, then tests for each combination
2899 of variable preceding @code{WITH} against variable following
2900 @code{WITH} are performed.
2902 The data in each variable must be dichotomous. If there are more
2903 than two distinct variables an error will occur and the test will
2907 @subsection Median Test
2912 [ /MEDIAN [(@var{value})] = @var{var_list} BY @var{variable} (@var{value1}, @var{value2}) ]
2915 The median test is used to test whether independent samples come from
2916 populations with a common median.
2917 The median of the populations against which the samples are to be tested
2918 may be given in parentheses immediately after the
2919 @subcmd{/MEDIAN} subcommand. If it is not given, the median is imputed from the
2920 union of all the samples.
2922 The variables of the samples to be tested should immediately follow the @samp{=} sign. The
2923 keyword @code{BY} must come next, and then the grouping variable. Two values
2924 in parentheses should follow. If the first value is greater than the second,
2925 then a 2 sample test is performed using these two values to determine the groups.
2926 If however, the first variable is less than the second, then a @i{k} sample test is
2927 conducted and the group values used are all values encountered which lie in the
2928 range [@var{value1},@var{value2}].
2932 @subsection Runs Test
2937 [ /RUNS (@{MEAN, MEDIAN, MODE, @var{value}@}) = @var{var_list} ]
2940 The @subcmd{/RUNS} subcommand tests whether a data sequence is randomly ordered.
2942 It works by examining the number of times a variable's value crosses a given threshold.
2943 The desired threshold must be specified within parentheses.
2944 It may either be specified as a number or as one of @subcmd{MEAN}, @subcmd{MEDIAN} or @subcmd{MODE}.
2945 Following the threshold specification comes the list of variables whose values are to be
2948 The subcommand shows the number of runs, the asymptotic significance based on the
2952 @subsection Sign Test
2957 [ /SIGN @var{var_list} [ WITH @var{var_list} [ (PAIRED) ]]]
2960 The @subcmd{/SIGN} subcommand tests for differences between medians of the
2962 The test does not make any assumptions about the
2963 distribution of the data.
2965 If the @code{WITH} keyword is omitted, then tests for all
2966 combinations of the listed variables are performed.
2967 If the @code{WITH} keyword is given, and the @code{(PAIRED)} keyword
2968 is also given, then the number of variables preceding @code{WITH}
2969 must be the same as the number following it.
2970 In this case, tests for each respective pair of variables are
2972 If the @code{WITH} keyword is given, but the
2973 @code{(PAIRED)} keyword is omitted, then tests for each combination
2974 of variable preceding @code{WITH} against variable following
2975 @code{WITH} are performed.
2978 @subsection Wilcoxon Matched Pairs Signed Ranks Test
2980 @cindex wilcoxon matched pairs signed ranks test
2983 [ /WILCOXON @var{var_list} [ WITH @var{var_list} [ (PAIRED) ]]]
2986 The @subcmd{/WILCOXON} subcommand tests for differences between medians of the
2988 The test does not make any assumptions about the variances of the samples.
2989 It does however assume that the distribution is symmetrical.
2991 If the @subcmd{WITH} keyword is omitted, then tests for all
2992 combinations of the listed variables are performed.
2993 If the @subcmd{WITH} keyword is given, and the @subcmd{(PAIRED)} keyword
2994 is also given, then the number of variables preceding @subcmd{WITH}
2995 must be the same as the number following it.
2996 In this case, tests for each respective pair of variables are
2998 If the @subcmd{WITH} keyword is given, but the
2999 @subcmd{(PAIRED)} keyword is omitted, then tests for each combination
3000 of variable preceding @subcmd{WITH} against variable following
3001 @subcmd{WITH} are performed.
3010 /MISSING=@{ANALYSIS,LISTWISE@} @{EXCLUDE,INCLUDE@}
3011 /CRITERIA=CI(@var{confidence})
3015 TESTVAL=@var{test_value}
3016 /VARIABLES=@var{var_list}
3019 (Independent Samples mode.)
3020 GROUPS=var(@var{value1} [, @var{value2}])
3021 /VARIABLES=@var{var_list}
3024 (Paired Samples mode.)
3025 PAIRS=@var{var_list} [WITH @var{var_list} [(PAIRED)] ]
3030 The @cmd{T-TEST} procedure outputs tables used in testing hypotheses about
3032 It operates in one of three modes:
3034 @item One Sample mode.
3035 @item Independent Groups mode.
3040 Each of these modes are described in more detail below.
3041 There are two optional subcommands which are common to all modes.
3043 The @cmd{/CRITERIA} subcommand tells @pspp{} the confidence interval used
3044 in the tests. The default value is 0.95.
3047 The @cmd{MISSING} subcommand determines the handling of missing
3049 If @subcmd{INCLUDE} is set, then user-missing values are included in the
3050 calculations, but system-missing values are not.
3051 If @subcmd{EXCLUDE} is set, which is the default, user-missing
3052 values are excluded as well as system-missing values.
3053 This is the default.
3055 If @subcmd{LISTWISE} is set, then the entire case is excluded from analysis
3056 whenever any variable specified in the @subcmd{/VARIABLES}, @subcmd{/PAIRS} or
3057 @subcmd{/GROUPS} subcommands contains a missing value.
3058 If @subcmd{ANALYSIS} is set, then missing values are excluded only in the analysis for
3059 which they would be needed. This is the default.
3063 * One Sample Mode:: Testing against a hypothesized mean
3064 * Independent Samples Mode:: Testing two independent groups for equal mean
3065 * Paired Samples Mode:: Testing two interdependent groups for equal mean
3068 @node One Sample Mode
3069 @subsection One Sample Mode
3071 The @subcmd{TESTVAL} subcommand invokes the One Sample mode.
3072 This mode is used to test a population mean against a hypothesized
3074 The value given to the @subcmd{TESTVAL} subcommand is the value against
3075 which you wish to test.
3076 In this mode, you must also use the @subcmd{/VARIABLES} subcommand to
3077 tell @pspp{} which variables you wish to test.
3079 @subsubsection Example - One Sample T-test
3081 A researcher wishes to know whether the weight of persons in a population
3082 is different from the national average.
3083 The samples are drawn from the population under investigation and recorded
3084 in the file @file{physiology.sav}.
3085 From the Department of Health, she
3086 knows that the national average weight of healthy adults is 76.8kg.
3087 Accordingly the @subcmd{TESTVAL} is set to 76.8.
3088 The null hypothesis therefore is that the mean average weight of the
3089 population from which the sample was drawn is 76.8kg.
3091 As previously noted (@pxref{Identifying incorrect data}), one
3092 sample in the dataset contains a weight value
3093 which is clearly incorrect. So this is excluded from the analysis
3094 using the @cmd{SELECT} command.
3096 @float Example, one-sample-t:ex
3097 @psppsyntax {one-sample-t.sps}
3098 @caption {Running a one sample T-Test after excluding all non-positive values}
3101 @float Screenshot, one-sample-t:scr
3102 @psppimage {one-sample-t}
3103 @caption {Using the One Sample T-Test dialog box to test @exvar{weight} for a mean of 76.8kg}
3107 @ref{one-sample-t:res} shows that the mean of our sample differs from the test value
3108 by -1.40kg. However the significance is very high (0.610). So one cannot
3109 reject the null hypothesis, and must conclude there is not enough evidence
3110 to suggest that the mean weight of the persons in our population is different
3113 @float Results, one-sample-t:res
3114 @psppoutput {one-sample-t}
3115 @caption {The results of a one sample T-test of @exvar{weight} using a test value of 76.8kg}
3118 @node Independent Samples Mode
3119 @subsection Independent Samples Mode
3121 The @subcmd{GROUPS} subcommand invokes Independent Samples mode or
3123 This mode is used to test whether two groups of values have the
3124 same population mean.
3125 In this mode, you must also use the @subcmd{/VARIABLES} subcommand to
3126 tell @pspp{} the dependent variables you wish to test.
3128 The variable given in the @subcmd{GROUPS} subcommand is the independent
3129 variable which determines to which group the samples belong.
3130 The values in parentheses are the specific values of the independent
3131 variable for each group.
3132 If the parentheses are omitted and no values are given, the default values
3133 of 1.0 and 2.0 are assumed.
3135 If the independent variable is numeric,
3136 it is acceptable to specify only one value inside the parentheses.
3137 If you do this, cases where the independent variable is
3138 greater than or equal to this value belong to the first group, and cases
3139 less than this value belong to the second group.
3140 When using this form of the @subcmd{GROUPS} subcommand, missing values in
3141 the independent variable are excluded on a listwise basis, regardless
3142 of whether @subcmd{/MISSING=LISTWISE} was specified.
3144 @subsubsection Example - Independent Samples T-test
3146 A researcher wishes to know whether within a population, adult males
3147 are taller than adult females.
3148 The samples are drawn from the population under investigation and recorded
3149 in the file @file{physiology.sav}.
3151 As previously noted (@pxref{Identifying incorrect data}), one
3152 sample in the dataset contains a height value
3153 which is clearly incorrect. So this is excluded from the analysis
3154 using the @cmd{SELECT} command.
3157 @float Example, indepdendent-samples-t:ex
3158 @psppsyntax {independent-samples-t.sps}
3159 @caption {Running a independent samples T-Test after excluding all observations less than 200kg}
3163 The null hypothesis is that both males and females are on average
3166 @float Screenshot, independent-samples-t:scr
3167 @psppimage {independent-samples-t}
3168 @caption {Using the Independent Sample T-test dialog, to test for differences of @exvar{height} between values of @exvar{sex}}
3172 In this case, the grouping variable is @exvar{sex}, so this is entered
3173 as the variable for the @subcmd{GROUP} subcommand. The group values are 0 (male) and
3176 If you are running the proceedure using syntax, then you need to enter
3177 the values corresponding to each group within parentheses.
3178 If you are using the graphic user interface, then you have to open
3179 the ``Define Groups'' dialog box and enter the values corresponding
3180 to each group as shown in @ref{define-groups-t:scr}. If, as in this case, the dataset has defined value
3181 labels for the group variable, then you can enter them by label
3184 @float Screenshot, define-groups-t:scr
3185 @psppimage {define-groups-t}
3186 @caption {Setting the values of the grouping variable for an Independent Samples T-test}
3189 From @ref{independent-samples-t:res}, one can clearly see that the @emph{sample} mean height
3190 is greater for males than for females. However in order to see if this
3191 is a significant result, one must consult the T-Test table.
3193 The T-Test table contains two rows; one for use if the variance of the samples
3194 in each group may be safely assumed to be equal, and the second row
3195 if the variances in each group may not be safely assumed to be equal.
3197 In this case however, both rows show a 2-tailed significance less than 0.001 and
3198 one must therefore reject the null hypothesis and conclude that within
3199 the population the mean height of males and of females are unequal.
3201 @float Result, independent-samples-t:res
3202 @psppoutput {independent-samples-t}
3203 @caption {The results of an independent samples T-test of @exvar{height} by @exvar{sex}}
3206 @node Paired Samples Mode
3207 @subsection Paired Samples Mode
3209 The @cmd{PAIRS} subcommand introduces Paired Samples mode.
3210 Use this mode when repeated measures have been taken from the same
3212 If the @subcmd{WITH} keyword is omitted, then tables for all
3213 combinations of variables given in the @cmd{PAIRS} subcommand are
3215 If the @subcmd{WITH} keyword is given, and the @subcmd{(PAIRED)} keyword
3216 is also given, then the number of variables preceding @subcmd{WITH}
3217 must be the same as the number following it.
3218 In this case, tables for each respective pair of variables are
3220 In the event that the @subcmd{WITH} keyword is given, but the
3221 @subcmd{(PAIRED)} keyword is omitted, then tables for each combination
3222 of variable preceding @subcmd{WITH} against variable following
3223 @subcmd{WITH} are generated.
3230 @cindex analysis of variance
3235 [/VARIABLES = ] @var{var_list} BY @var{var}
3236 /MISSING=@{ANALYSIS,LISTWISE@} @{EXCLUDE,INCLUDE@}
3237 /CONTRAST= @var{value1} [, @var{value2}] ... [,@var{valueN}]
3238 /STATISTICS=@{DESCRIPTIVES,HOMOGENEITY@}
3239 /POSTHOC=@{BONFERRONI, GH, LSD, SCHEFFE, SIDAK, TUKEY, ALPHA ([@var{value}])@}
3242 The @cmd{ONEWAY} procedure performs a one-way analysis of variance of
3243 variables factored by a single independent variable.
3244 It is used to compare the means of a population
3245 divided into more than two groups.
3247 The dependent variables to be analysed should be given in the @subcmd{VARIABLES}
3249 The list of variables must be followed by the @subcmd{BY} keyword and
3250 the name of the independent (or factor) variable.
3252 You can use the @subcmd{STATISTICS} subcommand to tell @pspp{} to display
3253 ancillary information. The options accepted are:
3256 Displays descriptive statistics about the groups factored by the independent
3259 Displays the Levene test of Homogeneity of Variance for the
3260 variables and their groups.
3263 The @subcmd{CONTRAST} subcommand is used when you anticipate certain
3264 differences between the groups.
3265 The subcommand must be followed by a list of numerals which are the
3266 coefficients of the groups to be tested.
3267 The number of coefficients must correspond to the number of distinct
3268 groups (or values of the independent variable).
3269 If the total sum of the coefficients are not zero, then @pspp{} will
3270 display a warning, but will proceed with the analysis.
3271 The @subcmd{CONTRAST} subcommand may be given up to 10 times in order
3272 to specify different contrast tests.
3273 The @subcmd{MISSING} subcommand defines how missing values are handled.
3274 If @subcmd{LISTWISE} is specified then cases which have missing values for
3275 the independent variable or any dependent variable are ignored.
3276 If @subcmd{ANALYSIS} is specified, then cases are ignored if the independent
3277 variable is missing or if the dependent variable currently being
3278 analysed is missing. The default is @subcmd{ANALYSIS}.
3279 A setting of @subcmd{EXCLUDE} means that variables whose values are
3280 user-missing are to be excluded from the analysis. A setting of
3281 @subcmd{INCLUDE} means they are to be included. The default is @subcmd{EXCLUDE}.
3283 Using the @code{POSTHOC} subcommand you can perform multiple
3284 pairwise comparisons on the data. The following comparison methods
3288 Least Significant Difference.
3289 @item @subcmd{TUKEY}
3290 Tukey Honestly Significant Difference.
3291 @item @subcmd{BONFERRONI}
3293 @item @subcmd{SCHEFFE}
3295 @item @subcmd{SIDAK}
3298 The Games-Howell test.
3302 Use the optional syntax @code{ALPHA(@var{value})} to indicate that
3303 @cmd{ONEWAY} should perform the posthoc tests at a confidence level of
3304 @var{value}. If @code{ALPHA(@var{value})} is not specified, then the
3305 confidence level used is 0.05.
3308 @section QUICK CLUSTER
3309 @vindex QUICK CLUSTER
3311 @cindex K-means clustering
3315 QUICK CLUSTER @var{var_list}
3316 [/CRITERIA=CLUSTERS(@var{k}) [MXITER(@var{max_iter})] CONVERGE(@var{epsilon}) [NOINITIAL]]
3317 [/MISSING=@{EXCLUDE,INCLUDE@} @{LISTWISE, PAIRWISE@}]
3318 [/PRINT=@{INITIAL@} @{CLUSTER@}]
3319 [/SAVE[=[CLUSTER[(@var{membership_var})]] [DISTANCE[(@var{distance_var})]]]
3322 The @cmd{QUICK CLUSTER} command performs k-means clustering on the
3323 dataset. This is useful when you wish to allocate cases into clusters
3324 of similar values and you already know the number of clusters.
3326 The minimum specification is @samp{QUICK CLUSTER} followed by the names
3327 of the variables which contain the cluster data. Normally you will also
3328 want to specify @subcmd{/CRITERIA=CLUSTERS(@var{k})} where @var{k} is the
3329 number of clusters. If this is not specified, then @var{k} defaults to 2.
3331 If you use @subcmd{/CRITERIA=NOINITIAL} then a naive algorithm to select
3332 the initial clusters is used. This will provide for faster execution but
3333 less well separated initial clusters and hence possibly an inferior final
3337 @cmd{QUICK CLUSTER} uses an iterative algorithm to select the clusters centers.
3338 The subcommand @subcmd{/CRITERIA=MXITER(@var{max_iter})} sets the maximum number of iterations.
3339 During classification, @pspp{} will continue iterating until until @var{max_iter}
3340 iterations have been done or the convergence criterion (see below) is fulfilled.
3341 The default value of @var{max_iter} is 2.
3343 If however, you specify @subcmd{/CRITERIA=NOUPDATE} then after selecting the initial centers,
3344 no further update to the cluster centers is done. In this case, @var{max_iter}, if specified.
3347 The subcommand @subcmd{/CRITERIA=CONVERGE(@var{epsilon})} is used
3348 to set the convergence criterion. The value of convergence criterion is @var{epsilon}
3349 times the minimum distance between the @emph{initial} cluster centers. Iteration stops when
3350 the mean cluster distance between one iteration and the next
3351 is less than the convergence criterion. The default value of @var{epsilon} is zero.
3353 The @subcmd{MISSING} subcommand determines the handling of missing variables.
3354 If @subcmd{INCLUDE} is set, then user-missing values are considered at their face
3355 value and not as missing values.
3356 If @subcmd{EXCLUDE} is set, which is the default, user-missing
3357 values are excluded as well as system-missing values.
3359 If @subcmd{LISTWISE} is set, then the entire case is excluded from the analysis
3360 whenever any of the clustering variables contains a missing value.
3361 If @subcmd{PAIRWISE} is set, then a case is considered missing only if all the
3362 clustering variables contain missing values. Otherwise it is clustered
3363 on the basis of the non-missing values.
3364 The default is @subcmd{LISTWISE}.
3366 The @subcmd{PRINT} subcommand requests additional output to be printed.
3367 If @subcmd{INITIAL} is set, then the initial cluster memberships will
3369 If @subcmd{CLUSTER} is set, the cluster memberships of the individual
3370 cases are displayed (potentially generating lengthy output).
3372 You can specify the subcommand @subcmd{SAVE} to ask that each case's cluster membership
3373 and the euclidean distance between the case and its cluster center be saved to
3374 a new variable in the active dataset. To save the cluster membership use the
3375 @subcmd{CLUSTER} keyword and to save the distance use the @subcmd{DISTANCE} keyword.
3376 Each keyword may optionally be followed by a variable name in parentheses to specify
3377 the new variable which is to contain the saved parameter. If no variable name is specified,
3378 then PSPP will create one.
3386 [VARIABLES=] @var{var_list} [@{A,D@}] [BY @var{var_list}]
3387 /TIES=@{MEAN,LOW,HIGH,CONDENSE@}
3388 /FRACTION=@{BLOM,TUKEY,VW,RANKIT@}
3390 /MISSING=@{EXCLUDE,INCLUDE@}
3392 /RANK [INTO @var{var_list}]
3393 /NTILES(k) [INTO @var{var_list}]
3394 /NORMAL [INTO @var{var_list}]
3395 /PERCENT [INTO @var{var_list}]
3396 /RFRACTION [INTO @var{var_list}]
3397 /PROPORTION [INTO @var{var_list}]
3398 /N [INTO @var{var_list}]
3399 /SAVAGE [INTO @var{var_list}]
3402 The @cmd{RANK} command ranks variables and stores the results into new
3405 The @subcmd{VARIABLES} subcommand, which is mandatory, specifies one or
3406 more variables whose values are to be ranked.
3407 After each variable, @samp{A} or @samp{D} may appear, indicating that
3408 the variable is to be ranked in ascending or descending order.
3409 Ascending is the default.
3410 If a @subcmd{BY} keyword appears, it should be followed by a list of variables
3411 which are to serve as group variables.
3412 In this case, the cases are gathered into groups, and ranks calculated
3415 The @subcmd{TIES} subcommand specifies how tied values are to be treated. The
3416 default is to take the mean value of all the tied cases.
3418 The @subcmd{FRACTION} subcommand specifies how proportional ranks are to be
3419 calculated. This only has any effect if @subcmd{NORMAL} or @subcmd{PROPORTIONAL} rank
3420 functions are requested.
3422 The @subcmd{PRINT} subcommand may be used to specify that a summary of the rank
3423 variables created should appear in the output.
3425 The function subcommands are @subcmd{RANK}, @subcmd{NTILES}, @subcmd{NORMAL}, @subcmd{PERCENT}, @subcmd{RFRACTION},
3426 @subcmd{PROPORTION} and @subcmd{SAVAGE}. Any number of function subcommands may appear.
3427 If none are given, then the default is RANK.
3428 The @subcmd{NTILES} subcommand must take an integer specifying the number of
3429 partitions into which values should be ranked.
3430 Each subcommand may be followed by the @subcmd{INTO} keyword and a list of
3431 variables which are the variables to be created and receive the rank
3432 scores. There may be as many variables specified as there are
3433 variables named on the @subcmd{VARIABLES} subcommand. If fewer are specified,
3434 then the variable names are automatically created.
3436 The @subcmd{MISSING} subcommand determines how user missing values are to be
3437 treated. A setting of @subcmd{EXCLUDE} means that variables whose values are
3438 user-missing are to be excluded from the rank scores. A setting of
3439 @subcmd{INCLUDE} means they are to be included. The default is @subcmd{EXCLUDE}.
3441 @include regression.texi
3445 @section RELIABILITY
3450 /VARIABLES=@var{var_list}
3451 /SCALE (@var{name}) = @{@var{var_list}, ALL@}
3452 /MODEL=@{ALPHA, SPLIT[(@var{n})]@}
3453 /SUMMARY=@{TOTAL,ALL@}
3454 /MISSING=@{EXCLUDE,INCLUDE@}
3457 @cindex Cronbach's Alpha
3458 The @cmd{RELIABILITY} command performs reliability analysis on the data.
3460 The @subcmd{VARIABLES} subcommand is required. It determines the set of variables
3461 upon which analysis is to be performed.
3463 The @subcmd{SCALE} subcommand determines the variables for which
3464 reliability is to be calculated. If @subcmd{SCALE} is omitted, then analysis for
3465 all variables named in the @subcmd{VARIABLES} subcommand are used.
3466 Optionally, the @var{name} parameter may be specified to set a string name
3469 The @subcmd{MODEL} subcommand determines the type of analysis. If @subcmd{ALPHA} is specified,
3470 then Cronbach's Alpha is calculated for the scale. If the model is @subcmd{SPLIT},
3471 then the variables are divided into 2 subsets. An optional parameter
3472 @var{n} may be given, to specify how many variables to be in the first subset.
3473 If @var{n} is omitted, then it defaults to one half of the variables in the
3474 scale, or one half minus one if there are an odd number of variables.
3475 The default model is @subcmd{ALPHA}.
3477 By default, any cases with user missing, or system missing values for
3478 any variables given in the @subcmd{VARIABLES} subcommand are omitted
3479 from the analysis. The @subcmd{MISSING} subcommand determines whether
3480 user missing values are included or excluded in the analysis.
3482 The @subcmd{SUMMARY} subcommand determines the type of summary analysis to be performed.
3483 Currently there is only one type: @subcmd{SUMMARY=TOTAL}, which displays per-item
3484 analysis tested against the totals.
3486 @subsection Example - Reliability
3488 Before analysing the results of a survey -- particularly for a multiple choice survey --
3489 it is desireable to know whether the respondents have considered their answers
3490 or simply provided random answers.
3492 In the following example the survey results from the file @file{hotel.sav} are used.
3493 All five survey questions are included in the reliability analysis.
3494 However, before running the analysis, the data must be preprocessed.
3495 An examination of the survey questions reveals that two questions, @i{viz:} v3 and v5
3496 are negatively worded, whereas the others are positively worded.
3497 All questions must be based upon the same scale for the analysis to be meaningful.
3498 One could use the @cmd{RECODE} command (@pxref{RECODE}), however a simpler way is
3499 to use @cmd{COMPUTE} (@pxref{COMPUTE}) and this is what is done in @ref{reliability:ex}.
3501 @float Example, reliability:ex
3502 @psppsyntax {reliability.sps}
3503 @caption {Investigating the reliability of survey responses}
3506 In this case, all variables in the data set are used. So we can use the special
3507 keyword @samp{ALL} (@pxref{BNF}).
3509 @float Screenshot, reliability:src
3510 @psppimage {reliability}
3511 @caption {Reliability dialog box with all variables selected}
3514 @ref{reliability:res} shows that Cronbach's Alpha is 0.11 which is a value normally considered too
3515 low to indicate consistency within the data. This is possibly due to the small number of
3516 survey questions. The survey should be redesigned before serious use of the results are
3519 @float Result, reliability:res
3520 @psppoutput {reliability}
3521 @caption {The results of the reliability command on @file{hotel.sav}}
3529 @cindex Receiver Operating Characteristic
3530 @cindex Area under curve
3533 ROC @var{var_list} BY @var{state_var} (@var{state_value})
3534 /PLOT = @{ CURVE [(REFERENCE)], NONE @}
3535 /PRINT = [ SE ] [ COORDINATES ]
3536 /CRITERIA = [ CUTOFF(@{INCLUDE,EXCLUDE@}) ]
3537 [ TESTPOS (@{LARGE,SMALL@}) ]
3538 [ CI (@var{confidence}) ]
3539 [ DISTRIBUTION (@{FREE, NEGEXPO @}) ]
3540 /MISSING=@{EXCLUDE,INCLUDE@}
3544 The @cmd{ROC} command is used to plot the receiver operating characteristic curve
3545 of a dataset, and to estimate the area under the curve.
3546 This is useful for analysing the efficacy of a variable as a predictor of a state of nature.
3548 The mandatory @var{var_list} is the list of predictor variables.
3549 The variable @var{state_var} is the variable whose values represent the actual states,
3550 and @var{state_value} is the value of this variable which represents the positive state.
3552 The optional subcommand @subcmd{PLOT} is used to determine if and how the @subcmd{ROC} curve is drawn.
3553 The keyword @subcmd{CURVE} means that the @subcmd{ROC} curve should be drawn, and the optional keyword @subcmd{REFERENCE},
3554 which should be enclosed in parentheses, says that the diagonal reference line should be drawn.
3555 If the keyword @subcmd{NONE} is given, then no @subcmd{ROC} curve is drawn.
3556 By default, the curve is drawn with no reference line.
3558 The optional subcommand @subcmd{PRINT} determines which additional
3559 tables should be printed. Two additional tables are available. The
3560 @subcmd{SE} keyword says that standard error of the area under the
3561 curve should be printed as well as the area itself. In addition, a
3562 p-value for the null hypothesis that the area under the curve equals
3563 0.5 is printed. The @subcmd{COORDINATES} keyword says that a
3564 table of coordinates of the @subcmd{ROC} curve should be printed.
3566 The @subcmd{CRITERIA} subcommand has four optional parameters:
3568 @item The @subcmd{TESTPOS} parameter may be @subcmd{LARGE} or @subcmd{SMALL}.
3569 @subcmd{LARGE} is the default, and says that larger values in the predictor variables are to be
3570 considered positive. @subcmd{SMALL} indicates that smaller values should be considered positive.
3572 @item The @subcmd{CI} parameter specifies the confidence interval that should be printed.
3573 It has no effect if the @subcmd{SE} keyword in the @subcmd{PRINT} subcommand has not been given.
3575 @item The @subcmd{DISTRIBUTION} parameter determines the method to be used when estimating the area
3577 There are two possibilities, @i{viz}: @subcmd{FREE} and @subcmd{NEGEXPO}.
3578 The @subcmd{FREE} method uses a non-parametric estimate, and the @subcmd{NEGEXPO} method a bi-negative
3579 exponential distribution estimate.
3580 The @subcmd{NEGEXPO} method should only be used when the number of positive actual states is
3581 equal to the number of negative actual states.
3582 The default is @subcmd{FREE}.
3584 @item The @subcmd{CUTOFF} parameter is for compatibility and is ignored.
3587 The @subcmd{MISSING} subcommand determines whether user missing values are to
3588 be included or excluded in the analysis. The default behaviour is to
3590 Cases are excluded on a listwise basis; if any of the variables in @var{var_list}
3591 or if the variable @var{state_var} is missing, then the entire case is
3594 @c LocalWords: subcmd subcommand