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