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