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