Statistics
**********

This chapter documents the statistical procedures that PSPP supports so far.

DESCRIPTIVES
============

     DESCRIPTIVES
             /VARIABLES=var_list
             /MISSING={VARIABLE,LISTWISE} {INCLUDE,NOINCLUDE}
             /FORMAT={LABELS,NOLABELS} {NOINDEX,INDEX} {LINE,SERIAL}
             /SAVE
             /STATISTICS={ALL,MEAN,SEMEAN,STDDEV,VARIANCE,KURTOSIS,
                          SKEWNESS,RANGE,MINIMUM,MAXIMUM,SUM,DEFAULT,
                          SESKEWNESS,SEKURTOSIS}
             /SORT={NONE,MEAN,SEMEAN,STDDEV,VARIANCE,KURTOSIS,SKEWNESS,
                    RANGE,MINIMUM,MAXIMUM,SUM,SESKEWNESS,SEKURTOSIS,NAME}
                   {A,D}

The DESCRIPTIVES procedure reads the active file and outputs descriptive statistics requested by the user.  In addition, it can optionally compute Z-scores.

The VARIABLES subcommand, which is required, specifies the list of variables to be analyzed.  Keyword VARIABLES is optional.

All other subcommands are optional:

The MISSING subcommand determines the handling of missing variables.  If INCLUDE is set, then user-missing values are included in the calculations.  If NOINCLUDE is set, which is the default, user-missing values are excluded.  If VARIABLE is set, then missing values are excluded on a variable by variable basis; if LISTWISE is set, then the entire case is excluded whenever any value in that case has a system-missing or, if INCLUDE is set, user-missing value.

The FORMAT subcommand affects the output format.  Currently the LABELS/NOLABELS and NOINDEX/INDEX settings are not used.  When SERIAL is set, both valid and missing number of cases are listed in the output; when NOSERIAL is set, only valid cases are listed.

The SAVE subcommand causes DESCRIPTIVES to calculate Z scores for all the specified variables.  The Z scores are saved to new variables. Variable names are generated by trying first the original variable name with Z prepended and truncated to a maximum of 8 characters, then the names ZSC000 through ZSC999, STDZ00 through STDZ09, ZZZZ00 through ZZZZ09, ZQZQ00 through ZQZQ09, in that sequence.  In addition, Z score variable names can be specified explicitly on VARIABLES in the variable list by enclosing them in parentheses after each variable.

The STATISTICS subcommand specifies the statistics to be displayed:

ALL
     All of the statistics below.

MEAN
     Arithmetic mean.

SEMEAN
     Standard error of the mean.

STDDEV
     Standard deviation.

VARIANCE
     Variance.

KURTOSIS
     Kurtosis and standard error of the kurtosis.

SKEWNESS
     Skewness and standard error of the skewness.

RANGE
     Range.

MINIMUM
     Minimum value.

MAXIMUM
     Maximum value.

SUM
     Sum.

DEFAULT
     Mean, standard deviation of the mean, minimum, maximum.

SEKURTOSIS
     Standard error of the kurtosis.

SESKEWNESS
     Standard error of the skewness.

The SORT subcommand specifies how the statistics should be sorted.  Most of the possible values should be self-explanatory.  NAME causes the statistics to be sorted by name.  By default, the statistics are listed in the order that they are specified on the VARIABLES subcommand.  The A and D settings request an ascending or descending sort order, respectively.

FREQUENCIES
===========

     FREQUENCIES
             /VARIABLES=var_list
             /FORMAT={TABLE,NOTABLE,LIMIT(limit)}
                     {STANDARD,CONDENSE,ONEPAGE[(onepage_limit)]}
                     {LABELS,NOLABELS}
                     {AVALUE,DVALUE,AFREQ,DFREQ}
                     {SINGLE,DOUBLE}
                     {OLDPAGE,NEWPAGE}
             /MISSING={EXCLUDE,INCLUDE}
             /STATISTICS={DEFAULT,MEAN,SEMEAN,MEDIAN,MODE,STDDEV,VARIANCE,
                          KURTOSIS,SKEWNESS,RANGE,MINIMUM,MAXIMUM,SUM,
                          SESKEWNESS,SEKURTOSIS,ALL,NONE}
             /NTILES=ntiles
             /PERCENTILES=percent...
             /HISTOGRAM=[MINIMUM(x_min)] [MAXIMUM(x_max)]
                        [{FREQ,PCNT}] [{NONORMAL,NORMAL}]
             /PIECHART=[MINIMUM(x_min)] [MAXIMUM(x_max)] {NOMISSING,MISSING}

     (These options are not currently implemented.)
             /BARCHART=...
             /HBAR=...
             /GROUPED=...

     (Integer mode.)
             /VARIABLES=var_list (low,high)...

The FREQUENCIES procedure outputs frequency tables for specified variables. FREQUENCIES can also calculate and display descriptive statistics (including median and mode) and percentiles.

FREQUENCIES also support graphical output in the form of histograms and pie charts.  In the future, it will be able to produce bar charts and output percentiles for grouped data.

The VARIABLES subcommand is the only required subcommand.  Specify the variables to be analyzed.  In most cases, this is all that is required. This is known as general mode.

Occasionally, one may want to invoke a special mode called integer mode.  Normally, in general mode, PSPP will automatically determine what values occur in the data.  In integer mode, the user specifies the range of values that the data assumes.  To invoke this mode, specify a range of data values in parentheses, separated by a comma.  Data values inside the range are truncated to the nearest integer, then assigned to that value.  If values occur outside this range, they are discarded.

The FORMAT subcommand controls the output format.  It has several possible settings:

  * TABLE, the default, causes a frequency table to be output for every variable specified.  NOTABLE prevents them from being output.  LIMIT with a numeric argument causes them to be output except when there are more than the specified number of values in the table.

  * STANDARD frequency tables contain more complete information, but also to take up more space on the printed page.  CONDENSE frequency tables are less informative but take up less space.  ONEPAGE with a numeric argument will output standard frequency tables if there are the specified number of values or less, condensed tables otherwise.  ONEPAGE without an argument defaults to a threshold of 50 values.

  * LABELS causes value labels to be displayed in STANDARD frequency tables.  NOLABLES prevents this.

  * Normally frequency tables are sorted in ascending order by value.  This is AVALUE.  DVALUE tables are sorted in descending order by value. AFREQ and DFREQ tables are sorted in ascending and descending order, respectively, by frequency count.

  * SINGLE spaced frequency tables are closely spaced.  DOUBLE spaced frequency tables have wider spacing.

  * OLDPAGE and NEWPAGE are not currently used.

The MISSING subcommand controls the handling of user-missing values. When EXCLUDE, the default, is set, user-missing values are not included in frequency tables or statistics.  When INCLUDE is set, user-missing are included.  System-missing values are never included in statistics, but are listed in frequency tables.

The available STATISTICS are the same as available in DESCRIPTIVES (see DESCRIPTIVES), with the addition of MEDIAN, the data's median value, and MODE, the mode.  (If there are multiple modes, the smallest value is reported.)  By default, the mean, standard deviation of the mean, minimum, and maximum are reported for each variable.

PERCENTILES causes the specified percentiles to be reported. The percentiles should  be presented at a list of numbers between 0 and 100 inclusive. The NTILES subcommand causes the percentiles to be reported at the boundaries of the data set divided into the specified number of ranges. For instance, /NTILES=4 would cause quartiles to be reported.

The HISTOGRAM subcommand causes the output to include a histogram for each specified variable.  The X axis by default ranges from the minimum to the maximum value observed in the data, but the MINIMUM and MAXIMUM keywords can set an explicit range.  The Y axis by default is labeled in frequencies; use the PERCENT keyword to causes it to be labeled in percent of the total observed count.  Specify NORMAL to superimpose a normal curve on the histogram.

The PIECHART adds a pie chart for each variable to the data.  Each slice represents one value, with the size of the slice proportional to the value's frequency.  By default, all non-missing values are given slices.  The MINIMUM and MAXIMUM keywords can be used to limit the displayed slices to a given range of values.  The MISSING keyword adds slices for missing values.

EXAMINE
=======

     EXAMINE
             VARIABLES=var_list [BY factor_list ]
             /STATISTICS={DESCRIPTIVES, EXTREME[(n)], ALL, NONE}
             /PLOT={BOXPLOT, NPPLOT, HISTOGRAM, ALL, NONE}
             /CINTERVAL n
             /COMPARE={GROUPS,VARIABLES}
             /ID={case_number, var_name}
             /{TOTAL,NOTOTAL}
             /PERCENTILE=[value_list]={HAVERAGE, WAVERAGE, ROUND, AEMPIRICAL, EMPIRICAL }
             /MISSING={LISTWISE, PAIRWISE} [{EXCLUDE, INCLUDE}]
     		[{NOREPORT,REPORT}]

The EXAMINE command is used to test how closely a distribution is to a normal distribution.  It also shows you outliers and extreme values.

The VARIABLES subcommand specifies the dependent variables and the independent variable to use as factors for the analysis.   Variables listed before the first BY keyword are the dependent variables. The dependent variables may optionally be followed by a list of factors which tell PSPP how to break down the analysis for each dependent variable.  The format for each factor is

     var [BY var].

The STATISTICS subcommand specifies the analysis to be done. DESCRIPTIVES will produce a table showing some parametric and non-parametrics statistics.  EXTREME produces a table showing extreme values of the dependent variable.  A number in parentheses determines how many upper and lower extremes to show.  The default number is 5.

The PLOT subcommand specifies which plots are to be produced if any.

The COMPARE subcommand is only relevant if producing boxplots, and it is only useful there is more than one dependent variable and at least one factor.   If /COMPARE=GROUPS is specified, then one plot per dependent variable is produced, containing boxplots for all the factors. If /COMPARE=VARIABLES is specified, then one plot per factor is produced, each each containing one boxplot per dependent variable. If the /COMPARE subcommand is ommitted, then PSPP uses the default value of /COMPARE=GROUPS.

The CINTERVAL subcommand specifies the confidence interval to use in calculation of the descriptives command.  The default it 95%.

The PERCENTILES subcommand specifies which percentiles are to be calculated, and which algorithm to use for calculating them.  The default is to calculate the 5, 10, 25, 50, 75, 90, 95 percentiles using the HAVERAGE algorithm.

The TOTAL and NOTOTAL subcommands are mutually exclusive.  If NOTOTAL is given and factors have been specified in the VARIABLES subcommand, then then statistics for the unfactored dependent variables are produced in addition to the factored variables.  If there are no factors specified then TOTAL and NOTOTAL have no effect.

Warning! If many dependent variable are given, or factors are given for which there are many distinct values, then EXAMINE will produce a very large quantity of output.

CROSSTABS
=========

     CROSSTABS
             /TABLES=var_list BY var_list [BY var_list]...
             /MISSING={TABLE,INCLUDE,REPORT}
             /WRITE={NONE,CELLS,ALL}
             /FORMAT={TABLES,NOTABLES}
                     {LABELS,NOLABELS,NOVALLABS}
                     {PIVOT,NOPIVOT}
                     {AVALUE,DVALUE}
                     {NOINDEX,INDEX}
                     {BOX,NOBOX}
             /CELLS={COUNT,ROW,COLUMN,TOTAL,EXPECTED,RESIDUAL,SRESIDUAL,
                     ASRESIDUAL,ALL,NONE}
             /STATISTICS={CHISQ,PHI,CC,LAMBDA,UC,BTAU,CTAU,RISK,GAMMA,D,
                          KAPPA,ETA,CORR,ALL,NONE}

     (Integer mode.)
             /VARIABLES=var_list (low,high)...

The CROSSTABS procedure displays crosstabulation tables requested by the user.  It can calculate several statistics for each cell in the crosstabulation tables.  In addition, a number of statistics can be calculated for each table itself.

The TABLES subcommand is used to specify the tables to be reported.  Any number of dimensions is permitted, and any number of variables per dimension is allowed.  The TABLES subcommand may be repeated as many times as needed.  This is the only required subcommand in general mode.

Occasionally, one may want to invoke a special mode called integer mode.  Normally, in general mode, PSPP automatically determines what values occur in the data.  In integer mode, the user specifies the range of values that the data assumes.  To invoke this mode, specify the VARIABLES subcommand, giving a range of data values in parentheses for each variable to be used on the TABLES subcommand.  Data values inside the range are truncated to the nearest integer, then assigned to that value.  If values occur outside this range, they are discarded.  When it is present, the VARIABLES subcommand must precede the TABLES subcommand.

In general mode, numeric and string variables may be specified on TABLES.  Although long string variables are allowed, only their initial short-string parts are used.  In integer mode, only numeric variables are allowed.

The MISSING subcommand determines the handling of user-missing values. When set to TABLE, the default, missing values are dropped on a table by table basis.  When set to INCLUDE, user-missing values are included in tables and statistics.  When set to REPORT, which is allowed only in integer mode, user-missing values are included in tables but marked with an M (for ``missing'') and excluded from statistical calculations.

Currently the WRITE subcommand is ignored.

The FORMAT subcommand controls the characteristics of the crosstabulation tables to be displayed.  It has a number of possible settings:

  * TABLES, the default, causes crosstabulation tables to be output. NOTABLES suppresses them.

  * LABELS, the default, allows variable labels and value labels to appear in the output.  NOLABELS suppresses them.  NOVALLABS displays variable labels but suppresses value labels.

  * PIVOT, the default, causes each TABLES subcommand to be displayed in a pivot table format.  NOPIVOT causes the old-style crosstabulation format to be used.

  * AVALUE, the default, causes values to be sorted in ascending order. DVALUE asserts a descending sort order.

  * INDEX/NOINDEX is currently ignored.

  * BOX/NOBOX is currently ignored.

The CELLS subcommand controls the contents of each cell in the displayed crosstabulation table.  The possible settings are:

COUNT
     Frequency count.

ROW
     Row percent.

COLUMN
     Column percent.

TOTAL
     Table percent.

EXPECTED
     Expected value.

RESIDUAL
     Residual.

SRESIDUAL
     Standardized residual.

ASRESIDUAL
     Adjusted standardized residual.

ALL
     All of the above.

NONE
     Suppress cells entirely.

/CELLS without any settings specified requests COUNT, ROW, COLUMN, and TOTAL.  If CELLS is not specified at all then only COUNT will be selected.

The STATISTICS subcommand selects statistics for computation:

CHISQ

     Pearson chi-square, likelihood ratio, Fisher's exact test, continuity correction, linear-by-linear association.

PHI
     Phi.

CC
     Contingency coefficient.

LAMBDA
     Lambda.

UC
     Uncertainty coefficient.

BTAU
     Tau-b.

CTAU
     Tau-c.

RISK
     Risk estimate.

GAMMA
     Gamma.

D
     Somers' D.

KAPPA
     Cohen's Kappa.

ETA
     Eta.

CORR
     Spearman correlation, Pearson's r.

ALL
     All of the above.

NONE
     No statistics.

Selected statistics are only calculated when appropriate for the statistic.  Certain statistics require tables of a particular size, and some statistics are calculated only in integer mode.

/STATISTICS without any settings selects CHISQ.  If the STATISTICS subcommand is not given, no statistics are calculated.

Please note: Currently the implementation of CROSSTABS has the followings bugs:

  * Pearson's R (but not Spearman) is off a little.

  * T values for Spearman's R and Pearson's R are wrong.

  * Significance of symmetric and directional measures is not calculated.

  * Asymmetric ASEs and T values for lambda are wrong.

  * ASE of Goodman and Kruskal's tau is not calculated.

  * ASE of symmetric somers' d is wrong.

  * Approximate T of uncertainty coefficient is wrong.

Fixes for any of these deficiencies would be welcomed.

T-TEST
======

     T-TEST
             /MISSING={ANALYSIS,LISTWISE} {EXCLUDE,INCLUDE}
             /CRITERIA=CIN(confidence)

     (One Sample mode.)
             TESTVAL=test_value
             /VARIABLES=var_list

     (Independent Samples mode.)
             GROUPS=var(value1 [, value2])
             /VARIABLES=var_list

     (Paired Samples mode.)
             PAIRS=var_list [WITH var_list [(PAIRED)] ]

The T-TEST procedure outputs tables used in testing hypotheses about means. It operates in one of three modes:

  * One Sample mode.

  * Independent Groups mode.

  * Paired mode.

Each of these modes are described in more detail below. There are two optional subcommands which are common to all modes.

The /CRITERIA subcommand tells PSPP the confidence interval used in the tests.  The default value is 0.95.

The MISSING subcommand determines the handling of missing variables. If INCLUDE is set, then user-missing values are included in the calculations, but system-missing values are not. If EXCLUDE is set, which is the default, user-missing values are excluded as well as system-missing values. This is the default.

If LISTWISE is set, then the entire case is excluded from analysis whenever any variable  specified in the /VARIABLES, /PAIRS or /GROUPS subcommands contains a missing value. If ANALYSIS is set, then missing values are excluded only in the analysis for which they would be needed. This is the default.

One Sample Mode
---------------

The TESTVAL subcommand invokes the One Sample mode. This mode is used to test a population mean against a hypothesised mean. The value given to the TESTVAL subcommand is the value against which you wish to test. In this mode, you must also use the /VARIABLES subcommand to tell PSPP which variables you wish to test.

Independent Samples Mode
------------------------

The GROUPS subcommand invokes Independent Samples mode or `Groups' mode. This mode is used to test whether two groups of values have the same population mean. In this mode, you must also use the /VARIABLES subcommand to tell PSPP the dependent variables you wish to test.

The variable given in the GROUPS subcommand is the independent variable which determines to which group the samples belong. The values in parentheses are the specific values of the independent variable for each group. If the parentheses are omitted and no values are given, the default values of 1.0 and 2.0 are assumed.

If the independent variable is numeric, it is acceptable to specify only one value inside the parentheses. If you do this, cases where the independent variable is less than  or equal to this value belong to the first group, and cases greater than this value belong to the second group. When using this form of the GROUPS subcommand, missing values in the independent variable are excluded on a listwise basis, regardless of whether /MISSING=LISTWISE was specified.

Paired Samples Mode
-------------------

The PAIRS subcommand introduces Paired Samples mode. Use this mode when repeated measures have been taken from the same samples. If the the WITH keyword is omitted, then tables for all combinations of variables given in the PAIRS subcommand are generated. If the WITH keyword is given, and the (PAIRED) keyword is also given, then the number of variables preceding WITH must be the same as the number following it. In this case, tables for each respective pair of variables are generated. In the event that the WITH keyword is given, but the (PAIRED) keyword is omitted, then tables for each combination of variable preceding WITH against variable following WITH are generated.

ONEWAY
======

     ONEWAY
             [/VARIABLES = ] var_list BY var
             /MISSING={ANALYSIS,LISTWISE} {EXCLUDE,INCLUDE}
             /CONTRASTS= value1 [, value2] ... [,valueN]
             /STATISTICS={DESCRIPTIVES,HOMOGENEITY}

The ONEWAY procedure performs a one-way analysis of variance of variables factored by a single independent variable. It is used to compare the means of a population divided into more than two groups.

The  variables to be analysed should be given in the VARIABLES subcommand. The list of variables must be followed by the BY keyword and the name of the independent (or factor) variable.

You can use the STATISTICS subcommand to tell PSPP to display ancilliary information.  The options accepted are:

  * DESCRIPTIVES Displays descriptive statistics about the groups factored by the independent variable.

  * HOMOGENEITY Displays the Levene test of Homogeneity of Variance for the variables and their groups.

The CONTRASTS subcommand is used when you anticipate certain differences between the groups. The subcommand must be followed by a list of numerals which are the coefficients of the groups to be tested. The number of coefficients must correspond to the number of distinct groups (or values of the independent variable). If the total sum of the coefficients are not zero, then PSPP will display a warning, but will proceed with the analysis. The CONTRASTS subcommand may be given up to 10 times in order to specify different contrast tests.

RANK
====

     RANK
             [VARIABLES=] var_list [{A,D}] [BY var_list]
             /TIES={MEAN,LOW,HIGH,CONDENSE}
             /FRACTION={BLOM,TUKEY,VW,RANKIT}
             /PRINT[={YES,NO}
             /MISSING={EXCLUDE,INCLUDE}

             /RANK [INTO var_list]
             /NTILES(k) [INTO var_list]
             /NORMAL [INTO var_list]
             /PERCENT [INTO var_list]
             /RFRACTION [INTO var_list]
             /PROPORTION [INTO var_list]
             /N [INTO var_list]
             /SAVAGE [INTO var_list]

The RANK command ranks variables and stores the results into new variables.

The VARIABLES subcommand, which is mandatory, specifies one or more variables whose values are to be ranked. After each variable, A or D may appear, indicating that the variable is to be ranked in ascending or descending order. Ascending is the default. If a BY keyword appears, it should be followed by a list of variables which are to serve as group variables. In this case, the cases are gathered into groups, and ranks calculated for each group.

The TIES subcommand specifies how tied values are to be treated.  The default is to take the mean value of all the tied cases.

The FRACTION subcommand specifies how proportional ranks are to be calculated.  This only has any effect if NORMAL or PROPORTIONAL rank functions are requested.

The PRINT subcommand may be used to specify that a summary of the rank variables created should appear in the output.

The function subcommands are RANK, NTILES, NORMAL, PERCENT, RFRACTION, PROPORTION and SAVAGE.  Any number of function subcommands may appear. If none are given, then the default is RANK. The NTILES subcommand must take an integer specifying the number of partitions into which values should be ranked. Each subcommand may be followed by the INTO keyword and a list of variables which are the variables to be created and receive the rank scores.  There may be as many variables specified as there are variables named on the VARIABLES subcommand.  If fewer are specified, then the variable names are automatically created.

The MISSING subcommand determines how user missing values are to be treated. A setting of EXCLUDE means that variables whose values are user-missing are to be excluded from the rank scores. A setting of INCLUDE means they are to be included.  The default is EXCLUDE.

     [file regression.texi not included]