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