Frequencies: Added the /BARCHART subcommand.
[pspp] / doc / statistics.texi
1 @node Statistics
2 @chapter Statistics
3
4 This chapter documents the statistical procedures that @pspp{} supports so
5 far.
6
7 @menu
8 * DESCRIPTIVES::                Descriptive statistics.
9 * FREQUENCIES::                 Frequency tables.
10 * EXAMINE::                     Testing data for normality.
11 * GRAPH::                       Plot data.
12 * CORRELATIONS::                Correlation tables.
13 * CROSSTABS::                   Crosstabulation tables.
14 * FACTOR::                      Factor analysis and Principal Components analysis.
15 * LOGISTIC REGRESSION::         Bivariate Logistic Regression.
16 * MEANS::                       Average values and other statistics.
17 * NPAR TESTS::                  Nonparametric tests.
18 * T-TEST::                      Test hypotheses about means.
19 * ONEWAY::                      One way analysis of variance.
20 * QUICK CLUSTER::               K-Means clustering.
21 * RANK::                        Compute rank scores.
22 * REGRESSION::                  Linear regression.
23 * RELIABILITY::                 Reliability analysis.
24 * ROC::                         Receiver Operating Characteristic.
25 @end menu
26
27 @node DESCRIPTIVES
28 @section DESCRIPTIVES
29
30 @vindex DESCRIPTIVES
31 @display
32 DESCRIPTIVES
33         /VARIABLES=@var{var_list}
34         /MISSING=@{VARIABLE,LISTWISE@} @{INCLUDE,NOINCLUDE@}
35         /FORMAT=@{LABELS,NOLABELS@} @{NOINDEX,INDEX@} @{LINE,SERIAL@}
36         /SAVE
37         /STATISTICS=@{ALL,MEAN,SEMEAN,STDDEV,VARIANCE,KURTOSIS,
38                      SKEWNESS,RANGE,MINIMUM,MAXIMUM,SUM,DEFAULT,
39                      SESKEWNESS,SEKURTOSIS@}
40         /SORT=@{NONE,MEAN,SEMEAN,STDDEV,VARIANCE,KURTOSIS,SKEWNESS,
41                RANGE,MINIMUM,MAXIMUM,SUM,SESKEWNESS,SEKURTOSIS,NAME@}
42               @{A,D@}
43 @end display
44
45 The @cmd{DESCRIPTIVES} procedure reads the active dataset and outputs
46 descriptive
47 statistics requested by the user.  In addition, it can optionally
48 compute Z-scores.
49
50 The @subcmd{VARIABLES} subcommand, which is required, specifies the list of
51 variables to be analyzed.  Keyword @subcmd{VARIABLES} is optional.
52
53 All other subcommands are optional:
54
55 The @subcmd{MISSING} subcommand determines the handling of missing variables.  If
56 @subcmd{INCLUDE} is set, then user-missing values are included in the
57 calculations.  If @subcmd{NOINCLUDE} is set, which is the default, user-missing
58 values are excluded.  If @subcmd{VARIABLE} is set, then missing values are
59 excluded on a variable by variable basis; if @subcmd{LISTWISE} is set, then
60 the entire case is excluded whenever any value in that case has a
61 system-missing or, if @subcmd{INCLUDE} is set, user-missing value.
62
63 The @subcmd{FORMAT} subcommand affects the output format.  Currently the
64 @subcmd{LABELS/NOLABELS} and @subcmd{NOINDEX/INDEX} settings are not used.
65 When @subcmd{SERIAL} is
66 set, both valid and missing number of cases are listed in the output;
67 when @subcmd{NOSERIAL} is set, only valid cases are listed.
68
69 The @subcmd{SAVE} subcommand causes @cmd{DESCRIPTIVES} to calculate Z scores for all
70 the specified variables.  The Z scores are saved to new variables.
71 Variable names are generated by trying first the original variable name
72 with Z prepended and truncated to a maximum of 8 characters, then the
73 names ZSC000 through ZSC999, STDZ00 through STDZ09, ZZZZ00 through
74 ZZZZ09, ZQZQ00 through ZQZQ09, in that sequence.  In addition, Z score
75 variable names can be specified explicitly on @subcmd{VARIABLES} in the variable
76 list by enclosing them in parentheses after each variable.
77 When Z scores are calculated, @pspp{} ignores @cmd{TEMPORARY},
78 treating temporary transformations as permanent.
79
80 The @subcmd{STATISTICS} subcommand specifies the statistics to be displayed:
81
82 @table @code
83 @item @subcmd{ALL}
84 All of the statistics below.
85 @item @subcmd{MEAN}
86 Arithmetic mean.
87 @item @subcmd{SEMEAN}
88 Standard error of the mean.
89 @item @subcmd{STDDEV}
90 Standard deviation.
91 @item @subcmd{VARIANCE}
92 Variance.
93 @item @subcmd{KURTOSIS}
94 Kurtosis and standard error of the kurtosis.
95 @item @subcmd{SKEWNESS}
96 Skewness and standard error of the skewness.
97 @item @subcmd{RANGE}
98 Range.
99 @item MINIMUM
100 Minimum value.
101 @item MAXIMUM
102 Maximum value.
103 @item SUM
104 Sum.
105 @item DEFAULT
106 Mean, standard deviation of the mean, minimum, maximum.
107 @item SEKURTOSIS
108 Standard error of the kurtosis.
109 @item SESKEWNESS
110 Standard error of the skewness.
111 @end table
112
113 The @subcmd{SORT} subcommand specifies how the statistics should be sorted.  Most
114 of the possible values should be self-explanatory.  @subcmd{NAME} causes the
115 statistics to be sorted by name.  By default, the statistics are listed
116 in the order that they are specified on the @subcmd{VARIABLES} subcommand.
117 The @subcmd{A} and @subcmd{D} settings request an ascending or descending
118 sort order, respectively.
119
120 @node FREQUENCIES
121 @section FREQUENCIES
122
123 @vindex FREQUENCIES
124 @display
125 FREQUENCIES
126         /VARIABLES=@var{var_list}
127         /FORMAT=@{TABLE,NOTABLE,LIMIT(@var{limit})@}
128                 @{AVALUE,DVALUE,AFREQ,DFREQ@}
129         /MISSING=@{EXCLUDE,INCLUDE@}
130         /STATISTICS=@{DEFAULT,MEAN,SEMEAN,MEDIAN,MODE,STDDEV,VARIANCE,
131                      KURTOSIS,SKEWNESS,RANGE,MINIMUM,MAXIMUM,SUM,
132                      SESKEWNESS,SEKURTOSIS,ALL,NONE@}
133         /NTILES=@var{ntiles}
134         /PERCENTILES=percent@dots{}
135         /HISTOGRAM=[MINIMUM(@var{x_min})] [MAXIMUM(@var{x_max})] 
136                    [@{FREQ[(@var{y_max})],PERCENT[(@var{y_max})]@}] [@{NONORMAL,NORMAL@}]
137         /PIECHART=[MINIMUM(@var{x_min})] [MAXIMUM(@var{x_max})]
138                   [@{FREQ,PERCENT@}] [@{NOMISSING,MISSING@}]
139         /BARCHART=[MINIMUM(@var{x_min})] [MAXIMUM(@var{x_max})]
140                   [@{FREQ,PERCENT@}]
141
142
143 (These options are not currently implemented.)
144         /HBAR=@dots{}
145         /GROUPED=@dots{}
146 @end display
147
148 The @cmd{FREQUENCIES} procedure outputs frequency tables for specified
149 variables.
150 @cmd{FREQUENCIES} can also calculate and display descriptive statistics
151 (including median and mode) and percentiles,
152 @cmd{FREQUENCIES} can also output
153 histograms and pie charts.  
154
155 The @subcmd{VARIABLES} subcommand is the only required subcommand.  Specify the
156 variables to be analyzed.
157
158 The @subcmd{FORMAT} subcommand controls the output format.  It has several
159 possible settings:  
160
161 @itemize @subcmd{}
162 @item
163 @subcmd{TABLE}, the default, causes a frequency table to be output for every
164 variable specified.  @subcmd{NOTABLE} prevents them from being output.  @subcmd{LIMIT}
165 with a numeric argument causes them to be output except when there are
166 more than the specified number of values in the table.
167
168 @item
169 Normally frequency tables are sorted in ascending order by value.  This
170 is @subcmd{AVALUE}.  @subcmd{DVALUE} tables are sorted in descending order by value.
171 @subcmd{AFREQ} and @subcmd{DFREQ} tables are sorted in ascending and descending order,
172 respectively, by frequency count.
173 @end itemize
174
175 The @subcmd{MISSING} subcommand controls the handling of user-missing values.
176 When @subcmd{EXCLUDE}, the default, is set, user-missing values are not included
177 in frequency tables or statistics.  When @subcmd{INCLUDE} is set, user-missing
178 are included.  System-missing values are never included in statistics,
179 but are listed in frequency tables.
180
181 The available @subcmd{STATISTICS} are the same as available 
182 in @cmd{DESCRIPTIVES} (@pxref{DESCRIPTIVES}), with the addition 
183 of @subcmd{MEDIAN}, the data's median
184 value, and MODE, the mode.  (If there are multiple modes, the smallest
185 value is reported.)  By default, the mean, standard deviation of the
186 mean, minimum, and maximum are reported for each variable.
187
188 @cindex percentiles
189 @subcmd{PERCENTILES} causes the specified percentiles to be reported.
190 The percentiles should  be presented at a list of numbers between 0
191 and 100 inclusive.  
192 The @subcmd{NTILES} subcommand causes the percentiles to be reported at the
193 boundaries of the data set divided into the specified number of ranges.
194 For instance, @subcmd{/NTILES=4} would cause quartiles to be reported.
195
196 @cindex histogram
197 The @subcmd{HISTOGRAM} subcommand causes the output to include a histogram for
198 each specified numeric variable.  The X axis by default ranges from
199 the minimum to the maximum value observed in the data, but the @subcmd{MINIMUM}
200 and @subcmd{MAXIMUM} keywords can set an explicit range. The number of
201 bins are 2IQR(x)n^-1/3 according to the Freedman-Diaconis rule.  (Note that
202 @cmd{EXAMINE} uses a different algorithm to determine bin sizes.)
203 Histograms are not created for string variables.
204
205 Specify @subcmd{NORMAL} to superimpose a normal curve on the
206 histogram.
207
208 @cindex piechart
209 The @subcmd{PIECHART} subcommand adds a pie chart for each variable to the data.  Each
210 slice represents one value, with the size of the slice proportional to
211 the value's frequency.  By default, all non-missing values are given
212 slices.  The @subcmd{MINIMUM} and @subcmd{MAXIMUM} keywords can be used to limit the
213 displayed slices to a given range of values.  The @subcmd{MISSING} keyword adds
214 slices for missing values.
215
216 The @subcmd{FREQ} and @subcmd{PERCENT} options on @subcmd{HISTOGRAM} and @subcmd{PIECHART} are accepted
217 but not currently honoured.
218
219 @node EXAMINE
220 @section EXAMINE
221
222 @vindex EXAMINE
223 @cindex Exploratory data analysis
224 @cindex normality, testing
225
226 @display
227 EXAMINE
228         VARIABLES= @var{var1} [@var{var2}] @dots{} [@var{varN}]
229            [BY @var{factor1} [BY @var{subfactor1}]
230              [ @var{factor2} [BY @var{subfactor2}]]
231              @dots{}
232              [ @var{factor3} [BY @var{subfactor3}]]
233             ]
234         /STATISTICS=@{DESCRIPTIVES, EXTREME[(@var{n})], ALL, NONE@}
235         /PLOT=@{BOXPLOT, NPPLOT, HISTOGRAM, SPREADLEVEL[(@var{t})], ALL, NONE@}
236         /CINTERVAL @var{p}
237         /COMPARE=@{GROUPS,VARIABLES@}
238         /ID=@var{identity_variable}
239         /@{TOTAL,NOTOTAL@}
240         /PERCENTILE=[@var{percentiles}]=@{HAVERAGE, WAVERAGE, ROUND, AEMPIRICAL, EMPIRICAL @}
241         /MISSING=@{LISTWISE, PAIRWISE@} [@{EXCLUDE, INCLUDE@}] 
242                 [@{NOREPORT,REPORT@}]
243
244 @end display
245
246 The @cmd{EXAMINE} command is used to perform exploratory data analysis.
247 In particular, it is useful for testing how closely a distribution follows a
248 normal distribution, and for finding outliers and extreme values.
249
250 The @subcmd{VARIABLES} subcommand is mandatory.  
251 It specifies the dependent variables and optionally variables to use as
252 factors for the analysis.
253 Variables listed before the first @subcmd{BY} keyword (if any) are the 
254 dependent variables.
255 The dependent variables may optionally be followed by a list of
256 factors which tell @pspp{} how to break down the analysis for each
257 dependent variable. 
258
259 Following the dependent variables, factors may be specified.
260 The factors (if desired) should be preceded by a single @subcmd{BY} keyword.
261 The format for each factor is 
262 @display
263 @var{factorvar} [BY @var{subfactorvar}].
264 @end display
265 Each unique combination of the values of  @var{factorvar} and
266 @var{subfactorvar} divide the dataset into @dfn{cells}.
267 Statistics will be calculated for each cell
268 and for the entire dataset (unless @subcmd{NOTOTAL} is given).
269
270 The @subcmd{STATISTICS} subcommand specifies which statistics to show.
271 @subcmd{DESCRIPTIVES} will produce a table showing some parametric and
272 non-parametrics statistics.
273 @subcmd{EXTREME} produces a table showing the extremities of each cell.
274 A number in parentheses, @var{n} determines
275 how many upper and lower extremities to show.
276 The default number is 5.
277
278 The subcommands @subcmd{TOTAL} and @subcmd{NOTOTAL} are mutually exclusive.
279 If @subcmd{TOTAL} appears, then statistics will be produced for the entire dataset
280 as well as for each cell.
281 If @subcmd{NOTOTAL} appears, then statistics will be produced only for the cells
282 (unless no factor variables have been given).
283 These subcommands have no effect if there have  been no factor variables
284 specified.
285
286 @cindex boxplot
287 @cindex histogram
288 @cindex npplot
289 @cindex spreadlevel plot
290 The @subcmd{PLOT} subcommand specifies which plots are to be produced if any.
291 Available plots are @subcmd{HISTOGRAM}, @subcmd{NPPLOT},  @subcmd{BOXPLOT} and
292 @subcmd{SPREADLEVEL}.
293 The first three can be used to visualise how closely each cell conforms to a 
294 normal distribution, whilst the spread vs.@: level plot can be useful to visualise
295 how the variance of differs between factors.
296 Boxplots will also show you the outliers and extreme values.
297
298 @subcmd{HISTOGRAM} uses Sturges' rule to determine the number of
299 bins, as approximately 1 + log2(n).  (Note that @cmd{FREQUENCIES} uses a
300 different algorithm to find the bin size.)
301
302 The @subcmd{SPREADLEVEL} plot displays the interquartile range versus the 
303 median.  It takes an optional parameter @var{t}, which specifies how the data
304 should be transformed prior to plotting.
305 The given value @var{t} is a power to which the data is raised.  For example, if
306 @var{t} is given as 2, then the data will be squared.
307 Zero, however is a special value.  If @var{t} is 0 or 
308 is omitted, then data will be transformed by taking its natural logarithm instead of
309 raising to the power of @var{t}.
310
311 The @subcmd{COMPARE} subcommand is only relevant if producing boxplots, and it is only 
312 useful there is more than one dependent variable and at least one factor.
313 If 
314 @subcmd{/COMPARE=GROUPS} is specified, then one plot per dependent variable is produced,
315 each of which contain boxplots for all the cells.
316 If @subcmd{/COMPARE=VARIABLES} is specified, then one plot per cell is produced,
317 each containing one boxplot per dependent variable.
318 If the @subcmd{/COMPARE} subcommand is omitted, then @pspp{} behaves as if
319 @subcmd{/COMPARE=GROUPS} were given.
320  
321 The @subcmd{ID} subcommand is relevant only if @subcmd{/PLOT=BOXPLOT} or 
322 @subcmd{/STATISTICS=EXTREME} has been given.
323 If given, it should provide the name of a variable which is to be used
324 to labels extreme values and outliers.
325 Numeric or string variables are permissible.  
326 If the @subcmd{ID} subcommand is not given, then the case number will be used for
327 labelling.
328
329 The @subcmd{CINTERVAL} subcommand specifies the confidence interval to use in
330 calculation of the descriptives command.  The default is 95%.
331
332 @cindex percentiles
333 The @subcmd{PERCENTILES} subcommand specifies which percentiles are to be calculated, 
334 and which algorithm to use for calculating them.  The default is to
335 calculate the 5, 10, 25, 50, 75, 90, 95 percentiles using the
336 @subcmd{HAVERAGE} algorithm.
337
338 The @subcmd{TOTAL} and @subcmd{NOTOTAL} subcommands are mutually exclusive.  If @subcmd{NOTOTAL}
339 is given and factors have been specified in the @subcmd{VARIABLES} subcommand,
340 then then statistics for the unfactored dependent variables are
341 produced in addition to the factored variables.  If there are no
342 factors specified then @subcmd{TOTAL} and @subcmd{NOTOTAL} have no effect.
343
344
345 The following example will generate descriptive statistics and histograms for
346 two variables @var{score1} and @var{score2}.
347 Two factors are given, @i{viz}: @var{gender} and @var{gender} BY @var{culture}.
348 Therefore, the descriptives and histograms will be generated for each
349 distinct  value
350 of @var{gender} @emph{and} for each distinct combination of the values
351 of @var{gender} and @var{race}.
352 Since the @subcmd{NOTOTAL} keyword is given, statistics and histograms for 
353 @var{score1} and @var{score2} covering the  whole dataset are not produced.
354 @example
355 EXAMINE @var{score1} @var{score2} BY 
356         @var{gender}
357         @var{gender} BY @var{culture}
358         /STATISTICS = DESCRIPTIVES
359         /PLOT = HISTOGRAM
360         /NOTOTAL.
361 @end example
362
363 Here is a second example showing how the @cmd{examine} command can be used to find extremities.
364 @example
365 EXAMINE @var{height} @var{weight} BY 
366         @var{gender}
367         /STATISTICS = EXTREME (3)
368         /PLOT = BOXPLOT
369         /COMPARE = GROUPS
370         /ID = @var{name}.
371 @end example
372 In this example, we look at the height and weight of a sample of individuals and
373 how they differ between male and female.
374 A table showing the 3 largest and the 3 smallest values of @var{height} and 
375 @var{weight} for each gender, and for the whole dataset will be shown.
376 Boxplots will also be produced.
377 Because @subcmd{/COMPARE = GROUPS} was given, boxplots for male and female will be
378 shown in the same graphic, allowing us to easily see the difference between
379 the genders.
380 Since the variable @var{name} was specified on the @subcmd{ID} subcommand, this will be
381 used to label the extreme values.
382
383 @strong{Warning!}
384 If many dependent variables are specified, or if factor variables are
385 specified for which
386 there are many distinct values, then @cmd{EXAMINE} will produce a very
387 large quantity of output.
388
389 @node GRAPH
390 @section GRAPH
391
392 @vindex GRAPH
393 @cindex Exploratory data analysis
394 @cindex normality, testing
395
396 @display
397 GRAPH
398         /HISTOGRAM = @var{var}
399         /SCATTERPLOT [(BIVARIATE)] = @var{var1} WITH @var{var2} [BY @var{var3}] 
400         [ /MISSING=@{LISTWISE, VARIABLE@} [@{EXCLUDE, INCLUDE@}] ] 
401                 [@{NOREPORT,REPORT@}]
402
403 @end display
404
405 The @cmd{GRAPH} produces graphical plots of data. Only one of the subcommands 
406 @subcmd{HISTOGRAM} or @subcmd{SCATTERPLOT} can be specified, i.e. only one plot
407 can be produced per call of @cmd{GRAPH}. The @subcmd{MISSING} is optional. 
408
409 @cindex scatterplot
410
411 The subcommand @subcmd{SCATTERPLOT} produces an xy plot of the data. The different 
412 values of the optional third variable @var{var3} will result in different colours and/or
413 markers for the plot. The following is an example for producing a scatterplot.
414
415 @example
416 GRAPH   
417         /SCATTERPLOT = @var{height} WITH @var{weight} BY @var{gender}.
418 @end example
419
420 This example will produce a scatterplot where @var{height} is plotted versus @var{weight}. Depending
421 on the value of the @var{gender} variable, the colour of the datapoint is different. With
422 this plot it is possible to analyze gender differences for @var{height} vs.@: @var{weight} relation.
423
424 @cindex histogram
425
426 The subcommand @subcmd{HISTOGRAM} produces a histogram. Only one variable is allowed for
427 the histogram plot.
428 For an alternative method to produce histograms @pxref{EXAMINE}. The
429 following example produces a histogram plot for the variable @var{weight}.
430
431 @example
432 GRAPH   
433         /HISTOGRAM = @var{weight}.
434 @end example
435
436 @node CORRELATIONS
437 @section CORRELATIONS
438
439 @vindex CORRELATIONS
440 @display
441 CORRELATIONS
442      /VARIABLES = @var{var_list} [ WITH @var{var_list} ]
443      [
444       .
445       .
446       .
447       /VARIABLES = @var{var_list} [ WITH @var{var_list} ]
448       /VARIABLES = @var{var_list} [ WITH @var{var_list} ]
449      ]
450
451      [ /PRINT=@{TWOTAIL, ONETAIL@} @{SIG, NOSIG@} ]
452      [ /STATISTICS=DESCRIPTIVES XPROD ALL]
453      [ /MISSING=@{PAIRWISE, LISTWISE@} @{INCLUDE, EXCLUDE@} ]
454 @end display    
455
456 @cindex correlation
457 The @cmd{CORRELATIONS} procedure produces tables of the Pearson correlation coefficient
458 for a set of variables.  The significance of the coefficients are also given.
459
460 At least one @subcmd{VARIABLES} subcommand is required. If the @subcmd{WITH} 
461 keyword is used, then a non-square correlation table will be produced.
462 The variables preceding @subcmd{WITH}, will be used as the rows of the table,
463 and the variables following will be the columns of the table.
464 If no @subcmd{WITH} subcommand is given, then a square, symmetrical table using all variables is produced.
465
466
467 The @cmd{MISSING} subcommand determines the handling of missing variables.  
468 If @subcmd{INCLUDE} is set, then user-missing values are included in the
469 calculations, but system-missing values are not.
470 If @subcmd{EXCLUDE} is set, which is the default, user-missing
471 values are excluded as well as system-missing values. 
472
473 If @subcmd{LISTWISE} is set, then the entire case is excluded from analysis
474 whenever any variable  specified in any @cmd{/VARIABLES} subcommand
475 contains a missing value.   
476 If @subcmd{PAIRWISE} is set, then a case is considered missing only if either of the
477 values  for the particular coefficient are missing.
478 The default is @subcmd{PAIRWISE}.
479
480 The @subcmd{PRINT} subcommand is used to control how the reported significance values are printed.
481 If the @subcmd{TWOTAIL} option is used, then a two-tailed test of significance is 
482 printed.  If the @subcmd{ONETAIL} option is given, then a one-tailed test is used.
483 The default is @subcmd{TWOTAIL}.
484
485 If the @subcmd{NOSIG} option is specified, then correlation coefficients with significance less than
486 0.05 are highlighted.
487 If @subcmd{SIG} is specified, then no highlighting is performed.  This is the default.
488
489 @cindex covariance
490 The @subcmd{STATISTICS} subcommand requests additional statistics to be displayed.  The keyword 
491 @subcmd{DESCRIPTIVES} requests that the mean, number of non-missing cases, and the non-biased
492 estimator of the standard deviation are displayed.
493 These statistics will be displayed in a separated table, for all the variables listed
494 in any @subcmd{/VARIABLES} subcommand.
495 The @subcmd{XPROD} keyword requests cross-product deviations and covariance estimators to 
496 be displayed for each pair of variables.
497 The keyword @subcmd{ALL} is the union of @subcmd{DESCRIPTIVES} and @subcmd{XPROD}.
498
499 @node CROSSTABS
500 @section CROSSTABS
501
502 @vindex CROSSTABS
503 @display
504 CROSSTABS
505         /TABLES=@var{var_list} BY @var{var_list} [BY @var{var_list}]@dots{}
506         /MISSING=@{TABLE,INCLUDE,REPORT@}
507         /WRITE=@{NONE,CELLS,ALL@}
508         /FORMAT=@{TABLES,NOTABLES@}
509                 @{PIVOT,NOPIVOT@}
510                 @{AVALUE,DVALUE@}
511                 @{NOINDEX,INDEX@}
512                 @{BOX,NOBOX@}
513         /CELLS=@{COUNT,ROW,COLUMN,TOTAL,EXPECTED,RESIDUAL,SRESIDUAL,
514                 ASRESIDUAL,ALL,NONE@}
515         /STATISTICS=@{CHISQ,PHI,CC,LAMBDA,UC,BTAU,CTAU,RISK,GAMMA,D,
516                      KAPPA,ETA,CORR,ALL,NONE@}
517         
518 (Integer mode.)
519         /VARIABLES=@var{var_list} (@var{low},@var{high})@dots{}
520 @end display
521
522 The @cmd{CROSSTABS} procedure displays crosstabulation
523 tables requested by the user.  It can calculate several statistics for
524 each cell in the crosstabulation tables.  In addition, a number of
525 statistics can be calculated for each table itself.
526
527 The @subcmd{TABLES} subcommand is used to specify the tables to be reported.  Any
528 number of dimensions is permitted, and any number of variables per
529 dimension is allowed.  The @subcmd{TABLES} subcommand may be repeated as many
530 times as needed.  This is the only required subcommand in @dfn{general
531 mode}.  
532
533 Occasionally, one may want to invoke a special mode called @dfn{integer
534 mode}.  Normally, in general mode, @pspp{} automatically determines
535 what values occur in the data.  In integer mode, the user specifies the
536 range of values that the data assumes.  To invoke this mode, specify the
537 @subcmd{VARIABLES} subcommand, giving a range of data values in parentheses for
538 each variable to be used on the @subcmd{TABLES} subcommand.  Data values inside
539 the range are truncated to the nearest integer, then assigned to that
540 value.  If values occur outside this range, they are discarded.  When it
541 is present, the @subcmd{VARIABLES} subcommand must precede the @subcmd{TABLES}
542 subcommand.
543
544 In general mode, numeric and string variables may be specified on
545 TABLES.  In integer mode, only numeric variables are allowed.
546
547 The @subcmd{MISSING} subcommand determines the handling of user-missing values.
548 When set to @subcmd{TABLE}, the default, missing values are dropped on a table by
549 table basis.  When set to @subcmd{INCLUDE}, user-missing values are included in
550 tables and statistics.  When set to @subcmd{REPORT}, which is allowed only in
551 integer mode, user-missing values are included in tables but marked with
552 an @samp{M} (for ``missing'') and excluded from statistical
553 calculations.
554
555 Currently the @subcmd{WRITE} subcommand is ignored.
556
557 The @subcmd{FORMAT} subcommand controls the characteristics of the
558 crosstabulation tables to be displayed.  It has a number of possible
559 settings:
560
561 @itemize @w{}
562 @item
563 @subcmd{TABLES}, the default, causes crosstabulation tables to be output.
564 @subcmd{NOTABLES} suppresses them.
565
566 @item
567 @subcmd{PIVOT}, the default, causes each @subcmd{TABLES} subcommand to be displayed in a
568 pivot table format.  @subcmd{NOPIVOT} causes the old-style crosstabulation format
569 to be used.
570
571 @item
572 @subcmd{AVALUE}, the default, causes values to be sorted in ascending order.
573 @subcmd{DVALUE} asserts a descending sort order.
574
575 @item
576 @subcmd{INDEX} and @subcmd{NOINDEX} are currently ignored.
577
578 @item
579 @subcmd{BOX} and @subcmd{NOBOX} is currently ignored.
580 @end itemize
581
582 The @subcmd{CELLS} subcommand controls the contents of each cell in the displayed
583 crosstabulation table.  The possible settings are:
584
585 @table @asis
586 @item COUNT
587 Frequency count.
588 @item ROW
589 Row percent.
590 @item COLUMN
591 Column percent.
592 @item TOTAL
593 Table percent.
594 @item EXPECTED
595 Expected value.
596 @item RESIDUAL 
597 Residual.
598 @item SRESIDUAL
599 Standardized residual.
600 @item ASRESIDUAL
601 Adjusted standardized residual.
602 @item ALL
603 All of the above.
604 @item NONE
605 Suppress cells entirely.
606 @end table
607
608 @samp{/CELLS} without any settings specified requests @subcmd{COUNT}, @subcmd{ROW},
609 @subcmd{COLUMN}, and @subcmd{TOTAL}.  
610 If @subcmd{CELLS} is not specified at all then only @subcmd{COUNT}
611 will be selected.
612
613 The @subcmd{STATISTICS} subcommand selects statistics for computation:
614
615 @table @asis
616 @item CHISQ
617 @cindex chisquare
618 @cindex chi-square
619
620 Pearson chi-square, likelihood ratio, Fisher's exact test, continuity
621 correction, linear-by-linear association.
622 @item PHI
623 Phi.
624 @item CC
625 Contingency coefficient.
626 @item LAMBDA
627 Lambda.
628 @item UC
629 Uncertainty coefficient.
630 @item BTAU
631 Tau-b.
632 @item CTAU
633 Tau-c.
634 @item RISK
635 Risk estimate.
636 @item GAMMA
637 Gamma.
638 @item D
639 Somers' D.
640 @item KAPPA
641 Cohen's Kappa.
642 @item ETA
643 Eta.
644 @item CORR
645 Spearman correlation, Pearson's r.
646 @item ALL
647 All of the above.
648 @item NONE
649 No statistics.
650 @end table
651
652 Selected statistics are only calculated when appropriate for the
653 statistic.  Certain statistics require tables of a particular size, and
654 some statistics are calculated only in integer mode.
655
656 @samp{/STATISTICS} without any settings selects CHISQ.  If the
657 @subcmd{STATISTICS} subcommand is not given, no statistics are calculated.
658
659 @strong{Please note:} Currently the implementation of @cmd{CROSSTABS} has the
660 following bugs:
661
662 @itemize @bullet
663 @item
664 Significance of some symmetric and directional measures is not calculated.
665 @item
666 Asymptotic standard error is not calculated for
667 Goodman and Kruskal's tau or symmetric Somers' d.
668 @item
669 Approximate T is not calculated for symmetric uncertainty coefficient.
670 @end itemize
671
672 Fixes for any of these deficiencies would be welcomed.
673
674 @node FACTOR
675 @section FACTOR
676
677 @vindex FACTOR
678 @cindex factor analysis
679 @cindex principal components analysis
680 @cindex principal axis factoring
681 @cindex data reduction
682
683 @display
684 FACTOR  VARIABLES=@var{var_list}
685
686         [ /METHOD = @{CORRELATION, COVARIANCE@} ]
687
688         [ /EXTRACTION=@{PC, PAF@}] 
689
690         [ /ROTATION=@{VARIMAX, EQUAMAX, QUARTIMAX, PROMAX[(@var{k})], NOROTATE@}]
691
692         [ /PRINT=[INITIAL] [EXTRACTION] [ROTATION] [UNIVARIATE] [CORRELATION] [COVARIANCE] [DET] [KMO] [SIG] [ALL] [DEFAULT] ]
693
694         [ /PLOT=[EIGEN] ]
695
696         [ /FORMAT=[SORT] [BLANK(@var{n})] [DEFAULT] ]
697
698         [ /CRITERIA=[FACTORS(@var{n})] [MINEIGEN(@var{l})] [ITERATE(@var{m})] [ECONVERGE (@var{delta})] [DEFAULT] ]
699
700         [ /MISSING=[@{LISTWISE, PAIRWISE@}] [@{INCLUDE, EXCLUDE@}] ]
701 @end display
702
703 The @cmd{FACTOR} command performs Factor Analysis or Principal Axis Factoring on a dataset.  It may be used to find
704 common factors in the data or for data reduction purposes.
705
706 The @subcmd{VARIABLES} subcommand is required.  It lists the variables which are to partake in the analysis.
707
708 The @subcmd{/EXTRACTION} subcommand is used to specify the way in which factors (components) are extracted from the data.
709 If @subcmd{PC} is specified, then Principal Components Analysis is used.  
710 If @subcmd{PAF} is specified, then Principal Axis Factoring is
711 used. By default Principal Components Analysis will be used.
712
713 The @subcmd{/ROTATION} subcommand is used to specify the method by which the extracted solution will be rotated.
714 Three orthogonal rotation methods are available: 
715 @subcmd{VARIMAX} (which is the default), @subcmd{EQUAMAX}, and @subcmd{QUARTIMAX}.
716 There is one oblique rotation method, @i{viz}: @subcmd{PROMAX}.
717 Optionally you may enter the power of the promax rotation @var{k}, which must be enclosed in parentheses.
718 The default value of @var{k} is 5.
719 If you don't want any rotation to be performed, the word @subcmd{NOROTATE} will prevent the command from performing any
720 rotation on the data. 
721
722 The @subcmd{/METHOD} subcommand should be used to determine whether the covariance matrix or the correlation matrix of the data is
723 to be analysed.  By default, the correlation matrix is analysed.
724
725 The @subcmd{/PRINT} subcommand may be used to select which features of the analysis are reported:
726
727 @itemize 
728 @item @subcmd{UNIVARIATE}
729       A table of mean values, standard deviations and total weights are printed.
730 @item @subcmd{INITIAL}
731       Initial communalities and eigenvalues are printed.
732 @item @subcmd{EXTRACTION}
733       Extracted communalities and eigenvalues are printed.
734 @item @subcmd{ROTATION}
735       Rotated communalities and eigenvalues are printed.
736 @item @subcmd{CORRELATION}
737       The correlation matrix is printed.
738 @item @subcmd{COVARIANCE}
739       The covariance matrix is printed.
740 @item @subcmd{DET}
741       The determinant of the correlation or covariance matrix is printed.
742 @item @subcmd{KMO}
743       The Kaiser-Meyer-Olkin measure of sampling adequacy and the Bartlett test of sphericity is printed.
744 @item @subcmd{SIG}
745       The significance of the elements of correlation matrix is printed.
746 @item @subcmd{ALL}
747       All of the above are printed.
748 @item @subcmd{DEFAULT}
749       Identical to @subcmd{INITIAL} and @subcmd{EXTRACTION}.
750 @end itemize
751
752 If @subcmd{/PLOT=EIGEN} is given, then a ``Scree'' plot of the eigenvalues will be printed.  This can be useful for visualizing
753 which factors (components) should be retained.
754
755 The @subcmd{/FORMAT} subcommand determined how data are to be displayed in loading matrices.  If @subcmd{SORT} is specified, then the variables
756 are sorted in descending order of significance.  If @subcmd{BLANK(@var{n})} is specified, then coefficients whose absolute value is less
757 than @var{n} will not be printed.  If the keyword @subcmd{DEFAULT} is given, or if no @subcmd{/FORMAT} subcommand is given, then no sorting is 
758 performed, and all coefficients will be printed.
759
760 The @subcmd{/CRITERIA} subcommand is used to specify how the number of extracted factors (components) are chosen.
761 If @subcmd{FACTORS(@var{n})} is
762 specified, where @var{n} is an integer, then @var{n} factors will be extracted.  Otherwise, the @subcmd{MINEIGEN} setting will
763 be used.  
764 @subcmd{MINEIGEN(@var{l})} requests that all factors whose eigenvalues are greater than or equal to @var{l} are extracted.
765 The default value of @var{l} is 1.    
766 The @subcmd{ECONVERGE} setting has effect only when iterative algorithms for factor
767 extraction (such as Principal Axis Factoring) are used.   
768 @subcmd{ECONVERGE(@var{delta})} specifies that
769 iteration should cease when
770 the maximum absolute value of the communality estimate between one iteration and the previous is less than @var{delta}. The
771 default value of @var{delta} is 0.001.
772 The @subcmd{ITERATE(@var{m})} may appear any number of times and is used for two different purposes.  
773 It is used to set the maximum number of iterations (@var{m}) for convergence and also to set the maximum number of iterations
774 for rotation.
775 Whether it affects convergence or rotation depends upon which subcommand follows the @subcmd{ITERATE} subcommand.
776 If @subcmd{EXTRACTION} follows, it affects convergence.  
777 If @subcmd{ROTATION} follows, it affects rotation.  
778 If neither @subcmd{ROTATION} nor @subcmd{EXTRACTION} follow a @subcmd{ITERATE} subcommand it will be ignored.
779 The default value of @var{m} is 25.
780
781 The @cmd{MISSING} subcommand determines the handling of missing variables.  
782 If @subcmd{INCLUDE} is set, then user-missing values are included in the
783 calculations, but system-missing values are not.
784 If @subcmd{EXCLUDE} is set, which is the default, user-missing
785 values are excluded as well as system-missing values. 
786 This is the default.
787 If @subcmd{LISTWISE} is set, then the entire case is excluded from analysis
788 whenever any variable  specified in the @cmd{VARIABLES} subcommand
789 contains a missing value.   
790 If @subcmd{PAIRWISE} is set, then a case is considered missing only if either of the
791 values  for the particular coefficient are missing.
792 The default is @subcmd{LISTWISE}.
793
794 @node LOGISTIC REGRESSION
795 @section LOGISTIC REGRESSION
796
797 @vindex LOGISTIC REGRESSION
798 @cindex logistic regression
799 @cindex bivariate logistic regression
800
801 @display
802 LOGISTIC REGRESSION [VARIABLES =] @var{dependent_var} WITH @var{predictors}
803
804      [/CATEGORICAL = @var{categorical_predictors}]
805
806      [@{/NOCONST | /ORIGIN | /NOORIGIN @}]
807
808      [/PRINT = [SUMMARY] [DEFAULT] [CI(@var{confidence})] [ALL]]
809
810      [/CRITERIA = [BCON(@var{min_delta})] [ITERATE(@var{max_interations})]
811                   [LCON(@var{min_likelihood_delta})] [EPS(@var{min_epsilon})]
812                   [CUT(@var{cut_point})]]
813
814      [/MISSING = @{INCLUDE|EXCLUDE@}]
815 @end display
816
817 Bivariate Logistic Regression is used when you want to explain a dichotomous dependent
818 variable in terms of one or more predictor variables.
819
820 The minimum command is
821 @example
822 LOGISTIC REGRESSION @var{y} WITH @var{x1} @var{x2} @dots{} @var{xn}.
823 @end example
824 Here, @var{y} is the dependent variable, which must be dichotomous and @var{x1} @dots{} @var{xn}
825 are the predictor variables whose coefficients the procedure estimates.
826
827 By default, a constant term is included in the model.
828 Hence, the full model is
829 @math{
830 {\bf y} 
831 = b_0 + b_1 {\bf x_1} 
832 + b_2 {\bf x_2} 
833 + \dots
834 + b_n {\bf x_n}
835 }
836
837 Predictor variables which are categorical in nature should be listed on the @subcmd{/CATEGORICAL} subcommand.
838 Simple variables as well as interactions between variables may be listed here.
839
840 If you want a model without the constant term @math{b_0}, use the keyword @subcmd{/ORIGIN}.
841 @subcmd{/NOCONST} is a synonym for @subcmd{/ORIGIN}.
842
843 An iterative Newton-Raphson procedure is used to fit the model.
844 The @subcmd{/CRITERIA} subcommand is used to specify the stopping criteria of the procedure,
845 and other parameters.
846 The value of @var{cut_point} is used in the classification table.  It is the 
847 threshold above which predicted values are considered to be 1.  Values
848 of @var{cut_point} must lie in the range [0,1].
849 During iterations, if any one of the stopping criteria are satisfied, the procedure is
850 considered complete.
851 The stopping criteria are:
852 @itemize
853 @item The number of iterations exceeds @var{max_iterations}.  
854       The default value of @var{max_iterations} is 20.
855 @item The change in the all coefficient estimates are less than @var{min_delta}.
856 The default value of @var{min_delta} is 0.001.
857 @item The magnitude of change in the likelihood estimate is less than @var{min_likelihood_delta}.
858 The default value of @var{min_delta} is zero.
859 This means that this criterion is disabled.
860 @item The differential of the estimated probability for all cases is less than @var{min_epsilon}.
861 In other words, the probabilities are close to zero or one.
862 The default value of @var{min_epsilon} is 0.00000001.
863 @end itemize
864
865
866 The @subcmd{PRINT} subcommand controls the display of optional statistics.
867 Currently there is one such option, @subcmd{CI}, which indicates that the 
868 confidence interval of the odds ratio should be displayed as well as its value.
869 @subcmd{CI} should be followed by an integer in parentheses, to indicate the
870 confidence level of the desired confidence interval.
871
872 The @subcmd{MISSING} subcommand determines the handling of missing
873 variables.  
874 If @subcmd{INCLUDE} is set, then user-missing values are included in the
875 calculations, but system-missing values are not.
876 If @subcmd{EXCLUDE} is set, which is the default, user-missing
877 values are excluded as well as system-missing values. 
878 This is the default.
879
880 @node MEANS
881 @section MEANS
882
883 @vindex MEANS
884 @cindex means
885
886 @display 
887 MEANS [TABLES =] 
888       @{@var{var_list}@} 
889         [ BY @{@var{var_list}@} [BY @{@var{var_list}@} [BY @{@var{var_list}@} @dots{} ]]]
890
891       [ /@{@var{var_list}@} 
892          [ BY @{@var{var_list}@} [BY @{@var{var_list}@} [BY @{@var{var_list}@} @dots{} ]]] ]
893
894       [/CELLS = [MEAN] [COUNT] [STDDEV] [SEMEAN] [SUM] [MIN] [MAX] [RANGE]
895         [VARIANCE] [KURT] [SEKURT] 
896         [SKEW] [SESKEW] [FIRST] [LAST] 
897         [HARMONIC] [GEOMETRIC] 
898         [DEFAULT]
899         [ALL]
900         [NONE] ]
901
902       [/MISSING = [TABLE] [INCLUDE] [DEPENDENT]]
903 @end display 
904
905 You can use the @cmd{MEANS} command to calculate the arithmetic mean and similar
906 statistics, either for the dataset as a whole or for categories of data.
907
908 The simplest form of the command is
909 @example
910 MEANS @var{v}.
911 @end example
912 @noindent which calculates the mean, count and standard deviation for @var{v}.
913 If you specify a grouping variable, for example
914 @example
915 MEANS @var{v} BY @var{g}.
916 @end example
917 @noindent then the means, counts and standard deviations for @var{v} after having
918 been grouped by @var{g} will be calculated.
919 Instead of the mean, count and standard deviation, you could specify the statistics
920 in which you are interested:
921 @example
922 MEANS @var{x} @var{y} BY @var{g}
923       /CELLS = HARMONIC SUM MIN.
924 @end example
925 This example calculates the harmonic mean, the sum and the minimum values of @var{x} and @var{y}
926 grouped by @var{g}.
927
928 The @subcmd{CELLS} subcommand specifies which statistics to calculate.  The available statistics
929 are:
930 @itemize
931 @item @subcmd{MEAN}
932 @cindex arithmetic mean
933       The arithmetic mean.
934 @item @subcmd{COUNT}
935       The count of the values.
936 @item @subcmd{STDDEV}
937       The standard deviation.
938 @item @subcmd{SEMEAN}
939       The standard error of the mean.
940 @item @subcmd{SUM}
941       The sum of the values.
942 @item @subcmd{MIN}
943       The minimum value.
944 @item @subcmd{MAX}
945       The maximum value.
946 @item @subcmd{RANGE}
947       The difference between the maximum and minimum values.
948 @item @subcmd{VARIANCE}
949       The variance.
950 @item @subcmd{FIRST}
951       The first value in the category.
952 @item @subcmd{LAST}
953       The last value in the category.
954 @item @subcmd{SKEW}
955       The skewness.
956 @item @subcmd{SESKEW}
957       The standard error of the skewness.
958 @item @subcmd{KURT}
959       The kurtosis
960 @item @subcmd{SEKURT}
961       The standard error of the kurtosis.
962 @item @subcmd{HARMONIC}
963 @cindex harmonic mean
964       The harmonic mean.
965 @item @subcmd{GEOMETRIC}
966 @cindex geometric mean
967       The geometric mean.
968 @end itemize
969
970 In addition, three special keywords are recognized:
971 @itemize
972 @item @subcmd{DEFAULT}
973       This is the same as @subcmd{MEAN} @subcmd{COUNT} @subcmd{STDDEV}.
974 @item @subcmd{ALL}
975       All of the above statistics will be calculated.
976 @item @subcmd{NONE}
977       No statistics will be calculated (only a summary will be shown).
978 @end itemize
979
980
981 More than one @dfn{table} can be specified in a single command. 
982 Each table is separated by a @samp{/}. For
983 example
984 @example
985 MEANS TABLES =
986       @var{c} @var{d} @var{e} BY @var{x}
987       /@var{a} @var{b} BY @var{x} @var{y}
988       /@var{f} BY @var{y} BY @var{z}.
989 @end example
990 has three tables (the @samp{TABLE =} is optional).
991 The first table has three dependent variables @var{c}, @var{d} and @var{e}
992 and a single categorical variable @var{x}.
993 The second table has two dependent variables @var{a} and @var{b}, 
994 and two categorical variables @var{x} and @var{y}.
995 The third table has a single dependent variables @var{f}
996 and a categorical variable formed by the combination of @var{y} and @var{z}.
997
998
999 By default values are omitted from the analysis only if missing values
1000 (either system missing or user missing)
1001 for any of the variables directly involved in their calculation are 
1002 encountered.
1003 This behaviour can be modified with the  @subcmd{/MISSING} subcommand.
1004 Three options are possible: @subcmd{TABLE}, @subcmd{INCLUDE} and @subcmd{DEPENDENT}.
1005
1006 @subcmd{/MISSING = TABLE} causes cases to be dropped if any variable is missing 
1007 in the table specification currently being processed, regardless of 
1008 whether it is needed to calculate the statistic.
1009
1010 @subcmd{/MISSING = INCLUDE} says that user missing values, either in the dependent
1011 variables or in the categorical variables should be taken at their face
1012 value, and not excluded.
1013
1014 @subcmd{/MISSING = DEPENDENT} says that user missing values, in the dependent
1015 variables should be taken at their face value, however cases which 
1016 have user missing values for the categorical variables should be omitted 
1017 from the calculation.
1018
1019 @node NPAR TESTS
1020 @section NPAR TESTS
1021
1022 @vindex NPAR TESTS
1023 @cindex nonparametric tests
1024
1025 @display 
1026 NPAR TESTS
1027      
1028      nonparametric test subcommands
1029      .
1030      .
1031      .
1032      
1033      [ /STATISTICS=@{DESCRIPTIVES@} ]
1034
1035      [ /MISSING=@{ANALYSIS, LISTWISE@} @{INCLUDE, EXCLUDE@} ]
1036
1037      [ /METHOD=EXACT [ TIMER [(@var{n})] ] ]
1038 @end display
1039
1040 @cmd{NPAR TESTS} performs nonparametric tests. 
1041 Non parametric tests make very few assumptions about the distribution of the 
1042 data.
1043 One or more tests may be specified by using the corresponding subcommand.
1044 If the @subcmd{/STATISTICS} subcommand is also specified, then summary statistics are 
1045 produces for each variable that is the subject of any test.
1046
1047 Certain tests may take a long time to execute, if an exact figure is required.
1048 Therefore, by default asymptotic approximations are used unless the
1049 subcommand @subcmd{/METHOD=EXACT} is specified.  
1050 Exact tests give more accurate results, but may take an unacceptably long 
1051 time to perform.  If the @subcmd{TIMER} keyword is used, it sets a maximum time,
1052 after which the test will be abandoned, and a warning message printed.
1053 The time, in minutes, should be specified in parentheses after the @subcmd{TIMER} keyword.
1054 If the @subcmd{TIMER} keyword is given without this figure, then a default value of 5 minutes 
1055 is used.
1056
1057
1058 @menu
1059 * BINOMIAL::                Binomial Test
1060 * CHISQUARE::               Chisquare Test
1061 * COCHRAN::                 Cochran Q Test
1062 * FRIEDMAN::                Friedman Test
1063 * KENDALL::                 Kendall's W Test
1064 * KOLMOGOROV-SMIRNOV::      Kolmogorov Smirnov Test
1065 * KRUSKAL-WALLIS::          Kruskal-Wallis Test
1066 * MANN-WHITNEY::            Mann Whitney U Test
1067 * MCNEMAR::                 McNemar Test
1068 * MEDIAN::                  Median Test
1069 * RUNS::                    Runs Test
1070 * SIGN::                    The Sign Test
1071 * WILCOXON::                Wilcoxon Signed Ranks Test
1072 @end menu
1073
1074
1075 @node    BINOMIAL
1076 @subsection Binomial test
1077 @vindex BINOMIAL
1078 @cindex binomial test
1079
1080 @display 
1081      [ /BINOMIAL[(@var{p})]=@var{var_list}[(@var{value1}[, @var{value2})] ] ]
1082 @end display 
1083
1084 The @subcmd{/BINOMIAL} subcommand compares the observed distribution of a dichotomous 
1085 variable with that of a binomial distribution.
1086 The variable @var{p} specifies the test proportion of the binomial 
1087 distribution.  
1088 The default value of 0.5 is assumed if @var{p} is omitted.
1089
1090 If a single value appears after the variable list, then that value is
1091 used as the threshold to partition the observed values. Values less
1092 than or equal to the threshold value form the first category.  Values
1093 greater than the threshold form the second category. 
1094
1095 If two values appear after the variable list, then they will be used
1096 as the values which a variable must take to be in the respective
1097 category. 
1098 Cases for which a variable takes a value equal to neither of the specified  
1099 values, take no part in the test for that variable.
1100
1101 If no values appear, then the variable must assume dichotomous
1102 values.
1103 If more than two distinct, non-missing values for a variable
1104 under test are encountered then an error occurs.
1105
1106 If the test proportion is equal to 0.5, then a two tailed test is
1107 reported.   For any other test proportion, a one tailed test is
1108 reported.   
1109 For one tailed tests, if the test proportion is less than
1110 or equal to the observed proportion, then the significance of
1111 observing the observed proportion or more is reported.
1112 If the test proportion is more than the observed proportion, then the
1113 significance of observing the observed proportion or less is reported.
1114 That is to say, the test is always performed in the observed
1115 direction. 
1116
1117 @pspp{} uses a very precise approximation to the gamma function to
1118 compute the binomial significance.  Thus, exact results are reported
1119 even for very large sample sizes.
1120
1121
1122
1123 @node    CHISQUARE
1124 @subsection Chisquare Test
1125 @vindex CHISQUARE
1126 @cindex chisquare test
1127
1128
1129 @display
1130      [ /CHISQUARE=@var{var_list}[(@var{lo},@var{hi})] [/EXPECTED=@{EQUAL|@var{f1}, @var{f2} @dots{} @var{fn}@}] ]
1131 @end display 
1132
1133
1134 The @subcmd{/CHISQUARE} subcommand produces a chi-square statistic for the differences 
1135 between the expected and observed frequencies of the categories of a variable. 
1136 Optionally, a range of values may appear after the variable list.  
1137 If a range is given, then non integer values are truncated, and values
1138 outside the  specified range are excluded from the analysis.
1139
1140 The @subcmd{/EXPECTED} subcommand specifies the expected values of each
1141 category.  
1142 There must be exactly one non-zero expected value, for each observed
1143 category, or the @subcmd{EQUAL} keyword must be specified.
1144 You may use the notation @subcmd{@var{n}*@var{f}} to specify @var{n}
1145 consecutive expected categories all taking a frequency of @var{f}.
1146 The frequencies given are proportions, not absolute frequencies.  The
1147 sum of the frequencies need not be 1.
1148 If no @subcmd{/EXPECTED} subcommand is given, then then equal frequencies 
1149 are expected.
1150
1151
1152 @node COCHRAN
1153 @subsection Cochran Q Test
1154 @vindex Cochran
1155 @cindex Cochran Q test
1156 @cindex Q, Cochran Q
1157
1158 @display
1159      [ /COCHRAN = @var{var_list} ]
1160 @end display
1161
1162 The Cochran Q test is used to test for differences between three or more groups.
1163 The data for @var{var_list} in all cases must assume exactly two distinct values (other than missing values). 
1164
1165 The value of Q will be displayed and its Asymptotic significance based on a chi-square distribution.
1166
1167 @node FRIEDMAN
1168 @subsection Friedman Test
1169 @vindex FRIEDMAN
1170 @cindex Friedman test
1171
1172 @display
1173      [ /FRIEDMAN = @var{var_list} ]
1174 @end display
1175
1176 The Friedman test is used to test for differences between repeated measures when
1177 there is no indication that the distributions are normally distributed.
1178
1179 A list of variables which contain the measured data must be given.  The procedure
1180 prints the sum of ranks for each variable, the test statistic and its significance.
1181
1182 @node KENDALL
1183 @subsection Kendall's W Test
1184 @vindex KENDALL
1185 @cindex Kendall's W test
1186 @cindex coefficient of concordance
1187
1188 @display
1189      [ /KENDALL = @var{var_list} ]
1190 @end display
1191
1192 The Kendall test investigates whether an arbitrary number of related samples come from the 
1193 same population.
1194 It is identical to the Friedman test except that the additional statistic W, Kendall's Coefficient of Concordance is printed.
1195 It has the range [0,1] --- a value of zero indicates no agreement between the samples whereas a value of
1196 unity indicates complete agreement.
1197
1198
1199 @node KOLMOGOROV-SMIRNOV
1200 @subsection Kolmogorov-Smirnov Test
1201 @vindex KOLMOGOROV-SMIRNOV
1202 @vindex K-S
1203 @cindex Kolmogorov-Smirnov test
1204
1205 @display
1206      [ /KOLMOGOROV-SMIRNOV (@{NORMAL [@var{mu}, @var{sigma}], UNIFORM [@var{min}, @var{max}], POISSON [@var{lambda}], EXPONENTIAL [@var{scale}] @}) = @var{var_list} ]
1207 @end display
1208
1209 The one sample Kolmogorov-Smirnov subcommand is used to test whether or not a dataset is
1210 drawn from a particular distribution.  Four distributions are supported, @i{viz:}
1211 Normal, Uniform, Poisson and Exponential.
1212
1213 Ideally you should provide the parameters of the distribution against which you wish to test
1214 the data. For example, with the normal distribution  the mean (@var{mu})and standard deviation (@var{sigma})
1215 should be given; with the uniform distribution, the minimum (@var{min})and maximum (@var{max}) value should
1216 be provided.
1217 However, if the parameters are omitted they will be imputed from the data. Imputing the
1218 parameters reduces the power of the test so should be avoided if possible.
1219
1220 In the following example, two variables @var{score} and @var{age} are tested to see if
1221 they follow a normal distribution with a mean of 3.5 and a standard deviation of 2.0.
1222 @example
1223   NPAR TESTS
1224         /KOLMOGOROV-SMIRNOV (normal 3.5 2.0) = @var{score} @var{age}.
1225 @end example
1226 If the variables need to be tested against different distributions, then a separate
1227 subcommand must be used.  For example the following syntax tests @var{score} against
1228 a normal distribution with mean of 3.5 and standard deviation of 2.0 whilst @var{age}
1229 is tested against a normal distribution of mean 40 and standard deviation 1.5.
1230 @example
1231   NPAR TESTS
1232         /KOLMOGOROV-SMIRNOV (normal 3.5 2.0) = @var{score}
1233         /KOLMOGOROV-SMIRNOV (normal 40 1.5) =  @var{age}.
1234 @end example
1235
1236 The abbreviated subcommand  @subcmd{K-S} may be used in place of @subcmd{KOLMOGOROV-SMIRNOV}.
1237
1238 @node KRUSKAL-WALLIS
1239 @subsection Kruskal-Wallis Test
1240 @vindex KRUSKAL-WALLIS
1241 @vindex K-W
1242 @cindex Kruskal-Wallis test
1243
1244 @display
1245      [ /KRUSKAL-WALLIS = @var{var_list} BY var (@var{lower}, @var{upper}) ]
1246 @end display
1247
1248 The Kruskal-Wallis test is used to compare data from an 
1249 arbitrary number of populations.  It does not assume normality.
1250 The data to be compared are specified by @var{var_list}.
1251 The categorical variable determining the groups to which the
1252 data belongs is given by @var{var}. The limits @var{lower} and
1253 @var{upper} specify the valid range of @var{var}. Any cases for
1254 which @var{var} falls outside [@var{lower}, @var{upper}] will be
1255 ignored.
1256
1257 The mean rank of each group as well as the chi-squared value and significance
1258 of the test will be printed.
1259 The abbreviated subcommand  @subcmd{K-W} may be used in place of @subcmd{KRUSKAL-WALLIS}.
1260
1261
1262 @node MANN-WHITNEY
1263 @subsection Mann-Whitney U Test
1264 @vindex MANN-WHITNEY
1265 @vindex M-W
1266 @cindex Mann-Whitney U test
1267 @cindex U, Mann-Whitney U
1268
1269 @display
1270      [ /MANN-WHITNEY = @var{var_list} BY var (@var{group1}, @var{group2}) ]
1271 @end display
1272
1273 The Mann-Whitney subcommand is used to test whether two groups of data come from different populations.
1274 The variables to be tested should be specified in @var{var_list} and the grouping variable, that determines to which group the test variables belong, in @var{var}.
1275 @var{Var} may be either a string or an alpha variable.
1276 @var{Group1} and @var{group2} specify the
1277 two values of @var{var} which determine the groups of the test data.
1278 Cases for which the @var{var} value is neither @var{group1} or @var{group2} will be ignored.
1279
1280 The value of the Mann-Whitney U statistic, the Wilcoxon W, and the significance will be printed.
1281 The abbreviated subcommand  @subcmd{M-W} may be used in place of @subcmd{MANN-WHITNEY}.
1282
1283 @node MCNEMAR
1284 @subsection McNemar Test
1285 @vindex MCNEMAR
1286 @cindex McNemar test
1287
1288 @display
1289      [ /MCNEMAR @var{var_list} [ WITH @var{var_list} [ (PAIRED) ]]]
1290 @end display
1291
1292 Use McNemar's test to analyse the significance of the difference between
1293 pairs of correlated proportions.
1294
1295 If the @code{WITH} keyword is omitted, then tests for all
1296 combinations of the listed variables are performed.
1297 If the @code{WITH} keyword is given, and the @code{(PAIRED)} keyword
1298 is also given, then the number of variables preceding @code{WITH}
1299 must be the same as the number following it.
1300 In this case, tests for each respective pair of variables are
1301 performed.
1302 If the @code{WITH} keyword is given, but the
1303 @code{(PAIRED)} keyword is omitted, then tests for each combination
1304 of variable preceding @code{WITH} against variable following
1305 @code{WITH} are performed.
1306
1307 The data in each variable must be dichotomous.  If there are more
1308 than two distinct variables an error will occur and the test will
1309 not be run.
1310
1311 @node MEDIAN
1312 @subsection Median Test
1313 @vindex MEDIAN
1314 @cindex Median test
1315
1316 @display
1317      [ /MEDIAN [(@var{value})] = @var{var_list} BY @var{variable} (@var{value1}, @var{value2}) ]
1318 @end display
1319
1320 The median test is used to test whether independent samples come from 
1321 populations with a common median.
1322 The median of the populations against which the samples are to be tested
1323 may be given in parentheses immediately after the 
1324 @subcmd{/MEDIAN} subcommand.  If it is not given, the median will be imputed from the 
1325 union of all the samples.
1326
1327 The variables of the samples to be tested should immediately follow the @samp{=} sign. The
1328 keyword @code{BY} must come next, and then the grouping variable.  Two values
1329 in parentheses should follow.  If the first value is greater than the second,
1330 then a 2 sample test is performed using these two values to determine the groups.
1331 If however, the first variable is less than the second, then a @i{k} sample test is
1332 conducted and the group values used are all values encountered which lie in the
1333 range [@var{value1},@var{value2}].
1334
1335
1336 @node RUNS
1337 @subsection Runs Test
1338 @vindex RUNS
1339 @cindex runs test
1340
1341 @display 
1342      [ /RUNS (@{MEAN, MEDIAN, MODE, @var{value}@})  = @var{var_list} ]
1343 @end display
1344
1345 The @subcmd{/RUNS} subcommand tests whether a data sequence is randomly ordered.
1346
1347 It works by examining the number of times a variable's value crosses a given threshold. 
1348 The desired threshold must be specified within parentheses.
1349 It may either be specified as a number or as one of @subcmd{MEAN}, @subcmd{MEDIAN} or @subcmd{MODE}.
1350 Following the threshold specification comes the list of variables whose values are to be
1351 tested.
1352
1353 The subcommand shows the number of runs, the asymptotic significance based on the
1354 length of the data.
1355
1356 @node SIGN
1357 @subsection Sign Test
1358 @vindex SIGN
1359 @cindex sign test
1360
1361 @display
1362      [ /SIGN @var{var_list} [ WITH @var{var_list} [ (PAIRED) ]]]
1363 @end display
1364
1365 The @subcmd{/SIGN} subcommand tests for differences between medians of the 
1366 variables listed.
1367 The test does not make any assumptions about the
1368 distribution of the data.
1369
1370 If the @code{WITH} keyword is omitted, then tests for all
1371 combinations of the listed variables are performed.
1372 If the @code{WITH} keyword is given, and the @code{(PAIRED)} keyword
1373 is also given, then the number of variables preceding @code{WITH}
1374 must be the same as the number following it.
1375 In this case, tests for each respective pair of variables are
1376 performed.
1377 If the @code{WITH} keyword is given, but the
1378 @code{(PAIRED)} keyword is omitted, then tests for each combination
1379 of variable preceding @code{WITH} against variable following
1380 @code{WITH} are performed.
1381
1382 @node WILCOXON
1383 @subsection Wilcoxon Matched Pairs Signed Ranks Test
1384 @vindex WILCOXON
1385 @cindex wilcoxon matched pairs signed ranks test
1386
1387 @display
1388      [ /WILCOXON @var{var_list} [ WITH @var{var_list} [ (PAIRED) ]]]
1389 @end display
1390
1391 The @subcmd{/WILCOXON} subcommand tests for differences between medians of the 
1392 variables listed.
1393 The test does not make any assumptions about the variances of the samples.
1394 It does however assume that the distribution is symmetrical.
1395
1396 If the @subcmd{WITH} keyword is omitted, then tests for all
1397 combinations of the listed variables are performed.
1398 If the @subcmd{WITH} keyword is given, and the @subcmd{(PAIRED)} keyword
1399 is also given, then the number of variables preceding @subcmd{WITH}
1400 must be the same as the number following it.
1401 In this case, tests for each respective pair of variables are
1402 performed.
1403 If the @subcmd{WITH} keyword is given, but the
1404 @subcmd{(PAIRED)} keyword is omitted, then tests for each combination
1405 of variable preceding @subcmd{WITH} against variable following
1406 @subcmd{WITH} are performed.
1407
1408 @node T-TEST
1409 @section T-TEST
1410
1411 @vindex T-TEST
1412
1413 @display
1414 T-TEST
1415         /MISSING=@{ANALYSIS,LISTWISE@} @{EXCLUDE,INCLUDE@}
1416         /CRITERIA=CIN(@var{confidence})
1417
1418
1419 (One Sample mode.)
1420         TESTVAL=@var{test_value}
1421         /VARIABLES=@var{var_list}
1422
1423
1424 (Independent Samples mode.)
1425         GROUPS=var(@var{value1} [, @var{value2}])
1426         /VARIABLES=@var{var_list}
1427
1428
1429 (Paired Samples mode.)
1430         PAIRS=@var{var_list} [WITH @var{var_list} [(PAIRED)] ]
1431
1432 @end display
1433
1434
1435 The @cmd{T-TEST} procedure outputs tables used in testing hypotheses about 
1436 means.  
1437 It operates in one of three modes:
1438 @itemize
1439 @item One Sample mode.
1440 @item Independent Groups mode.
1441 @item Paired mode.
1442 @end itemize
1443
1444 @noindent
1445 Each of these modes are described in more detail below.
1446 There are two optional subcommands which are common to all modes.
1447
1448 The @cmd{/CRITERIA} subcommand tells @pspp{} the confidence interval used
1449 in the tests.  The default value is 0.95.
1450
1451
1452 The @cmd{MISSING} subcommand determines the handling of missing
1453 variables.  
1454 If @subcmd{INCLUDE} is set, then user-missing values are included in the
1455 calculations, but system-missing values are not.
1456 If @subcmd{EXCLUDE} is set, which is the default, user-missing
1457 values are excluded as well as system-missing values. 
1458 This is the default.
1459
1460 If @subcmd{LISTWISE} is set, then the entire case is excluded from analysis
1461 whenever any variable  specified in the @subcmd{/VARIABLES}, @subcmd{/PAIRS} or 
1462 @subcmd{/GROUPS} subcommands contains a missing value.   
1463 If @subcmd{ANALYSIS} is set, then missing values are excluded only in the analysis for
1464 which they would be needed. This is the default.
1465
1466
1467 @menu
1468 * One Sample Mode::             Testing against a hypothesized mean
1469 * Independent Samples Mode::    Testing two independent groups for equal mean
1470 * Paired Samples Mode::         Testing two interdependent groups for equal mean
1471 @end menu
1472
1473 @node One Sample Mode
1474 @subsection One Sample Mode
1475
1476 The @subcmd{TESTVAL} subcommand invokes the One Sample mode.
1477 This mode is used to test a population mean against a hypothesized
1478 mean. 
1479 The value given to the @subcmd{TESTVAL} subcommand is the value against
1480 which you wish to test.
1481 In this mode, you must also use the @subcmd{/VARIABLES} subcommand to
1482 tell @pspp{} which variables you wish to test.
1483
1484 @node Independent Samples Mode
1485 @subsection Independent Samples Mode
1486
1487 The @subcmd{GROUPS} subcommand invokes Independent Samples mode or
1488 `Groups' mode. 
1489 This mode is used to test whether two groups of values have the
1490 same population mean.
1491 In this mode, you must also use the @subcmd{/VARIABLES} subcommand to
1492 tell @pspp{} the dependent variables you wish to test.
1493
1494 The variable given in the @subcmd{GROUPS} subcommand is the independent
1495 variable which determines to which group the samples belong.
1496 The values in parentheses are the specific values of the independent
1497 variable for each group.
1498 If the parentheses are omitted and no values are given, the default values 
1499 of 1.0 and 2.0 are assumed.
1500
1501 If the independent variable is numeric, 
1502 it is acceptable to specify only one value inside the parentheses.
1503 If you do this, cases where the independent variable is
1504 greater than or equal to this value belong to the first group, and cases
1505 less than this value belong to the second group.
1506 When using this form of the @subcmd{GROUPS} subcommand, missing values in
1507 the independent variable are excluded on a listwise basis, regardless
1508 of whether @subcmd{/MISSING=LISTWISE} was specified.
1509
1510
1511 @node Paired Samples Mode
1512 @subsection Paired Samples Mode
1513
1514 The @cmd{PAIRS} subcommand introduces Paired Samples mode.
1515 Use this mode when repeated measures have been taken from the same
1516 samples.
1517 If the @subcmd{WITH} keyword is omitted, then tables for all
1518 combinations of variables given in the @cmd{PAIRS} subcommand are
1519 generated. 
1520 If the @subcmd{WITH} keyword is given, and the @subcmd{(PAIRED)} keyword
1521 is also given, then the number of variables preceding @subcmd{WITH}
1522 must be the same as the number following it.
1523 In this case, tables for each respective pair of variables are
1524 generated.
1525 In the event that the @subcmd{WITH} keyword is given, but the
1526 @subcmd{(PAIRED)} keyword is omitted, then tables for each combination
1527 of variable preceding @subcmd{WITH} against variable following
1528 @subcmd{WITH} are generated.
1529
1530
1531 @node ONEWAY
1532 @section ONEWAY
1533
1534 @vindex ONEWAY
1535 @cindex analysis of variance
1536 @cindex ANOVA
1537
1538 @display
1539 ONEWAY
1540         [/VARIABLES = ] @var{var_list} BY @var{var}
1541         /MISSING=@{ANALYSIS,LISTWISE@} @{EXCLUDE,INCLUDE@}
1542         /CONTRAST= @var{value1} [, @var{value2}] ... [,@var{valueN}]
1543         /STATISTICS=@{DESCRIPTIVES,HOMOGENEITY@}
1544         /POSTHOC=@{BONFERRONI, GH, LSD, SCHEFFE, SIDAK, TUKEY, ALPHA ([@var{value}])@}
1545 @end display
1546
1547 The @cmd{ONEWAY} procedure performs a one-way analysis of variance of
1548 variables factored by a single independent variable.
1549 It is used to compare the means of a population
1550 divided into more than two groups. 
1551
1552 The dependent variables to be analysed should be given in the @subcmd{VARIABLES}
1553 subcommand.  
1554 The list of variables must be followed by the @subcmd{BY} keyword and
1555 the name of the independent (or factor) variable.
1556
1557 You can use the @subcmd{STATISTICS} subcommand to tell @pspp{} to display
1558 ancillary information.  The options accepted are:
1559 @itemize
1560 @item DESCRIPTIVES
1561 Displays descriptive statistics about the groups factored by the independent
1562 variable.
1563 @item HOMOGENEITY
1564 Displays the Levene test of Homogeneity of Variance for the
1565 variables and their groups.
1566 @end itemize
1567
1568 The @subcmd{CONTRAST} subcommand is used when you anticipate certain
1569 differences between the groups.
1570 The subcommand must be followed by a list of numerals which are the
1571 coefficients of the groups to be tested.
1572 The number of coefficients must correspond to the number of distinct
1573 groups (or values of the independent variable).
1574 If the total sum of the coefficients are not zero, then @pspp{} will
1575 display a warning, but will proceed with the analysis.
1576 The @subcmd{CONTRAST} subcommand may be given up to 10 times in order
1577 to specify different contrast tests.
1578 The @subcmd{MISSING} subcommand defines how missing values are handled.
1579 If @subcmd{LISTWISE} is specified then cases which have missing values for 
1580 the independent variable or any dependent variable will be ignored.
1581 If @subcmd{ANALYSIS} is specified, then cases will be ignored if the independent
1582 variable is missing or if the dependent variable currently being 
1583 analysed is missing.  The default is @subcmd{ANALYSIS}.
1584 A setting of @subcmd{EXCLUDE} means that variables whose values are
1585 user-missing are to be excluded from the analysis. A setting of
1586 @subcmd{INCLUDE} means they are to be included.  The default is @subcmd{EXCLUDE}.
1587
1588 Using the @code{POSTHOC} subcommand you can perform multiple
1589 pairwise comparisons on the data. The following comparison methods
1590 are available:
1591 @itemize
1592 @item @subcmd{LSD}
1593 Least Significant Difference.
1594 @item @subcmd{TUKEY}
1595 Tukey Honestly Significant Difference.
1596 @item @subcmd{BONFERRONI}
1597 Bonferroni test.
1598 @item @subcmd{SCHEFFE}
1599 Scheff@'e's test.
1600 @item @subcmd{SIDAK}
1601 Sidak test.
1602 @item @subcmd{GH}
1603 The Games-Howell test.
1604 @end itemize
1605
1606 @noindent
1607 The optional syntax @code{ALPHA(@var{value})} is used to indicate
1608 that @var{value} should be used as the
1609 confidence level for which the posthoc tests will be performed.
1610 The default is 0.05.
1611
1612 @node QUICK CLUSTER
1613 @section QUICK CLUSTER
1614 @vindex QUICK CLUSTER
1615
1616 @cindex K-means clustering
1617 @cindex clustering
1618
1619 @display
1620 QUICK CLUSTER @var{var_list}
1621       [/CRITERIA=CLUSTERS(@var{k}) [MXITER(@var{max_iter})]]
1622       [/MISSING=@{EXCLUDE,INCLUDE@} @{LISTWISE, PAIRWISE@}]
1623 @end display
1624
1625 The @cmd{QUICK CLUSTER} command performs k-means clustering on the
1626 dataset.  This is useful when you wish to allocate cases into clusters
1627 of similar values and you already know the number of clusters.
1628
1629 The minimum specification is @samp{QUICK CLUSTER} followed by the names
1630 of the variables which contain the cluster data.  Normally you will also
1631 want to specify @subcmd{/CRITERIA=CLUSTERS(@var{k})} where @var{k} is the
1632 number of clusters.  If this is not given, then @var{k} defaults to 2.
1633
1634 The command uses an iterative algorithm to determine the clusters for
1635 each case.  It will continue iterating until convergence, or until @var{max_iter}
1636 iterations have been done.  The default value of @var{max_iter} is 2.
1637
1638 The @subcmd{MISSING} subcommand determines the handling of missing variables.  
1639 If @subcmd{INCLUDE} is set, then user-missing values are considered at their face
1640 value and not as missing values.
1641 If @subcmd{EXCLUDE} is set, which is the default, user-missing
1642 values are excluded as well as system-missing values. 
1643
1644 If @subcmd{LISTWISE} is set, then the entire case is excluded from the analysis
1645 whenever any of the clustering variables contains a missing value.   
1646 If @subcmd{PAIRWISE} is set, then a case is considered missing only if all the
1647 clustering variables contain missing values.  Otherwise it is clustered
1648 on the basis of the non-missing values.
1649 The default is @subcmd{LISTWISE}.
1650
1651
1652 @node RANK
1653 @section RANK
1654
1655 @vindex RANK
1656 @display
1657 RANK
1658         [VARIABLES=] @var{var_list} [@{A,D@}] [BY @var{var_list}]
1659         /TIES=@{MEAN,LOW,HIGH,CONDENSE@}
1660         /FRACTION=@{BLOM,TUKEY,VW,RANKIT@}
1661         /PRINT[=@{YES,NO@}
1662         /MISSING=@{EXCLUDE,INCLUDE@}
1663
1664         /RANK [INTO @var{var_list}]
1665         /NTILES(k) [INTO @var{var_list}]
1666         /NORMAL [INTO @var{var_list}]
1667         /PERCENT [INTO @var{var_list}]
1668         /RFRACTION [INTO @var{var_list}]
1669         /PROPORTION [INTO @var{var_list}]
1670         /N [INTO @var{var_list}]
1671         /SAVAGE [INTO @var{var_list}]
1672 @end display
1673
1674 The @cmd{RANK} command ranks variables and stores the results into new
1675 variables. 
1676
1677 The @subcmd{VARIABLES} subcommand, which is mandatory, specifies one or
1678 more variables whose values are to be ranked.  
1679 After each variable, @samp{A} or @samp{D} may appear, indicating that
1680 the variable is to be ranked in ascending or descending order.
1681 Ascending is the default.
1682 If a @subcmd{BY} keyword appears, it should be followed by a list of variables
1683 which are to serve as group variables.  
1684 In this case, the cases are gathered into groups, and ranks calculated
1685 for each group.
1686
1687 The @subcmd{TIES} subcommand specifies how tied values are to be treated.  The
1688 default is to take the mean value of all the tied cases.
1689
1690 The @subcmd{FRACTION} subcommand specifies how proportional ranks are to be
1691 calculated.  This only has any effect if @subcmd{NORMAL} or @subcmd{PROPORTIONAL} rank
1692 functions are requested.
1693
1694 The @subcmd{PRINT} subcommand may be used to specify that a summary of the rank
1695 variables created should appear in the output.
1696
1697 The function subcommands are @subcmd{RANK}, @subcmd{NTILES}, @subcmd{NORMAL}, @subcmd{PERCENT}, @subcmd{RFRACTION},
1698 @subcmd{PROPORTION} and @subcmd{SAVAGE}.  Any number of function subcommands may appear.
1699 If none are given, then the default is RANK.
1700 The @subcmd{NTILES} subcommand must take an integer specifying the number of
1701 partitions into which values should be ranked.
1702 Each subcommand may be followed by the @subcmd{INTO} keyword and a list of
1703 variables which are the variables to be created and receive the rank
1704 scores.  There may be as many variables specified as there are
1705 variables named on the @subcmd{VARIABLES} subcommand.  If fewer are specified,
1706 then the variable names are automatically created.
1707
1708 The @subcmd{MISSING} subcommand determines how user missing values are to be
1709 treated. A setting of @subcmd{EXCLUDE} means that variables whose values are
1710 user-missing are to be excluded from the rank scores. A setting of
1711 @subcmd{INCLUDE} means they are to be included.  The default is @subcmd{EXCLUDE}.
1712
1713 @include regression.texi
1714
1715
1716 @node RELIABILITY
1717 @section RELIABILITY
1718
1719 @vindex RELIABILITY
1720 @display
1721 RELIABILITY
1722         /VARIABLES=@var{var_list}
1723         /SCALE (@var{name}) = @{@var{var_list}, ALL@}
1724         /MODEL=@{ALPHA, SPLIT[(@var{n})]@}
1725         /SUMMARY=@{TOTAL,ALL@}
1726         /MISSING=@{EXCLUDE,INCLUDE@}
1727 @end display
1728
1729 @cindex Cronbach's Alpha
1730 The @cmd{RELIABILITY} command performs reliability analysis on the data.
1731
1732 The @subcmd{VARIABLES} subcommand is required. It determines the set of variables 
1733 upon which analysis is to be performed.
1734
1735 The @subcmd{SCALE} subcommand determines which variables reliability is to be 
1736 calculated for.  If it is omitted, then analysis for all variables named
1737 in the @subcmd{VARIABLES} subcommand will be used.
1738 Optionally, the @var{name} parameter may be specified to set a string name 
1739 for the scale.
1740
1741 The @subcmd{MODEL} subcommand determines the type of analysis. If @subcmd{ALPHA} is specified, 
1742 then Cronbach's Alpha is calculated for the scale.  If the model is @subcmd{SPLIT}, 
1743 then the variables  are divided into 2 subsets.  An optional parameter 
1744 @var{n} may be given, to specify how many variables to be in the first subset.
1745 If @var{n} is omitted, then it defaults to one half of the variables in the 
1746 scale, or one half minus one if there are an odd number of variables.
1747 The default model is @subcmd{ALPHA}.
1748
1749 By default, any cases with user missing, or system missing values for 
1750 any variables given 
1751 in the @subcmd{VARIABLES} subcommand will be omitted from analysis.
1752 The @subcmd{MISSING} subcommand determines whether user missing values are to 
1753 be included or excluded in the analysis.
1754
1755 The @subcmd{SUMMARY} subcommand determines the type of summary analysis to be performed.
1756 Currently there is only one type: @subcmd{SUMMARY=TOTAL}, which displays per-item
1757 analysis tested against the totals.
1758
1759
1760
1761 @node ROC
1762 @section ROC
1763
1764 @vindex ROC
1765 @cindex Receiver Operating Characteristic
1766 @cindex Area under curve
1767
1768 @display
1769 ROC     @var{var_list} BY @var{state_var} (@var{state_value})
1770         /PLOT = @{ CURVE [(REFERENCE)], NONE @}
1771         /PRINT = [ SE ] [ COORDINATES ]
1772         /CRITERIA = [ CUTOFF(@{INCLUDE,EXCLUDE@}) ]
1773           [ TESTPOS (@{LARGE,SMALL@}) ]
1774           [ CI (@var{confidence}) ]
1775           [ DISTRIBUTION (@{FREE, NEGEXPO @}) ]
1776         /MISSING=@{EXCLUDE,INCLUDE@}
1777 @end display
1778
1779
1780 The @cmd{ROC} command is used to plot the receiver operating characteristic curve 
1781 of a dataset, and to estimate the area under the curve.
1782 This is useful for analysing the efficacy of a variable as a predictor of a state of nature.
1783
1784 The mandatory @var{var_list} is the list of predictor variables.
1785 The variable @var{state_var} is the variable whose values represent the actual states, 
1786 and @var{state_value} is the value of this variable which represents the positive state.
1787
1788 The optional subcommand @subcmd{PLOT} is used to determine if and how the @subcmd{ROC} curve is drawn.
1789 The keyword @subcmd{CURVE} means that the @subcmd{ROC} curve should be drawn, and the optional keyword @subcmd{REFERENCE},
1790 which should be enclosed in parentheses, says that the diagonal reference line should be drawn.
1791 If the keyword @subcmd{NONE} is given, then no @subcmd{ROC} curve is drawn.
1792 By default, the curve is drawn with no reference line.
1793
1794 The optional subcommand @subcmd{PRINT} determines which additional tables should be printed.
1795 Two additional tables are available. 
1796 The @subcmd{SE} keyword says that standard error of the area under the curve should be printed as well as
1797 the area itself.
1798 In addition, a p-value under the null hypothesis that the area under the curve equals 0.5 will be
1799 printed.
1800 The @subcmd{COORDINATES} keyword says that a table of coordinates of the @subcmd{ROC} curve should be printed.
1801
1802 The @subcmd{CRITERIA} subcommand has four optional parameters:
1803 @itemize @bullet
1804 @item The @subcmd{TESTPOS} parameter may be @subcmd{LARGE} or @subcmd{SMALL}.
1805 @subcmd{LARGE} is the default, and says that larger values in the predictor variables are to be 
1806 considered positive.  @subcmd{SMALL} indicates that smaller values should be considered positive.
1807
1808 @item The @subcmd{CI} parameter specifies the confidence interval that should be printed.
1809 It has no effect if the @subcmd{SE} keyword in the @subcmd{PRINT} subcommand has not been given.
1810
1811 @item The @subcmd{DISTRIBUTION} parameter determines the method to be used when estimating the area
1812 under the curve.  
1813 There are two possibilities, @i{viz}: @subcmd{FREE} and @subcmd{NEGEXPO}.
1814 The @subcmd{FREE} method uses a non-parametric estimate, and the @subcmd{NEGEXPO} method a bi-negative 
1815 exponential distribution estimate.
1816 The @subcmd{NEGEXPO} method should only be used when the number of positive actual states is
1817 equal to the number of negative actual states.
1818 The default is @subcmd{FREE}.
1819
1820 @item The @subcmd{CUTOFF} parameter is for compatibility and is ignored.
1821 @end itemize
1822
1823 The @subcmd{MISSING} subcommand determines whether user missing values are to 
1824 be included or excluded in the analysis.  The default behaviour is to
1825 exclude them.
1826 Cases are excluded on a listwise basis; if any of the variables in @var{var_list} 
1827 or if the variable @var{state_var} is missing, then the entire case will be 
1828 excluded.