work on docs
[pspp] / doc / statistics.texi
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".
9 @c
10 @node Statistics
11 @chapter Statistics
12
13 This chapter documents the statistical procedures that @pspp{} supports so
14 far.
15
16 @menu
17 * DESCRIPTIVES::                Descriptive statistics.
18 * FREQUENCIES::                 Frequency tables.
19 * EXAMINE::                     Testing data for normality.
20 * GRAPH::                       Plot data.
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 * REGRESSION::                  Linear regression.
34 * RELIABILITY::                 Reliability analysis.
35 * ROC::                         Receiver Operating Characteristic.
36 @end menu
37
38 @node DESCRIPTIVES
39 @section DESCRIPTIVES
40
41 @vindex DESCRIPTIVES
42 @display
43 DESCRIPTIVES
44         /VARIABLES=@var{var_list}
45         /MISSING=@{VARIABLE,LISTWISE@} @{INCLUDE,NOINCLUDE@}
46         /FORMAT=@{LABELS,NOLABELS@} @{NOINDEX,INDEX@} @{LINE,SERIAL@}
47         /SAVE
48         /STATISTICS=@{ALL,MEAN,SEMEAN,STDDEV,VARIANCE,KURTOSIS,
49                      SKEWNESS,RANGE,MINIMUM,MAXIMUM,SUM,DEFAULT,
50                      SESKEWNESS,SEKURTOSIS@}
51         /SORT=@{NONE,MEAN,SEMEAN,STDDEV,VARIANCE,KURTOSIS,SKEWNESS,
52                RANGE,MINIMUM,MAXIMUM,SUM,SESKEWNESS,SEKURTOSIS,NAME@}
53               @{A,D@}
54 @end display
55
56 The @cmd{DESCRIPTIVES} procedure reads the active dataset and outputs
57 linear descriptive statistics requested by the user.  In addition, it can optionally
58 compute Z-scores.
59
60 The @subcmd{VARIABLES} subcommand, which is required, specifies the list of
61 variables to be analyzed.  Keyword @subcmd{VARIABLES} is optional.
62
63 All other subcommands are optional:
64
65 The @subcmd{MISSING} subcommand determines the handling of missing variables.  If
66 @subcmd{INCLUDE} is set, then user-missing values are included in the
67 calculations.  If @subcmd{NOINCLUDE} is set, which is the default, user-missing
68 values are excluded.  If @subcmd{VARIABLE} is set, then missing values are
69 excluded on a variable by variable basis; if @subcmd{LISTWISE} is set, then
70 the entire case is excluded whenever any value in that case has a
71 system-missing or, if @subcmd{INCLUDE} is set, user-missing value.
72
73 The @subcmd{FORMAT} subcommand has no effect.  It is accepted for
74 backward compatibility.
75
76 The @subcmd{SAVE} subcommand causes @cmd{DESCRIPTIVES} to calculate Z scores for all
77 the specified variables.  The Z scores are saved to new variables.
78 Variable names are generated by trying first the original variable name
79 with Z prepended and truncated to a maximum of 8 characters, then the
80 names ZSC000 through ZSC999, STDZ00 through STDZ09, ZZZZ00 through
81 ZZZZ09, ZQZQ00 through ZQZQ09, in that sequence.  In addition, Z score
82 variable names can be specified explicitly on @subcmd{VARIABLES} in the variable
83 list by enclosing them in parentheses after each variable.
84 When Z scores are calculated, @pspp{} ignores @cmd{TEMPORARY},
85 treating temporary transformations as permanent.
86
87 The @subcmd{STATISTICS} subcommand specifies the statistics to be displayed:
88
89 @table @code
90 @item @subcmd{ALL}
91 All of the statistics below.
92 @item @subcmd{MEAN}
93 Arithmetic mean.
94 @item @subcmd{SEMEAN}
95 Standard error of the mean.
96 @item @subcmd{STDDEV}
97 Standard deviation.
98 @item @subcmd{VARIANCE}
99 Variance.
100 @item @subcmd{KURTOSIS}
101 Kurtosis and standard error of the kurtosis.
102 @item @subcmd{SKEWNESS}
103 Skewness and standard error of the skewness.
104 @item @subcmd{RANGE}
105 Range.
106 @item MINIMUM
107 Minimum value.
108 @item MAXIMUM
109 Maximum value.
110 @item SUM
111 Sum.
112 @item DEFAULT
113 Mean, standard deviation of the mean, minimum, maximum.
114 @item SEKURTOSIS
115 Standard error of the kurtosis.
116 @item SESKEWNESS
117 Standard error of the skewness.
118 @end table
119
120 The @subcmd{SORT} subcommand specifies how the statistics should be sorted.  Most
121 of the possible values should be self-explanatory.  @subcmd{NAME} causes the
122 statistics to be sorted by name.  By default, the statistics are listed
123 in the order that they are specified on the @subcmd{VARIABLES} subcommand.
124 The @subcmd{A} and @subcmd{D} settings request an ascending or descending
125 sort order, respectively.
126
127 @subsection Descriptives Example
128
129 The @file{physiology.sav} file contains various physiological data for a sample
130 of persons.   Running the @cmd{DESCRIPTIVES} command on the variables @exvar{height}
131 and @exvar{temperature} with the default options allows one to see simple linear
132 statistics for these two variables.  In @ref{descriptives:ex}, these variables
133 are specfied on the @subcmd{VARIABLES} subcommand and the @subcmd{SAVE} option
134 has been used, to request that Z scores be calculated.
135
136 After the command has completed, this example runs @cmd{DESCRIPTIVES} again, this
137 time on the @exvar{zheight} and @exvar{ztemperature} variables,
138 which are the two normalized (Z-score) variables generated by the
139 first @cmd{DESCRIPTIVES} command.
140
141 @float Example, descriptives:ex
142 @psppsyntax {descriptives.sps}
143 @caption {Running two @cmd{DESCRIPTIVES} commands, one with the @subcmd{SAVE} subcommand}
144 @end float
145
146 @float Screenshot, descriptives:scr
147 @psppimage {descriptives}
148 @caption {The Descriptives dialog box with two variables and Z-Scores option selected}
149 @end float
150
151 In @ref{descriptives:res}, we can see that there are 40 valid data for each of the variables
152 and no missing values.   The mean average of the height and temperature is 16677.12
153 and 37.02 respectively.  The descriptive statistics for temperature seem reasonable.
154 However there is a very high standard deviation for @exvar{height} and a suspiciously
155 low minimum.  This is due to a data entry error in the
156 data (@pxref{Identifying incorrect data}).
157
158 In the second Descriptive Statistics command, one can see that the mean and standard
159 deviation of both Z score variables is 0 and 1 respectively.  All Z score statistics
160 should have these properties since they are normalized versions of the original scores.
161
162 @float Result, descriptives:res
163 @psppoutput {descriptives}
164 @caption {Descriptives statistics including two normalized variables (Z-scores)}
165 @end float
166
167 @node FREQUENCIES
168 @section FREQUENCIES
169
170 @vindex FREQUENCIES
171 @display
172 FREQUENCIES
173         /VARIABLES=@var{var_list}
174         /FORMAT=@{TABLE,NOTABLE,LIMIT(@var{limit})@}
175                 @{AVALUE,DVALUE,AFREQ,DFREQ@}
176         /MISSING=@{EXCLUDE,INCLUDE@}
177         /STATISTICS=@{DEFAULT,MEAN,SEMEAN,MEDIAN,MODE,STDDEV,VARIANCE,
178                      KURTOSIS,SKEWNESS,RANGE,MINIMUM,MAXIMUM,SUM,
179                      SESKEWNESS,SEKURTOSIS,ALL,NONE@}
180         /NTILES=@var{ntiles}
181         /PERCENTILES=percent@dots{}
182         /HISTOGRAM=[MINIMUM(@var{x_min})] [MAXIMUM(@var{x_max})]
183                    [@{FREQ[(@var{y_max})],PERCENT[(@var{y_max})]@}] [@{NONORMAL,NORMAL@}]
184         /PIECHART=[MINIMUM(@var{x_min})] [MAXIMUM(@var{x_max})]
185                   [@{FREQ,PERCENT@}] [@{NOMISSING,MISSING@}]
186         /BARCHART=[MINIMUM(@var{x_min})] [MAXIMUM(@var{x_max})]
187                   [@{FREQ,PERCENT@}]
188         /ORDER=@{ANALYSIS,VARIABLE@}
189
190
191 (These options are not currently implemented.)
192         /HBAR=@dots{}
193         /GROUPED=@dots{}
194 @end display
195
196 The @cmd{FREQUENCIES} procedure outputs frequency tables for specified
197 variables.
198 @cmd{FREQUENCIES} can also calculate and display descriptive statistics
199 (including median and mode) and percentiles, and various graphical representations
200 of the frequency distribution.
201
202 The @subcmd{VARIABLES} subcommand is the only required subcommand.  Specify the
203 variables to be analyzed.
204
205 The @subcmd{FORMAT} subcommand controls the output format.  It has several
206 possible settings:
207
208 @itemize @subcmd{}
209 @item
210 @subcmd{TABLE}, the default, causes a frequency table to be output for every
211 variable specified.  @subcmd{NOTABLE} prevents them from being output.  @subcmd{LIMIT}
212 with a numeric argument causes them to be output except when there are
213 more than the specified number of values in the table.
214
215 @item
216 Normally frequency tables are sorted in ascending order by value.  This
217 is @subcmd{AVALUE}.  @subcmd{DVALUE} tables are sorted in descending order by value.
218 @subcmd{AFREQ} and @subcmd{DFREQ} tables are sorted in ascending and descending order,
219 respectively, by frequency count.
220 @end itemize
221
222 The @subcmd{MISSING} subcommand controls the handling of user-missing values.
223 When @subcmd{EXCLUDE}, the default, is set, user-missing values are not included
224 in frequency tables or statistics.  When @subcmd{INCLUDE} is set, user-missing
225 are included.  System-missing values are never included in statistics,
226 but are listed in frequency tables.
227
228 The available @subcmd{STATISTICS} are the same as available
229 in @cmd{DESCRIPTIVES} (@pxref{DESCRIPTIVES}), with the addition
230 of @subcmd{MEDIAN}, the data's median
231 value, and MODE, the mode.  (If there are multiple modes, the smallest
232 value is reported.)  By default, the mean, standard deviation of the
233 mean, minimum, and maximum are reported for each variable.
234
235 @cindex percentiles
236 @subcmd{PERCENTILES} causes the specified percentiles to be reported.
237 The percentiles should  be presented at a list of numbers between 0
238 and 100 inclusive.
239 The @subcmd{NTILES} subcommand causes the percentiles to be reported at the
240 boundaries of the data set divided into the specified number of ranges.
241 For instance, @subcmd{/NTILES=4} would cause quartiles to be reported.
242
243 @cindex histogram
244 The @subcmd{HISTOGRAM} subcommand causes the output to include a histogram for
245 each specified numeric variable.  The X axis by default ranges from
246 the minimum to the maximum value observed in the data, but the @subcmd{MINIMUM}
247 and @subcmd{MAXIMUM} keywords can set an explicit range.
248 @footnote{The number of
249 bins is chosen according to the Freedman-Diaconis rule:
250 @math{2 \times IQR(x)n^{-1/3}}, where @math{IQR(x)} is the interquartile range of @math{x}
251 and @math{n} is the number of samples.    Note that
252 @cmd{EXAMINE} uses a different algorithm to determine bin sizes.}
253 Histograms are not created for string variables.
254
255 Specify @subcmd{NORMAL} to superimpose a normal curve on the
256 histogram.
257
258 @cindex piechart
259 The @subcmd{PIECHART} subcommand adds a pie chart for each variable to the data.  Each
260 slice represents one value, with the size of the slice proportional to
261 the value's frequency.  By default, all non-missing values are given
262 slices.
263 The @subcmd{MINIMUM} and @subcmd{MAXIMUM} keywords can be used to limit the
264 displayed slices to a given range of values.
265 The keyword @subcmd{NOMISSING} causes missing values to be omitted from the
266 piechart.  This is the default.
267 If instead, @subcmd{MISSING} is specified, then the pie chart includes
268 a single slice representing all system missing and user-missing cases.
269
270 @cindex bar chart
271 The @subcmd{BARCHART} subcommand produces a bar chart for each variable.
272 The @subcmd{MINIMUM} and @subcmd{MAXIMUM} keywords can be used to omit
273 categories whose counts which lie outside the specified limits.
274 The @subcmd{FREQ} option (default) causes the ordinate to display the frequency
275 of each category, whereas the @subcmd{PERCENT} option displays relative
276 percentages.
277
278 The @subcmd{FREQ} and @subcmd{PERCENT} options on @subcmd{HISTOGRAM} and
279 @subcmd{PIECHART} are accepted but not currently honoured.
280
281 The @subcmd{ORDER} subcommand is accepted but ignored.
282
283 @subsection Frequencies Example
284
285 @ref{frequencies:ex} runs a frequency analysis on the @exvar{sex}
286 and @exvar{occupation} variables from the @file{personnel.sav} file.
287 This is useful to get an general idea of the way in which these nominal
288 variables are distributed.
289
290 @float Example, frequencies:ex
291 @psppsyntax {frequencies.sps}
292 @caption {Running frequencies on the @exvar{sex} and @exvar{occupation} variables}
293 @end float
294
295 If you are using the graphic user interface, the dialog box is set up such that
296 by default, several statistics are calculated.   Some are not particularly useful
297 for categorical variables, so you may want to disable those.
298
299 @float Screenshot, frequencies:scr
300 @psppimage {frequencies}
301 @caption {The frequencies dialog box with the @exvar{sex} and @exvar{occupation} variables selected}
302 @end float
303
304 From @ref{frequencies:res} it is evident that there are 33 males, 21 females and
305 2 persons for whom their sex has not been entered.
306
307 One can also see how many of each occupation there are in the data.
308 When dealing with string variables used as nominal values, running a frequency
309 analysis is useful to detect data input entries.  Notice that
310 one @exvar{occupation} value has been mistyped as ``Scrientist''.  This entry should
311 be corrected, or marked as missing before using the data.
312
313 @float Result, frequencies:res
314 @psppoutput {frequencies}
315 @caption {The relative frequencies of @exvar{sex} and @exvar{occupation}}
316 @end float
317
318 @node EXAMINE
319 @section EXAMINE
320
321 @vindex EXAMINE
322 @cindex Exploratory data analysis
323 @cindex normality, testing
324
325 @display
326 EXAMINE
327         VARIABLES= @var{var1} [@var{var2}] @dots{} [@var{varN}]
328            [BY @var{factor1} [BY @var{subfactor1}]
329              [ @var{factor2} [BY @var{subfactor2}]]
330              @dots{}
331              [ @var{factor3} [BY @var{subfactor3}]]
332             ]
333         /STATISTICS=@{DESCRIPTIVES, EXTREME[(@var{n})], ALL, NONE@}
334         /PLOT=@{BOXPLOT, NPPLOT, HISTOGRAM, SPREADLEVEL[(@var{t})], ALL, NONE@}
335         /CINTERVAL @var{p}
336         /COMPARE=@{GROUPS,VARIABLES@}
337         /ID=@var{identity_variable}
338         /@{TOTAL,NOTOTAL@}
339         /PERCENTILE=[@var{percentiles}]=@{HAVERAGE, WAVERAGE, ROUND, AEMPIRICAL, EMPIRICAL @}
340         /MISSING=@{LISTWISE, PAIRWISE@} [@{EXCLUDE, INCLUDE@}]
341                 [@{NOREPORT,REPORT@}]
342
343 @end display
344
345 The @cmd{EXAMINE} command is used to perform exploratory data analysis.
346 In particular, it is useful for testing how closely a distribution follows a
347 normal distribution, and for finding outliers and extreme values.
348
349 The @subcmd{VARIABLES} subcommand is mandatory.
350 It specifies the dependent variables and optionally variables to use as
351 factors for the analysis.
352 Variables listed before the first @subcmd{BY} keyword (if any) are the
353 dependent variables.
354 The dependent variables may optionally be followed by a list of
355 factors which tell @pspp{} how to break down the analysis for each
356 dependent variable.
357
358 Following the dependent variables, factors may be specified.
359 The factors (if desired) should be preceded by a single @subcmd{BY} keyword.
360 The format for each factor is
361 @display
362 @var{factorvar} [BY @var{subfactorvar}].
363 @end display
364 Each unique combination of the values of  @var{factorvar} and
365 @var{subfactorvar} divide the dataset into @dfn{cells}.
366 Statistics are calculated for each cell
367 and for the entire dataset (unless @subcmd{NOTOTAL} is given).
368
369 The @subcmd{STATISTICS} subcommand specifies which statistics to show.
370 @subcmd{DESCRIPTIVES} produces a table showing some parametric and
371 non-parametrics statistics.
372 @subcmd{EXTREME} produces a table showing the extremities of each cell.
373 A number in parentheses, @var{n} determines
374 how many upper and lower extremities to show.
375 The default number is 5.
376
377 The subcommands @subcmd{TOTAL} and @subcmd{NOTOTAL} are mutually exclusive.
378 If @subcmd{TOTAL} appears, then statistics for the entire dataset
379 as well as for each cell are produced.
380 If @subcmd{NOTOTAL} appears, then statistics are produced only for the cells
381 (unless no factor variables have been given).
382 These subcommands have no effect if there have  been no factor variables
383 specified.
384
385 @cindex boxplot
386 @cindex histogram
387 @cindex npplot
388 @cindex spreadlevel plot
389 The @subcmd{PLOT} subcommand specifies which plots are to be produced if any.
390 Available plots are @subcmd{HISTOGRAM}, @subcmd{NPPLOT},  @subcmd{BOXPLOT} and
391 @subcmd{SPREADLEVEL}.
392 The first three can be used to visualise how closely each cell conforms to a
393 normal distribution, whilst the spread vs.@: level plot can be useful to visualise
394 how the variance differs between factors.
395 Boxplots show you the outliers and extreme values.
396 @footnote{@subcmd{HISTOGRAM} uses Sturges' rule to determine the number of
397 bins, as approximately @math{1 + \log2(n)}, where @math{n} is the number of samples.
398 Note that @cmd{FREQUENCIES} uses a different algorithm to find the bin size.}
399
400 The @subcmd{SPREADLEVEL} plot displays the interquartile range versus the
401 median.  It takes an optional parameter @var{t}, which specifies how the data
402 should be transformed prior to plotting.
403 The given value @var{t} is a power to which the data are raised.  For example, if
404 @var{t} is given as 2, then the square of the data is used.
405 Zero, however is a special value.  If @var{t} is 0 or
406 is omitted, then data are transformed by taking its natural logarithm instead of
407 raising to the power of @var{t}.
408
409 @cindex Shapiro-Wilk
410 When one or more plots are requested, @subcmd{EXAMINE} also performs the
411 Shapiro-Wilk test for each category.
412 There are however a number of provisos:
413 @itemize
414 @item All weight values must be integer.
415 @item The cumulative weight value must be in the range [3, 5000]
416 @end itemize
417
418 The @subcmd{COMPARE} subcommand is only relevant if producing boxplots, and it is only
419 useful there is more than one dependent variable and at least one factor.
420 If
421 @subcmd{/COMPARE=GROUPS} is specified, then one plot per dependent variable is produced,
422 each of which contain boxplots for all the cells.
423 If @subcmd{/COMPARE=VARIABLES} is specified, then one plot per cell is produced,
424 each containing one boxplot per dependent variable.
425 If the @subcmd{/COMPARE} subcommand is omitted, then @pspp{} behaves as if
426 @subcmd{/COMPARE=GROUPS} were given.
427
428 The @subcmd{ID} subcommand is relevant only if @subcmd{/PLOT=BOXPLOT} or
429 @subcmd{/STATISTICS=EXTREME} has been given.
430 If given, it should provide the name of a variable which is to be used
431 to labels extreme values and outliers.
432 Numeric or string variables are permissible.
433 If the @subcmd{ID} subcommand is not given, then the case number is used for
434 labelling.
435
436 The @subcmd{CINTERVAL} subcommand specifies the confidence interval to use in
437 calculation of the descriptives command.  The default is 95%.
438
439 @cindex percentiles
440 The @subcmd{PERCENTILES} subcommand specifies which percentiles are to be calculated,
441 and which algorithm to use for calculating them.  The default is to
442 calculate the 5, 10, 25, 50, 75, 90, 95 percentiles using the
443 @subcmd{HAVERAGE} algorithm.
444
445 The @subcmd{TOTAL} and @subcmd{NOTOTAL} subcommands are mutually exclusive.  If @subcmd{NOTOTAL}
446 is given and factors have been specified in the @subcmd{VARIABLES} subcommand,
447 then statistics for the unfactored dependent variables are
448 produced in addition to the factored variables.  If there are no
449 factors specified then @subcmd{TOTAL} and @subcmd{NOTOTAL} have no effect.
450
451
452 The following example generates descriptive statistics and histograms for
453 two variables @var{score1} and @var{score2}.
454 Two factors are given, @i{viz}: @var{gender} and @var{gender} BY @var{culture}.
455 Therefore, the descriptives and histograms are generated for each
456 distinct  value
457 of @var{gender} @emph{and} for each distinct combination of the values
458 of @var{gender} and @var{race}.
459 Since the @subcmd{NOTOTAL} keyword is given, statistics and histograms for
460 @var{score1} and @var{score2} covering the  whole dataset are not produced.
461 @example
462 EXAMINE @var{score1} @var{score2} BY
463         @var{gender}
464         @var{gender} BY @var{culture}
465         /STATISTICS = DESCRIPTIVES
466         /PLOT = HISTOGRAM
467         /NOTOTAL.
468 @end example
469
470 Here is a second example showing how the @cmd{examine} command can be used to find extremities.
471 @example
472 EXAMINE @var{height} @var{weight} BY
473         @var{gender}
474         /STATISTICS = EXTREME (3)
475         /PLOT = BOXPLOT
476         /COMPARE = GROUPS
477         /ID = @var{name}.
478 @end example
479 In this example, we look at the height and weight of a sample of individuals and
480 how they differ between male and female.
481 A table showing the 3 largest and the 3 smallest values of @exvar{height} and
482 @exvar{weight} for each gender, and for the whole dataset as are shown.
483 In addition, the @subcmd{/PLOT} subcommand requests boxplots.
484 Because @subcmd{/COMPARE = GROUPS} was specified, boxplots for male and female are
485 shown in juxtaposed in the same graphic, allowing us to easily see the difference between
486 the genders.
487 Since the variable @var{name} was specified on the @subcmd{ID} subcommand,
488 values of the @var{name} variable are used to label the extreme values.
489
490 @strong{Warning!}
491 If you specify many dependent variables or factor variables
492 for which there are many distinct values, then @cmd{EXAMINE} will produce a very
493 large quantity of output.
494
495 @node GRAPH
496 @section GRAPH
497
498 @vindex GRAPH
499 @cindex Exploratory data analysis
500 @cindex normality, testing
501
502 @display
503 GRAPH
504         /HISTOGRAM [(NORMAL)]= @var{var}
505         /SCATTERPLOT [(BIVARIATE)] = @var{var1} WITH @var{var2} [BY @var{var3}]
506         /BAR = @{@var{summary-function}(@var{var1}) | @var{count-function}@} BY @var{var2} [BY @var{var3}]
507         [ /MISSING=@{LISTWISE, VARIABLE@} [@{EXCLUDE, INCLUDE@}] ]
508                 [@{NOREPORT,REPORT@}]
509
510 @end display
511
512 The @cmd{GRAPH} command produces graphical plots of data. Only one of the subcommands
513 @subcmd{HISTOGRAM}, @subcmd{BAR} or @subcmd{SCATTERPLOT} can be specified, @i{i.e.} only one plot
514 can be produced per call of @cmd{GRAPH}. The @subcmd{MISSING} is optional.
515
516 @menu
517 * SCATTERPLOT::             Cartesian Plots
518 * HISTOGRAM::               Histograms
519 * BAR CHART::               Bar Charts
520 @end menu
521
522 @node SCATTERPLOT
523 @subsection Scatterplot
524 @cindex scatterplot
525
526 The subcommand @subcmd{SCATTERPLOT} produces an xy plot of the
527 data.
528 @cmd{GRAPH} uses the third variable @var{var3}, if specified, to determine
529 the colours and/or markers for the plot.
530 The following is an example for producing a scatterplot.
531
532 @example
533 GRAPH
534         /SCATTERPLOT = @var{height} WITH @var{weight} BY @var{gender}.
535 @end example
536
537 This example produces a scatterplot where @var{height} is plotted versus @var{weight}. Depending
538 on the value of the @var{gender} variable, the colour of the datapoint is different. With
539 this plot it is possible to analyze gender differences for @var{height} versus @var{weight} relation.
540
541 @node HISTOGRAM
542 @subsection Histogram
543 @cindex histogram
544
545 The subcommand @subcmd{HISTOGRAM} produces a histogram. Only one variable is allowed for
546 the histogram plot.
547 The keyword @subcmd{NORMAL} may be specified in parentheses, to indicate that the ideal normal curve
548 should be superimposed over the histogram.
549 For an alternative method to produce histograms @pxref{EXAMINE}. The
550 following example produces a histogram plot for the variable @var{weight}.
551
552 @example
553 GRAPH
554         /HISTOGRAM = @var{weight}.
555 @end example
556
557 @node BAR CHART
558 @subsection Bar Chart
559 @cindex bar chart
560
561 The subcommand @subcmd{BAR} produces a bar chart.
562 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.
563 Following the summary or count function, the keyword @subcmd{BY} should be specified and then a catagorical variable, @var{var2}.
564 The values of the variable @var{var2} determine the labels of the bars to be plotted.
565 Optionally a second categorical variable @var{var3} may be specified in which case a clustered (grouped) bar chart is produced.
566
567 Valid count functions are
568 @table @subcmd
569 @item COUNT
570 The weighted counts of the cases in each category.
571 @item PCT
572 The weighted counts of the cases in each category expressed as a percentage of the total weights of the cases.
573 @item CUFREQ
574 The cumulative weighted counts of the cases in each category.
575 @item CUPCT
576 The cumulative weighted counts of the cases in each category expressed as a percentage of the total weights of the cases.
577 @end table
578
579 The summary function is applied to @var{var1} across all cases in each category.
580 The recognised summary functions are:
581 @table @subcmd
582 @item SUM
583 The sum.
584 @item MEAN
585 The arithmetic mean.
586 @item MAXIMUM
587 The maximum value.
588 @item MINIMUM
589 The minimum value.
590 @end table
591
592 The following examples assume a dataset which is the results of a survey.
593 Each respondent has indicated annual income, their sex and city of residence.
594 One could create a bar chart showing how the mean income varies between of residents of different cities, thus:
595 @example
596 GRAPH  /BAR  = MEAN(@var{income}) BY @var{city}.
597 @end example
598
599 This can be extended to also indicate how income in each city differs between the sexes.
600 @example
601 GRAPH  /BAR  = MEAN(@var{income}) BY @var{city} BY @var{sex}.
602 @end example
603
604 One might also want to see how many respondents there are from each city.  This can be achieved as follows:
605 @example
606 GRAPH  /BAR  = COUNT BY @var{city}.
607 @end example
608
609 Bar charts can also be produced using the @ref{FREQUENCIES} and @ref{CROSSTABS} commands.
610
611 @node CORRELATIONS
612 @section CORRELATIONS
613
614 @vindex CORRELATIONS
615 @display
616 CORRELATIONS
617      /VARIABLES = @var{var_list} [ WITH @var{var_list} ]
618      [
619       .
620       .
621       .
622       /VARIABLES = @var{var_list} [ WITH @var{var_list} ]
623       /VARIABLES = @var{var_list} [ WITH @var{var_list} ]
624      ]
625
626      [ /PRINT=@{TWOTAIL, ONETAIL@} @{SIG, NOSIG@} ]
627      [ /STATISTICS=DESCRIPTIVES XPROD ALL]
628      [ /MISSING=@{PAIRWISE, LISTWISE@} @{INCLUDE, EXCLUDE@} ]
629 @end display
630
631 @cindex correlation
632 The @cmd{CORRELATIONS} procedure produces tables of the Pearson correlation coefficient
633 for a set of variables.  The significance of the coefficients are also given.
634
635 At least one @subcmd{VARIABLES} subcommand is required. If you specify the @subcmd{WITH}
636 keyword, then a non-square correlation table is produced.
637 The variables preceding @subcmd{WITH}, are used as the rows of the table,
638 and the variables following @subcmd{WITH} are used as the columns of the table.
639 If no @subcmd{WITH} subcommand is specified, then @cmd{CORRELATIONS} produces a
640 square, symmetrical table using all variables.
641
642 The @cmd{MISSING} subcommand determines the handling of missing variables.
643 If @subcmd{INCLUDE} is set, then user-missing values are included in the
644 calculations, but system-missing values are not.
645 If @subcmd{EXCLUDE} is set, which is the default, user-missing
646 values are excluded as well as system-missing values.
647
648 If @subcmd{LISTWISE} is set, then the entire case is excluded from analysis
649 whenever any variable  specified in any @cmd{/VARIABLES} subcommand
650 contains a missing value.
651 If @subcmd{PAIRWISE} is set, then a case is considered missing only if either of the
652 values  for the particular coefficient are missing.
653 The default is @subcmd{PAIRWISE}.
654
655 The @subcmd{PRINT} subcommand is used to control how the reported significance values are printed.
656 If the @subcmd{TWOTAIL} option is used, then a two-tailed test of significance is
657 printed.  If the @subcmd{ONETAIL} option is given, then a one-tailed test is used.
658 The default is @subcmd{TWOTAIL}.
659
660 If the @subcmd{NOSIG} option is specified, then correlation coefficients with significance less than
661 0.05 are highlighted.
662 If @subcmd{SIG} is specified, then no highlighting is performed.  This is the default.
663
664 @cindex covariance
665 The @subcmd{STATISTICS} subcommand requests additional statistics to be displayed.  The keyword
666 @subcmd{DESCRIPTIVES} requests that the mean, number of non-missing cases, and the non-biased
667 estimator of the standard deviation are displayed.
668 These statistics are displayed in a separated table, for all the variables listed
669 in any @subcmd{/VARIABLES} subcommand.
670 The @subcmd{XPROD} keyword requests cross-product deviations and covariance estimators to
671 be displayed for each pair of variables.
672 The keyword @subcmd{ALL} is the union of @subcmd{DESCRIPTIVES} and @subcmd{XPROD}.
673
674 @node CROSSTABS
675 @section CROSSTABS
676
677 @vindex CROSSTABS
678 @display
679 CROSSTABS
680         /TABLES=@var{var_list} BY @var{var_list} [BY @var{var_list}]@dots{}
681         /MISSING=@{TABLE,INCLUDE,REPORT@}
682         /FORMAT=@{TABLES,NOTABLES@}
683                 @{AVALUE,DVALUE@}
684         /CELLS=@{COUNT,ROW,COLUMN,TOTAL,EXPECTED,RESIDUAL,SRESIDUAL,
685                 ASRESIDUAL,ALL,NONE@}
686         /COUNT=@{ASIS,CASE,CELL@}
687                @{ROUND,TRUNCATE@}
688         /STATISTICS=@{CHISQ,PHI,CC,LAMBDA,UC,BTAU,CTAU,RISK,GAMMA,D,
689                      KAPPA,ETA,CORR,ALL,NONE@}
690         /BARCHART
691
692 (Integer mode.)
693         /VARIABLES=@var{var_list} (@var{low},@var{high})@dots{}
694 @end display
695
696 The @cmd{CROSSTABS} procedure displays crosstabulation
697 tables requested by the user.  It can calculate several statistics for
698 each cell in the crosstabulation tables.  In addition, a number of
699 statistics can be calculated for each table itself.
700
701 The @subcmd{TABLES} subcommand is used to specify the tables to be reported.  Any
702 number of dimensions is permitted, and any number of variables per
703 dimension is allowed.  The @subcmd{TABLES} subcommand may be repeated as many
704 times as needed.  This is the only required subcommand in @dfn{general
705 mode}.
706
707 Occasionally, one may want to invoke a special mode called @dfn{integer
708 mode}.  Normally, in general mode, @pspp{} automatically determines
709 what values occur in the data.  In integer mode, the user specifies the
710 range of values that the data assumes.  To invoke this mode, specify the
711 @subcmd{VARIABLES} subcommand, giving a range of data values in parentheses for
712 each variable to be used on the @subcmd{TABLES} subcommand.  Data values inside
713 the range are truncated to the nearest integer, then assigned to that
714 value.  If values occur outside this range, they are discarded.  When it
715 is present, the @subcmd{VARIABLES} subcommand must precede the @subcmd{TABLES}
716 subcommand.
717
718 In general mode, numeric and string variables may be specified on
719 TABLES.  In integer mode, only numeric variables are allowed.
720
721 The @subcmd{MISSING} subcommand determines the handling of user-missing values.
722 When set to @subcmd{TABLE}, the default, missing values are dropped on a table by
723 table basis.  When set to @subcmd{INCLUDE}, user-missing values are included in
724 tables and statistics.  When set to @subcmd{REPORT}, which is allowed only in
725 integer mode, user-missing values are included in tables but marked with
726 a footnote and excluded from statistical calculations.
727
728 The @subcmd{FORMAT} subcommand controls the characteristics of the
729 crosstabulation tables to be displayed.  It has a number of possible
730 settings:
731
732 @itemize @w{}
733 @item
734 @subcmd{TABLES}, the default, causes crosstabulation tables to be output.
735 @subcmd{NOTABLES}, which is equivalent to @code{CELLS=NONE}, suppresses them.
736
737 @item
738 @subcmd{AVALUE}, the default, causes values to be sorted in ascending order.
739 @subcmd{DVALUE} asserts a descending sort order.
740 @end itemize
741
742 The @subcmd{CELLS} subcommand controls the contents of each cell in the displayed
743 crosstabulation table.  The possible settings are:
744
745 @table @asis
746 @item COUNT
747 Frequency count.
748 @item ROW
749 Row percent.
750 @item COLUMN
751 Column percent.
752 @item TOTAL
753 Table percent.
754 @item EXPECTED
755 Expected value.
756 @item RESIDUAL
757 Residual.
758 @item SRESIDUAL
759 Standardized residual.
760 @item ASRESIDUAL
761 Adjusted standardized residual.
762 @item ALL
763 All of the above.
764 @item NONE
765 Suppress cells entirely.
766 @end table
767
768 @samp{/CELLS} without any settings specified requests @subcmd{COUNT}, @subcmd{ROW},
769 @subcmd{COLUMN}, and @subcmd{TOTAL}.
770 If @subcmd{CELLS} is not specified at all then only @subcmd{COUNT}
771 is selected.
772
773 By default, crosstabulation and statistics use raw case weights,
774 without rounding.  Use the @subcmd{/COUNT} subcommand to perform
775 rounding: CASE rounds the weights of individual weights as cases are
776 read, CELL rounds the weights of cells within each crosstabulation
777 table after it has been constructed, and ASIS explicitly specifies the
778 default non-rounding behavior.  When rounding is requested, ROUND, the
779 default, rounds to the nearest integer and TRUNCATE rounds toward
780 zero.
781
782 The @subcmd{STATISTICS} subcommand selects statistics for computation:
783
784 @table @asis
785 @item CHISQ
786 @cindex chi-square
787
788 Pearson chi-square, likelihood ratio, Fisher's exact test, continuity
789 correction, linear-by-linear association.
790 @item PHI
791 Phi.
792 @item CC
793 Contingency coefficient.
794 @item LAMBDA
795 Lambda.
796 @item UC
797 Uncertainty coefficient.
798 @item BTAU
799 Tau-b.
800 @item CTAU
801 Tau-c.
802 @item RISK
803 Risk estimate.
804 @item GAMMA
805 Gamma.
806 @item D
807 Somers' D.
808 @item KAPPA
809 Cohen's Kappa.
810 @item ETA
811 Eta.
812 @item CORR
813 Spearman correlation, Pearson's r.
814 @item ALL
815 All of the above.
816 @item NONE
817 No statistics.
818 @end table
819
820 Selected statistics are only calculated when appropriate for the
821 statistic.  Certain statistics require tables of a particular size, and
822 some statistics are calculated only in integer mode.
823
824 @samp{/STATISTICS} without any settings selects CHISQ.  If the
825 @subcmd{STATISTICS} subcommand is not given, no statistics are calculated.
826
827 @cindex bar chart
828 The @samp{/BARCHART} subcommand produces a clustered bar chart for the first two
829 variables on each table.
830 If a table has more than two variables, the counts for the third and subsequent levels
831 are aggregated and the chart is produced as if there were only two variables.
832
833
834 @strong{Please note:} Currently the implementation of @cmd{CROSSTABS} has the
835 following limitations:
836
837 @itemize @bullet
838 @item
839 Significance of some symmetric and directional measures is not calculated.
840 @item
841 Asymptotic standard error is not calculated for
842 Goodman and Kruskal's tau or symmetric Somers' d.
843 @item
844 Approximate T is not calculated for symmetric uncertainty coefficient.
845 @end itemize
846
847 Fixes for any of these deficiencies would be welcomed.
848
849 @subsection Crosstabs Example
850
851 @cindex chi-square test of independence
852
853 A researcher wishes to know if, in an industry, a person's sex is related to
854 the person's occupation.  To investigate this, she has determined that the
855 @file{personnel.sav} is a representative, randomly selected sample of persons.
856 The researcher's null hypothesis is that a person's sex has no relation to a
857 person's occupation. She uses a chi-squared test of independence to investigate
858 the hypothesis.
859
860 @float Example, crosstabs:ex
861 @psppsyntax {crosstabs.sps}
862 @caption {Running crosstabs on the @exvar{sex} and @exvar{occupation} variables}
863 @end float
864
865 The syntax in @ref{crosstabs:ex} conducts a chi-squared test of independence.
866 The line @code{/tables = occupation by sex} indicates that @exvar{occupation}
867 and @exvar{sex} are the variables to be tabulated.  To do this using the @gui{}
868 you must place these variable names respectively in the @samp{Row} and
869 @samp{Column} fields as shown in @ref{crosstabs:scr}.
870
871 @float Screenshot, crosstabs:scr
872 @psppimage {crosstabs}
873 @caption {The Crosstabs dialog box with the @exvar{sex} and @exvar{occupation} variables selected}
874 @end float
875
876 Similarly, the @samp{Cells} button shows a dialog box to select the @code{count}
877 and @code{expected} options.  All other cell options can be deselected for this
878 test.
879
880 You would use the @samp{Format} and @samp{Statistics}  buttons to select options
881 for the @subcmd{FORMAT} and @subcmd{STATISTICS} subcommands.  In this example,
882 the @samp{Statistics} requires only the @samp{Chisq} option to be checked.  All
883 other options should be unchecked.  No special settings are required from the
884 @samp{Format} dialog.
885
886 As shown in @ref{crosstabs:res} @cmd{CROSSTABS} generates a contingency table
887 containing the observed count and the expected count of each sex and each
888 occupation.  The expected count is the count which would be observed if the
889 null hypothesis were true.
890
891 The significance of the Pearson Chi-Square value is very much larger than the
892 normally accepted value of 0.05 and so one cannot reject the null hypothesis.
893 Thus the researcher must conclude that a person's sex has no relation to the
894 person's occupation.
895
896 @float Results, crosstabs:res
897 @psppoutput {crosstabs}
898 @caption {The results of a test of independence between @exvar{sex} and @exvar{occupation}}
899 @end float
900
901 @node CTABLES
902 @section CTABLES
903
904 @vindex CTABLES
905 @cindex custom tables
906 @cindex tables, custom
907
908 @code{CTABLES} has the following overall syntax.  At least one
909 @code{TABLE} subcommand is required:
910
911 @display
912 @t{CTABLES}
913   @dots{}@i{global subcommands}@dots{}
914   [@t{/TABLE} @i{axis} [@t{BY} @i{axis} [@t{BY} @i{axis}]]
915    @dots{}@i{per-table subcommands}@dots{}]@dots{}
916 @end display
917
918 @noindent
919 where each @i{axis} may be empty or take one of the following forms:
920
921 @display
922 @i{variable}
923 @i{variable} @t{[}@{@t{C} @math{|} @t{S}@}@t{]}
924 @i{axis} + @i{axis}
925 @i{axis} > @i{axis}
926 (@i{axis})
927 @i{axis} @t{(}@i{summary} [@i{string}] [@i{format}]@t{)}
928 @end display
929
930 The following subcommands precede the first @code{TABLE} subcommand
931 and apply to all of the output tables.  All of these subcommands are
932 optional:
933
934 @display
935 @t{/FORMAT}
936     [@t{MINCOLWIDTH=}@{@t{DEFAULT} @math{|} @i{width}@}]
937     [@t{MAXCOLWIDTH=}@{@t{DEFAULT} @math{|} @i{width}@}]
938     [@t{UNITS=}@{@t{POINTS} @math{|} @t{INCHES} @math{|} @t{CM}@}]
939     [@t{EMPTY=}@{@t{ZERO} @math{|} @t{BLANK} @math{|} @i{string}@}]
940     [@t{MISSING=}@i{string}]
941 @t{/VLABELS}
942     @t{VARIABLES=}@i{variables}
943     @t{DISPLAY}=@{@t{DEFAULT} @math{|} @t{NAME} @math{|} @t{LABEL} @math{|} @t{BOTH} @math{|} @t{NONE}@}
944 @t{/MRSETS COUNTDUPLICATES=}@{@t{YES} @math{|} @t{NO}@}
945 @t{/SMISSING} @{@t{VARIABLE} @math{|} @t{LISTWISE}@}
946 @t{/PCOMPUTE} @t{&}@i{category}@t{=EXPR(}@i{expression}@t{)}
947 @t{/PPROPERTIES} @t{&}@i{category}@dots{}
948     [@t{LABEL=}@i{string}]
949     [@t{FORMAT=}[@i{summary} @i{format}]@dots{}]
950     [@t{HIDESOURCECATS=}@{@t{NO} @math{|} @t{YES}@}
951 @t{/WEIGHT VARIABLE=}@i{variable}
952 @t{/HIDESMALLCOUNTS COUNT=@i{count}}
953 @end display
954
955 The following subcommands follow @code{TABLE} and apply only to the
956 previous @code{TABLE}.  All of these subcommands are optional:
957
958 @display
959 @t{/SLABELS}
960     [@t{POSITION=}@{@t{COLUMN} @math{|} @t{ROW} @math{|} @t{LAYER}@}]
961     [@t{VISIBLE=}@{@t{YES} @math{|} @t{NO}@}]
962 @t{/CLABELS} @{@t{AUTO} @math{|} @{@t{ROWLABELS}@math{|}@t{COLLABELS}@}@t{=}@{@t{OPPOSITE}@math{|}@t{LAYER}@}@}
963 @t{/CRITERIA CILEVEL=}@i{percentage}
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}@}]
971 @t{/TITLES}
972     [@t{TITLE=}@i{string}@dots{}]
973     [@t{CAPTION=}@i{string}@dots{}]
974     [@t{CORNER=}@i{string}@dots{}]
975 @t{/SIGTEST TYPE=CHISQUARE}
976     [@t{ALPHA=}@i{siglevel}]
977     [@t{INCLUDEMRSETS=}@{@t{YES} @math{|} @t{NO}@}]
978     [@t{CATEGORIES=}@{@t{ALLVISIBLE} @math{|} @t{SUBTOTALS}@}]
979 @t{/COMPARETEST TYPE=}@{@t{PROP} @math{|} @t{MEAN}@}
980     [@t{ALPHA=}@i{value}[@t{,} @i{value}]]
981     [@t{ADJUST=}@{@t{BONFERRONI} @math{|} @t{BH} @math{|} @t{NONE}@}]
982     [@t{INCLUDEMRSETS=}@{@t{YES} @math{|} @t{NO}@}]
983     [@t{MEANSVARIANCE=}@{@t{ALLCATS} @math{|} @t{TESTEDCATS}@}]
984     [@t{CATEGORIES=}@{@t{ALLVISIBLE} @math{|} @t{SUBTOTALS}@}]
985     [@t{MERGE=}@{@t{NO} @math{|} @t{YES}@}]
986     [@t{STYLE=}@{@t{APA} @math{|} @t{SIMPLE}@}]
987     [@t{SHOWSIG=}@{@t{NO} @math{|} @t{YES}@}]
988 @end display
989
990 The @code{CTABLES} (aka ``custom tables'') command outputs
991 multi-dimensional tables, offering many options for table
992 summarization and formatting.
993
994 @code{TABLE}, the only required subcommand, specifies the variables to
995 include on each dimension, using the syntax @t{/TABLE} @i{rows} @t{BY}
996 @i{columns} @t{BY} @i{layers}, in which @i{rows}, @i{columns}, and
997 @i{layers} is each empty or an @i{axis}.  The simplest form of
998 @i{axis} is just a variable name.  
999
1000
1001 @node FACTOR
1002 @section FACTOR
1003
1004 @vindex FACTOR
1005 @cindex factor analysis
1006 @cindex principal components analysis
1007 @cindex principal axis factoring
1008 @cindex data reduction
1009
1010 @display
1011 FACTOR  @{
1012          VARIABLES=@var{var_list},
1013          MATRIX IN (@{CORR,COV@}=@{*,@var{file_spec}@})
1014         @}
1015
1016         [ /METHOD = @{CORRELATION, COVARIANCE@} ]
1017
1018         [ /ANALYSIS=@var{var_list} ]
1019
1020         [ /EXTRACTION=@{PC, PAF@}]
1021
1022         [ /ROTATION=@{VARIMAX, EQUAMAX, QUARTIMAX, PROMAX[(@var{k})], NOROTATE@}]
1023
1024         [ /PRINT=[INITIAL] [EXTRACTION] [ROTATION] [UNIVARIATE] [CORRELATION] [COVARIANCE] [DET] [KMO] [AIC] [SIG] [ALL] [DEFAULT] ]
1025
1026         [ /PLOT=[EIGEN] ]
1027
1028         [ /FORMAT=[SORT] [BLANK(@var{n})] [DEFAULT] ]
1029
1030         [ /CRITERIA=[FACTORS(@var{n})] [MINEIGEN(@var{l})] [ITERATE(@var{m})] [ECONVERGE (@var{delta})] [DEFAULT] ]
1031
1032         [ /MISSING=[@{LISTWISE, PAIRWISE@}] [@{INCLUDE, EXCLUDE@}] ]
1033 @end display
1034
1035 The @cmd{FACTOR} command performs Factor Analysis or Principal Axis Factoring on a dataset.  It may be used to find
1036 common factors in the data or for data reduction purposes.
1037
1038 The @subcmd{VARIABLES} subcommand is required (unless the @subcmd{MATRIX IN}
1039 subcommand is used).
1040 It lists the variables which are to partake in the analysis.  (The @subcmd{ANALYSIS}
1041 subcommand may optionally further limit the variables that
1042 participate; it is useful primarily in conjunction with @subcmd{MATRIX IN}.)
1043
1044 If @subcmd{MATRIX IN} instead of @subcmd{VARIABLES} is specified, then the analysis
1045 is performed on a pre-prepared correlation or covariance matrix file instead of on
1046 individual data cases.  Typically the matrix file will have been generated by
1047 @cmd{MATRIX DATA} (@pxref{MATRIX DATA}) or provided by a third party.
1048 If specified, @subcmd{MATRIX IN} must be followed by @samp{COV} or @samp{CORR},
1049 then by @samp{=} and @var{file_spec} all in parentheses.
1050 @var{file_spec} may either be an asterisk, which indicates the currently loaded
1051 dataset, or it may be a file name to be loaded. @xref{MATRIX DATA}, for the expected
1052 format of the file.
1053
1054 The @subcmd{/EXTRACTION} subcommand is used to specify the way in which factors
1055 (components) are extracted from the data.
1056 If @subcmd{PC} is specified, then Principal Components Analysis is used.
1057 If @subcmd{PAF} is specified, then Principal Axis Factoring is
1058 used. By default Principal Components Analysis is used.
1059
1060 The @subcmd{/ROTATION} subcommand is used to specify the method by which the
1061 extracted solution is rotated.  Three orthogonal rotation methods are available:
1062 @subcmd{VARIMAX} (which is the default), @subcmd{EQUAMAX}, and @subcmd{QUARTIMAX}.
1063 There is one oblique rotation method, @i{viz}: @subcmd{PROMAX}.
1064 Optionally you may enter the power of the promax rotation @var{k}, which must be enclosed in parentheses.
1065 The default value of @var{k} is 5.
1066 If you don't want any rotation to be performed, the word @subcmd{NOROTATE}
1067 prevents the command from performing any rotation on the data.
1068
1069 The @subcmd{/METHOD} subcommand should be used to determine whether the
1070 covariance matrix or the correlation matrix of the data is
1071 to be analysed.  By default, the correlation matrix is analysed.
1072
1073 The @subcmd{/PRINT} subcommand may be used to select which features of the analysis are reported:
1074
1075 @itemize
1076 @item @subcmd{UNIVARIATE}
1077       A table of mean values, standard deviations and total weights are printed.
1078 @item @subcmd{INITIAL}
1079       Initial communalities and eigenvalues are printed.
1080 @item @subcmd{EXTRACTION}
1081       Extracted communalities and eigenvalues are printed.
1082 @item @subcmd{ROTATION}
1083       Rotated communalities and eigenvalues are printed.
1084 @item @subcmd{CORRELATION}
1085       The correlation matrix is printed.
1086 @item @subcmd{COVARIANCE}
1087       The covariance matrix is printed.
1088 @item @subcmd{DET}
1089       The determinant of the correlation or covariance matrix is printed.
1090 @item @subcmd{AIC}
1091       The anti-image covariance and anti-image correlation matrices are printed.
1092 @item @subcmd{KMO}
1093       The Kaiser-Meyer-Olkin measure of sampling adequacy and the Bartlett test of sphericity is printed.
1094 @item @subcmd{SIG}
1095       The significance of the elements of correlation matrix is printed.
1096 @item @subcmd{ALL}
1097       All of the above are printed.
1098 @item @subcmd{DEFAULT}
1099       Identical to @subcmd{INITIAL} and @subcmd{EXTRACTION}.
1100 @end itemize
1101
1102 If @subcmd{/PLOT=EIGEN} is given, then a ``Scree'' plot of the eigenvalues is
1103 printed.  This can be useful for visualizing the factors and deciding
1104 which factors (components) should be retained.
1105
1106 The @subcmd{/FORMAT} subcommand determined how data are to be
1107 displayed in loading matrices.  If @subcmd{SORT} is specified, then
1108 the variables are sorted in descending order of significance.  If
1109 @subcmd{BLANK(@var{n})} is specified, then coefficients whose absolute
1110 value is less than @var{n} are not printed.  If the keyword
1111 @subcmd{DEFAULT} is specified, or if no @subcmd{/FORMAT} subcommand is
1112 specified, then no sorting is performed, and all coefficients are printed.
1113
1114 You can use the @subcmd{/CRITERIA} subcommand to specify how the number of
1115 extracted factors (components) are chosen.  If @subcmd{FACTORS(@var{n})} is
1116 specified, where @var{n} is an integer, then @var{n} factors are
1117 extracted.  Otherwise, the @subcmd{MINEIGEN} setting is used.
1118 @subcmd{MINEIGEN(@var{l})} requests that all factors whose eigenvalues
1119 are greater than or equal to @var{l} are extracted. The default value
1120 of @var{l} is 1. The @subcmd{ECONVERGE} setting has effect only when
1121 using iterative algorithms for factor extraction (such as Principal Axis
1122 Factoring).  @subcmd{ECONVERGE(@var{delta})} specifies that
1123 iteration should cease when the maximum absolute value of the
1124 communality estimate between one iteration and the previous is less
1125 than @var{delta}. The default value of @var{delta} is 0.001.
1126
1127 The @subcmd{ITERATE(@var{m})} may appear any number of times and is
1128 used for two different purposes. It is used to set the maximum number
1129 of iterations (@var{m}) for convergence and also to set the maximum
1130 number of iterations for rotation.
1131 Whether it affects convergence or rotation depends upon which
1132 subcommand follows the @subcmd{ITERATE} subcommand.
1133 If @subcmd{EXTRACTION} follows, it affects convergence.
1134 If @subcmd{ROTATION} follows, it affects rotation.
1135 If neither @subcmd{ROTATION} nor @subcmd{EXTRACTION} follow a
1136 @subcmd{ITERATE} subcommand, then the entire subcommand is ignored.
1137 The default value of @var{m} is 25.
1138
1139 The @cmd{MISSING} subcommand determines the handling of missing
1140 variables.  If @subcmd{INCLUDE} is set, then user-missing values are
1141 included in the calculations, but system-missing values are not.
1142 If @subcmd{EXCLUDE} is set, which is the default, user-missing
1143 values are excluded as well as system-missing values.  This is the
1144 default. If @subcmd{LISTWISE} is set, then the entire case is excluded
1145 from analysis whenever any variable  specified in the @cmd{VARIABLES}
1146 subcommand contains a missing value.
1147
1148 If @subcmd{PAIRWISE} is set, then a case is considered missing only if
1149 either of the values  for the particular coefficient are missing.
1150 The default is @subcmd{LISTWISE}.
1151
1152 @node GLM
1153 @section GLM
1154
1155 @vindex GLM
1156 @cindex univariate analysis of variance
1157 @cindex fixed effects
1158 @cindex factorial anova
1159 @cindex analysis of variance
1160 @cindex ANOVA
1161
1162
1163 @display
1164 GLM @var{dependent_vars} BY @var{fixed_factors}
1165      [/METHOD = SSTYPE(@var{type})]
1166      [/DESIGN = @var{interaction_0} [@var{interaction_1} [... @var{interaction_n}]]]
1167      [/INTERCEPT = @{INCLUDE|EXCLUDE@}]
1168      [/MISSING = @{INCLUDE|EXCLUDE@}]
1169 @end display
1170
1171 The @cmd{GLM} procedure can be used for fixed effects factorial Anova.
1172
1173 The @var{dependent_vars} are the variables to be analysed.
1174 You may analyse several variables in the same command in which case they should all
1175 appear before the @code{BY} keyword.
1176
1177 The @var{fixed_factors} list must be one or more categorical variables.  Normally it
1178 does not make sense to enter a scalar variable in the @var{fixed_factors} and doing
1179 so may cause @pspp{} to do a lot of unnecessary processing.
1180
1181 The @subcmd{METHOD} subcommand is used to change the method for producing the sums of
1182 squares.  Available values of @var{type} are 1, 2 and 3.  The default is type 3.
1183
1184 You may specify a custom design using the @subcmd{DESIGN} subcommand.
1185 The design comprises a list of interactions where each interaction is a
1186 list of variables separated by a @samp{*}.  For example the command
1187 @display
1188 GLM subject BY sex age_group race
1189     /DESIGN = age_group sex group age_group*sex age_group*race
1190 @end display
1191 @noindent specifies the model @math{subject = age_group + sex + race + age_group*sex + age_group*race}.
1192 If no @subcmd{DESIGN} subcommand is specified, then the default is all possible combinations
1193 of the fixed factors.  That is to say
1194 @display
1195 GLM subject BY sex age_group race
1196 @end display
1197 implies the model
1198 @math{subject = age_group + sex + race + age_group*sex + age_group*race + sex*race + age_group*sex*race}.
1199
1200
1201 The @subcmd{MISSING} subcommand determines the handling of missing
1202 variables.
1203 If @subcmd{INCLUDE} is set then, for the purposes of GLM analysis,
1204 only system-missing values are considered
1205 to be missing; user-missing values are not regarded as missing.
1206 If @subcmd{EXCLUDE} is set, which is the default, then user-missing
1207 values are considered to be missing as well as system-missing values.
1208 A case for which any dependent variable or any factor
1209 variable has a missing value is excluded from the analysis.
1210
1211 @node LOGISTIC REGRESSION
1212 @section LOGISTIC REGRESSION
1213
1214 @vindex LOGISTIC REGRESSION
1215 @cindex logistic regression
1216 @cindex bivariate logistic regression
1217
1218 @display
1219 LOGISTIC REGRESSION [VARIABLES =] @var{dependent_var} WITH @var{predictors}
1220
1221      [/CATEGORICAL = @var{categorical_predictors}]
1222
1223      [@{/NOCONST | /ORIGIN | /NOORIGIN @}]
1224
1225      [/PRINT = [SUMMARY] [DEFAULT] [CI(@var{confidence})] [ALL]]
1226
1227      [/CRITERIA = [BCON(@var{min_delta})] [ITERATE(@var{max_interations})]
1228                   [LCON(@var{min_likelihood_delta})] [EPS(@var{min_epsilon})]
1229                   [CUT(@var{cut_point})]]
1230
1231      [/MISSING = @{INCLUDE|EXCLUDE@}]
1232 @end display
1233
1234 Bivariate Logistic Regression is used when you want to explain a dichotomous dependent
1235 variable in terms of one or more predictor variables.
1236
1237 The minimum command is
1238 @example
1239 LOGISTIC REGRESSION @var{y} WITH @var{x1} @var{x2} @dots{} @var{xn}.
1240 @end example
1241 Here, @var{y} is the dependent variable, which must be dichotomous and @var{x1} @dots{} @var{xn}
1242 are the predictor variables whose coefficients the procedure estimates.
1243
1244 By default, a constant term is included in the model.
1245 Hence, the full model is
1246 @math{
1247 {\bf y}
1248 = b_0 + b_1 {\bf x_1}
1249 + b_2 {\bf x_2}
1250 + \dots
1251 + b_n {\bf x_n}
1252 }
1253
1254 Predictor variables which are categorical in nature should be listed on the @subcmd{/CATEGORICAL} subcommand.
1255 Simple variables as well as interactions between variables may be listed here.
1256
1257 If you want a model without the constant term @math{b_0}, use the keyword @subcmd{/ORIGIN}.
1258 @subcmd{/NOCONST} is a synonym for @subcmd{/ORIGIN}.
1259
1260 An iterative Newton-Raphson procedure is used to fit the model.
1261 The @subcmd{/CRITERIA} subcommand is used to specify the stopping criteria of the procedure,
1262 and other parameters.
1263 The value of @var{cut_point} is used in the classification table.  It is the
1264 threshold above which predicted values are considered to be 1.  Values
1265 of @var{cut_point} must lie in the range [0,1].
1266 During iterations, if any one of the stopping criteria are satisfied, the procedure is
1267 considered complete.
1268 The stopping criteria are:
1269 @itemize
1270 @item The number of iterations exceeds @var{max_iterations}.
1271       The default value of @var{max_iterations} is 20.
1272 @item The change in the all coefficient estimates are less than @var{min_delta}.
1273 The default value of @var{min_delta} is 0.001.
1274 @item The magnitude of change in the likelihood estimate is less than @var{min_likelihood_delta}.
1275 The default value of @var{min_delta} is zero.
1276 This means that this criterion is disabled.
1277 @item The differential of the estimated probability for all cases is less than @var{min_epsilon}.
1278 In other words, the probabilities are close to zero or one.
1279 The default value of @var{min_epsilon} is 0.00000001.
1280 @end itemize
1281
1282
1283 The @subcmd{PRINT} subcommand controls the display of optional statistics.
1284 Currently there is one such option, @subcmd{CI}, which indicates that the
1285 confidence interval of the odds ratio should be displayed as well as its value.
1286 @subcmd{CI} should be followed by an integer in parentheses, to indicate the
1287 confidence level of the desired confidence interval.
1288
1289 The @subcmd{MISSING} subcommand determines the handling of missing
1290 variables.
1291 If @subcmd{INCLUDE} is set, then user-missing values are included in the
1292 calculations, but system-missing values are not.
1293 If @subcmd{EXCLUDE} is set, which is the default, user-missing
1294 values are excluded as well as system-missing values.
1295 This is the default.
1296
1297 @node MEANS
1298 @section MEANS
1299
1300 @vindex MEANS
1301 @cindex means
1302
1303 @display
1304 MEANS [TABLES =]
1305       @{@var{var_list}@}
1306         [ BY @{@var{var_list}@} [BY @{@var{var_list}@} [BY @{@var{var_list}@} @dots{} ]]]
1307
1308       [ /@{@var{var_list}@}
1309          [ BY @{@var{var_list}@} [BY @{@var{var_list}@} [BY @{@var{var_list}@} @dots{} ]]] ]
1310
1311       [/CELLS = [MEAN] [COUNT] [STDDEV] [SEMEAN] [SUM] [MIN] [MAX] [RANGE]
1312         [VARIANCE] [KURT] [SEKURT]
1313         [SKEW] [SESKEW] [FIRST] [LAST]
1314         [HARMONIC] [GEOMETRIC]
1315         [DEFAULT]
1316         [ALL]
1317         [NONE] ]
1318
1319       [/MISSING = [INCLUDE] [DEPENDENT]]
1320 @end display
1321
1322 You can use the @cmd{MEANS} command to calculate the arithmetic mean and similar
1323 statistics, either for the dataset as a whole or for categories of data.
1324
1325 The simplest form of the command is
1326 @example
1327 MEANS @var{v}.
1328 @end example
1329 @noindent which calculates the mean, count and standard deviation for @var{v}.
1330 If you specify a grouping variable, for example
1331 @example
1332 MEANS @var{v} BY @var{g}.
1333 @end example
1334 @noindent then the means, counts and standard deviations for @var{v} after having
1335 been grouped by @var{g} are calculated.
1336 Instead of the mean, count and standard deviation, you could specify the statistics
1337 in which you are interested:
1338 @example
1339 MEANS @var{x} @var{y} BY @var{g}
1340       /CELLS = HARMONIC SUM MIN.
1341 @end example
1342 This example calculates the harmonic mean, the sum and the minimum values of @var{x} and @var{y}
1343 grouped by @var{g}.
1344
1345 The @subcmd{CELLS} subcommand specifies which statistics to calculate.  The available statistics
1346 are:
1347 @itemize
1348 @item @subcmd{MEAN}
1349 @cindex arithmetic mean
1350       The arithmetic mean.
1351 @item @subcmd{COUNT}
1352       The count of the values.
1353 @item @subcmd{STDDEV}
1354       The standard deviation.
1355 @item @subcmd{SEMEAN}
1356       The standard error of the mean.
1357 @item @subcmd{SUM}
1358       The sum of the values.
1359 @item @subcmd{MIN}
1360       The minimum value.
1361 @item @subcmd{MAX}
1362       The maximum value.
1363 @item @subcmd{RANGE}
1364       The difference between the maximum and minimum values.
1365 @item @subcmd{VARIANCE}
1366       The variance.
1367 @item @subcmd{FIRST}
1368       The first value in the category.
1369 @item @subcmd{LAST}
1370       The last value in the category.
1371 @item @subcmd{SKEW}
1372       The skewness.
1373 @item @subcmd{SESKEW}
1374       The standard error of the skewness.
1375 @item @subcmd{KURT}
1376       The kurtosis
1377 @item @subcmd{SEKURT}
1378       The standard error of the kurtosis.
1379 @item @subcmd{HARMONIC}
1380 @cindex harmonic mean
1381       The harmonic mean.
1382 @item @subcmd{GEOMETRIC}
1383 @cindex geometric mean
1384       The geometric mean.
1385 @end itemize
1386
1387 In addition, three special keywords are recognized:
1388 @itemize
1389 @item @subcmd{DEFAULT}
1390       This is the same as @subcmd{MEAN} @subcmd{COUNT} @subcmd{STDDEV}.
1391 @item @subcmd{ALL}
1392       All of the above statistics are calculated.
1393 @item @subcmd{NONE}
1394       No statistics are calculated (only a summary is shown).
1395 @end itemize
1396
1397
1398 More than one @dfn{table} can be specified in a single command.
1399 Each table is separated by a @samp{/}. For
1400 example
1401 @example
1402 MEANS TABLES =
1403       @var{c} @var{d} @var{e} BY @var{x}
1404       /@var{a} @var{b} BY @var{x} @var{y}
1405       /@var{f} BY @var{y} BY @var{z}.
1406 @end example
1407 has three tables (the @samp{TABLE =} is optional).
1408 The first table has three dependent variables @var{c}, @var{d} and @var{e}
1409 and a single categorical variable @var{x}.
1410 The second table has two dependent variables @var{a} and @var{b},
1411 and two categorical variables @var{x} and @var{y}.
1412 The third table has a single dependent variables @var{f}
1413 and a categorical variable formed by the combination of @var{y} and @var{z}.
1414
1415
1416 By default values are omitted from the analysis only if missing values
1417 (either system missing or user missing)
1418 for any of the variables directly involved in their calculation are
1419 encountered.
1420 This behaviour can be modified with the  @subcmd{/MISSING} subcommand.
1421 Three options are possible: @subcmd{TABLE}, @subcmd{INCLUDE} and @subcmd{DEPENDENT}.
1422
1423 @subcmd{/MISSING = INCLUDE} says that user missing values, either in the dependent
1424 variables or in the categorical variables should be taken at their face
1425 value, and not excluded.
1426
1427 @subcmd{/MISSING = DEPENDENT} says that user missing values, in the dependent
1428 variables should be taken at their face value, however cases which
1429 have user missing values for the categorical variables should be omitted
1430 from the calculation.
1431
1432 @subsection Example Means
1433
1434 The dataset in @file{repairs.sav} contains the mean time between failures (@exvar{mtbf})
1435 for a sample of artifacts produced by different factories and trialed under
1436 different operating conditions.
1437 Since there are four combinations of categorical variables, by simply looking
1438 at the list of data, it would be hard to how the scores vary for each category.
1439 @ref{means:ex} shows one way of tabulating the @exvar{mtbf} in a way which is
1440 easier to understand.
1441
1442 @float Example, means:ex
1443 @psppsyntax {means.sps}
1444 @caption {Running @cmd{MEANS} on the @exvar{mtbf} score with categories @exvar{factory} and @exvar{environment}}
1445 @end float
1446
1447 The results are shown in @ref{means:res}.   The figures shown indicate the mean,
1448 standard deviation and number of samples in each category.
1449 These figures however do not indicate whether the results are statistically
1450 significant.  For that, you would need to use the procedures @cmd{ONEWAY}, @cmd{GLM} or
1451 @cmd{T-TEST} depending on the hypothesis being tested.
1452
1453 @float Result, means:res
1454 @psppoutput {means}
1455 @caption {The @exvar{mtbf} categorised by @exvar{factory} and @exvar{environment}}
1456 @end float
1457
1458 Note that there is no limit to the number of variables for which you can calculate
1459 statistics, nor to the number of categorical variables per layer, nor the number
1460 of layers.
1461 However, running @cmd{MEANS} on a large numbers of variables, or with categorical variables
1462 containing a large number of distinct values may result in an extremely large output, which
1463 will not be easy to interpret.
1464 So you should consider carefully which variables to select for participation in the analysis.
1465
1466 @node NPAR TESTS
1467 @section NPAR TESTS
1468
1469 @vindex NPAR TESTS
1470 @cindex nonparametric tests
1471
1472 @display
1473 NPAR TESTS
1474
1475      nonparametric test subcommands
1476      .
1477      .
1478      .
1479
1480      [ /STATISTICS=@{DESCRIPTIVES@} ]
1481
1482      [ /MISSING=@{ANALYSIS, LISTWISE@} @{INCLUDE, EXCLUDE@} ]
1483
1484      [ /METHOD=EXACT [ TIMER [(@var{n})] ] ]
1485 @end display
1486
1487 @cmd{NPAR TESTS} performs nonparametric tests.
1488 Non parametric tests make very few assumptions about the distribution of the
1489 data.
1490 One or more tests may be specified by using the corresponding subcommand.
1491 If the @subcmd{/STATISTICS} subcommand is also specified, then summary statistics are
1492 produces for each variable that is the subject of any test.
1493
1494 Certain tests may take a long time to execute, if an exact figure is required.
1495 Therefore, by default asymptotic approximations are used unless the
1496 subcommand @subcmd{/METHOD=EXACT} is specified.
1497 Exact tests give more accurate results, but may take an unacceptably long
1498 time to perform.  If the @subcmd{TIMER} keyword is used, it sets a maximum time,
1499 after which the test is abandoned, and a warning message printed.
1500 The time, in minutes, should be specified in parentheses after the @subcmd{TIMER} keyword.
1501 If the @subcmd{TIMER} keyword is given without this figure, then a default value of 5 minutes
1502 is used.
1503
1504
1505 @menu
1506 * BINOMIAL::                Binomial Test
1507 * CHISQUARE::               Chi-square Test
1508 * COCHRAN::                 Cochran Q Test
1509 * FRIEDMAN::                Friedman Test
1510 * KENDALL::                 Kendall's W Test
1511 * KOLMOGOROV-SMIRNOV::      Kolmogorov Smirnov Test
1512 * KRUSKAL-WALLIS::          Kruskal-Wallis Test
1513 * MANN-WHITNEY::            Mann Whitney U Test
1514 * MCNEMAR::                 McNemar Test
1515 * MEDIAN::                  Median Test
1516 * RUNS::                    Runs Test
1517 * SIGN::                    The Sign Test
1518 * WILCOXON::                Wilcoxon Signed Ranks Test
1519 @end menu
1520
1521
1522 @node    BINOMIAL
1523 @subsection Binomial test
1524 @vindex BINOMIAL
1525 @cindex binomial test
1526
1527 @display
1528      [ /BINOMIAL[(@var{p})]=@var{var_list}[(@var{value1}[, @var{value2})] ] ]
1529 @end display
1530
1531 The @subcmd{/BINOMIAL} subcommand compares the observed distribution of a dichotomous
1532 variable with that of a binomial distribution.
1533 The variable @var{p} specifies the test proportion of the binomial
1534 distribution.
1535 The default value of 0.5 is assumed if @var{p} is omitted.
1536
1537 If a single value appears after the variable list, then that value is
1538 used as the threshold to partition the observed values. Values less
1539 than or equal to the threshold value form the first category.  Values
1540 greater than the threshold form the second category.
1541
1542 If two values appear after the variable list, then they are used
1543 as the values which a variable must take to be in the respective
1544 category.
1545 Cases for which a variable takes a value equal to neither of the specified
1546 values, take no part in the test for that variable.
1547
1548 If no values appear, then the variable must assume dichotomous
1549 values.
1550 If more than two distinct, non-missing values for a variable
1551 under test are encountered then an error occurs.
1552
1553 If the test proportion is equal to 0.5, then a two tailed test is
1554 reported.   For any other test proportion, a one tailed test is
1555 reported.
1556 For one tailed tests, if the test proportion is less than
1557 or equal to the observed proportion, then the significance of
1558 observing the observed proportion or more is reported.
1559 If the test proportion is more than the observed proportion, then the
1560 significance of observing the observed proportion or less is reported.
1561 That is to say, the test is always performed in the observed
1562 direction.
1563
1564 @pspp{} uses a very precise approximation to the gamma function to
1565 compute the binomial significance.  Thus, exact results are reported
1566 even for very large sample sizes.
1567
1568
1569 @node    CHISQUARE
1570 @subsection Chi-square Test
1571 @vindex CHISQUARE
1572 @cindex chi-square test
1573
1574
1575 @display
1576      [ /CHISQUARE=@var{var_list}[(@var{lo},@var{hi})] [/EXPECTED=@{EQUAL|@var{f1}, @var{f2} @dots{} @var{fn}@}] ]
1577 @end display
1578
1579
1580 The @subcmd{/CHISQUARE} subcommand produces a chi-square statistic for the differences
1581 between the expected and observed frequencies of the categories of a variable.
1582 Optionally, a range of values may appear after the variable list.
1583 If a range is given, then non integer values are truncated, and values
1584 outside the  specified range are excluded from the analysis.
1585
1586 The @subcmd{/EXPECTED} subcommand specifies the expected values of each
1587 category.
1588 There must be exactly one non-zero expected value, for each observed
1589 category, or the @subcmd{EQUAL} keyword must be specified.
1590 You may use the notation @subcmd{@var{n}*@var{f}} to specify @var{n}
1591 consecutive expected categories all taking a frequency of @var{f}.
1592 The frequencies given are proportions, not absolute frequencies.  The
1593 sum of the frequencies need not be 1.
1594 If no @subcmd{/EXPECTED} subcommand is given, then equal frequencies
1595 are expected.
1596
1597 @subsubsection Chi-square Example
1598
1599 A researcher wishes to investigate whether there are an equal number of
1600 persons of each sex in a population.   The sample chosen for invesigation
1601 is that from the @file {physiology.sav} dataset.   The null hypothesis for
1602 the test is that the population comprises an equal number of males and females.
1603 The analysis is performed as shown in @ref{chisquare:ex}.
1604
1605 @float Example, chisquare:ex
1606 @psppsyntax {chisquare.sps}
1607 @caption {Performing a chi-square test to check for equal distribution of sexes}
1608 @end float
1609
1610 There is only one test variable, @i{viz:} @exvar{sex}.  The other variables in the dataset
1611 are ignored.
1612
1613 @float Screenshot, chisquare:scr
1614 @psppimage {chisquare}
1615 @caption {Performing a chi-square test using the graphic user interface}
1616 @end float
1617
1618 In @ref{chisquare:res} the summary box shows that in the sample, there are more males
1619 than females.  However the significance of chi-square result is greater than 0.05
1620 --- the most commonly accepted p-value --- and therefore
1621 there is not enough evidence to reject the null hypothesis and one must conclude
1622 that the evidence does not indicate that there is an imbalance of the sexes
1623 in the population.
1624
1625 @float Result, chisquare:res
1626 @psppoutput {chisquare}
1627 @caption {The results of running a chi-square test on @exvar{sex}}
1628 @end float
1629
1630
1631 @node COCHRAN
1632 @subsection Cochran Q Test
1633 @vindex Cochran
1634 @cindex Cochran Q test
1635 @cindex Q, Cochran Q
1636
1637 @display
1638      [ /COCHRAN = @var{var_list} ]
1639 @end display
1640
1641 The Cochran Q test is used to test for differences between three or more groups.
1642 The data for @var{var_list} in all cases must assume exactly two
1643 distinct values (other than missing values).
1644
1645 The value of Q is displayed along with its Asymptotic significance
1646 based on a chi-square distribution.
1647
1648 @node FRIEDMAN
1649 @subsection Friedman Test
1650 @vindex FRIEDMAN
1651 @cindex Friedman test
1652
1653 @display
1654      [ /FRIEDMAN = @var{var_list} ]
1655 @end display
1656
1657 The Friedman test is used to test for differences between repeated measures when
1658 there is no indication that the distributions are normally distributed.
1659
1660 A list of variables which contain the measured data must be given.  The procedure
1661 prints the sum of ranks for each variable, the test statistic and its significance.
1662
1663 @node KENDALL
1664 @subsection Kendall's W Test
1665 @vindex KENDALL
1666 @cindex Kendall's W test
1667 @cindex coefficient of concordance
1668
1669 @display
1670      [ /KENDALL = @var{var_list} ]
1671 @end display
1672
1673 The Kendall test investigates whether an arbitrary number of related samples come from the
1674 same population.
1675 It is identical to the Friedman test except that the additional statistic W, Kendall's Coefficient of Concordance is printed.
1676 It has the range [0,1] --- a value of zero indicates no agreement between the samples whereas a value of
1677 unity indicates complete agreement.
1678
1679
1680 @node KOLMOGOROV-SMIRNOV
1681 @subsection Kolmogorov-Smirnov Test
1682 @vindex KOLMOGOROV-SMIRNOV
1683 @vindex K-S
1684 @cindex Kolmogorov-Smirnov test
1685
1686 @display
1687      [ /KOLMOGOROV-SMIRNOV (@{NORMAL [@var{mu}, @var{sigma}], UNIFORM [@var{min}, @var{max}], POISSON [@var{lambda}], EXPONENTIAL [@var{scale}] @}) = @var{var_list} ]
1688 @end display
1689
1690 The one sample Kolmogorov-Smirnov subcommand is used to test whether or not a dataset is
1691 drawn from a particular distribution.  Four distributions are supported, @i{viz:}
1692 Normal, Uniform, Poisson and Exponential.
1693
1694 Ideally you should provide the parameters of the distribution against
1695 which you wish to test the data. For example, with the normal
1696 distribution  the mean (@var{mu})and standard deviation (@var{sigma})
1697 should be given; with the uniform distribution, the minimum
1698 (@var{min})and maximum (@var{max}) value should be provided.
1699 However, if the parameters are omitted they are imputed from the
1700 data.  Imputing the parameters reduces the power of the test so should
1701 be avoided if possible.
1702
1703 In the following example, two variables @var{score} and @var{age} are
1704 tested to see if they follow a normal distribution with a mean of 3.5
1705 and a standard deviation of 2.0.
1706 @example
1707   NPAR TESTS
1708         /KOLMOGOROV-SMIRNOV (normal 3.5 2.0) = @var{score} @var{age}.
1709 @end example
1710 If the variables need to be tested against different distributions, then a separate
1711 subcommand must be used.  For example the following syntax tests @var{score} against
1712 a normal distribution with mean of 3.5 and standard deviation of 2.0 whilst @var{age}
1713 is tested against a normal distribution of mean 40 and standard deviation 1.5.
1714 @example
1715   NPAR TESTS
1716         /KOLMOGOROV-SMIRNOV (normal 3.5 2.0) = @var{score}
1717         /KOLMOGOROV-SMIRNOV (normal 40 1.5) =  @var{age}.
1718 @end example
1719
1720 The abbreviated subcommand  @subcmd{K-S} may be used in place of @subcmd{KOLMOGOROV-SMIRNOV}.
1721
1722 @node KRUSKAL-WALLIS
1723 @subsection Kruskal-Wallis Test
1724 @vindex KRUSKAL-WALLIS
1725 @vindex K-W
1726 @cindex Kruskal-Wallis test
1727
1728 @display
1729      [ /KRUSKAL-WALLIS = @var{var_list} BY var (@var{lower}, @var{upper}) ]
1730 @end display
1731
1732 The Kruskal-Wallis test is used to compare data from an
1733 arbitrary number of populations.  It does not assume normality.
1734 The data to be compared are specified by @var{var_list}.
1735 The categorical variable determining the groups to which the
1736 data belongs is given by @var{var}. The limits @var{lower} and
1737 @var{upper} specify the valid range of @var{var}.
1738 If @var{upper} is smaller than @var{lower}, the PSPP will assume their values
1739 to be reversed. Any cases for which @var{var} falls outside
1740 [@var{lower}, @var{upper}] are ignored.
1741
1742 The mean rank of each group as well as the chi-squared value and
1743 significance of the test are printed.
1744 The abbreviated subcommand  @subcmd{K-W} may be used in place of
1745 @subcmd{KRUSKAL-WALLIS}.
1746
1747
1748 @node MANN-WHITNEY
1749 @subsection Mann-Whitney U Test
1750 @vindex MANN-WHITNEY
1751 @vindex M-W
1752 @cindex Mann-Whitney U test
1753 @cindex U, Mann-Whitney U
1754
1755 @display
1756      [ /MANN-WHITNEY = @var{var_list} BY var (@var{group1}, @var{group2}) ]
1757 @end display
1758
1759 The Mann-Whitney subcommand is used to test whether two groups of data
1760 come from different populations. The variables to be tested should be
1761 specified in @var{var_list} and the grouping variable, that determines
1762 to which group the test variables belong, in @var{var}.
1763 @var{Var} may be either a string or an alpha variable.
1764 @var{Group1} and @var{group2} specify the
1765 two values of @var{var} which determine the groups of the test data.
1766 Cases for which the @var{var} value is neither @var{group1} or
1767 @var{group2} are ignored.
1768
1769 The value of the Mann-Whitney U statistic, the Wilcoxon W, and the
1770 significance are printed.
1771 You may abbreviated the subcommand @subcmd{MANN-WHITNEY} to
1772 @subcmd{M-W}.
1773
1774
1775 @node MCNEMAR
1776 @subsection McNemar Test
1777 @vindex MCNEMAR
1778 @cindex McNemar test
1779
1780 @display
1781      [ /MCNEMAR @var{var_list} [ WITH @var{var_list} [ (PAIRED) ]]]
1782 @end display
1783
1784 Use McNemar's test to analyse the significance of the difference between
1785 pairs of correlated proportions.
1786
1787 If the @code{WITH} keyword is omitted, then tests for all
1788 combinations of the listed variables are performed.
1789 If the @code{WITH} keyword is given, and the @code{(PAIRED)} keyword
1790 is also given, then the number of variables preceding @code{WITH}
1791 must be the same as the number following it.
1792 In this case, tests for each respective pair of variables are
1793 performed.
1794 If the @code{WITH} keyword is given, but the
1795 @code{(PAIRED)} keyword is omitted, then tests for each combination
1796 of variable preceding @code{WITH} against variable following
1797 @code{WITH} are performed.
1798
1799 The data in each variable must be dichotomous.  If there are more
1800 than two distinct variables an error will occur and the test will
1801 not be run.
1802
1803 @node MEDIAN
1804 @subsection Median Test
1805 @vindex MEDIAN
1806 @cindex Median test
1807
1808 @display
1809      [ /MEDIAN [(@var{value})] = @var{var_list} BY @var{variable} (@var{value1}, @var{value2}) ]
1810 @end display
1811
1812 The median test is used to test whether independent samples come from
1813 populations with a common median.
1814 The median of the populations against which the samples are to be tested
1815 may be given in parentheses immediately after the
1816 @subcmd{/MEDIAN} subcommand.  If it is not given, the median is imputed from the
1817 union of all the samples.
1818
1819 The variables of the samples to be tested should immediately follow the @samp{=} sign. The
1820 keyword @code{BY} must come next, and then the grouping variable.  Two values
1821 in parentheses should follow.  If the first value is greater than the second,
1822 then a 2 sample test is performed using these two values to determine the groups.
1823 If however, the first variable is less than the second, then a @i{k} sample test is
1824 conducted and the group values used are all values encountered which lie in the
1825 range [@var{value1},@var{value2}].
1826
1827
1828 @node RUNS
1829 @subsection Runs Test
1830 @vindex RUNS
1831 @cindex runs test
1832
1833 @display
1834      [ /RUNS (@{MEAN, MEDIAN, MODE, @var{value}@})  = @var{var_list} ]
1835 @end display
1836
1837 The @subcmd{/RUNS} subcommand tests whether a data sequence is randomly ordered.
1838
1839 It works by examining the number of times a variable's value crosses a given threshold.
1840 The desired threshold must be specified within parentheses.
1841 It may either be specified as a number or as one of @subcmd{MEAN}, @subcmd{MEDIAN} or @subcmd{MODE}.
1842 Following the threshold specification comes the list of variables whose values are to be
1843 tested.
1844
1845 The subcommand shows the number of runs, the asymptotic significance based on the
1846 length of the data.
1847
1848 @node SIGN
1849 @subsection Sign Test
1850 @vindex SIGN
1851 @cindex sign test
1852
1853 @display
1854      [ /SIGN @var{var_list} [ WITH @var{var_list} [ (PAIRED) ]]]
1855 @end display
1856
1857 The @subcmd{/SIGN} subcommand tests for differences between medians of the
1858 variables listed.
1859 The test does not make any assumptions about the
1860 distribution of the data.
1861
1862 If the @code{WITH} keyword is omitted, then tests for all
1863 combinations of the listed variables are performed.
1864 If the @code{WITH} keyword is given, and the @code{(PAIRED)} keyword
1865 is also given, then the number of variables preceding @code{WITH}
1866 must be the same as the number following it.
1867 In this case, tests for each respective pair of variables are
1868 performed.
1869 If the @code{WITH} keyword is given, but the
1870 @code{(PAIRED)} keyword is omitted, then tests for each combination
1871 of variable preceding @code{WITH} against variable following
1872 @code{WITH} are performed.
1873
1874 @node WILCOXON
1875 @subsection Wilcoxon Matched Pairs Signed Ranks Test
1876 @vindex WILCOXON
1877 @cindex wilcoxon matched pairs signed ranks test
1878
1879 @display
1880      [ /WILCOXON @var{var_list} [ WITH @var{var_list} [ (PAIRED) ]]]
1881 @end display
1882
1883 The @subcmd{/WILCOXON} subcommand tests for differences between medians of the
1884 variables listed.
1885 The test does not make any assumptions about the variances of the samples.
1886 It does however assume that the distribution is symmetrical.
1887
1888 If the @subcmd{WITH} keyword is omitted, then tests for all
1889 combinations of the listed variables are performed.
1890 If the @subcmd{WITH} keyword is given, and the @subcmd{(PAIRED)} keyword
1891 is also given, then the number of variables preceding @subcmd{WITH}
1892 must be the same as the number following it.
1893 In this case, tests for each respective pair of variables are
1894 performed.
1895 If the @subcmd{WITH} keyword is given, but the
1896 @subcmd{(PAIRED)} keyword is omitted, then tests for each combination
1897 of variable preceding @subcmd{WITH} against variable following
1898 @subcmd{WITH} are performed.
1899
1900 @node T-TEST
1901 @section T-TEST
1902
1903 @vindex T-TEST
1904
1905 @display
1906 T-TEST
1907         /MISSING=@{ANALYSIS,LISTWISE@} @{EXCLUDE,INCLUDE@}
1908         /CRITERIA=CI(@var{confidence})
1909
1910
1911 (One Sample mode.)
1912         TESTVAL=@var{test_value}
1913         /VARIABLES=@var{var_list}
1914
1915
1916 (Independent Samples mode.)
1917         GROUPS=var(@var{value1} [, @var{value2}])
1918         /VARIABLES=@var{var_list}
1919
1920
1921 (Paired Samples mode.)
1922         PAIRS=@var{var_list} [WITH @var{var_list} [(PAIRED)] ]
1923
1924 @end display
1925
1926
1927 The @cmd{T-TEST} procedure outputs tables used in testing hypotheses about
1928 means.
1929 It operates in one of three modes:
1930 @itemize
1931 @item One Sample mode.
1932 @item Independent Groups mode.
1933 @item Paired mode.
1934 @end itemize
1935
1936 @noindent
1937 Each of these modes are described in more detail below.
1938 There are two optional subcommands which are common to all modes.
1939
1940 The @cmd{/CRITERIA} subcommand tells @pspp{} the confidence interval used
1941 in the tests.  The default value is 0.95.
1942
1943
1944 The @cmd{MISSING} subcommand determines the handling of missing
1945 variables.
1946 If @subcmd{INCLUDE} is set, then user-missing values are included in the
1947 calculations, but system-missing values are not.
1948 If @subcmd{EXCLUDE} is set, which is the default, user-missing
1949 values are excluded as well as system-missing values.
1950 This is the default.
1951
1952 If @subcmd{LISTWISE} is set, then the entire case is excluded from analysis
1953 whenever any variable  specified in the @subcmd{/VARIABLES}, @subcmd{/PAIRS} or
1954 @subcmd{/GROUPS} subcommands contains a missing value.
1955 If @subcmd{ANALYSIS} is set, then missing values are excluded only in the analysis for
1956 which they would be needed. This is the default.
1957
1958
1959 @menu
1960 * One Sample Mode::             Testing against a hypothesized mean
1961 * Independent Samples Mode::    Testing two independent groups for equal mean
1962 * Paired Samples Mode::         Testing two interdependent groups for equal mean
1963 @end menu
1964
1965 @node One Sample Mode
1966 @subsection One Sample Mode
1967
1968 The @subcmd{TESTVAL} subcommand invokes the One Sample mode.
1969 This mode is used to test a population mean against a hypothesized
1970 mean.
1971 The value given to the @subcmd{TESTVAL} subcommand is the value against
1972 which you wish to test.
1973 In this mode, you must also use the @subcmd{/VARIABLES} subcommand to
1974 tell @pspp{} which variables you wish to test.
1975
1976 @subsubsection Example - One Sample T-test
1977
1978 A researcher wishes to know whether the weight of persons in a population
1979 is different from the national average.
1980 The samples are drawn from the population under investigation and recorded
1981 in the file @file{physiology.sav}.
1982 From the Department of Health, she
1983 knows that the national average weight of healthy adults is 76.8kg.
1984 Accordingly the @subcmd{TESTVAL} is set to 76.8.
1985 The null hypothesis therefore is that the mean average weight of the
1986 population from which the sample was drawn is 76.8kg.
1987
1988 As previously noted (@pxref{Identifying incorrect data}), one
1989 sample in the dataset contains a weight value
1990 which is clearly incorrect.  So this is excluded from the analysis
1991 using the @cmd{SELECT} command.
1992
1993 @float Example, one-sample-t:ex
1994 @psppsyntax {one-sample-t.sps}
1995 @caption {Running a one sample T-Test after excluding all non-positive values}
1996 @end float
1997
1998 @float Screenshot, one-sample-t:scr
1999 @psppimage {one-sample-t}
2000 @caption {Using the One Sample T-Test dialog box to test @exvar{weight} for a mean of 76.8kg}
2001 @end float
2002
2003
2004 @ref{one-sample-t:res} shows that the mean of our sample differs from the test value
2005 by -1.40kg.  However the significance is very high (0.610).  So one cannot
2006 reject the null hypothesis, and must conclude there is not enough evidence
2007 to suggest that the mean weight of the persons in our population is different
2008 from 76.8kg.
2009
2010 @float Results, one-sample-t:res
2011 @psppoutput {one-sample-t}
2012 @caption {The results of a one sample T-test of @exvar{weight} using a test value of 76.8kg}
2013 @end float
2014
2015 @node Independent Samples Mode
2016 @subsection Independent Samples Mode
2017
2018 The @subcmd{GROUPS} subcommand invokes Independent Samples mode or
2019 `Groups' mode.
2020 This mode is used to test whether two groups of values have the
2021 same population mean.
2022 In this mode, you must also use the @subcmd{/VARIABLES} subcommand to
2023 tell @pspp{} the dependent variables you wish to test.
2024
2025 The variable given in the @subcmd{GROUPS} subcommand is the independent
2026 variable which determines to which group the samples belong.
2027 The values in parentheses are the specific values of the independent
2028 variable for each group.
2029 If the parentheses are omitted and no values are given, the default values
2030 of 1.0 and 2.0 are assumed.
2031
2032 If the independent variable is numeric,
2033 it is acceptable to specify only one value inside the parentheses.
2034 If you do this, cases where the independent variable is
2035 greater than or equal to this value belong to the first group, and cases
2036 less than this value belong to the second group.
2037 When using this form of the @subcmd{GROUPS} subcommand, missing values in
2038 the independent variable are excluded on a listwise basis, regardless
2039 of whether @subcmd{/MISSING=LISTWISE} was specified.
2040
2041 @subsubsection Example - Independent Samples T-test
2042
2043 A researcher wishes to know whether within a population, adult males
2044 are taller than adult females.
2045 The samples are drawn from the population under investigation and recorded
2046 in the file @file{physiology.sav}.
2047
2048 As previously noted (@pxref{Identifying incorrect data}), one
2049 sample in the dataset contains a height value
2050 which is clearly incorrect.  So this is excluded from the analysis
2051 using the @cmd{SELECT} command.
2052
2053
2054 @float Example, indepdendent-samples-t:ex
2055 @psppsyntax {independent-samples-t.sps}
2056 @caption {Running a independent samples T-Test after excluding all observations less than 200kg}
2057 @end float
2058
2059
2060 The null hypothesis is that both males and females are on average
2061 of equal height.
2062
2063 @float Screenshot, independent-samples-t:scr
2064 @psppimage {independent-samples-t}
2065 @caption {Using the Independent Sample T-test dialog, to test for differences of @exvar{height} between values of @exvar{sex}}
2066 @end float
2067
2068
2069 In this case, the grouping variable is @exvar{sex}, so this is entered
2070 as the variable for the @subcmd{GROUP} subcommand.  The group values are  0 (male) and
2071 1 (female).
2072
2073 If you are running the proceedure using syntax, then you need to enter
2074 the values corresponding to each group within parentheses.
2075 If you are using the graphic user interface, then you have to open
2076 the ``Define Groups'' dialog box and enter the values corresponding
2077 to each group as shown in @ref{define-groups-t:scr}.  If, as in this case, the dataset has defined value
2078 labels for the group variable, then you can enter them by label
2079 or by value.
2080
2081 @float Screenshot, define-groups-t:scr
2082 @psppimage {define-groups-t}
2083 @caption {Setting the values of the grouping variable for an Independent Samples T-test}
2084 @end float
2085
2086 From @ref{independent-samples-t:res}, one can clearly see that the @emph{sample} mean height
2087 is greater for males than for females.  However in order to see if this
2088 is a significant result, one must consult the T-Test table.
2089
2090 The T-Test table contains two rows; one for use if the variance of the samples
2091 in each group may be safely assumed to be equal, and the second row
2092 if the variances in each group may not be safely assumed to be equal.
2093
2094 In this case however, both rows show a 2-tailed significance less than 0.001 and
2095 one must therefore reject the null hypothesis and conclude that within
2096 the population the mean height of males and of females are unequal.
2097
2098 @float Result, independent-samples-t:res
2099 @psppoutput {independent-samples-t}
2100 @caption {The results of an independent samples T-test of @exvar{height} by @exvar{sex}}
2101 @end float
2102
2103 @node Paired Samples Mode
2104 @subsection Paired Samples Mode
2105
2106 The @cmd{PAIRS} subcommand introduces Paired Samples mode.
2107 Use this mode when repeated measures have been taken from the same
2108 samples.
2109 If the @subcmd{WITH} keyword is omitted, then tables for all
2110 combinations of variables given in the @cmd{PAIRS} subcommand are
2111 generated.
2112 If the @subcmd{WITH} keyword is given, and the @subcmd{(PAIRED)} keyword
2113 is also given, then the number of variables preceding @subcmd{WITH}
2114 must be the same as the number following it.
2115 In this case, tables for each respective pair of variables are
2116 generated.
2117 In the event that the @subcmd{WITH} keyword is given, but the
2118 @subcmd{(PAIRED)} keyword is omitted, then tables for each combination
2119 of variable preceding @subcmd{WITH} against variable following
2120 @subcmd{WITH} are generated.
2121
2122
2123 @node ONEWAY
2124 @section ONEWAY
2125
2126 @vindex ONEWAY
2127 @cindex analysis of variance
2128 @cindex ANOVA
2129
2130 @display
2131 ONEWAY
2132         [/VARIABLES = ] @var{var_list} BY @var{var}
2133         /MISSING=@{ANALYSIS,LISTWISE@} @{EXCLUDE,INCLUDE@}
2134         /CONTRAST= @var{value1} [, @var{value2}] ... [,@var{valueN}]
2135         /STATISTICS=@{DESCRIPTIVES,HOMOGENEITY@}
2136         /POSTHOC=@{BONFERRONI, GH, LSD, SCHEFFE, SIDAK, TUKEY, ALPHA ([@var{value}])@}
2137 @end display
2138
2139 The @cmd{ONEWAY} procedure performs a one-way analysis of variance of
2140 variables factored by a single independent variable.
2141 It is used to compare the means of a population
2142 divided into more than two groups.
2143
2144 The dependent variables to be analysed should be given in the @subcmd{VARIABLES}
2145 subcommand.
2146 The list of variables must be followed by the @subcmd{BY} keyword and
2147 the name of the independent (or factor) variable.
2148
2149 You can use the @subcmd{STATISTICS} subcommand to tell @pspp{} to display
2150 ancillary information.  The options accepted are:
2151 @itemize
2152 @item DESCRIPTIVES
2153 Displays descriptive statistics about the groups factored by the independent
2154 variable.
2155 @item HOMOGENEITY
2156 Displays the Levene test of Homogeneity of Variance for the
2157 variables and their groups.
2158 @end itemize
2159
2160 The @subcmd{CONTRAST} subcommand is used when you anticipate certain
2161 differences between the groups.
2162 The subcommand must be followed by a list of numerals which are the
2163 coefficients of the groups to be tested.
2164 The number of coefficients must correspond to the number of distinct
2165 groups (or values of the independent variable).
2166 If the total sum of the coefficients are not zero, then @pspp{} will
2167 display a warning, but will proceed with the analysis.
2168 The @subcmd{CONTRAST} subcommand may be given up to 10 times in order
2169 to specify different contrast tests.
2170 The @subcmd{MISSING} subcommand defines how missing values are handled.
2171 If @subcmd{LISTWISE} is specified then cases which have missing values for
2172 the independent variable or any dependent variable are ignored.
2173 If @subcmd{ANALYSIS} is specified, then cases are ignored if the independent
2174 variable is missing or if the dependent variable currently being
2175 analysed is missing.  The default is @subcmd{ANALYSIS}.
2176 A setting of @subcmd{EXCLUDE} means that variables whose values are
2177 user-missing are to be excluded from the analysis. A setting of
2178 @subcmd{INCLUDE} means they are to be included.  The default is @subcmd{EXCLUDE}.
2179
2180 Using the @code{POSTHOC} subcommand you can perform multiple
2181 pairwise comparisons on the data. The following comparison methods
2182 are available:
2183 @itemize
2184 @item @subcmd{LSD}
2185 Least Significant Difference.
2186 @item @subcmd{TUKEY}
2187 Tukey Honestly Significant Difference.
2188 @item @subcmd{BONFERRONI}
2189 Bonferroni test.
2190 @item @subcmd{SCHEFFE}
2191 Scheff@'e's test.
2192 @item @subcmd{SIDAK}
2193 Sidak test.
2194 @item @subcmd{GH}
2195 The Games-Howell test.
2196 @end itemize
2197
2198 @noindent
2199 Use the optional syntax @code{ALPHA(@var{value})} to indicate that
2200 @cmd{ONEWAY} should perform the posthoc tests at a confidence level of
2201 @var{value}.  If @code{ALPHA(@var{value})} is not specified, then the
2202 confidence level used is 0.05.
2203
2204 @node QUICK CLUSTER
2205 @section QUICK CLUSTER
2206 @vindex QUICK CLUSTER
2207
2208 @cindex K-means clustering
2209 @cindex clustering
2210
2211 @display
2212 QUICK CLUSTER @var{var_list}
2213       [/CRITERIA=CLUSTERS(@var{k}) [MXITER(@var{max_iter})] CONVERGE(@var{epsilon}) [NOINITIAL]]
2214       [/MISSING=@{EXCLUDE,INCLUDE@} @{LISTWISE, PAIRWISE@}]
2215       [/PRINT=@{INITIAL@} @{CLUSTER@}]
2216       [/SAVE[=[CLUSTER[(@var{membership_var})]] [DISTANCE[(@var{distance_var})]]]
2217 @end display
2218
2219 The @cmd{QUICK CLUSTER} command performs k-means clustering on the
2220 dataset.  This is useful when you wish to allocate cases into clusters
2221 of similar values and you already know the number of clusters.
2222
2223 The minimum specification is @samp{QUICK CLUSTER} followed by the names
2224 of the variables which contain the cluster data.  Normally you will also
2225 want to specify @subcmd{/CRITERIA=CLUSTERS(@var{k})} where @var{k} is the
2226 number of clusters.  If this is not specified, then @var{k} defaults to 2.
2227
2228 If you use @subcmd{/CRITERIA=NOINITIAL} then a naive algorithm to select
2229 the initial clusters is used.   This will provide for faster execution but
2230 less well separated initial clusters and hence possibly an inferior final
2231 result.
2232
2233
2234 @cmd{QUICK CLUSTER} uses an iterative algorithm to select the clusters centers.
2235 The subcommand  @subcmd{/CRITERIA=MXITER(@var{max_iter})} sets the maximum number of iterations.
2236 During classification, @pspp{} will continue iterating until until @var{max_iter}
2237 iterations have been done or the convergence criterion (see below) is fulfilled.
2238 The default value of @var{max_iter} is 2.
2239
2240 If however, you specify @subcmd{/CRITERIA=NOUPDATE} then after selecting the initial centers,
2241 no further update to the cluster centers is done.  In this case, @var{max_iter}, if specified.
2242 is ignored.
2243
2244 The subcommand  @subcmd{/CRITERIA=CONVERGE(@var{epsilon})} is used
2245 to set the convergence criterion.  The value of convergence criterion is  @var{epsilon}
2246 times the minimum distance between the @emph{initial} cluster centers.  Iteration stops when
2247 the  mean cluster distance between  one iteration and the next
2248 is less than the convergence criterion.  The default value of @var{epsilon} is zero.
2249
2250 The @subcmd{MISSING} subcommand determines the handling of missing variables.
2251 If @subcmd{INCLUDE} is set, then user-missing values are considered at their face
2252 value and not as missing values.
2253 If @subcmd{EXCLUDE} is set, which is the default, user-missing
2254 values are excluded as well as system-missing values.
2255
2256 If @subcmd{LISTWISE} is set, then the entire case is excluded from the analysis
2257 whenever any of the clustering variables contains a missing value.
2258 If @subcmd{PAIRWISE} is set, then a case is considered missing only if all the
2259 clustering variables contain missing values.  Otherwise it is clustered
2260 on the basis of the non-missing values.
2261 The default is @subcmd{LISTWISE}.
2262
2263 The @subcmd{PRINT} subcommand requests additional output to be printed.
2264 If @subcmd{INITIAL} is set, then the initial cluster memberships will
2265 be printed.
2266 If @subcmd{CLUSTER} is set, the cluster memberships of the individual
2267 cases are displayed (potentially generating lengthy output).
2268
2269 You can specify the subcommand @subcmd{SAVE} to ask that each case's cluster membership
2270 and the euclidean distance between the case and its cluster center be saved to
2271 a new variable in the active dataset.   To save the cluster membership use the
2272 @subcmd{CLUSTER} keyword and to save the distance use the @subcmd{DISTANCE} keyword.
2273 Each keyword may optionally be followed by a variable name in parentheses to specify
2274 the new variable which is to contain the saved parameter.  If no variable name is specified,
2275 then PSPP will create one.
2276
2277 @node RANK
2278 @section RANK
2279
2280 @vindex RANK
2281 @display
2282 RANK
2283         [VARIABLES=] @var{var_list} [@{A,D@}] [BY @var{var_list}]
2284         /TIES=@{MEAN,LOW,HIGH,CONDENSE@}
2285         /FRACTION=@{BLOM,TUKEY,VW,RANKIT@}
2286         /PRINT[=@{YES,NO@}
2287         /MISSING=@{EXCLUDE,INCLUDE@}
2288
2289         /RANK [INTO @var{var_list}]
2290         /NTILES(k) [INTO @var{var_list}]
2291         /NORMAL [INTO @var{var_list}]
2292         /PERCENT [INTO @var{var_list}]
2293         /RFRACTION [INTO @var{var_list}]
2294         /PROPORTION [INTO @var{var_list}]
2295         /N [INTO @var{var_list}]
2296         /SAVAGE [INTO @var{var_list}]
2297 @end display
2298
2299 The @cmd{RANK} command ranks variables and stores the results into new
2300 variables.
2301
2302 The @subcmd{VARIABLES} subcommand, which is mandatory, specifies one or
2303 more variables whose values are to be ranked.
2304 After each variable, @samp{A} or @samp{D} may appear, indicating that
2305 the variable is to be ranked in ascending or descending order.
2306 Ascending is the default.
2307 If a @subcmd{BY} keyword appears, it should be followed by a list of variables
2308 which are to serve as group variables.
2309 In this case, the cases are gathered into groups, and ranks calculated
2310 for each group.
2311
2312 The @subcmd{TIES} subcommand specifies how tied values are to be treated.  The
2313 default is to take the mean value of all the tied cases.
2314
2315 The @subcmd{FRACTION} subcommand specifies how proportional ranks are to be
2316 calculated.  This only has any effect if @subcmd{NORMAL} or @subcmd{PROPORTIONAL} rank
2317 functions are requested.
2318
2319 The @subcmd{PRINT} subcommand may be used to specify that a summary of the rank
2320 variables created should appear in the output.
2321
2322 The function subcommands are @subcmd{RANK}, @subcmd{NTILES}, @subcmd{NORMAL}, @subcmd{PERCENT}, @subcmd{RFRACTION},
2323 @subcmd{PROPORTION} and @subcmd{SAVAGE}.  Any number of function subcommands may appear.
2324 If none are given, then the default is RANK.
2325 The @subcmd{NTILES} subcommand must take an integer specifying the number of
2326 partitions into which values should be ranked.
2327 Each subcommand may be followed by the @subcmd{INTO} keyword and a list of
2328 variables which are the variables to be created and receive the rank
2329 scores.  There may be as many variables specified as there are
2330 variables named on the @subcmd{VARIABLES} subcommand.  If fewer are specified,
2331 then the variable names are automatically created.
2332
2333 The @subcmd{MISSING} subcommand determines how user missing values are to be
2334 treated. A setting of @subcmd{EXCLUDE} means that variables whose values are
2335 user-missing are to be excluded from the rank scores. A setting of
2336 @subcmd{INCLUDE} means they are to be included.  The default is @subcmd{EXCLUDE}.
2337
2338 @include regression.texi
2339
2340
2341 @node RELIABILITY
2342 @section RELIABILITY
2343
2344 @vindex RELIABILITY
2345 @display
2346 RELIABILITY
2347         /VARIABLES=@var{var_list}
2348         /SCALE (@var{name}) = @{@var{var_list}, ALL@}
2349         /MODEL=@{ALPHA, SPLIT[(@var{n})]@}
2350         /SUMMARY=@{TOTAL,ALL@}
2351         /MISSING=@{EXCLUDE,INCLUDE@}
2352 @end display
2353
2354 @cindex Cronbach's Alpha
2355 The @cmd{RELIABILITY} command performs reliability analysis on the data.
2356
2357 The @subcmd{VARIABLES} subcommand is required. It determines the set of variables
2358 upon which analysis is to be performed.
2359
2360 The @subcmd{SCALE} subcommand determines the  variables for which
2361 reliability is to be calculated.  If @subcmd{SCALE} is omitted, then analysis for
2362 all variables named in the @subcmd{VARIABLES} subcommand are used.
2363 Optionally, the @var{name} parameter may be specified to set a string name
2364 for the scale.
2365
2366 The @subcmd{MODEL} subcommand determines the type of analysis. If @subcmd{ALPHA} is specified,
2367 then Cronbach's Alpha is calculated for the scale.  If the model is @subcmd{SPLIT},
2368 then the variables  are divided into 2 subsets.  An optional parameter
2369 @var{n} may be given, to specify how many variables to be in the first subset.
2370 If @var{n} is omitted, then it defaults to one half of the variables in the
2371 scale, or one half minus one if there are an odd number of variables.
2372 The default model is @subcmd{ALPHA}.
2373
2374 By default, any cases with user missing, or system missing values for
2375 any variables given in the @subcmd{VARIABLES} subcommand are omitted
2376 from the analysis.  The @subcmd{MISSING} subcommand determines whether
2377 user missing values are included or excluded in the analysis.
2378
2379 The @subcmd{SUMMARY} subcommand determines the type of summary analysis to be performed.
2380 Currently there is only one type: @subcmd{SUMMARY=TOTAL}, which displays per-item
2381 analysis tested against the totals.
2382
2383 @subsection Example - Reliability
2384
2385 Before analysing the results of a survey -- particularly for a multiple choice survey --
2386 it is desireable to know whether the respondents have considered their answers
2387 or simply provided random answers.
2388
2389 In the following example the survey results from the file @file{hotel.sav} are used.
2390 All five survey questions are included in the reliability analysis.
2391 However, before running the analysis, the data must be preprocessed.
2392 An examination of the survey questions reveals that two questions, @i{viz:} v3 and v5
2393 are negatively worded, whereas the others are positively worded.
2394 All questions must be based upon the same scale for the analysis to be meaningful.
2395 One could use the @cmd{RECODE} command (@pxref{RECODE}), however a simpler way is
2396 to use @cmd{COMPUTE} (@pxref{COMPUTE}) and this is what is done in @ref{reliability:ex}.
2397
2398 @float Example, reliability:ex
2399 @psppsyntax {reliability.sps}
2400 @caption {Investigating the reliability of survey responses}
2401 @end float
2402
2403 In this case, all variables in the data set are used.  So we can use the special
2404 keyword @samp{ALL} (@pxref{BNF}).
2405
2406 @float Screenshot, reliability:src
2407 @psppimage {reliability}
2408 @caption {Reliability dialog box with all variables selected}
2409 @end float
2410
2411 @ref{reliability:res} shows that Cronbach's Alpha is 0.11  which is a value normally considered too
2412 low to indicate consistency within the data.  This is possibly due to the small number of
2413 survey questions.  The survey should be redesigned before serious use of the results are
2414 applied.
2415
2416 @float Result, reliability:res
2417 @psppoutput {reliability}
2418 @caption {The results of the reliability command on @file{hotel.sav}}
2419 @end float
2420
2421
2422 @node ROC
2423 @section ROC
2424
2425 @vindex ROC
2426 @cindex Receiver Operating Characteristic
2427 @cindex Area under curve
2428
2429 @display
2430 ROC     @var{var_list} BY @var{state_var} (@var{state_value})
2431         /PLOT = @{ CURVE [(REFERENCE)], NONE @}
2432         /PRINT = [ SE ] [ COORDINATES ]
2433         /CRITERIA = [ CUTOFF(@{INCLUDE,EXCLUDE@}) ]
2434           [ TESTPOS (@{LARGE,SMALL@}) ]
2435           [ CI (@var{confidence}) ]
2436           [ DISTRIBUTION (@{FREE, NEGEXPO @}) ]
2437         /MISSING=@{EXCLUDE,INCLUDE@}
2438 @end display
2439
2440
2441 The @cmd{ROC} command is used to plot the receiver operating characteristic curve
2442 of a dataset, and to estimate the area under the curve.
2443 This is useful for analysing the efficacy of a variable as a predictor of a state of nature.
2444
2445 The mandatory @var{var_list} is the list of predictor variables.
2446 The variable @var{state_var} is the variable whose values represent the actual states,
2447 and @var{state_value} is the value of this variable which represents the positive state.
2448
2449 The optional subcommand @subcmd{PLOT} is used to determine if and how the @subcmd{ROC} curve is drawn.
2450 The keyword @subcmd{CURVE} means that the @subcmd{ROC} curve should be drawn, and the optional keyword @subcmd{REFERENCE},
2451 which should be enclosed in parentheses, says that the diagonal reference line should be drawn.
2452 If the keyword @subcmd{NONE} is given, then no @subcmd{ROC} curve is drawn.
2453 By default, the curve is drawn with no reference line.
2454
2455 The optional subcommand @subcmd{PRINT} determines which additional
2456 tables should be printed.  Two additional tables are available.  The
2457 @subcmd{SE} keyword says that standard error of the area under the
2458 curve should be printed as well as the area itself.  In addition, a
2459 p-value for the null hypothesis that the area under the curve equals
2460 0.5 is printed.   The @subcmd{COORDINATES} keyword says that a
2461 table of coordinates of the @subcmd{ROC} curve should be printed.
2462
2463 The @subcmd{CRITERIA} subcommand has four optional parameters:
2464 @itemize @bullet
2465 @item The @subcmd{TESTPOS} parameter may be @subcmd{LARGE} or @subcmd{SMALL}.
2466 @subcmd{LARGE} is the default, and says that larger values in the predictor variables are to be
2467 considered positive.  @subcmd{SMALL} indicates that smaller values should be considered positive.
2468
2469 @item The @subcmd{CI} parameter specifies the confidence interval that should be printed.
2470 It has no effect if the @subcmd{SE} keyword in the @subcmd{PRINT} subcommand has not been given.
2471
2472 @item The @subcmd{DISTRIBUTION} parameter determines the method to be used when estimating the area
2473 under the curve.
2474 There are two possibilities, @i{viz}: @subcmd{FREE} and @subcmd{NEGEXPO}.
2475 The @subcmd{FREE} method uses a non-parametric estimate, and the @subcmd{NEGEXPO} method a bi-negative
2476 exponential distribution estimate.
2477 The @subcmd{NEGEXPO} method should only be used when the number of positive actual states is
2478 equal to the number of negative actual states.
2479 The default is @subcmd{FREE}.
2480
2481 @item The @subcmd{CUTOFF} parameter is for compatibility and is ignored.
2482 @end itemize
2483
2484 The @subcmd{MISSING} subcommand determines whether user missing values are to
2485 be included or excluded in the analysis.  The default behaviour is to
2486 exclude them.
2487 Cases are excluded on a listwise basis; if any of the variables in @var{var_list}
2488 or if the variable @var{state_var} is missing, then the entire case is
2489 excluded.
2490
2491 @c  LocalWords:  subcmd subcommand