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