Implemented a dialog box for the ONEWAY command.
[pspp-builds.git] / doc / statistics.texi
index 08d66d797e922554512fc209760b22a3ed182a93..28398fb75e4a5c8abf82085a557715b6049bd796 100644 (file)
@@ -1,22 +1,22 @@
-@node Statistics, Utilities, Conditionals and Looping, Top
+@node Statistics
 @chapter Statistics
 
 This chapter documents the statistical procedures that PSPP supports so
 far.
 
-@c If you add any new commands, then don't forget to remove the entry in 
-@c not-implemented.texi
-
 @menu
 * DESCRIPTIVES::                Descriptive statistics.
 * FREQUENCIES::                 Frequency tables.
 * EXAMINE::                     Testing data for normality.
 * CROSSTABS::                   Crosstabulation tables.
+* NPAR TESTS::                  Nonparametric tests.
 * T-TEST::                      Test hypotheses about means.
 * ONEWAY::                      One way analysis of variance.
+* RANK::                        Compute rank scores.
+* REGRESSION::                  Linear regression.
 @end menu
 
-@node DESCRIPTIVES, FREQUENCIES, Statistics, Statistics
+@node DESCRIPTIVES
 @section DESCRIPTIVES
 
 @vindex DESCRIPTIVES
@@ -106,7 +106,7 @@ in the order that they are specified on the VARIABLES subcommand.  The A
 and D settings request an ascending or descending sort order,
 respectively.
 
-@node FREQUENCIES, EXAMINE, DESCRIPTIVES, Statistics
+@node FREQUENCIES
 @section FREQUENCIES
 
 @vindex FREQUENCIES
@@ -125,15 +125,14 @@ FREQUENCIES
                      SESKEWNESS,SEKURTOSIS,ALL,NONE@}
         /NTILES=ntiles
         /PERCENTILES=percent@dots{}
+        /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=@dots{}
-        /HISTOGRAM=@dots{}
         /HBAR=@dots{}
         /GROUPED=@dots{}
-
-(Integer mode.)
-        /VARIABLES=var_list (low,high)@dots{}
 @end display
 
 The @cmd{FREQUENCIES} procedure outputs frequency tables for specified
@@ -141,21 +140,12 @@ variables.
 @cmd{FREQUENCIES} can also calculate and display descriptive statistics
 (including median and mode) and percentiles.
 
-In the future, @cmd{FREQUENCIES} will also support graphical output in the
-form of bar charts and histograms.  In addition, it will be able to
-support percentiles for grouped data.
+@cmd{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 @dfn{general mode}.
-
-Occasionally, one may want to invoke a special mode called @dfn{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.
+variables to be analyzed.
 
 The FORMAT subcommand controls the output format.  It has several
 possible settings:  
@@ -205,6 +195,7 @@ 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.
 
+@cindex percentiles
 PERCENTILES causes the specified percentiles to be reported.
 The percentiles should  be presented at a list of numbers between 0
 and 100 inclusive.  
@@ -212,8 +203,22 @@ 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, @code{/NTILES=4} would cause quartiles to be reported.
 
-
-@node EXAMINE, CROSSTABS, FREQUENCIES, Statistics
+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.
+
+@node EXAMINE
 @comment  node-name,  next,  previous,  up
 @section EXAMINE
 @vindex EXAMINE
@@ -222,23 +227,73 @@ For instance, @code{/NTILES=4} would cause quartiles to be reported.
 
 @display
 EXAMINE
-        VARIABLES=var_list [[BY var_list] [BY var_list]]
+        VARIABLES=var_list [BY factor_list ]
         /STATISTICS=@{DESCRIPTIVES, EXTREME[(n)], ALL, NONE@}
-        /PLOT=@{STEMLEAF, BOXPLOT, NPPLOT, SPREADLEVEL(n), HISTOGRAM, 
-              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@}]
+
 @end display
 
 The @cmd{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 
+@display
+var [BY var].
+@end display
+
+
+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.
 
-@node CROSSTABS, T-TEST, EXAMINE, Statistics
+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%.
+
+@cindex percentiles
+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.
+
+@strong{Warning!}
+If many dependent variable are given, or factors are given for which
+there are many distinct values, then @cmd{EXAMINE} will produce a very
+large quantity of output.
+
+
+@node CROSSTABS
 @section CROSSTABS
 
 @vindex CROSSTABS
@@ -363,6 +418,9 @@ The STATISTICS subcommand selects statistics for computation:
 
 @table @asis
 @item CHISQ
+@cindex chisquare
+@cindex chi-square
+
 Pearson chi-square, likelihood ratio, Fisher's exact test, continuity
 correction, linear-by-linear association.
 @item PHI
@@ -424,11 +482,122 @@ Approximate T of uncertainty coefficient is wrong.
 
 Fixes for any of these deficiencies would be welcomed.
 
-@node T-TEST, ONEWAY, CROSSTABS, Statistics
+@node NPAR TESTS
+@section NPAR TESTS
+
+@vindex NPAR TESTS
+@cindex nonparametric tests
+
+@display 
+NPAR TESTS
+     
+     nonparametric test subcommands
+     .
+     .
+     .
+     
+     [ /STATISTICS=@{DESCRIPTIVES@} ]
+
+     [ /MISSING=@{ANALYSIS, LISTWISE@} @{INCLUDE, EXCLUDE@} ]
+@end display
+
+NPAR TESTS performs nonparametric tests. 
+Non parametric tests make very few assumptions about the distribution of the 
+data.
+One or more tests may be specified by using the corresponding subcommand.
+If the /STATISTICS subcommand is also specified, then summary statistics are 
+produces for each variable that is the subject of any test.
+
+
+@menu
+* BINOMIAL::                Binomial Test
+* CHISQUARE::               Chisquare Test
+@end menu
+
+
+@node    BINOMIAL
+@subsection Binomial test
+@vindex BINOMIAL
+@cindex binomial test
+
+@display 
+     [ /BINOMIAL[(p)]=var_list[(value1[, value2)] ] ]
+@end display 
+
+The binomial test compares the observed distribution of a dichotomous 
+variable with that of a binomial distribution.
+The variable @var{p} specifies the test proportion of the binomial 
+distribution.  
+The default value of 0.5 is assumed if @var{p} is omitted.
+
+If a single value appears after the variable list, then that value is
+used as the threshold to partition the observed values. Values less
+than or equal to the threshold value form the first category.  Values
+greater than the threshold form the second category. 
+
+If two values appear after the variable list, then they will be used
+as the values which a variable must take to be in the respective
+category. 
+Cases for which a variable takes a value equal to neither of the specified  
+values, take no part in the test for that variable.
+
+If no values appear, then the variable must assume dichotomous
+values.
+If more than two distinct, non-missing values for a variable
+under test are encountered then an error occurs.
+
+If the test proportion is equal to 0.5, then a one tailed test is
+reported.   For any other test proportion, a one tailed test is
+reported.   
+For one tailed tests, if the test proportion is less than
+or equal to the observed proportion, then the significance of
+observing the observed proportion or more is reported.
+If the test proportion is more than the observed proportion, then the
+significance of observing the observed proportion or less is reported.
+That is to say, the test is always performed in the observed
+direction. 
+
+PSPP uses a very precise approximation to the gamma function to
+compute the binomial significance.  Thus, exact results are reported
+even for very large sample sizes.
+
+
+
+@node    CHISQUARE
+@subsection Chisquare test
+@vindex CHISQUARE
+@cindex chisquare test
+
+
+@display
+     [ /CHISQUARE=var_list[(lo,hi)] [/EXPECTED=@{EQUAL|f1, f2 @dots{} fn@}] ]
+@end display 
+
+
+The chisquare test produces a chi-square statistic for the differences 
+between the expected and observed frequencies of the categories of a variable. 
+Optionally, a range of values may appear after the variable list.  
+If a range is given, then non integer values are truncated, and values
+outside the  specified range are excluded from the analysis.
+
+The /EXPECTED subcommand specifies the expected values of each
+category.  
+There must be exactly one non-zero expected value, for each observed
+category, or the EQUAL keywork must be specified.
+You may use the notation @var{n}*@var{f} to specify @var{n}
+consecutive expected categories all taking a frequency of @var{f}.
+The frequencies given are proportions, not absolute frequencies.  The
+sum of the frequencies need not be 1.
+If no /EXPECTED subcommand is given, then then equal frequencies 
+are expected.
+
+
+@node T-TEST
 @comment  node-name,  next,  previous,  up
 @section T-TEST
 
 @vindex T-TEST
+
 @display
 T-TEST
         /MISSING=@{ANALYSIS,LISTWISE@} @{EXCLUDE,INCLUDE@}
@@ -489,7 +658,7 @@ which they would be needed. This is the default.
 * Paired Samples Mode::         Testing two interdependent groups for equal mean
 @end menu
 
-@node One Sample Mode, Independent Samples Mode, T-TEST, T-TEST
+@node One Sample Mode
 @subsection One Sample Mode
 
 The @cmd{TESTVAL} subcommand invokes the One Sample mode.
@@ -500,7 +669,7 @@ which you wish to test.
 In this mode, you must also use the @cmd{/VARIABLES} subcommand to
 tell PSPP which variables you wish to test.
 
-@node Independent Samples Mode, Paired Samples Mode, One Sample Mode, T-TEST
+@node Independent Samples Mode
 @comment  node-name,  next,  previous,  up
 @subsection Independent Samples Mode
 
@@ -521,21 +690,21 @@ 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.
+greater than or equal to this value belong to the first group, and cases
+less than this value belong to the second group.
 When using this form of the @cmd{GROUPS} subcommand, missing values in
 the independent variable are excluded on a listwise basis, regardless
 of whether @cmd{/MISSING=LISTWISE} was specified.
 
 
-@node Paired Samples Mode,  , Independent Samples Mode, T-TEST
+@node Paired Samples Mode
 @comment  node-name,  next,  previous,  up
 @subsection Paired Samples Mode
 
 The @cmd{PAIRS} subcommand introduces Paired Samples mode.
 Use this mode when repeated measures have been taken from the same
 samples.
-If the the @code{WITH} keyword is omitted, then tables for all
+If the @code{WITH} keyword is omitted, then tables for all
 combinations of variables given in the @cmd{PAIRS} subcommand are
 generated. 
 If the @code{WITH} keyword is given, and the @code{(PAIRED)} keyword
@@ -549,9 +718,9 @@ of variable preceding @code{WITH} against variable following
 @code{WITH} are generated.
 
 
-@node ONEWAY, , T-TEST, Statistics
+@node ONEWAY
 @comment  node-name,  next,  previous,  up
-@section Oneway
+@section ONEWAY
 
 @vindex ONEWAY
 @cindex analysis of variance
@@ -561,7 +730,7 @@ of variable preceding @code{WITH} against variable following
 ONEWAY
         [/VARIABLES = ] var_list BY var
         /MISSING=@{ANALYSIS,LISTWISE@} @{EXCLUDE,INCLUDE@}
-        /CONTRASTS= value1 [, value2] ... [,valueN]
+        /CONTRAST= value1 [, value2] ... [,valueN]
         /STATISTICS=@{DESCRIPTIVES,HOMOGENEITY@}
 
 @end display
@@ -587,7 +756,7 @@ Displays the Levene test of Homogeneity of Variance for the
 variables and their groups.
 @end itemize
 
-The @code{CONTRASTS} subcommand is used when you anticipate certain
+The @code{CONTRAST} 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.
@@ -595,6 +764,70 @@ 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 @code{CONTRASTS} subcommand may be given up to 10 times in order
+The @code{CONTRAST} subcommand may be given up to 10 times in order
 to specify different contrast tests.
 @setfilename ignored
+
+@node RANK
+@comment  node-name,  next,  previous,  up
+@section RANK
+
+@vindex RANK
+@display
+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]
+@end display
+
+The @cmd{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, @samp{A} or @samp{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.
+
+@include regression.texi