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