Implemented the NPAR TESTS command.
authorJohn Darrington <john@darrington.wattle.id.au>
Wed, 20 Dec 2006 10:10:51 +0000 (10:10 +0000)
committerJohn Darrington <john@darrington.wattle.id.au>
Wed, 20 Dec 2006 10:10:51 +0000 (10:10 +0000)
24 files changed:
doc/ChangeLog
doc/statistics.texi
po/de.po
po/pspp.pot
src/data/casefilter.c
src/data/casefilter.h
src/data/variable.c
src/language/command.def
src/language/stats/ChangeLog
src/language/stats/automake.mk
src/language/stats/binomial.c [new file with mode: 0644]
src/language/stats/binomial.h [new file with mode: 0644]
src/language/stats/chisquare.c [new file with mode: 0644]
src/language/stats/chisquare.h [new file with mode: 0644]
src/language/stats/freq.c [new file with mode: 0644]
src/language/stats/freq.h [new file with mode: 0644]
src/language/stats/frequencies.q
src/language/stats/npar-summary.c [new file with mode: 0644]
src/language/stats/npar-summary.h [new file with mode: 0644]
src/language/stats/npar.h [new file with mode: 0644]
src/language/stats/npar.q [new file with mode: 0644]
tests/automake.mk
tests/command/npar-binomial.sh [new file with mode: 0755]
tests/command/npar-chisquare.sh [new file with mode: 0755]

index f9b21a0f4a8204f2447b89d0d2fdef78d09cf19e..0e638e87dd04742d678735980028ab9dc1be3535 100644 (file)
@@ -1,3 +1,7 @@
+Wed Dec 20 18:45:31 WST 2006 John Darrington <john@darrington.wattle.id.au>
+
+       * statistics.texi: Added documentation for the NPAR TESTS command.
+
 Thu Nov 30 22:20:10 2006  Ben Pfaff  <blp@gnu.org>
 
        * statistics.texi: Document charts supported by FREQUENCIES.
 Thu Nov 30 22:20:10 2006  Ben Pfaff  <blp@gnu.org>
 
        * statistics.texi: Document charts supported by FREQUENCIES.
index 0774d526d70653fbac37c0dbf2c416c763d76972..69576e55cbbc025d23887d0435708c6e09ac266f 100644 (file)
@@ -9,6 +9,7 @@ far.
 * FREQUENCIES::                 Frequency tables.
 * EXAMINE::                     Testing data for normality.
 * CROSSTABS::                   Crosstabulation tables.
 * 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.
 * T-TEST::                      Test hypotheses about means.
 * ONEWAY::                      One way analysis of variance.
 * RANK::                        Compute rank scores.
@@ -304,7 +305,7 @@ there are many distinct values, then @cmd{EXAMINE} will produce a very
 large quantity of output.
 
 
 large quantity of output.
 
 
-@node CROSSTABS, T-TEST, EXAMINE, Statistics
+@node CROSSTABS, NPAR TESTS, EXAMINE, Statistics
 @section CROSSTABS
 
 @vindex CROSSTABS
 @section CROSSTABS
 
 @vindex CROSSTABS
@@ -493,11 +494,122 @@ Approximate T of uncertainty coefficient is wrong.
 
 Fixes for any of these deficiencies would be welcomed.
 
 
 Fixes for any of these deficiencies would be welcomed.
 
-@node T-TEST, ONEWAY, CROSSTABS, Statistics
+@node NPAR TESTS, T-TEST, CROSSTABS, Statistics
+@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,  CHISQUARE, NPAR TESTS, NPAR TESTS
+@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 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, , BINOMIAL, NPAR TESTS
+@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, ONEWAY, NPAR TESTS, Statistics
 @comment  node-name,  next,  previous,  up
 @section T-TEST
 
 @vindex T-TEST
 @comment  node-name,  next,  previous,  up
 @section T-TEST
 
 @vindex T-TEST
+
 @display
 T-TEST
         /MISSING=@{ANALYSIS,LISTWISE@} @{EXCLUDE,INCLUDE@}
 @display
 T-TEST
         /MISSING=@{ANALYSIS,LISTWISE@} @{EXCLUDE,INCLUDE@}
index 1232884e2d566302c92c953d44265b6829ba8280..32d73620ecb02af75cead0cf2268f2c84d20ebb6 100644 (file)
--- a/po/de.po
+++ b/po/de.po
@@ -10,7 +10,7 @@ msgid ""
 msgstr ""
 "Project-Id-Version: PSPP 0.4.2\n"
 "Report-Msgid-Bugs-To: pspp-dev@gnu.org\n"
 msgstr ""
 "Project-Id-Version: PSPP 0.4.2\n"
 "Report-Msgid-Bugs-To: pspp-dev@gnu.org\n"
-"POT-Creation-Date: 2006-12-16 15:49+0900\n"
+"POT-Creation-Date: 2006-12-20 18:53+0900\n"
 "PO-Revision-Date: 2006-05-26 17:49+0800\n"
 "Last-Translator: John Darrington <john@darrington.wattle.id.au>\n"
 "Language-Team: German <pspp-dev@gnu.org>\n"
 "PO-Revision-Date: 2006-05-26 17:49+0800\n"
 "Last-Translator: John Darrington <john@darrington.wattle.id.au>\n"
 "Language-Team: German <pspp-dev@gnu.org>\n"
@@ -320,8 +320,8 @@ msgstr "Zeichenkette"
 msgid "Numeric"
 msgstr "Nummer"
 
 msgid "Numeric"
 msgstr "Nummer"
 
-#: src/data/format.c:311 src/data/sys-file-reader.c:1022
-#: src/data/sys-file-reader.c:1024
+#: src/data/format.c:311 src/data/sys-file-reader.c:1026
+#: src/data/sys-file-reader.c:1028
 #: src/language/dictionary/apply-dictionary.c:77
 #: src/language/dictionary/apply-dictionary.c:78
 #: src/language/xforms/recode.c:467 src/language/xforms/recode.c:468
 #: src/language/dictionary/apply-dictionary.c:77
 #: src/language/dictionary/apply-dictionary.c:78
 #: src/language/xforms/recode.c:467 src/language/xforms/recode.c:468
@@ -329,8 +329,8 @@ msgstr "Nummer"
 msgid "numeric"
 msgstr "numerisch"
 
 msgid "numeric"
 msgstr "numerisch"
 
-#: src/data/format.c:311 src/data/sys-file-reader.c:1022
-#: src/data/sys-file-reader.c:1024
+#: src/data/format.c:311 src/data/sys-file-reader.c:1026
+#: src/data/sys-file-reader.c:1028
 #: src/language/dictionary/apply-dictionary.c:77
 #: src/language/dictionary/apply-dictionary.c:78
 #: src/language/xforms/recode.c:467 src/language/xforms/recode.c:468
 #: src/language/dictionary/apply-dictionary.c:77
 #: src/language/dictionary/apply-dictionary.c:78
 #: src/language/xforms/recode.c:467 src/language/xforms/recode.c:468
@@ -673,100 +673,100 @@ msgstr ""
 msgid "Invalid variable display parameters.  Default parameters substituted."
 msgstr ""
 
 msgid "Invalid variable display parameters.  Default parameters substituted."
 msgstr ""
 
-#: src/data/sys-file-reader.c:854
+#: src/data/sys-file-reader.c:858
 #, c-format
 msgid "Long variable mapping from %s to invalid variable name `%s'."
 msgstr ""
 
 #, c-format
 msgid "Long variable mapping from %s to invalid variable name `%s'."
 msgstr ""
 
-#: src/data/sys-file-reader.c:864
+#: src/data/sys-file-reader.c:868
 #, c-format
 msgid "Duplicate long variable name `%s' within system file."
 msgstr ""
 
 #, c-format
 msgid "Duplicate long variable name `%s' within system file."
 msgstr ""
 
-#: src/data/sys-file-reader.c:902
+#: src/data/sys-file-reader.c:906
 #, c-format
 msgid "%s listed as string of length %s in length table."
 msgstr ""
 
 #, c-format
 msgid "%s listed as string of length %s in length table."
 msgstr ""
 
-#: src/data/sys-file-reader.c:916
+#: src/data/sys-file-reader.c:920
 #, c-format
 msgid "Very long string %s overflows dictionary."
 msgstr ""
 
 #, c-format
 msgid "Very long string %s overflows dictionary."
 msgstr ""
 
-#: src/data/sys-file-reader.c:963
+#: src/data/sys-file-reader.c:967
 #, c-format
 msgid "Invalid number of labels: %d.  Ignoring labels."
 msgstr ""
 
 #, c-format
 msgid "Invalid number of labels: %d.  Ignoring labels."
 msgstr ""
 
-#: src/data/sys-file-reader.c:994
+#: src/data/sys-file-reader.c:998
 msgid ""
 "Variable index record (type 4) does not immediately follow value label "
 "record (type 3) as it should."
 msgstr ""
 
 msgid ""
 "Variable index record (type 4) does not immediately follow value label "
 "record (type 3) as it should."
 msgstr ""
 
-#: src/data/sys-file-reader.c:1001
+#: src/data/sys-file-reader.c:1005
 #, c-format
 msgid ""
 "Number of variables associated with a value label (%d) is not between 1 and "
 "the number of variables (%d)."
 msgstr ""
 
 #, c-format
 msgid ""
 "Number of variables associated with a value label (%d) is not between 1 and "
 "the number of variables (%d)."
 msgstr ""
 
-#: src/data/sys-file-reader.c:1011
+#: src/data/sys-file-reader.c:1015
 #, c-format
 msgid "Value labels are not allowed on long string variables (%s)."
 msgstr ""
 
 #, c-format
 msgid "Value labels are not allowed on long string variables (%s)."
 msgstr ""
 
-#: src/data/sys-file-reader.c:1018
+#: src/data/sys-file-reader.c:1022
 #, c-format
 msgid ""
 "Variables associated with value label are not all of identical type.  "
 "Variable %s is %s, but variable %s is %s."
 msgstr ""
 
 #, c-format
 msgid ""
 "Variables associated with value label are not all of identical type.  "
 "Variable %s is %s, but variable %s is %s."
 msgstr ""
 
-#: src/data/sys-file-reader.c:1051
+#: src/data/sys-file-reader.c:1055
 #, c-format
 msgid "Duplicate value label for %g on %s."
 msgstr ""
 
 #, c-format
 msgid "Duplicate value label for %g on %s."
 msgstr ""
 
-#: src/data/sys-file-reader.c:1054
+#: src/data/sys-file-reader.c:1058
 #, c-format
 msgid "Duplicate value label for \"%.*s\" on %s."
 msgstr ""
 
 #, c-format
 msgid "Duplicate value label for \"%.*s\" on %s."
 msgstr ""
 
-#: src/data/sys-file-reader.c:1172
+#: src/data/sys-file-reader.c:1176
 msgid "File ends in partial case."
 msgstr ""
 
 msgid "File ends in partial case."
 msgstr ""
 
-#: src/data/sys-file-reader.c:1268 src/data/sys-file-reader.c:1304
+#: src/data/sys-file-reader.c:1272 src/data/sys-file-reader.c:1308
 msgid "Compressed data is corrupt."
 msgstr ""
 
 msgid "Compressed data is corrupt."
 msgstr ""
 
-#: src/data/sys-file-reader.c:1377
+#: src/data/sys-file-reader.c:1381
 #, c-format
 msgid "Variable index %d not in valid range 1...%d."
 msgstr ""
 
 #, c-format
 msgid "Variable index %d not in valid range 1...%d."
 msgstr ""
 
-#: src/data/sys-file-reader.c:1382
+#: src/data/sys-file-reader.c:1386
 #, c-format
 msgid "Variable index %d refers to long string continuation."
 msgstr ""
 
 #, c-format
 msgid "Variable index %d refers to long string continuation."
 msgstr ""
 
-#: src/data/sys-file-reader.c:1468
+#: src/data/sys-file-reader.c:1472
 #, c-format
 msgid "Suppressed %d additional variable map warnings."
 msgstr ""
 
 #, c-format
 msgid "Suppressed %d additional variable map warnings."
 msgstr ""
 
-#: src/data/sys-file-reader.c:1481
+#: src/data/sys-file-reader.c:1485
 #, c-format
 msgid "Variable map refers to unknown variable %s."
 msgstr ""
 
 #, c-format
 msgid "Variable map refers to unknown variable %s."
 msgstr ""
 
-#: src/data/sys-file-reader.c:1557
+#: src/data/sys-file-reader.c:1561
 #, c-format
 msgid "System error: %s."
 msgstr ""
 
 #, c-format
 msgid "System error: %s."
 msgstr ""
 
-#: src/data/sys-file-reader.c:1559
+#: src/data/sys-file-reader.c:1563
 #, fuzzy
 msgid "Unexpected end of file."
 msgstr "plotzlich ist der Datei beendet"
 #, fuzzy
 msgid "Unexpected end of file."
 msgstr "plotzlich ist der Datei beendet"
@@ -781,46 +781,46 @@ msgstr ""
 msgid "Error opening \"%s\" for writing as a system file: %s."
 msgstr ""
 
 msgid "Error opening \"%s\" for writing as a system file: %s."
 msgstr ""
 
-#: src/data/sys-file-writer.c:1101
+#: src/data/sys-file-writer.c:1105
 #, c-format
 msgid "An I/O error occurred writing system file \"%s\"."
 msgstr ""
 
 #, c-format
 msgid "An I/O error occurred writing system file \"%s\"."
 msgstr ""
 
-#: src/data/variable.c:232
+#: src/data/variable.c:231
 #, c-format
 msgid ""
 "Character `%c' (in %s) may not appear as the first character in a variable "
 "name."
 msgstr ""
 
 #, c-format
 msgid ""
 "Character `%c' (in %s) may not appear as the first character in a variable "
 "name."
 msgstr ""
 
-#: src/data/variable.c:244
+#: src/data/variable.c:243
 #, c-format
 msgid "Character `%c' (in %s) may not appear in a variable name."
 msgstr ""
 
 #, c-format
 msgid "Character `%c' (in %s) may not appear in a variable name."
 msgstr ""
 
-#: src/data/variable.c:272
+#: src/data/variable.c:271
 msgid "Variable name cannot be empty string."
 msgstr "Ein Variablename darf nicht eines leeres Kette sein."
 
 msgid "Variable name cannot be empty string."
 msgstr "Ein Variablename darf nicht eines leeres Kette sein."
 
-#: src/data/variable.c:278
+#: src/data/variable.c:277
 #, c-format
 msgid "Variable name %s exceeds %d-character limit."
 msgstr "Der Variabelname %s ist große als %d Buchstaben."
 
 #, c-format
 msgid "Variable name %s exceeds %d-character limit."
 msgstr "Der Variabelname %s ist große als %d Buchstaben."
 
-#: src/data/variable.c:286
+#: src/data/variable.c:285
 #, c-format
 msgid "`%s' may not be used as a variable name because it is a reserved word."
 msgstr ""
 
 #, c-format
 msgid "`%s' may not be used as a variable name because it is a reserved word."
 msgstr ""
 
-#: src/data/variable.c:997
+#: src/data/variable.c:996
 msgid "ordinary"
 msgstr ""
 
 msgid "ordinary"
 msgstr ""
 
-#: src/data/variable.c:999
+#: src/data/variable.c:998
 msgid "system"
 msgstr ""
 
 msgid "system"
 msgstr ""
 
-#: src/data/variable.c:1001
+#: src/data/variable.c:1000
 msgid "scratch"
 msgstr ""
 
 msgid "scratch"
 msgstr ""
 
@@ -909,10 +909,9 @@ msgstr ""
 msgid "Error executing command: %s."
 msgstr ""
 
 msgid "Error executing command: %s."
 msgstr ""
 
-#: src/language/command.c:802 src/language/data-io/matrix-data.c:538
-#: src/language/data-io/print-space.c:75 src/language/dictionary/vector.c:202
-#: src/language/lexer/lexer.c:465 src/language/stats/autorecode.c:153
-#: src/language/xforms/select-if.c:61
+#: src/language/command.c:802 src/language/data-io/print-space.c:75
+#: src/language/dictionary/vector.c:202 src/language/lexer/lexer.c:465
+#: src/language/stats/autorecode.c:153 src/language/xforms/select-if.c:61
 msgid "expecting end of command"
 msgstr ""
 
 msgid "expecting end of command"
 msgstr ""
 
@@ -1161,17 +1160,17 @@ msgstr ""
 msgid "expecting COMM or TAPE"
 msgstr ""
 
 msgid "expecting COMM or TAPE"
 msgstr ""
 
-#: src/language/data-io/get.c:360 src/language/data-io/get.c:374
-#: src/language/data-io/get.c:399
+#: src/language/data-io/get.c:349 src/language/data-io/get.c:363
+#: src/language/data-io/get.c:388
 #, c-format
 msgid "expecting %s or %s"
 msgstr ""
 
 #, c-format
 msgid "expecting %s or %s"
 msgstr ""
 
-#: src/language/data-io/get.c:608 src/language/data-io/print.c:177
+#: src/language/data-io/get.c:593 src/language/data-io/print.c:177
 msgid "expecting a valid subcommand"
 msgstr ""
 
 msgid "expecting a valid subcommand"
 msgstr ""
 
-#: src/language/data-io/get.c:641
+#: src/language/data-io/get.c:626
 #, c-format
 msgid ""
 "Cannot rename %s as %s because there already exists a variable named %s.  To "
 #, c-format
 msgid ""
 "Cannot rename %s as %s because there already exists a variable named %s.  To "
@@ -1179,75 +1178,75 @@ msgid ""
 "as \"/RENAME (A=B)(B=C)(C=A)\", or equivalently, \"/RENAME (A B C=B C A)\"."
 msgstr ""
 
 "as \"/RENAME (A=B)(B=C)(C=A)\", or equivalently, \"/RENAME (A B C=B C A)\"."
 msgstr ""
 
-#: src/language/data-io/get.c:667
+#: src/language/data-io/get.c:652
 msgid "`=' expected after variable list."
 msgstr ""
 
 msgid "`=' expected after variable list."
 msgstr ""
 
-#: src/language/data-io/get.c:674
+#: src/language/data-io/get.c:659
 #, c-format
 msgid ""
 "Number of variables on left side of `=' (%d) does not match number of "
 "variables on right side (%d), in parenthesized group %d of RENAME subcommand."
 msgstr ""
 
 #, c-format
 msgid ""
 "Number of variables on left side of `=' (%d) does not match number of "
 "variables on right side (%d), in parenthesized group %d of RENAME subcommand."
 msgstr ""
 
-#: src/language/data-io/get.c:687
+#: src/language/data-io/get.c:672
 #, c-format
 msgid "Requested renaming duplicates variable name %s."
 msgstr ""
 
 #, c-format
 msgid "Requested renaming duplicates variable name %s."
 msgstr ""
 
-#: src/language/data-io/get.c:717
+#: src/language/data-io/get.c:702
 msgid "Cannot DROP all variables from dictionary."
 msgstr ""
 
 msgid "Cannot DROP all variables from dictionary."
 msgstr ""
 
-#: src/language/data-io/get.c:895
+#: src/language/data-io/get.c:879
 msgid "The active file may not be specified more than once."
 msgstr ""
 
 msgid "The active file may not be specified more than once."
 msgstr ""
 
-#: src/language/data-io/get.c:903
+#: src/language/data-io/get.c:887
 msgid "Cannot specify the active file since no active file has been defined."
 msgstr ""
 
 msgid "Cannot specify the active file since no active file has been defined."
 msgstr ""
 
-#: src/language/data-io/get.c:910
+#: src/language/data-io/get.c:894
 msgid ""
 "MATCH FILES may not be used after TEMPORARY when the active file is an input "
 "source.  Temporary transformations will be made permanent."
 msgstr ""
 
 msgid ""
 "MATCH FILES may not be used after TEMPORARY when the active file is an input "
 "source.  Temporary transformations will be made permanent."
 msgstr ""
 
-#: src/language/data-io/get.c:946
+#: src/language/data-io/get.c:931
 msgid "Multiple IN subcommands for a single FILE or TABLE."
 msgstr ""
 
 msgid "Multiple IN subcommands for a single FILE or TABLE."
 msgstr ""
 
-#: src/language/data-io/get.c:966
+#: src/language/data-io/get.c:951
 msgid "BY may appear at most once."
 msgstr ""
 
 msgid "BY may appear at most once."
 msgstr ""
 
-#: src/language/data-io/get.c:987
+#: src/language/data-io/get.c:972
 #, c-format
 msgid "File %s lacks BY variable %s."
 msgstr ""
 
 #, c-format
 msgid "File %s lacks BY variable %s."
 msgstr ""
 
-#: src/language/data-io/get.c:1001
+#: src/language/data-io/get.c:986
 msgid "FIRST may appear at most once."
 msgstr ""
 
 msgid "FIRST may appear at most once."
 msgstr ""
 
-#: src/language/data-io/get.c:1015
+#: src/language/data-io/get.c:1000
 msgid "LAST may appear at most once."
 msgstr ""
 
 msgid "LAST may appear at most once."
 msgstr ""
 
-#: src/language/data-io/get.c:1056
+#: src/language/data-io/get.c:1041
 msgid "BY is required when TABLE is specified."
 msgstr ""
 
 msgid "BY is required when TABLE is specified."
 msgstr ""
 
-#: src/language/data-io/get.c:1061
+#: src/language/data-io/get.c:1046
 msgid "BY is required when IN is specified."
 msgstr ""
 
 msgid "BY is required when IN is specified."
 msgstr ""
 
-#: src/language/data-io/get.c:1090
+#: src/language/data-io/get.c:1075
 #, c-format
 msgid "IN variable name %s duplicates an existing variable name."
 msgstr ""
 
 #, c-format
 msgid "IN variable name %s duplicates an existing variable name."
 msgstr ""
 
-#: src/language/data-io/get.c:1546
+#: src/language/data-io/get.c:1479
 #, c-format
 msgid ""
 "Variable %s in file %s (%s) has different type or width from the same "
 #, c-format
 msgid ""
 "Variable %s in file %s (%s) has different type or width from the same "
@@ -1262,11 +1261,11 @@ msgstr ""
 msgid "Input program did not create any variables."
 msgstr ""
 
 msgid "Input program did not create any variables."
 msgstr ""
 
-#: src/language/data-io/inpt-pgm.c:340
+#: src/language/data-io/inpt-pgm.c:360
 msgid "COLUMN subcommand multiply specified."
 msgstr ""
 
 msgid "COLUMN subcommand multiply specified."
 msgstr ""
 
-#: src/language/data-io/inpt-pgm.c:388
+#: src/language/data-io/inpt-pgm.c:408
 msgid ""
 "REREAD: Column numbers must be positive finite numbers.  Column set to 1."
 msgstr ""
 msgid ""
 "REREAD: Column numbers must be positive finite numbers.  Column set to 1."
 msgstr ""
@@ -1307,187 +1306,6 @@ msgstr ""
 msgid "Line"
 msgstr ""
 
 msgid "Line"
 msgstr ""
 
-#: src/language/data-io/matrix-data.c:218
-msgid "VARIABLES subcommand multiply specified."
-msgstr ""
-
-#: src/language/data-io/matrix-data.c:233
-msgid "VARNAME_ cannot be explicitly specified on VARIABLES."
-msgstr ""
-
-#: src/language/data-io/matrix-data.c:294
-msgid "in FORMAT subcommand"
-msgstr ""
-
-#: src/language/data-io/matrix-data.c:305
-msgid "SPLIT subcommand multiply specified."
-msgstr ""
-
-#: src/language/data-io/matrix-data.c:312
-msgid "in SPLIT subcommand"
-msgstr ""
-
-#: src/language/data-io/matrix-data.c:322
-msgid "Split variable may not be named ROWTYPE_ or VARNAME_."
-msgstr ""
-
-#: src/language/data-io/matrix-data.c:356
-#, c-format
-msgid "Split variable %s is already another type."
-msgstr ""
-
-#: src/language/data-io/matrix-data.c:371
-msgid "FACTORS subcommand multiply specified."
-msgstr ""
-
-#: src/language/data-io/matrix-data.c:389
-#, c-format
-msgid "Factor variable %s is already another type."
-msgstr ""
-
-#: src/language/data-io/matrix-data.c:404
-msgid "CELLS subcommand multiply specified."
-msgstr ""
-
-#: src/language/data-io/matrix-data.c:410
-#: src/language/data-io/matrix-data.c:429
-msgid "expecting positive integer"
-msgstr ""
-
-#: src/language/data-io/matrix-data.c:423
-msgid "N subcommand multiply specified."
-msgstr ""
-
-#: src/language/data-io/matrix-data.c:444
-msgid "CONTENTS subcommand multiply specified."
-msgstr ""
-
-#: src/language/data-io/matrix-data.c:464
-msgid "Nested parentheses not allowed."
-msgstr ""
-
-#: src/language/data-io/matrix-data.c:474
-msgid "Mismatched right parenthesis (`(')."
-msgstr ""
-
-#: src/language/data-io/matrix-data.c:479
-msgid "Empty parentheses not allowed."
-msgstr ""
-
-#: src/language/data-io/matrix-data.c:492
-#: src/language/data-io/matrix-data.c:500
-msgid "in CONTENTS subcommand"
-msgstr ""
-
-#: src/language/data-io/matrix-data.c:507
-#, c-format
-msgid "Content multiply specified for %s."
-msgstr ""
-
-#: src/language/data-io/matrix-data.c:524
-msgid "Missing right parenthesis."
-msgstr ""
-
-#: src/language/data-io/matrix-data.c:544
-msgid "Missing VARIABLES subcommand."
-msgstr ""
-
-#: src/language/data-io/matrix-data.c:550
-msgid ""
-"CONTENTS subcommand not specified: assuming file contains only CORR matrix."
-msgstr ""
-
-#: src/language/data-io/matrix-data.c:560
-msgid ""
-"Missing CELLS subcommand.  CELLS is required when ROWTYPE_ is not given in "
-"the data and factors are present."
-msgstr ""
-
-#: src/language/data-io/matrix-data.c:568
-msgid "Split file values must be present in the data when ROWTYPE_ is present."
-msgstr ""
-
-#: src/language/data-io/matrix-data.c:621
-msgid "No continuous variables specified."
-msgstr ""
-
-#: src/language/data-io/matrix-data.c:840
-msgid "Scope of string exceeds line."
-msgstr ""
-
-#: src/language/data-io/matrix-data.c:893
-#, c-format
-msgid "End of line expected %s while reading %s."
-msgstr ""
-
-#: src/language/data-io/matrix-data.c:1084
-#, c-format
-msgid "expecting value for %s %s"
-msgstr ""
-
-#: src/language/data-io/matrix-data.c:1249
-#, c-format
-msgid "Syntax error expecting SPLIT FILE value %s."
-msgstr ""
-
-#: src/language/data-io/matrix-data.c:1258
-#, c-format
-msgid "Expecting value %g for %s."
-msgstr ""
-
-#: src/language/data-io/matrix-data.c:1299
-#: src/language/data-io/matrix-data.c:1781
-#, c-format
-msgid "Syntax error expecting factor value %s."
-msgstr ""
-
-#: src/language/data-io/matrix-data.c:1308
-#, c-format
-msgid "Syntax error expecting value %g for %s %s."
-msgstr ""
-
-#: src/language/data-io/matrix-data.c:1557
-#, c-format
-msgid "Syntax error %s expecting SPLIT FILE value."
-msgstr ""
-
-#: src/language/data-io/matrix-data.c:1685
-#, c-format
-msgid ""
-"Expected %d lines of data for %s content; actually saw %d lines.  No data "
-"will be output for this content."
-msgstr ""
-
-#: src/language/data-io/matrix-data.c:1723
-#, c-format
-msgid "Multiply specified ROWTYPE_ %s."
-msgstr ""
-
-#: src/language/data-io/matrix-data.c:1728
-#, c-format
-msgid "Syntax error %s expecting ROWTYPE_ string."
-msgstr ""
-
-#: src/language/data-io/matrix-data.c:1748
-#, c-format
-msgid "Syntax error %s."
-msgstr ""
-
-#: src/language/data-io/matrix-data.c:1899
-#, c-format
-msgid "Duplicate specification for %s."
-msgstr ""
-
-#: src/language/data-io/matrix-data.c:1911
-#, c-format
-msgid "Too many rows of matrix data for %s."
-msgstr ""
-
-#: src/language/data-io/matrix-data.c:1955
-#, c-format
-msgid "Syntax error expecting value for %s %s."
-msgstr ""
-
 #: src/language/data-io/placement-parser.c:87
 #, c-format
 msgid ""
 #: src/language/data-io/placement-parser.c:87
 #, c-format
 msgid ""
@@ -1585,7 +1403,7 @@ msgid "`)' expected after output format."
 msgstr ""
 
 #: src/language/dictionary/missing-values.c:58
 msgstr ""
 
 #: src/language/dictionary/missing-values.c:58
-#: src/language/stats/aggregate.c:467
+#: src/language/stats/aggregate.c:479
 msgid "expecting `('"
 msgstr ""
 
 msgid "expecting `('"
 msgstr ""
 
@@ -1728,8 +1546,8 @@ msgstr ""
 #: src/language/dictionary/sys-file-info.c:549
 #: src/language/stats/crosstabs.q:1114 src/language/stats/crosstabs.q:1141
 #: src/language/stats/crosstabs.q:1161 src/language/stats/crosstabs.q:1183
 #: src/language/dictionary/sys-file-info.c:549
 #: src/language/stats/crosstabs.q:1114 src/language/stats/crosstabs.q:1141
 #: src/language/stats/crosstabs.q:1161 src/language/stats/crosstabs.q:1183
-#: src/language/stats/examine.q:1192 src/language/stats/frequencies.q:1177
-#: src/language/stats/frequencies.q:1300
+#: src/language/stats/examine.q:1192 src/language/stats/frequencies.q:1139
+#: src/language/stats/frequencies.q:1267
 msgid "Value"
 msgstr ""
 
 msgid "Value"
 msgstr ""
 
@@ -2067,7 +1885,7 @@ msgstr ""
 msgid "Unknown identifier %s."
 msgstr ""
 
 msgid "Unknown identifier %s."
 msgstr ""
 
-#: src/language/expressions/parse.c:886 src/language/stats/aggregate.c:525
+#: src/language/expressions/parse.c:886 src/language/stats/aggregate.c:537
 msgid "expecting `)'"
 msgstr ""
 
 msgid "expecting `)'"
 msgstr ""
 
@@ -2339,54 +2157,54 @@ msgstr ""
 msgid "Bad bounds in use of TO convention."
 msgstr ""
 
 msgid "Bad bounds in use of TO convention."
 msgstr ""
 
-#: src/language/stats/aggregate.c:218
+#: src/language/stats/aggregate.c:212
 msgid "while expecting COLUMNWISE"
 msgstr ""
 
 msgid "while expecting COLUMNWISE"
 msgstr ""
 
-#: src/language/stats/aggregate.c:247
+#: src/language/stats/aggregate.c:241
 msgid "expecting BREAK"
 msgstr ""
 
 msgid "expecting BREAK"
 msgstr ""
 
-#: src/language/stats/aggregate.c:252
+#: src/language/stats/aggregate.c:246
 msgid ""
 "When PRESORTED is specified, specifying sorting directions with (A) or (D) "
 "has no effect.  Output data will be sorted the same way as the input data."
 msgstr ""
 
 msgid ""
 "When PRESORTED is specified, specifying sorting directions with (A) or (D) "
 "has no effect.  Output data will be sorted the same way as the input data."
 msgstr ""
 
-#: src/language/stats/aggregate.c:432
+#: src/language/stats/aggregate.c:444
 msgid "expecting aggregation function"
 msgstr ""
 
 msgid "expecting aggregation function"
 msgstr ""
 
-#: src/language/stats/aggregate.c:450
+#: src/language/stats/aggregate.c:462
 #, c-format
 msgid "Unknown aggregation function %s."
 msgstr ""
 
 #, c-format
 msgid "Unknown aggregation function %s."
 msgstr ""
 
-#: src/language/stats/aggregate.c:506
+#: src/language/stats/aggregate.c:518
 #, c-format
 msgid "Missing argument %d to %s."
 msgstr ""
 
 #, c-format
 msgid "Missing argument %d to %s."
 msgstr ""
 
-#: src/language/stats/aggregate.c:515
+#: src/language/stats/aggregate.c:527
 #, c-format
 msgid "Arguments to %s must be of same type as source variables."
 msgstr ""
 
 #, c-format
 msgid "Arguments to %s must be of same type as source variables."
 msgstr ""
 
-#: src/language/stats/aggregate.c:537
+#: src/language/stats/aggregate.c:549
 #, c-format
 msgid ""
 "Number of source variables (%u) does not match number of target variables (%"
 "u)."
 msgstr ""
 
 #, c-format
 msgid ""
 "Number of source variables (%u) does not match number of target variables (%"
 "u)."
 msgstr ""
 
-#: src/language/stats/aggregate.c:553
+#: src/language/stats/aggregate.c:565
 #, c-format
 msgid ""
 "The value arguments passed to the %s function are out-of-order.  They will "
 "be treated as if they had been specified in the correct order."
 msgstr ""
 
 #, c-format
 msgid ""
 "The value arguments passed to the %s function are out-of-order.  They will "
 "be treated as if they had been specified in the correct order."
 msgstr ""
 
-#: src/language/stats/aggregate.c:623
+#: src/language/stats/aggregate.c:635
 #, c-format
 msgid ""
 "Variable name %s is not unique within the aggregate file dictionary, which "
 #, c-format
 msgid ""
 "Variable name %s is not unique within the aggregate file dictionary, which "
@@ -2408,6 +2226,101 @@ msgstr ""
 msgid "Duplicate variable name %s among target variables."
 msgstr ""
 
 msgid "Duplicate variable name %s among target variables."
 msgstr ""
 
+#: src/language/stats/binomial.c:139
+#, c-format
+msgid "Variable %s is not dichotomous"
+msgstr ""
+
+#: src/language/stats/binomial.c:185
+msgid "Binomial Test"
+msgstr ""
+
+#: src/language/stats/binomial.c:203
+msgid "Group1"
+msgstr ""
+
+#: src/language/stats/binomial.c:206
+msgid "Group2"
+msgstr ""
+
+#: src/language/stats/binomial.c:209 src/language/stats/chisquare.c:237
+#: src/language/stats/chisquare.c:297 src/language/stats/crosstabs.q:821
+#: src/language/stats/crosstabs.q:1021 src/language/stats/crosstabs.q:1744
+#: src/language/stats/examine.q:912 src/language/stats/frequencies.q:1220
+#: src/language/stats/oneway.q:306 src/language/stats/oneway.q:470
+#: src/language/stats/regression.q:314
+msgid "Total"
+msgstr ""
+
+#: src/language/stats/binomial.c:254 src/language/stats/chisquare.c:260
+#: src/language/stats/crosstabs.q:1139 src/language/stats/crosstabs.q:1180
+msgid "Category"
+msgstr ""
+
+#: src/language/stats/binomial.c:255 src/language/stats/crosstabs.q:831
+#: src/language/stats/examine.q:988 src/language/stats/frequencies.q:1516
+#: src/language/stats/npar-summary.c:125 src/language/stats/oneway.q:391
+#: src/language/stats/t-test.q:681 src/language/stats/t-test.q:704
+#: src/language/stats/t-test.q:830 src/language/stats/t-test.q:1367
+msgid "N"
+msgstr ""
+
+#: src/language/stats/binomial.c:256
+msgid "Observed Prop."
+msgstr ""
+
+#: src/language/stats/binomial.c:257
+msgid "Test Prop."
+msgstr ""
+
+#: src/language/stats/binomial.c:260
+#, c-format
+msgid "Exact Sig. (%d-tailed)"
+msgstr ""
+
+#: src/language/stats/chisquare.c:209
+#, c-format
+msgid ""
+"CHISQUARE test specified %d expected values, but %d distinct values were "
+"encountered in variable %s."
+msgstr ""
+
+#: src/language/stats/chisquare.c:221 src/language/stats/chisquare.c:261
+msgid "Observed N"
+msgstr ""
+
+#: src/language/stats/chisquare.c:222 src/language/stats/chisquare.c:262
+msgid "Expected N"
+msgstr ""
+
+#: src/language/stats/chisquare.c:223 src/language/stats/chisquare.c:263
+#: src/language/stats/regression.q:313
+msgid "Residual"
+msgstr ""
+
+#: src/language/stats/chisquare.c:256
+msgid "Frequencies"
+msgstr ""
+
+#: src/language/stats/chisquare.c:310
+msgid "Test Statistics"
+msgstr ""
+
+#: src/language/stats/chisquare.c:324
+msgid "Chi-Square"
+msgstr ""
+
+#: src/language/stats/chisquare.c:325 src/language/stats/crosstabs.q:1115
+#: src/language/stats/oneway.q:279 src/language/stats/oneway.q:680
+#: src/language/stats/regression.q:307 src/language/stats/t-test.q:981
+#: src/language/stats/t-test.q:1173 src/language/stats/t-test.q:1266
+msgid "df"
+msgstr ""
+
+#: src/language/stats/chisquare.c:326
+msgid "Asymp. Sig."
+msgstr ""
+
 #: src/language/stats/crosstabs.q:271
 msgid ""
 "Missing mode REPORT not allowed in general mode.  Assuming MISSING=TABLE."
 #: src/language/stats/crosstabs.q:271
 msgid ""
 "Missing mode REPORT not allowed in general mode.  Assuming MISSING=TABLE."
@@ -2443,33 +2356,19 @@ msgid "Cases"
 msgstr ""
 
 #: src/language/stats/crosstabs.q:819 src/language/stats/examine.q:910
 msgstr ""
 
 #: src/language/stats/crosstabs.q:819 src/language/stats/examine.q:910
-#: src/language/stats/frequencies.q:1175 src/language/stats/frequencies.q:1550
+#: src/language/stats/frequencies.q:1137 src/language/stats/frequencies.q:1517
 msgid "Valid"
 msgstr ""
 
 #: src/language/stats/crosstabs.q:820 src/language/stats/examine.q:911
 msgid "Valid"
 msgstr ""
 
 #: src/language/stats/crosstabs.q:820 src/language/stats/examine.q:911
-#: src/language/stats/frequencies.q:1244 src/language/stats/frequencies.q:1551
+#: src/language/stats/frequencies.q:1211 src/language/stats/frequencies.q:1518
 #: src/ui/gui/var-sheet.c:75
 msgid "Missing"
 msgstr "Löse"
 
 #: src/ui/gui/var-sheet.c:75
 msgid "Missing"
 msgstr "Löse"
 
-#: src/language/stats/crosstabs.q:821 src/language/stats/crosstabs.q:1021
-#: src/language/stats/crosstabs.q:1744 src/language/stats/examine.q:912
-#: src/language/stats/frequencies.q:1253 src/language/stats/oneway.q:306
-#: src/language/stats/oneway.q:470 src/language/stats/regression.q:315
-msgid "Total"
-msgstr ""
-
-#: src/language/stats/crosstabs.q:831 src/language/stats/examine.q:988
-#: src/language/stats/frequencies.q:1549 src/language/stats/oneway.q:391
-#: src/language/stats/t-test.q:681 src/language/stats/t-test.q:704
-#: src/language/stats/t-test.q:830 src/language/stats/t-test.q:1367
-msgid "N"
-msgstr ""
-
 #: src/language/stats/crosstabs.q:832 src/language/stats/examine.q:991
 #: src/language/stats/crosstabs.q:832 src/language/stats/examine.q:991
-#: src/language/stats/frequencies.q:1179 src/language/stats/frequencies.q:1180
-#: src/language/stats/frequencies.q:1181
+#: src/language/stats/frequencies.q:1141 src/language/stats/frequencies.q:1142
+#: src/language/stats/frequencies.q:1143
 msgid "Percent"
 msgstr "Prozent"
 
 msgid "Percent"
 msgstr "Prozent"
 
@@ -2515,13 +2414,6 @@ msgstr ""
 msgid "Statistic"
 msgstr ""
 
 msgid "Statistic"
 msgstr ""
 
-#: src/language/stats/crosstabs.q:1115 src/language/stats/oneway.q:279
-#: src/language/stats/oneway.q:680 src/language/stats/regression.q:308
-#: src/language/stats/t-test.q:981 src/language/stats/t-test.q:1173
-#: src/language/stats/t-test.q:1266
-msgid "df"
-msgstr ""
-
 #: src/language/stats/crosstabs.q:1117
 msgid "Asymp. Sig. (2-sided)"
 msgstr ""
 #: src/language/stats/crosstabs.q:1117
 msgid "Asymp. Sig. (2-sided)"
 msgstr ""
@@ -2538,10 +2430,6 @@ msgstr ""
 msgid "Symmetric measures."
 msgstr ""
 
 msgid "Symmetric measures."
 msgstr ""
 
-#: src/language/stats/crosstabs.q:1139 src/language/stats/crosstabs.q:1180
-msgid "Category"
-msgstr ""
-
 #: src/language/stats/crosstabs.q:1142 src/language/stats/crosstabs.q:1184
 msgid "Asymp. Std. Error"
 msgstr ""
 #: src/language/stats/crosstabs.q:1142 src/language/stats/crosstabs.q:1184
 msgid "Asymp. Std. Error"
 msgstr ""
@@ -2712,9 +2600,10 @@ msgid "%s Dependent"
 msgstr ""
 
 #: src/language/stats/descriptives.c:106 src/language/stats/examine.q:1528
 msgstr ""
 
 #: src/language/stats/descriptives.c:106 src/language/stats/examine.q:1528
-#: src/language/stats/frequencies.q:123 src/language/stats/oneway.q:392
-#: src/language/stats/t-test.q:682 src/language/stats/t-test.q:705
-#: src/language/stats/t-test.q:829 src/language/stats/t-test.q:1167
+#: src/language/stats/frequencies.q:125 src/language/stats/npar-summary.c:128
+#: src/language/stats/oneway.q:392 src/language/stats/t-test.q:682
+#: src/language/stats/t-test.q:705 src/language/stats/t-test.q:829
+#: src/language/stats/t-test.q:1167
 msgid "Mean"
 msgstr ""
 
 msgid "Mean"
 msgstr ""
 
@@ -2722,17 +2611,17 @@ msgstr ""
 msgid "S E Mean"
 msgstr ""
 
 msgid "S E Mean"
 msgstr ""
 
-#: src/language/stats/descriptives.c:108 src/language/stats/frequencies.q:127
+#: src/language/stats/descriptives.c:108 src/language/stats/frequencies.q:129
 msgid "Std Dev"
 msgstr ""
 
 #: src/language/stats/descriptives.c:109 src/language/stats/examine.q:1608
 msgid "Std Dev"
 msgstr ""
 
 #: src/language/stats/descriptives.c:109 src/language/stats/examine.q:1608
-#: src/language/stats/frequencies.q:128
+#: src/language/stats/frequencies.q:130
 msgid "Variance"
 msgstr ""
 
 #: src/language/stats/descriptives.c:110 src/language/stats/examine.q:1715
 msgid "Variance"
 msgstr ""
 
 #: src/language/stats/descriptives.c:110 src/language/stats/examine.q:1715
-#: src/language/stats/frequencies.q:129
+#: src/language/stats/frequencies.q:131
 msgid "Kurtosis"
 msgstr ""
 
 msgid "Kurtosis"
 msgstr ""
 
@@ -2741,7 +2630,7 @@ msgid "S E Kurt"
 msgstr ""
 
 #: src/language/stats/descriptives.c:112 src/language/stats/examine.q:1695
 msgstr ""
 
 #: src/language/stats/descriptives.c:112 src/language/stats/examine.q:1695
-#: src/language/stats/frequencies.q:131
+#: src/language/stats/frequencies.q:133
 msgid "Skewness"
 msgstr ""
 
 msgid "Skewness"
 msgstr ""
 
@@ -2750,21 +2639,23 @@ msgid "S E Skew"
 msgstr ""
 
 #: src/language/stats/descriptives.c:114 src/language/stats/examine.q:1656
 msgstr ""
 
 #: src/language/stats/descriptives.c:114 src/language/stats/examine.q:1656
-#: src/language/stats/frequencies.q:133
+#: src/language/stats/frequencies.q:135
 msgid "Range"
 msgstr ""
 
 #: src/language/stats/descriptives.c:115 src/language/stats/examine.q:1633
 msgid "Range"
 msgstr ""
 
 #: src/language/stats/descriptives.c:115 src/language/stats/examine.q:1633
-#: src/language/stats/frequencies.q:134 src/language/stats/oneway.q:404
+#: src/language/stats/frequencies.q:136 src/language/stats/npar-summary.c:134
+#: src/language/stats/oneway.q:404
 msgid "Minimum"
 msgstr ""
 
 #: src/language/stats/descriptives.c:116 src/language/stats/examine.q:1644
 msgid "Minimum"
 msgstr ""
 
 #: src/language/stats/descriptives.c:116 src/language/stats/examine.q:1644
-#: src/language/stats/frequencies.q:135 src/language/stats/oneway.q:405
+#: src/language/stats/frequencies.q:137 src/language/stats/npar-summary.c:137
+#: src/language/stats/oneway.q:405
 msgid "Maximum"
 msgstr ""
 
 msgid "Maximum"
 msgstr ""
 
-#: src/language/stats/descriptives.c:117 src/language/stats/frequencies.q:136
+#: src/language/stats/descriptives.c:117 src/language/stats/frequencies.q:138
 msgid "Sum"
 msgstr ""
 
 msgid "Sum"
 msgstr ""
 
@@ -2844,7 +2735,7 @@ msgid "Lowest"
 msgstr ""
 
 #: src/language/stats/examine.q:1424 src/language/stats/oneway.q:394
 msgstr ""
 
 #: src/language/stats/examine.q:1424 src/language/stats/oneway.q:394
-#: src/language/stats/oneway.q:678 src/language/stats/regression.q:212
+#: src/language/stats/oneway.q:678 src/language/stats/regression.q:211
 msgid "Std. Error"
 msgstr ""
 
 msgid "Std. Error"
 msgstr ""
 
@@ -2870,13 +2761,14 @@ msgstr ""
 msgid "5%% Trimmed Mean"
 msgstr ""
 
 msgid "5%% Trimmed Mean"
 msgstr ""
 
-#: src/language/stats/examine.q:1586 src/language/stats/frequencies.q:125
+#: src/language/stats/examine.q:1586 src/language/stats/frequencies.q:127
 msgid "Median"
 msgstr ""
 
 msgid "Median"
 msgstr ""
 
-#: src/language/stats/examine.q:1620 src/language/stats/oneway.q:393
-#: src/language/stats/t-test.q:683 src/language/stats/t-test.q:706
-#: src/language/stats/t-test.q:831 src/language/stats/t-test.q:1168
+#: src/language/stats/examine.q:1620 src/language/stats/npar-summary.c:131
+#: src/language/stats/oneway.q:393 src/language/stats/t-test.q:683
+#: src/language/stats/t-test.q:706 src/language/stats/t-test.q:831
+#: src/language/stats/t-test.q:1168
 msgid "Std. Deviation"
 msgstr ""
 
 msgid "Std. Deviation"
 msgstr ""
 
@@ -2916,7 +2808,7 @@ msgid "Dev from Normal"
 msgstr ""
 
 #: src/language/stats/examine.q:2014 src/language/stats/examine.q:2036
 msgstr ""
 
 #: src/language/stats/examine.q:2014 src/language/stats/examine.q:2036
-#: src/language/stats/frequencies.q:1561
+#: src/language/stats/frequencies.q:1528 src/language/stats/npar-summary.c:144
 msgid "Percentiles"
 msgstr ""
 
 msgid "Percentiles"
 msgstr ""
 
@@ -2924,153 +2816,153 @@ msgstr ""
 msgid "Tukey's Hinges"
 msgstr ""
 
 msgid "Tukey's Hinges"
 msgstr ""
 
-#: src/language/stats/flip.c:101
+#: src/language/stats/flip.c:104
 msgid ""
 "FLIP ignores TEMPORARY.  Temporary transformations will be made permanent."
 msgstr ""
 
 msgid ""
 "FLIP ignores TEMPORARY.  Temporary transformations will be made permanent."
 msgstr ""
 
-#: src/language/stats/flip.c:243
+#: src/language/stats/flip.c:249
 #, c-format
 msgid "Could not create acceptable variant for variable %s."
 msgstr ""
 
 #, c-format
 msgid "Could not create acceptable variant for variable %s."
 msgstr ""
 
-#: src/language/stats/flip.c:259
+#: src/language/stats/flip.c:265
 msgid "Cannot create more than 99999 variable names."
 msgstr ""
 
 msgid "Cannot create more than 99999 variable names."
 msgstr ""
 
-#: src/language/stats/flip.c:296
+#: src/language/stats/flip.c:302
 msgid "Could not create temporary file for FLIP."
 msgstr ""
 
 msgid "Could not create temporary file for FLIP."
 msgstr ""
 
-#: src/language/stats/flip.c:307 src/language/stats/flip.c:376
+#: src/language/stats/flip.c:313 src/language/stats/flip.c:382
 #, c-format
 msgid "Error writing FLIP file: %s."
 msgstr ""
 
 #, c-format
 msgid "Error writing FLIP file: %s."
 msgstr ""
 
-#: src/language/stats/flip.c:423
+#: src/language/stats/flip.c:429
 #, c-format
 msgid "Error rewinding FLIP file: %s."
 msgstr ""
 
 #, c-format
 msgid "Error rewinding FLIP file: %s."
 msgstr ""
 
-#: src/language/stats/flip.c:430
+#: src/language/stats/flip.c:436
 msgid "Error creating FLIP source file."
 msgstr ""
 
 msgid "Error creating FLIP source file."
 msgstr ""
 
-#: src/language/stats/flip.c:442
+#: src/language/stats/flip.c:448
 #, c-format
 msgid "Error reading FLIP file: %s."
 msgstr ""
 
 #, c-format
 msgid "Error reading FLIP file: %s."
 msgstr ""
 
-#: src/language/stats/flip.c:466
+#: src/language/stats/flip.c:472
 #, c-format
 msgid "Error seeking FLIP source file: %s."
 msgstr ""
 
 #, c-format
 msgid "Error seeking FLIP source file: %s."
 msgstr ""
 
-#: src/language/stats/flip.c:474
+#: src/language/stats/flip.c:480
 #, c-format
 msgid "Error writing FLIP source file: %s."
 msgstr ""
 
 #, c-format
 msgid "Error writing FLIP source file: %s."
 msgstr ""
 
-#: src/language/stats/flip.c:485
+#: src/language/stats/flip.c:491
 #, c-format
 msgid "Error closing FLIP source file: %s."
 msgstr ""
 
 #, c-format
 msgid "Error closing FLIP source file: %s."
 msgstr ""
 
-#: src/language/stats/flip.c:493
+#: src/language/stats/flip.c:499
 #, c-format
 msgid "Error rewinding FLIP source file: %s."
 msgstr ""
 
 #, c-format
 msgid "Error rewinding FLIP source file: %s."
 msgstr ""
 
-#: src/language/stats/flip.c:541
+#: src/language/stats/flip.c:545
 #, c-format
 msgid "Error reading FLIP temporary file: %s."
 msgstr ""
 
 #, c-format
 msgid "Error reading FLIP temporary file: %s."
 msgstr ""
 
-#: src/language/stats/flip.c:544
+#: src/language/stats/flip.c:548
 msgid "Unexpected end of file reading FLIP temporary file."
 msgstr ""
 
 msgid "Unexpected end of file reading FLIP temporary file."
 msgstr ""
 
-#: src/language/stats/frequencies.q:124
+#: src/language/stats/frequencies.q:126
 msgid "S.E. Mean"
 msgstr ""
 
 msgid "S.E. Mean"
 msgstr ""
 
-#: src/language/stats/frequencies.q:126
+#: src/language/stats/frequencies.q:128
 msgid "Mode"
 msgstr ""
 
 msgid "Mode"
 msgstr ""
 
-#: src/language/stats/frequencies.q:130
+#: src/language/stats/frequencies.q:132
 msgid "S.E. Kurt"
 msgstr ""
 
 msgid "S.E. Kurt"
 msgstr ""
 
-#: src/language/stats/frequencies.q:132
+#: src/language/stats/frequencies.q:134
 msgid "S.E. Skew"
 msgstr ""
 
 msgid "S.E. Skew"
 msgstr ""
 
-#: src/language/stats/frequencies.q:414
+#: src/language/stats/frequencies.q:408
 msgid ""
 "At most one of BARCHART, HISTOGRAM, or HBAR should be given.  HBAR will be "
 "assumed.  Argument values will be given precedence increasing along the "
 "order given."
 msgstr ""
 
 msgid ""
 "At most one of BARCHART, HISTOGRAM, or HBAR should be given.  HBAR will be "
 "assumed.  Argument values will be given precedence increasing along the "
 "order given."
 msgstr ""
 
-#: src/language/stats/frequencies.q:497
+#: src/language/stats/frequencies.q:491
 #, c-format
 msgid ""
 "MAX must be greater than or equal to MIN, if both are specified.  However, "
 "MIN was specified as %g and MAX as %g.  MIN and MAX will be ignored."
 msgstr ""
 
 #, c-format
 msgid ""
 "MAX must be greater than or equal to MIN, if both are specified.  However, "
 "MIN was specified as %g and MAX as %g.  MIN and MAX will be ignored."
 msgstr ""
 
-#: src/language/stats/frequencies.q:829
+#: src/language/stats/frequencies.q:810
 msgid ""
 "Upper limit of integer mode value range must be greater than lower limit."
 msgstr ""
 
 msgid ""
 "Upper limit of integer mode value range must be greater than lower limit."
 msgstr ""
 
-#: src/language/stats/frequencies.q:842
+#: src/language/stats/frequencies.q:823
 #, c-format
 msgid "Variable %s specified multiple times on VARIABLES subcommand."
 msgstr ""
 
 #, c-format
 msgid "Variable %s specified multiple times on VARIABLES subcommand."
 msgstr ""
 
-#: src/language/stats/frequencies.q:848
+#: src/language/stats/frequencies.q:829
 #, c-format
 msgid "Integer mode specified, but %s is not a numeric variable."
 msgstr ""
 
 #, c-format
 msgid "Integer mode specified, but %s is not a numeric variable."
 msgstr ""
 
-#: src/language/stats/frequencies.q:922
+#: src/language/stats/frequencies.q:903
 msgid "`)' expected after GROUPED interval list."
 msgstr ""
 
 msgid "`)' expected after GROUPED interval list."
 msgstr ""
 
-#: src/language/stats/frequencies.q:934
+#: src/language/stats/frequencies.q:915
 #, c-format
 msgid "Variables %s specified on GROUPED but not on VARIABLES."
 msgstr ""
 
 #, c-format
 msgid "Variables %s specified on GROUPED but not on VARIABLES."
 msgstr ""
 
-#: src/language/stats/frequencies.q:941
+#: src/language/stats/frequencies.q:922
 #, c-format
 msgid "Variables %s specified multiple times on GROUPED subcommand."
 msgstr ""
 
 #, c-format
 msgid "Variables %s specified multiple times on GROUPED subcommand."
 msgstr ""
 
-#: src/language/stats/frequencies.q:1176 src/language/stats/frequencies.q:1268
-#: src/language/stats/frequencies.q:1269 src/language/stats/frequencies.q:1303
+#: src/language/stats/frequencies.q:1138 src/language/stats/frequencies.q:1235
+#: src/language/stats/frequencies.q:1236 src/language/stats/frequencies.q:1270
 msgid "Cum"
 msgstr ""
 
 msgid "Cum"
 msgstr ""
 
-#: src/language/stats/frequencies.q:1178 src/output/charts/plot-hist.c:128
+#: src/language/stats/frequencies.q:1140 src/output/charts/plot-hist.c:128
 msgid "Frequency"
 msgstr ""
 
 msgid "Frequency"
 msgstr ""
 
-#: src/language/stats/frequencies.q:1199
+#: src/language/stats/frequencies.q:1161
 msgid "Value Label"
 msgstr ""
 
 msgid "Value Label"
 msgstr ""
 
-#: src/language/stats/frequencies.q:1301
+#: src/language/stats/frequencies.q:1268
 msgid "Freq"
 msgstr ""
 
 msgid "Freq"
 msgstr ""
 
-#: src/language/stats/frequencies.q:1302 src/language/stats/frequencies.q:1304
+#: src/language/stats/frequencies.q:1269 src/language/stats/frequencies.q:1271
 msgid "Pct"
 msgstr ""
 
 msgid "Pct"
 msgstr ""
 
-#: src/language/stats/frequencies.q:1523
+#: src/language/stats/frequencies.q:1490
 #, c-format
 msgid "No valid data for variable %s; statistics not displayed."
 msgstr ""
 #, c-format
 msgid "No valid data for variable %s; statistics not displayed."
 msgstr ""
@@ -3083,6 +2975,46 @@ msgstr ""
 msgid "TABLES subcommand may not appear more than once."
 msgstr ""
 
 msgid "TABLES subcommand may not appear more than once."
 msgstr ""
 
+#: src/language/stats/npar.q:101
+msgid "NPAR subcommand not currently implemented."
+msgstr ""
+
+#: src/language/stats/npar.q:233
+#, c-format
+msgid ""
+"The specified value of HI (%d) is lower than the specified value of LO (%d)"
+msgstr ""
+
+#: src/language/stats/npar.q:288
+#, c-format
+msgid ""
+"%d expected values were given, but the specified range (%d-%d) requires "
+"exactly %d values."
+msgstr ""
+
+#: src/language/stats/npar.q:422 src/language/stats/t-test.q:485
+#, c-format
+msgid ""
+"PAIRED was specified but the number of variables preceding WITH (%d) did not "
+"match the number following (%d)."
+msgstr ""
+
+#: src/language/stats/npar-summary.c:111
+msgid "Descriptive Statistics"
+msgstr ""
+
+#: src/language/stats/npar-summary.c:148
+msgid "25th"
+msgstr ""
+
+#: src/language/stats/npar-summary.c:151
+msgid "50th (Median)"
+msgstr ""
+
+#: src/language/stats/npar-summary.c:154
+msgid "75th"
+msgstr ""
+
 #: src/language/stats/oneway.q:169
 msgid "Number of contrast coefficients must equal the number of groups"
 msgstr ""
 #: src/language/stats/oneway.q:169
 msgid "Number of contrast coefficients must equal the number of groups"
 msgstr ""
@@ -3097,21 +3029,21 @@ msgstr ""
 msgid "`%s' is not a variable name"
 msgstr ""
 
 msgid "`%s' is not a variable name"
 msgstr ""
 
-#: src/language/stats/oneway.q:278 src/language/stats/regression.q:307
+#: src/language/stats/oneway.q:278 src/language/stats/regression.q:306
 msgid "Sum of Squares"
 msgstr ""
 
 msgid "Sum of Squares"
 msgstr ""
 
-#: src/language/stats/oneway.q:280 src/language/stats/regression.q:309
+#: src/language/stats/oneway.q:280 src/language/stats/regression.q:308
 msgid "Mean Square"
 msgstr ""
 
 msgid "Mean Square"
 msgstr ""
 
-#: src/language/stats/oneway.q:281 src/language/stats/regression.q:310
+#: src/language/stats/oneway.q:281 src/language/stats/regression.q:309
 #: src/language/stats/t-test.q:978
 msgid "F"
 msgstr ""
 
 #: src/language/stats/oneway.q:282 src/language/stats/oneway.q:536
 #: src/language/stats/t-test.q:978
 msgid "F"
 msgstr ""
 
 #: src/language/stats/oneway.q:282 src/language/stats/oneway.q:536
-#: src/language/stats/regression.q:215 src/language/stats/regression.q:311
+#: src/language/stats/regression.q:214 src/language/stats/regression.q:310
 msgid "Significance"
 msgstr ""
 
 msgid "Significance"
 msgstr ""
 
@@ -3123,7 +3055,7 @@ msgstr ""
 msgid "Within Groups"
 msgstr ""
 
 msgid "Within Groups"
 msgstr ""
 
-#: src/language/stats/oneway.q:352 src/language/stats/regression.q:337
+#: src/language/stats/oneway.q:352 src/language/stats/regression.q:336
 msgid "ANOVA"
 msgstr ""
 
 msgid "ANOVA"
 msgstr ""
 
@@ -3159,7 +3091,7 @@ msgstr ""
 msgid "Value of Contrast"
 msgstr ""
 
 msgid "Value of Contrast"
 msgstr ""
 
-#: src/language/stats/oneway.q:679 src/language/stats/regression.q:214
+#: src/language/stats/oneway.q:679 src/language/stats/regression.q:213
 #: src/language/stats/t-test.q:980 src/language/stats/t-test.q:1172
 #: src/language/stats/t-test.q:1265
 msgid "t"
 #: src/language/stats/t-test.q:980 src/language/stats/t-test.q:1172
 #: src/language/stats/t-test.q:1265
 msgid "t"
@@ -3231,63 +3163,59 @@ msgstr ""
 msgid "Too many variables in INTO clause."
 msgstr ""
 
 msgid "Too many variables in INTO clause."
 msgstr ""
 
-#: src/language/stats/regression.q:166
+#: src/language/stats/regression.q:165
 msgid "R"
 msgstr ""
 
 msgid "R"
 msgstr ""
 
-#: src/language/stats/regression.q:167
+#: src/language/stats/regression.q:166
 msgid "R Square"
 msgstr ""
 
 msgid "R Square"
 msgstr ""
 
-#: src/language/stats/regression.q:168
+#: src/language/stats/regression.q:167
 msgid "Adjusted R Square"
 msgstr ""
 
 msgid "Adjusted R Square"
 msgstr ""
 
-#: src/language/stats/regression.q:169
+#: src/language/stats/regression.q:168
 msgid "Std. Error of the Estimate"
 msgstr ""
 
 msgid "Std. Error of the Estimate"
 msgstr ""
 
-#: src/language/stats/regression.q:174
+#: src/language/stats/regression.q:173
 msgid "Model Summary"
 msgstr ""
 
 msgid "Model Summary"
 msgstr ""
 
-#: src/language/stats/regression.q:211
+#: src/language/stats/regression.q:210
 msgid "B"
 msgstr ""
 
 msgid "B"
 msgstr ""
 
-#: src/language/stats/regression.q:213
+#: src/language/stats/regression.q:212
 msgid "Beta"
 msgstr ""
 
 msgid "Beta"
 msgstr ""
 
-#: src/language/stats/regression.q:216
+#: src/language/stats/regression.q:215
 msgid "(Constant)"
 msgstr ""
 
 msgid "(Constant)"
 msgstr ""
 
-#: src/language/stats/regression.q:276
+#: src/language/stats/regression.q:275
 msgid "Coefficients"
 msgstr ""
 
 msgid "Coefficients"
 msgstr ""
 
-#: src/language/stats/regression.q:313
+#: src/language/stats/regression.q:312
 msgid "Regression"
 msgstr ""
 
 msgid "Regression"
 msgstr ""
 
-#: src/language/stats/regression.q:314
-msgid "Residual"
-msgstr ""
-
-#: src/language/stats/regression.q:392
+#: src/language/stats/regression.q:391
 msgid "Model"
 msgstr ""
 
 msgid "Model"
 msgstr ""
 
-#: src/language/stats/regression.q:393
+#: src/language/stats/regression.q:392
 msgid "Covariances"
 msgstr ""
 
 msgid "Covariances"
 msgstr ""
 
-#: src/language/stats/regression.q:408
+#: src/language/stats/regression.q:407
 msgid "Coefficient Correlations"
 msgstr ""
 
 msgid "Coefficient Correlations"
 msgstr ""
 
-#: src/language/stats/regression.q:1132
+#: src/language/stats/regression.q:1131
 msgid "Dependent variable must be numeric."
 msgstr ""
 
 msgid "Dependent variable must be numeric."
 msgstr ""
 
@@ -3325,13 +3253,6 @@ msgid ""
 "When applying GROUPS to a string variable, two values must be specified."
 msgstr ""
 
 "When applying GROUPS to a string variable, two values must be specified."
 msgstr ""
 
-#: src/language/stats/t-test.q:485
-#, c-format
-msgid ""
-"PAIRED was specified but the number of variables preceding WITH (%d) did not "
-"match the number following (%d)."
-msgstr ""
-
 #: src/language/stats/t-test.q:502
 msgid "At least two variables must be specified on PAIRS."
 msgstr ""
 #: src/language/stats/t-test.q:502
 msgid "At least two variables must be specified on PAIRS."
 msgstr ""
index 63c5b73d05b5d8fb04d16d5fa1fdfd682d6973fd..651a3d853a563ef4e34e24d6d9e882f4005436d8 100644 (file)
@@ -8,7 +8,7 @@ msgid ""
 msgstr ""
 "Project-Id-Version: PACKAGE VERSION\n"
 "Report-Msgid-Bugs-To: pspp-dev@gnu.org\n"
 msgstr ""
 "Project-Id-Version: PACKAGE VERSION\n"
 "Report-Msgid-Bugs-To: pspp-dev@gnu.org\n"
-"POT-Creation-Date: 2006-12-16 15:49+0900\n"
+"POT-Creation-Date: 2006-12-20 18:53+0900\n"
 "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
 "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
 "Language-Team: LANGUAGE <LL@li.org>\n"
 "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
 "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
 "Language-Team: LANGUAGE <LL@li.org>\n"
@@ -319,8 +319,8 @@ msgstr ""
 msgid "Numeric"
 msgstr ""
 
 msgid "Numeric"
 msgstr ""
 
-#: src/data/format.c:311 src/data/sys-file-reader.c:1022
-#: src/data/sys-file-reader.c:1024
+#: src/data/format.c:311 src/data/sys-file-reader.c:1026
+#: src/data/sys-file-reader.c:1028
 #: src/language/dictionary/apply-dictionary.c:77
 #: src/language/dictionary/apply-dictionary.c:78
 #: src/language/xforms/recode.c:467 src/language/xforms/recode.c:468
 #: src/language/dictionary/apply-dictionary.c:77
 #: src/language/dictionary/apply-dictionary.c:78
 #: src/language/xforms/recode.c:467 src/language/xforms/recode.c:468
@@ -328,8 +328,8 @@ msgstr ""
 msgid "numeric"
 msgstr ""
 
 msgid "numeric"
 msgstr ""
 
-#: src/data/format.c:311 src/data/sys-file-reader.c:1022
-#: src/data/sys-file-reader.c:1024
+#: src/data/format.c:311 src/data/sys-file-reader.c:1026
+#: src/data/sys-file-reader.c:1028
 #: src/language/dictionary/apply-dictionary.c:77
 #: src/language/dictionary/apply-dictionary.c:78
 #: src/language/xforms/recode.c:467 src/language/xforms/recode.c:468
 #: src/language/dictionary/apply-dictionary.c:77
 #: src/language/dictionary/apply-dictionary.c:78
 #: src/language/xforms/recode.c:467 src/language/xforms/recode.c:468
@@ -669,100 +669,100 @@ msgstr ""
 msgid "Invalid variable display parameters.  Default parameters substituted."
 msgstr ""
 
 msgid "Invalid variable display parameters.  Default parameters substituted."
 msgstr ""
 
-#: src/data/sys-file-reader.c:854
+#: src/data/sys-file-reader.c:858
 #, c-format
 msgid "Long variable mapping from %s to invalid variable name `%s'."
 msgstr ""
 
 #, c-format
 msgid "Long variable mapping from %s to invalid variable name `%s'."
 msgstr ""
 
-#: src/data/sys-file-reader.c:864
+#: src/data/sys-file-reader.c:868
 #, c-format
 msgid "Duplicate long variable name `%s' within system file."
 msgstr ""
 
 #, c-format
 msgid "Duplicate long variable name `%s' within system file."
 msgstr ""
 
-#: src/data/sys-file-reader.c:902
+#: src/data/sys-file-reader.c:906
 #, c-format
 msgid "%s listed as string of length %s in length table."
 msgstr ""
 
 #, c-format
 msgid "%s listed as string of length %s in length table."
 msgstr ""
 
-#: src/data/sys-file-reader.c:916
+#: src/data/sys-file-reader.c:920
 #, c-format
 msgid "Very long string %s overflows dictionary."
 msgstr ""
 
 #, c-format
 msgid "Very long string %s overflows dictionary."
 msgstr ""
 
-#: src/data/sys-file-reader.c:963
+#: src/data/sys-file-reader.c:967
 #, c-format
 msgid "Invalid number of labels: %d.  Ignoring labels."
 msgstr ""
 
 #, c-format
 msgid "Invalid number of labels: %d.  Ignoring labels."
 msgstr ""
 
-#: src/data/sys-file-reader.c:994
+#: src/data/sys-file-reader.c:998
 msgid ""
 "Variable index record (type 4) does not immediately follow value label "
 "record (type 3) as it should."
 msgstr ""
 
 msgid ""
 "Variable index record (type 4) does not immediately follow value label "
 "record (type 3) as it should."
 msgstr ""
 
-#: src/data/sys-file-reader.c:1001
+#: src/data/sys-file-reader.c:1005
 #, c-format
 msgid ""
 "Number of variables associated with a value label (%d) is not between 1 and "
 "the number of variables (%d)."
 msgstr ""
 
 #, c-format
 msgid ""
 "Number of variables associated with a value label (%d) is not between 1 and "
 "the number of variables (%d)."
 msgstr ""
 
-#: src/data/sys-file-reader.c:1011
+#: src/data/sys-file-reader.c:1015
 #, c-format
 msgid "Value labels are not allowed on long string variables (%s)."
 msgstr ""
 
 #, c-format
 msgid "Value labels are not allowed on long string variables (%s)."
 msgstr ""
 
-#: src/data/sys-file-reader.c:1018
+#: src/data/sys-file-reader.c:1022
 #, c-format
 msgid ""
 "Variables associated with value label are not all of identical type.  "
 "Variable %s is %s, but variable %s is %s."
 msgstr ""
 
 #, c-format
 msgid ""
 "Variables associated with value label are not all of identical type.  "
 "Variable %s is %s, but variable %s is %s."
 msgstr ""
 
-#: src/data/sys-file-reader.c:1051
+#: src/data/sys-file-reader.c:1055
 #, c-format
 msgid "Duplicate value label for %g on %s."
 msgstr ""
 
 #, c-format
 msgid "Duplicate value label for %g on %s."
 msgstr ""
 
-#: src/data/sys-file-reader.c:1054
+#: src/data/sys-file-reader.c:1058
 #, c-format
 msgid "Duplicate value label for \"%.*s\" on %s."
 msgstr ""
 
 #, c-format
 msgid "Duplicate value label for \"%.*s\" on %s."
 msgstr ""
 
-#: src/data/sys-file-reader.c:1172
+#: src/data/sys-file-reader.c:1176
 msgid "File ends in partial case."
 msgstr ""
 
 msgid "File ends in partial case."
 msgstr ""
 
-#: src/data/sys-file-reader.c:1268 src/data/sys-file-reader.c:1304
+#: src/data/sys-file-reader.c:1272 src/data/sys-file-reader.c:1308
 msgid "Compressed data is corrupt."
 msgstr ""
 
 msgid "Compressed data is corrupt."
 msgstr ""
 
-#: src/data/sys-file-reader.c:1377
+#: src/data/sys-file-reader.c:1381
 #, c-format
 msgid "Variable index %d not in valid range 1...%d."
 msgstr ""
 
 #, c-format
 msgid "Variable index %d not in valid range 1...%d."
 msgstr ""
 
-#: src/data/sys-file-reader.c:1382
+#: src/data/sys-file-reader.c:1386
 #, c-format
 msgid "Variable index %d refers to long string continuation."
 msgstr ""
 
 #, c-format
 msgid "Variable index %d refers to long string continuation."
 msgstr ""
 
-#: src/data/sys-file-reader.c:1468
+#: src/data/sys-file-reader.c:1472
 #, c-format
 msgid "Suppressed %d additional variable map warnings."
 msgstr ""
 
 #, c-format
 msgid "Suppressed %d additional variable map warnings."
 msgstr ""
 
-#: src/data/sys-file-reader.c:1481
+#: src/data/sys-file-reader.c:1485
 #, c-format
 msgid "Variable map refers to unknown variable %s."
 msgstr ""
 
 #, c-format
 msgid "Variable map refers to unknown variable %s."
 msgstr ""
 
-#: src/data/sys-file-reader.c:1557
+#: src/data/sys-file-reader.c:1561
 #, c-format
 msgid "System error: %s."
 msgstr ""
 
 #, c-format
 msgid "System error: %s."
 msgstr ""
 
-#: src/data/sys-file-reader.c:1559
+#: src/data/sys-file-reader.c:1563
 msgid "Unexpected end of file."
 msgstr ""
 
 msgid "Unexpected end of file."
 msgstr ""
 
@@ -776,46 +776,46 @@ msgstr ""
 msgid "Error opening \"%s\" for writing as a system file: %s."
 msgstr ""
 
 msgid "Error opening \"%s\" for writing as a system file: %s."
 msgstr ""
 
-#: src/data/sys-file-writer.c:1101
+#: src/data/sys-file-writer.c:1105
 #, c-format
 msgid "An I/O error occurred writing system file \"%s\"."
 msgstr ""
 
 #, c-format
 msgid "An I/O error occurred writing system file \"%s\"."
 msgstr ""
 
-#: src/data/variable.c:232
+#: src/data/variable.c:231
 #, c-format
 msgid ""
 "Character `%c' (in %s) may not appear as the first character in a variable "
 "name."
 msgstr ""
 
 #, c-format
 msgid ""
 "Character `%c' (in %s) may not appear as the first character in a variable "
 "name."
 msgstr ""
 
-#: src/data/variable.c:244
+#: src/data/variable.c:243
 #, c-format
 msgid "Character `%c' (in %s) may not appear in a variable name."
 msgstr ""
 
 #, c-format
 msgid "Character `%c' (in %s) may not appear in a variable name."
 msgstr ""
 
-#: src/data/variable.c:272
+#: src/data/variable.c:271
 msgid "Variable name cannot be empty string."
 msgstr ""
 
 msgid "Variable name cannot be empty string."
 msgstr ""
 
-#: src/data/variable.c:278
+#: src/data/variable.c:277
 #, c-format
 msgid "Variable name %s exceeds %d-character limit."
 msgstr ""
 
 #, c-format
 msgid "Variable name %s exceeds %d-character limit."
 msgstr ""
 
-#: src/data/variable.c:286
+#: src/data/variable.c:285
 #, c-format
 msgid "`%s' may not be used as a variable name because it is a reserved word."
 msgstr ""
 
 #, c-format
 msgid "`%s' may not be used as a variable name because it is a reserved word."
 msgstr ""
 
-#: src/data/variable.c:997
+#: src/data/variable.c:996
 msgid "ordinary"
 msgstr ""
 
 msgid "ordinary"
 msgstr ""
 
-#: src/data/variable.c:999
+#: src/data/variable.c:998
 msgid "system"
 msgstr ""
 
 msgid "system"
 msgstr ""
 
-#: src/data/variable.c:1001
+#: src/data/variable.c:1000
 msgid "scratch"
 msgstr ""
 
 msgid "scratch"
 msgstr ""
 
@@ -904,10 +904,9 @@ msgstr ""
 msgid "Error executing command: %s."
 msgstr ""
 
 msgid "Error executing command: %s."
 msgstr ""
 
-#: src/language/command.c:802 src/language/data-io/matrix-data.c:538
-#: src/language/data-io/print-space.c:75 src/language/dictionary/vector.c:202
-#: src/language/lexer/lexer.c:465 src/language/stats/autorecode.c:153
-#: src/language/xforms/select-if.c:61
+#: src/language/command.c:802 src/language/data-io/print-space.c:75
+#: src/language/dictionary/vector.c:202 src/language/lexer/lexer.c:465
+#: src/language/stats/autorecode.c:153 src/language/xforms/select-if.c:61
 msgid "expecting end of command"
 msgstr ""
 
 msgid "expecting end of command"
 msgstr ""
 
@@ -1156,17 +1155,17 @@ msgstr ""
 msgid "expecting COMM or TAPE"
 msgstr ""
 
 msgid "expecting COMM or TAPE"
 msgstr ""
 
-#: src/language/data-io/get.c:360 src/language/data-io/get.c:374
-#: src/language/data-io/get.c:399
+#: src/language/data-io/get.c:349 src/language/data-io/get.c:363
+#: src/language/data-io/get.c:388
 #, c-format
 msgid "expecting %s or %s"
 msgstr ""
 
 #, c-format
 msgid "expecting %s or %s"
 msgstr ""
 
-#: src/language/data-io/get.c:608 src/language/data-io/print.c:177
+#: src/language/data-io/get.c:593 src/language/data-io/print.c:177
 msgid "expecting a valid subcommand"
 msgstr ""
 
 msgid "expecting a valid subcommand"
 msgstr ""
 
-#: src/language/data-io/get.c:641
+#: src/language/data-io/get.c:626
 #, c-format
 msgid ""
 "Cannot rename %s as %s because there already exists a variable named %s.  To "
 #, c-format
 msgid ""
 "Cannot rename %s as %s because there already exists a variable named %s.  To "
@@ -1174,75 +1173,75 @@ msgid ""
 "as \"/RENAME (A=B)(B=C)(C=A)\", or equivalently, \"/RENAME (A B C=B C A)\"."
 msgstr ""
 
 "as \"/RENAME (A=B)(B=C)(C=A)\", or equivalently, \"/RENAME (A B C=B C A)\"."
 msgstr ""
 
-#: src/language/data-io/get.c:667
+#: src/language/data-io/get.c:652
 msgid "`=' expected after variable list."
 msgstr ""
 
 msgid "`=' expected after variable list."
 msgstr ""
 
-#: src/language/data-io/get.c:674
+#: src/language/data-io/get.c:659
 #, c-format
 msgid ""
 "Number of variables on left side of `=' (%d) does not match number of "
 "variables on right side (%d), in parenthesized group %d of RENAME subcommand."
 msgstr ""
 
 #, c-format
 msgid ""
 "Number of variables on left side of `=' (%d) does not match number of "
 "variables on right side (%d), in parenthesized group %d of RENAME subcommand."
 msgstr ""
 
-#: src/language/data-io/get.c:687
+#: src/language/data-io/get.c:672
 #, c-format
 msgid "Requested renaming duplicates variable name %s."
 msgstr ""
 
 #, c-format
 msgid "Requested renaming duplicates variable name %s."
 msgstr ""
 
-#: src/language/data-io/get.c:717
+#: src/language/data-io/get.c:702
 msgid "Cannot DROP all variables from dictionary."
 msgstr ""
 
 msgid "Cannot DROP all variables from dictionary."
 msgstr ""
 
-#: src/language/data-io/get.c:895
+#: src/language/data-io/get.c:879
 msgid "The active file may not be specified more than once."
 msgstr ""
 
 msgid "The active file may not be specified more than once."
 msgstr ""
 
-#: src/language/data-io/get.c:903
+#: src/language/data-io/get.c:887
 msgid "Cannot specify the active file since no active file has been defined."
 msgstr ""
 
 msgid "Cannot specify the active file since no active file has been defined."
 msgstr ""
 
-#: src/language/data-io/get.c:910
+#: src/language/data-io/get.c:894
 msgid ""
 "MATCH FILES may not be used after TEMPORARY when the active file is an input "
 "source.  Temporary transformations will be made permanent."
 msgstr ""
 
 msgid ""
 "MATCH FILES may not be used after TEMPORARY when the active file is an input "
 "source.  Temporary transformations will be made permanent."
 msgstr ""
 
-#: src/language/data-io/get.c:946
+#: src/language/data-io/get.c:931
 msgid "Multiple IN subcommands for a single FILE or TABLE."
 msgstr ""
 
 msgid "Multiple IN subcommands for a single FILE or TABLE."
 msgstr ""
 
-#: src/language/data-io/get.c:966
+#: src/language/data-io/get.c:951
 msgid "BY may appear at most once."
 msgstr ""
 
 msgid "BY may appear at most once."
 msgstr ""
 
-#: src/language/data-io/get.c:987
+#: src/language/data-io/get.c:972
 #, c-format
 msgid "File %s lacks BY variable %s."
 msgstr ""
 
 #, c-format
 msgid "File %s lacks BY variable %s."
 msgstr ""
 
-#: src/language/data-io/get.c:1001
+#: src/language/data-io/get.c:986
 msgid "FIRST may appear at most once."
 msgstr ""
 
 msgid "FIRST may appear at most once."
 msgstr ""
 
-#: src/language/data-io/get.c:1015
+#: src/language/data-io/get.c:1000
 msgid "LAST may appear at most once."
 msgstr ""
 
 msgid "LAST may appear at most once."
 msgstr ""
 
-#: src/language/data-io/get.c:1056
+#: src/language/data-io/get.c:1041
 msgid "BY is required when TABLE is specified."
 msgstr ""
 
 msgid "BY is required when TABLE is specified."
 msgstr ""
 
-#: src/language/data-io/get.c:1061
+#: src/language/data-io/get.c:1046
 msgid "BY is required when IN is specified."
 msgstr ""
 
 msgid "BY is required when IN is specified."
 msgstr ""
 
-#: src/language/data-io/get.c:1090
+#: src/language/data-io/get.c:1075
 #, c-format
 msgid "IN variable name %s duplicates an existing variable name."
 msgstr ""
 
 #, c-format
 msgid "IN variable name %s duplicates an existing variable name."
 msgstr ""
 
-#: src/language/data-io/get.c:1546
+#: src/language/data-io/get.c:1479
 #, c-format
 msgid ""
 "Variable %s in file %s (%s) has different type or width from the same "
 #, c-format
 msgid ""
 "Variable %s in file %s (%s) has different type or width from the same "
@@ -1257,11 +1256,11 @@ msgstr ""
 msgid "Input program did not create any variables."
 msgstr ""
 
 msgid "Input program did not create any variables."
 msgstr ""
 
-#: src/language/data-io/inpt-pgm.c:340
+#: src/language/data-io/inpt-pgm.c:360
 msgid "COLUMN subcommand multiply specified."
 msgstr ""
 
 msgid "COLUMN subcommand multiply specified."
 msgstr ""
 
-#: src/language/data-io/inpt-pgm.c:388
+#: src/language/data-io/inpt-pgm.c:408
 msgid ""
 "REREAD: Column numbers must be positive finite numbers.  Column set to 1."
 msgstr ""
 msgid ""
 "REREAD: Column numbers must be positive finite numbers.  Column set to 1."
 msgstr ""
@@ -1302,187 +1301,6 @@ msgstr ""
 msgid "Line"
 msgstr ""
 
 msgid "Line"
 msgstr ""
 
-#: src/language/data-io/matrix-data.c:218
-msgid "VARIABLES subcommand multiply specified."
-msgstr ""
-
-#: src/language/data-io/matrix-data.c:233
-msgid "VARNAME_ cannot be explicitly specified on VARIABLES."
-msgstr ""
-
-#: src/language/data-io/matrix-data.c:294
-msgid "in FORMAT subcommand"
-msgstr ""
-
-#: src/language/data-io/matrix-data.c:305
-msgid "SPLIT subcommand multiply specified."
-msgstr ""
-
-#: src/language/data-io/matrix-data.c:312
-msgid "in SPLIT subcommand"
-msgstr ""
-
-#: src/language/data-io/matrix-data.c:322
-msgid "Split variable may not be named ROWTYPE_ or VARNAME_."
-msgstr ""
-
-#: src/language/data-io/matrix-data.c:356
-#, c-format
-msgid "Split variable %s is already another type."
-msgstr ""
-
-#: src/language/data-io/matrix-data.c:371
-msgid "FACTORS subcommand multiply specified."
-msgstr ""
-
-#: src/language/data-io/matrix-data.c:389
-#, c-format
-msgid "Factor variable %s is already another type."
-msgstr ""
-
-#: src/language/data-io/matrix-data.c:404
-msgid "CELLS subcommand multiply specified."
-msgstr ""
-
-#: src/language/data-io/matrix-data.c:410
-#: src/language/data-io/matrix-data.c:429
-msgid "expecting positive integer"
-msgstr ""
-
-#: src/language/data-io/matrix-data.c:423
-msgid "N subcommand multiply specified."
-msgstr ""
-
-#: src/language/data-io/matrix-data.c:444
-msgid "CONTENTS subcommand multiply specified."
-msgstr ""
-
-#: src/language/data-io/matrix-data.c:464
-msgid "Nested parentheses not allowed."
-msgstr ""
-
-#: src/language/data-io/matrix-data.c:474
-msgid "Mismatched right parenthesis (`(')."
-msgstr ""
-
-#: src/language/data-io/matrix-data.c:479
-msgid "Empty parentheses not allowed."
-msgstr ""
-
-#: src/language/data-io/matrix-data.c:492
-#: src/language/data-io/matrix-data.c:500
-msgid "in CONTENTS subcommand"
-msgstr ""
-
-#: src/language/data-io/matrix-data.c:507
-#, c-format
-msgid "Content multiply specified for %s."
-msgstr ""
-
-#: src/language/data-io/matrix-data.c:524
-msgid "Missing right parenthesis."
-msgstr ""
-
-#: src/language/data-io/matrix-data.c:544
-msgid "Missing VARIABLES subcommand."
-msgstr ""
-
-#: src/language/data-io/matrix-data.c:550
-msgid ""
-"CONTENTS subcommand not specified: assuming file contains only CORR matrix."
-msgstr ""
-
-#: src/language/data-io/matrix-data.c:560
-msgid ""
-"Missing CELLS subcommand.  CELLS is required when ROWTYPE_ is not given in "
-"the data and factors are present."
-msgstr ""
-
-#: src/language/data-io/matrix-data.c:568
-msgid "Split file values must be present in the data when ROWTYPE_ is present."
-msgstr ""
-
-#: src/language/data-io/matrix-data.c:621
-msgid "No continuous variables specified."
-msgstr ""
-
-#: src/language/data-io/matrix-data.c:840
-msgid "Scope of string exceeds line."
-msgstr ""
-
-#: src/language/data-io/matrix-data.c:893
-#, c-format
-msgid "End of line expected %s while reading %s."
-msgstr ""
-
-#: src/language/data-io/matrix-data.c:1084
-#, c-format
-msgid "expecting value for %s %s"
-msgstr ""
-
-#: src/language/data-io/matrix-data.c:1249
-#, c-format
-msgid "Syntax error expecting SPLIT FILE value %s."
-msgstr ""
-
-#: src/language/data-io/matrix-data.c:1258
-#, c-format
-msgid "Expecting value %g for %s."
-msgstr ""
-
-#: src/language/data-io/matrix-data.c:1299
-#: src/language/data-io/matrix-data.c:1781
-#, c-format
-msgid "Syntax error expecting factor value %s."
-msgstr ""
-
-#: src/language/data-io/matrix-data.c:1308
-#, c-format
-msgid "Syntax error expecting value %g for %s %s."
-msgstr ""
-
-#: src/language/data-io/matrix-data.c:1557
-#, c-format
-msgid "Syntax error %s expecting SPLIT FILE value."
-msgstr ""
-
-#: src/language/data-io/matrix-data.c:1685
-#, c-format
-msgid ""
-"Expected %d lines of data for %s content; actually saw %d lines.  No data "
-"will be output for this content."
-msgstr ""
-
-#: src/language/data-io/matrix-data.c:1723
-#, c-format
-msgid "Multiply specified ROWTYPE_ %s."
-msgstr ""
-
-#: src/language/data-io/matrix-data.c:1728
-#, c-format
-msgid "Syntax error %s expecting ROWTYPE_ string."
-msgstr ""
-
-#: src/language/data-io/matrix-data.c:1748
-#, c-format
-msgid "Syntax error %s."
-msgstr ""
-
-#: src/language/data-io/matrix-data.c:1899
-#, c-format
-msgid "Duplicate specification for %s."
-msgstr ""
-
-#: src/language/data-io/matrix-data.c:1911
-#, c-format
-msgid "Too many rows of matrix data for %s."
-msgstr ""
-
-#: src/language/data-io/matrix-data.c:1955
-#, c-format
-msgid "Syntax error expecting value for %s %s."
-msgstr ""
-
 #: src/language/data-io/placement-parser.c:87
 #, c-format
 msgid ""
 #: src/language/data-io/placement-parser.c:87
 #, c-format
 msgid ""
@@ -1580,7 +1398,7 @@ msgid "`)' expected after output format."
 msgstr ""
 
 #: src/language/dictionary/missing-values.c:58
 msgstr ""
 
 #: src/language/dictionary/missing-values.c:58
-#: src/language/stats/aggregate.c:467
+#: src/language/stats/aggregate.c:479
 msgid "expecting `('"
 msgstr ""
 
 msgid "expecting `('"
 msgstr ""
 
@@ -1723,8 +1541,8 @@ msgstr ""
 #: src/language/dictionary/sys-file-info.c:549
 #: src/language/stats/crosstabs.q:1114 src/language/stats/crosstabs.q:1141
 #: src/language/stats/crosstabs.q:1161 src/language/stats/crosstabs.q:1183
 #: src/language/dictionary/sys-file-info.c:549
 #: src/language/stats/crosstabs.q:1114 src/language/stats/crosstabs.q:1141
 #: src/language/stats/crosstabs.q:1161 src/language/stats/crosstabs.q:1183
-#: src/language/stats/examine.q:1192 src/language/stats/frequencies.q:1177
-#: src/language/stats/frequencies.q:1300
+#: src/language/stats/examine.q:1192 src/language/stats/frequencies.q:1139
+#: src/language/stats/frequencies.q:1267
 msgid "Value"
 msgstr ""
 
 msgid "Value"
 msgstr ""
 
@@ -2062,7 +1880,7 @@ msgstr ""
 msgid "Unknown identifier %s."
 msgstr ""
 
 msgid "Unknown identifier %s."
 msgstr ""
 
-#: src/language/expressions/parse.c:886 src/language/stats/aggregate.c:525
+#: src/language/expressions/parse.c:886 src/language/stats/aggregate.c:537
 msgid "expecting `)'"
 msgstr ""
 
 msgid "expecting `)'"
 msgstr ""
 
@@ -2334,54 +2152,54 @@ msgstr ""
 msgid "Bad bounds in use of TO convention."
 msgstr ""
 
 msgid "Bad bounds in use of TO convention."
 msgstr ""
 
-#: src/language/stats/aggregate.c:218
+#: src/language/stats/aggregate.c:212
 msgid "while expecting COLUMNWISE"
 msgstr ""
 
 msgid "while expecting COLUMNWISE"
 msgstr ""
 
-#: src/language/stats/aggregate.c:247
+#: src/language/stats/aggregate.c:241
 msgid "expecting BREAK"
 msgstr ""
 
 msgid "expecting BREAK"
 msgstr ""
 
-#: src/language/stats/aggregate.c:252
+#: src/language/stats/aggregate.c:246
 msgid ""
 "When PRESORTED is specified, specifying sorting directions with (A) or (D) "
 "has no effect.  Output data will be sorted the same way as the input data."
 msgstr ""
 
 msgid ""
 "When PRESORTED is specified, specifying sorting directions with (A) or (D) "
 "has no effect.  Output data will be sorted the same way as the input data."
 msgstr ""
 
-#: src/language/stats/aggregate.c:432
+#: src/language/stats/aggregate.c:444
 msgid "expecting aggregation function"
 msgstr ""
 
 msgid "expecting aggregation function"
 msgstr ""
 
-#: src/language/stats/aggregate.c:450
+#: src/language/stats/aggregate.c:462
 #, c-format
 msgid "Unknown aggregation function %s."
 msgstr ""
 
 #, c-format
 msgid "Unknown aggregation function %s."
 msgstr ""
 
-#: src/language/stats/aggregate.c:506
+#: src/language/stats/aggregate.c:518
 #, c-format
 msgid "Missing argument %d to %s."
 msgstr ""
 
 #, c-format
 msgid "Missing argument %d to %s."
 msgstr ""
 
-#: src/language/stats/aggregate.c:515
+#: src/language/stats/aggregate.c:527
 #, c-format
 msgid "Arguments to %s must be of same type as source variables."
 msgstr ""
 
 #, c-format
 msgid "Arguments to %s must be of same type as source variables."
 msgstr ""
 
-#: src/language/stats/aggregate.c:537
+#: src/language/stats/aggregate.c:549
 #, c-format
 msgid ""
 "Number of source variables (%u) does not match number of target variables (%"
 "u)."
 msgstr ""
 
 #, c-format
 msgid ""
 "Number of source variables (%u) does not match number of target variables (%"
 "u)."
 msgstr ""
 
-#: src/language/stats/aggregate.c:553
+#: src/language/stats/aggregate.c:565
 #, c-format
 msgid ""
 "The value arguments passed to the %s function are out-of-order.  They will "
 "be treated as if they had been specified in the correct order."
 msgstr ""
 
 #, c-format
 msgid ""
 "The value arguments passed to the %s function are out-of-order.  They will "
 "be treated as if they had been specified in the correct order."
 msgstr ""
 
-#: src/language/stats/aggregate.c:623
+#: src/language/stats/aggregate.c:635
 #, c-format
 msgid ""
 "Variable name %s is not unique within the aggregate file dictionary, which "
 #, c-format
 msgid ""
 "Variable name %s is not unique within the aggregate file dictionary, which "
@@ -2403,6 +2221,101 @@ msgstr ""
 msgid "Duplicate variable name %s among target variables."
 msgstr ""
 
 msgid "Duplicate variable name %s among target variables."
 msgstr ""
 
+#: src/language/stats/binomial.c:139
+#, c-format
+msgid "Variable %s is not dichotomous"
+msgstr ""
+
+#: src/language/stats/binomial.c:185
+msgid "Binomial Test"
+msgstr ""
+
+#: src/language/stats/binomial.c:203
+msgid "Group1"
+msgstr ""
+
+#: src/language/stats/binomial.c:206
+msgid "Group2"
+msgstr ""
+
+#: src/language/stats/binomial.c:209 src/language/stats/chisquare.c:237
+#: src/language/stats/chisquare.c:297 src/language/stats/crosstabs.q:821
+#: src/language/stats/crosstabs.q:1021 src/language/stats/crosstabs.q:1744
+#: src/language/stats/examine.q:912 src/language/stats/frequencies.q:1220
+#: src/language/stats/oneway.q:306 src/language/stats/oneway.q:470
+#: src/language/stats/regression.q:314
+msgid "Total"
+msgstr ""
+
+#: src/language/stats/binomial.c:254 src/language/stats/chisquare.c:260
+#: src/language/stats/crosstabs.q:1139 src/language/stats/crosstabs.q:1180
+msgid "Category"
+msgstr ""
+
+#: src/language/stats/binomial.c:255 src/language/stats/crosstabs.q:831
+#: src/language/stats/examine.q:988 src/language/stats/frequencies.q:1516
+#: src/language/stats/npar-summary.c:125 src/language/stats/oneway.q:391
+#: src/language/stats/t-test.q:681 src/language/stats/t-test.q:704
+#: src/language/stats/t-test.q:830 src/language/stats/t-test.q:1367
+msgid "N"
+msgstr ""
+
+#: src/language/stats/binomial.c:256
+msgid "Observed Prop."
+msgstr ""
+
+#: src/language/stats/binomial.c:257
+msgid "Test Prop."
+msgstr ""
+
+#: src/language/stats/binomial.c:260
+#, c-format
+msgid "Exact Sig. (%d-tailed)"
+msgstr ""
+
+#: src/language/stats/chisquare.c:209
+#, c-format
+msgid ""
+"CHISQUARE test specified %d expected values, but %d distinct values were "
+"encountered in variable %s."
+msgstr ""
+
+#: src/language/stats/chisquare.c:221 src/language/stats/chisquare.c:261
+msgid "Observed N"
+msgstr ""
+
+#: src/language/stats/chisquare.c:222 src/language/stats/chisquare.c:262
+msgid "Expected N"
+msgstr ""
+
+#: src/language/stats/chisquare.c:223 src/language/stats/chisquare.c:263
+#: src/language/stats/regression.q:313
+msgid "Residual"
+msgstr ""
+
+#: src/language/stats/chisquare.c:256
+msgid "Frequencies"
+msgstr ""
+
+#: src/language/stats/chisquare.c:310
+msgid "Test Statistics"
+msgstr ""
+
+#: src/language/stats/chisquare.c:324
+msgid "Chi-Square"
+msgstr ""
+
+#: src/language/stats/chisquare.c:325 src/language/stats/crosstabs.q:1115
+#: src/language/stats/oneway.q:279 src/language/stats/oneway.q:680
+#: src/language/stats/regression.q:307 src/language/stats/t-test.q:981
+#: src/language/stats/t-test.q:1173 src/language/stats/t-test.q:1266
+msgid "df"
+msgstr ""
+
+#: src/language/stats/chisquare.c:326
+msgid "Asymp. Sig."
+msgstr ""
+
 #: src/language/stats/crosstabs.q:271
 msgid ""
 "Missing mode REPORT not allowed in general mode.  Assuming MISSING=TABLE."
 #: src/language/stats/crosstabs.q:271
 msgid ""
 "Missing mode REPORT not allowed in general mode.  Assuming MISSING=TABLE."
@@ -2438,33 +2351,19 @@ msgid "Cases"
 msgstr ""
 
 #: src/language/stats/crosstabs.q:819 src/language/stats/examine.q:910
 msgstr ""
 
 #: src/language/stats/crosstabs.q:819 src/language/stats/examine.q:910
-#: src/language/stats/frequencies.q:1175 src/language/stats/frequencies.q:1550
+#: src/language/stats/frequencies.q:1137 src/language/stats/frequencies.q:1517
 msgid "Valid"
 msgstr ""
 
 #: src/language/stats/crosstabs.q:820 src/language/stats/examine.q:911
 msgid "Valid"
 msgstr ""
 
 #: src/language/stats/crosstabs.q:820 src/language/stats/examine.q:911
-#: src/language/stats/frequencies.q:1244 src/language/stats/frequencies.q:1551
+#: src/language/stats/frequencies.q:1211 src/language/stats/frequencies.q:1518
 #: src/ui/gui/var-sheet.c:75
 msgid "Missing"
 msgstr ""
 
 #: src/ui/gui/var-sheet.c:75
 msgid "Missing"
 msgstr ""
 
-#: src/language/stats/crosstabs.q:821 src/language/stats/crosstabs.q:1021
-#: src/language/stats/crosstabs.q:1744 src/language/stats/examine.q:912
-#: src/language/stats/frequencies.q:1253 src/language/stats/oneway.q:306
-#: src/language/stats/oneway.q:470 src/language/stats/regression.q:315
-msgid "Total"
-msgstr ""
-
-#: src/language/stats/crosstabs.q:831 src/language/stats/examine.q:988
-#: src/language/stats/frequencies.q:1549 src/language/stats/oneway.q:391
-#: src/language/stats/t-test.q:681 src/language/stats/t-test.q:704
-#: src/language/stats/t-test.q:830 src/language/stats/t-test.q:1367
-msgid "N"
-msgstr ""
-
 #: src/language/stats/crosstabs.q:832 src/language/stats/examine.q:991
 #: src/language/stats/crosstabs.q:832 src/language/stats/examine.q:991
-#: src/language/stats/frequencies.q:1179 src/language/stats/frequencies.q:1180
-#: src/language/stats/frequencies.q:1181
+#: src/language/stats/frequencies.q:1141 src/language/stats/frequencies.q:1142
+#: src/language/stats/frequencies.q:1143
 msgid "Percent"
 msgstr ""
 
 msgid "Percent"
 msgstr ""
 
@@ -2510,13 +2409,6 @@ msgstr ""
 msgid "Statistic"
 msgstr ""
 
 msgid "Statistic"
 msgstr ""
 
-#: src/language/stats/crosstabs.q:1115 src/language/stats/oneway.q:279
-#: src/language/stats/oneway.q:680 src/language/stats/regression.q:308
-#: src/language/stats/t-test.q:981 src/language/stats/t-test.q:1173
-#: src/language/stats/t-test.q:1266
-msgid "df"
-msgstr ""
-
 #: src/language/stats/crosstabs.q:1117
 msgid "Asymp. Sig. (2-sided)"
 msgstr ""
 #: src/language/stats/crosstabs.q:1117
 msgid "Asymp. Sig. (2-sided)"
 msgstr ""
@@ -2533,10 +2425,6 @@ msgstr ""
 msgid "Symmetric measures."
 msgstr ""
 
 msgid "Symmetric measures."
 msgstr ""
 
-#: src/language/stats/crosstabs.q:1139 src/language/stats/crosstabs.q:1180
-msgid "Category"
-msgstr ""
-
 #: src/language/stats/crosstabs.q:1142 src/language/stats/crosstabs.q:1184
 msgid "Asymp. Std. Error"
 msgstr ""
 #: src/language/stats/crosstabs.q:1142 src/language/stats/crosstabs.q:1184
 msgid "Asymp. Std. Error"
 msgstr ""
@@ -2707,9 +2595,10 @@ msgid "%s Dependent"
 msgstr ""
 
 #: src/language/stats/descriptives.c:106 src/language/stats/examine.q:1528
 msgstr ""
 
 #: src/language/stats/descriptives.c:106 src/language/stats/examine.q:1528
-#: src/language/stats/frequencies.q:123 src/language/stats/oneway.q:392
-#: src/language/stats/t-test.q:682 src/language/stats/t-test.q:705
-#: src/language/stats/t-test.q:829 src/language/stats/t-test.q:1167
+#: src/language/stats/frequencies.q:125 src/language/stats/npar-summary.c:128
+#: src/language/stats/oneway.q:392 src/language/stats/t-test.q:682
+#: src/language/stats/t-test.q:705 src/language/stats/t-test.q:829
+#: src/language/stats/t-test.q:1167
 msgid "Mean"
 msgstr ""
 
 msgid "Mean"
 msgstr ""
 
@@ -2717,17 +2606,17 @@ msgstr ""
 msgid "S E Mean"
 msgstr ""
 
 msgid "S E Mean"
 msgstr ""
 
-#: src/language/stats/descriptives.c:108 src/language/stats/frequencies.q:127
+#: src/language/stats/descriptives.c:108 src/language/stats/frequencies.q:129
 msgid "Std Dev"
 msgstr ""
 
 #: src/language/stats/descriptives.c:109 src/language/stats/examine.q:1608
 msgid "Std Dev"
 msgstr ""
 
 #: src/language/stats/descriptives.c:109 src/language/stats/examine.q:1608
-#: src/language/stats/frequencies.q:128
+#: src/language/stats/frequencies.q:130
 msgid "Variance"
 msgstr ""
 
 #: src/language/stats/descriptives.c:110 src/language/stats/examine.q:1715
 msgid "Variance"
 msgstr ""
 
 #: src/language/stats/descriptives.c:110 src/language/stats/examine.q:1715
-#: src/language/stats/frequencies.q:129
+#: src/language/stats/frequencies.q:131
 msgid "Kurtosis"
 msgstr ""
 
 msgid "Kurtosis"
 msgstr ""
 
@@ -2736,7 +2625,7 @@ msgid "S E Kurt"
 msgstr ""
 
 #: src/language/stats/descriptives.c:112 src/language/stats/examine.q:1695
 msgstr ""
 
 #: src/language/stats/descriptives.c:112 src/language/stats/examine.q:1695
-#: src/language/stats/frequencies.q:131
+#: src/language/stats/frequencies.q:133
 msgid "Skewness"
 msgstr ""
 
 msgid "Skewness"
 msgstr ""
 
@@ -2745,21 +2634,23 @@ msgid "S E Skew"
 msgstr ""
 
 #: src/language/stats/descriptives.c:114 src/language/stats/examine.q:1656
 msgstr ""
 
 #: src/language/stats/descriptives.c:114 src/language/stats/examine.q:1656
-#: src/language/stats/frequencies.q:133
+#: src/language/stats/frequencies.q:135
 msgid "Range"
 msgstr ""
 
 #: src/language/stats/descriptives.c:115 src/language/stats/examine.q:1633
 msgid "Range"
 msgstr ""
 
 #: src/language/stats/descriptives.c:115 src/language/stats/examine.q:1633
-#: src/language/stats/frequencies.q:134 src/language/stats/oneway.q:404
+#: src/language/stats/frequencies.q:136 src/language/stats/npar-summary.c:134
+#: src/language/stats/oneway.q:404
 msgid "Minimum"
 msgstr ""
 
 #: src/language/stats/descriptives.c:116 src/language/stats/examine.q:1644
 msgid "Minimum"
 msgstr ""
 
 #: src/language/stats/descriptives.c:116 src/language/stats/examine.q:1644
-#: src/language/stats/frequencies.q:135 src/language/stats/oneway.q:405
+#: src/language/stats/frequencies.q:137 src/language/stats/npar-summary.c:137
+#: src/language/stats/oneway.q:405
 msgid "Maximum"
 msgstr ""
 
 msgid "Maximum"
 msgstr ""
 
-#: src/language/stats/descriptives.c:117 src/language/stats/frequencies.q:136
+#: src/language/stats/descriptives.c:117 src/language/stats/frequencies.q:138
 msgid "Sum"
 msgstr ""
 
 msgid "Sum"
 msgstr ""
 
@@ -2839,7 +2730,7 @@ msgid "Lowest"
 msgstr ""
 
 #: src/language/stats/examine.q:1424 src/language/stats/oneway.q:394
 msgstr ""
 
 #: src/language/stats/examine.q:1424 src/language/stats/oneway.q:394
-#: src/language/stats/oneway.q:678 src/language/stats/regression.q:212
+#: src/language/stats/oneway.q:678 src/language/stats/regression.q:211
 msgid "Std. Error"
 msgstr ""
 
 msgid "Std. Error"
 msgstr ""
 
@@ -2865,13 +2756,14 @@ msgstr ""
 msgid "5%% Trimmed Mean"
 msgstr ""
 
 msgid "5%% Trimmed Mean"
 msgstr ""
 
-#: src/language/stats/examine.q:1586 src/language/stats/frequencies.q:125
+#: src/language/stats/examine.q:1586 src/language/stats/frequencies.q:127
 msgid "Median"
 msgstr ""
 
 msgid "Median"
 msgstr ""
 
-#: src/language/stats/examine.q:1620 src/language/stats/oneway.q:393
-#: src/language/stats/t-test.q:683 src/language/stats/t-test.q:706
-#: src/language/stats/t-test.q:831 src/language/stats/t-test.q:1168
+#: src/language/stats/examine.q:1620 src/language/stats/npar-summary.c:131
+#: src/language/stats/oneway.q:393 src/language/stats/t-test.q:683
+#: src/language/stats/t-test.q:706 src/language/stats/t-test.q:831
+#: src/language/stats/t-test.q:1168
 msgid "Std. Deviation"
 msgstr ""
 
 msgid "Std. Deviation"
 msgstr ""
 
@@ -2911,7 +2803,7 @@ msgid "Dev from Normal"
 msgstr ""
 
 #: src/language/stats/examine.q:2014 src/language/stats/examine.q:2036
 msgstr ""
 
 #: src/language/stats/examine.q:2014 src/language/stats/examine.q:2036
-#: src/language/stats/frequencies.q:1561
+#: src/language/stats/frequencies.q:1528 src/language/stats/npar-summary.c:144
 msgid "Percentiles"
 msgstr ""
 
 msgid "Percentiles"
 msgstr ""
 
@@ -2919,153 +2811,153 @@ msgstr ""
 msgid "Tukey's Hinges"
 msgstr ""
 
 msgid "Tukey's Hinges"
 msgstr ""
 
-#: src/language/stats/flip.c:101
+#: src/language/stats/flip.c:104
 msgid ""
 "FLIP ignores TEMPORARY.  Temporary transformations will be made permanent."
 msgstr ""
 
 msgid ""
 "FLIP ignores TEMPORARY.  Temporary transformations will be made permanent."
 msgstr ""
 
-#: src/language/stats/flip.c:243
+#: src/language/stats/flip.c:249
 #, c-format
 msgid "Could not create acceptable variant for variable %s."
 msgstr ""
 
 #, c-format
 msgid "Could not create acceptable variant for variable %s."
 msgstr ""
 
-#: src/language/stats/flip.c:259
+#: src/language/stats/flip.c:265
 msgid "Cannot create more than 99999 variable names."
 msgstr ""
 
 msgid "Cannot create more than 99999 variable names."
 msgstr ""
 
-#: src/language/stats/flip.c:296
+#: src/language/stats/flip.c:302
 msgid "Could not create temporary file for FLIP."
 msgstr ""
 
 msgid "Could not create temporary file for FLIP."
 msgstr ""
 
-#: src/language/stats/flip.c:307 src/language/stats/flip.c:376
+#: src/language/stats/flip.c:313 src/language/stats/flip.c:382
 #, c-format
 msgid "Error writing FLIP file: %s."
 msgstr ""
 
 #, c-format
 msgid "Error writing FLIP file: %s."
 msgstr ""
 
-#: src/language/stats/flip.c:423
+#: src/language/stats/flip.c:429
 #, c-format
 msgid "Error rewinding FLIP file: %s."
 msgstr ""
 
 #, c-format
 msgid "Error rewinding FLIP file: %s."
 msgstr ""
 
-#: src/language/stats/flip.c:430
+#: src/language/stats/flip.c:436
 msgid "Error creating FLIP source file."
 msgstr ""
 
 msgid "Error creating FLIP source file."
 msgstr ""
 
-#: src/language/stats/flip.c:442
+#: src/language/stats/flip.c:448
 #, c-format
 msgid "Error reading FLIP file: %s."
 msgstr ""
 
 #, c-format
 msgid "Error reading FLIP file: %s."
 msgstr ""
 
-#: src/language/stats/flip.c:466
+#: src/language/stats/flip.c:472
 #, c-format
 msgid "Error seeking FLIP source file: %s."
 msgstr ""
 
 #, c-format
 msgid "Error seeking FLIP source file: %s."
 msgstr ""
 
-#: src/language/stats/flip.c:474
+#: src/language/stats/flip.c:480
 #, c-format
 msgid "Error writing FLIP source file: %s."
 msgstr ""
 
 #, c-format
 msgid "Error writing FLIP source file: %s."
 msgstr ""
 
-#: src/language/stats/flip.c:485
+#: src/language/stats/flip.c:491
 #, c-format
 msgid "Error closing FLIP source file: %s."
 msgstr ""
 
 #, c-format
 msgid "Error closing FLIP source file: %s."
 msgstr ""
 
-#: src/language/stats/flip.c:493
+#: src/language/stats/flip.c:499
 #, c-format
 msgid "Error rewinding FLIP source file: %s."
 msgstr ""
 
 #, c-format
 msgid "Error rewinding FLIP source file: %s."
 msgstr ""
 
-#: src/language/stats/flip.c:541
+#: src/language/stats/flip.c:545
 #, c-format
 msgid "Error reading FLIP temporary file: %s."
 msgstr ""
 
 #, c-format
 msgid "Error reading FLIP temporary file: %s."
 msgstr ""
 
-#: src/language/stats/flip.c:544
+#: src/language/stats/flip.c:548
 msgid "Unexpected end of file reading FLIP temporary file."
 msgstr ""
 
 msgid "Unexpected end of file reading FLIP temporary file."
 msgstr ""
 
-#: src/language/stats/frequencies.q:124
+#: src/language/stats/frequencies.q:126
 msgid "S.E. Mean"
 msgstr ""
 
 msgid "S.E. Mean"
 msgstr ""
 
-#: src/language/stats/frequencies.q:126
+#: src/language/stats/frequencies.q:128
 msgid "Mode"
 msgstr ""
 
 msgid "Mode"
 msgstr ""
 
-#: src/language/stats/frequencies.q:130
+#: src/language/stats/frequencies.q:132
 msgid "S.E. Kurt"
 msgstr ""
 
 msgid "S.E. Kurt"
 msgstr ""
 
-#: src/language/stats/frequencies.q:132
+#: src/language/stats/frequencies.q:134
 msgid "S.E. Skew"
 msgstr ""
 
 msgid "S.E. Skew"
 msgstr ""
 
-#: src/language/stats/frequencies.q:414
+#: src/language/stats/frequencies.q:408
 msgid ""
 "At most one of BARCHART, HISTOGRAM, or HBAR should be given.  HBAR will be "
 "assumed.  Argument values will be given precedence increasing along the "
 "order given."
 msgstr ""
 
 msgid ""
 "At most one of BARCHART, HISTOGRAM, or HBAR should be given.  HBAR will be "
 "assumed.  Argument values will be given precedence increasing along the "
 "order given."
 msgstr ""
 
-#: src/language/stats/frequencies.q:497
+#: src/language/stats/frequencies.q:491
 #, c-format
 msgid ""
 "MAX must be greater than or equal to MIN, if both are specified.  However, "
 "MIN was specified as %g and MAX as %g.  MIN and MAX will be ignored."
 msgstr ""
 
 #, c-format
 msgid ""
 "MAX must be greater than or equal to MIN, if both are specified.  However, "
 "MIN was specified as %g and MAX as %g.  MIN and MAX will be ignored."
 msgstr ""
 
-#: src/language/stats/frequencies.q:829
+#: src/language/stats/frequencies.q:810
 msgid ""
 "Upper limit of integer mode value range must be greater than lower limit."
 msgstr ""
 
 msgid ""
 "Upper limit of integer mode value range must be greater than lower limit."
 msgstr ""
 
-#: src/language/stats/frequencies.q:842
+#: src/language/stats/frequencies.q:823
 #, c-format
 msgid "Variable %s specified multiple times on VARIABLES subcommand."
 msgstr ""
 
 #, c-format
 msgid "Variable %s specified multiple times on VARIABLES subcommand."
 msgstr ""
 
-#: src/language/stats/frequencies.q:848
+#: src/language/stats/frequencies.q:829
 #, c-format
 msgid "Integer mode specified, but %s is not a numeric variable."
 msgstr ""
 
 #, c-format
 msgid "Integer mode specified, but %s is not a numeric variable."
 msgstr ""
 
-#: src/language/stats/frequencies.q:922
+#: src/language/stats/frequencies.q:903
 msgid "`)' expected after GROUPED interval list."
 msgstr ""
 
 msgid "`)' expected after GROUPED interval list."
 msgstr ""
 
-#: src/language/stats/frequencies.q:934
+#: src/language/stats/frequencies.q:915
 #, c-format
 msgid "Variables %s specified on GROUPED but not on VARIABLES."
 msgstr ""
 
 #, c-format
 msgid "Variables %s specified on GROUPED but not on VARIABLES."
 msgstr ""
 
-#: src/language/stats/frequencies.q:941
+#: src/language/stats/frequencies.q:922
 #, c-format
 msgid "Variables %s specified multiple times on GROUPED subcommand."
 msgstr ""
 
 #, c-format
 msgid "Variables %s specified multiple times on GROUPED subcommand."
 msgstr ""
 
-#: src/language/stats/frequencies.q:1176 src/language/stats/frequencies.q:1268
-#: src/language/stats/frequencies.q:1269 src/language/stats/frequencies.q:1303
+#: src/language/stats/frequencies.q:1138 src/language/stats/frequencies.q:1235
+#: src/language/stats/frequencies.q:1236 src/language/stats/frequencies.q:1270
 msgid "Cum"
 msgstr ""
 
 msgid "Cum"
 msgstr ""
 
-#: src/language/stats/frequencies.q:1178 src/output/charts/plot-hist.c:128
+#: src/language/stats/frequencies.q:1140 src/output/charts/plot-hist.c:128
 msgid "Frequency"
 msgstr ""
 
 msgid "Frequency"
 msgstr ""
 
-#: src/language/stats/frequencies.q:1199
+#: src/language/stats/frequencies.q:1161
 msgid "Value Label"
 msgstr ""
 
 msgid "Value Label"
 msgstr ""
 
-#: src/language/stats/frequencies.q:1301
+#: src/language/stats/frequencies.q:1268
 msgid "Freq"
 msgstr ""
 
 msgid "Freq"
 msgstr ""
 
-#: src/language/stats/frequencies.q:1302 src/language/stats/frequencies.q:1304
+#: src/language/stats/frequencies.q:1269 src/language/stats/frequencies.q:1271
 msgid "Pct"
 msgstr ""
 
 msgid "Pct"
 msgstr ""
 
-#: src/language/stats/frequencies.q:1523
+#: src/language/stats/frequencies.q:1490
 #, c-format
 msgid "No valid data for variable %s; statistics not displayed."
 msgstr ""
 #, c-format
 msgid "No valid data for variable %s; statistics not displayed."
 msgstr ""
@@ -3078,6 +2970,46 @@ msgstr ""
 msgid "TABLES subcommand may not appear more than once."
 msgstr ""
 
 msgid "TABLES subcommand may not appear more than once."
 msgstr ""
 
+#: src/language/stats/npar.q:101
+msgid "NPAR subcommand not currently implemented."
+msgstr ""
+
+#: src/language/stats/npar.q:233
+#, c-format
+msgid ""
+"The specified value of HI (%d) is lower than the specified value of LO (%d)"
+msgstr ""
+
+#: src/language/stats/npar.q:288
+#, c-format
+msgid ""
+"%d expected values were given, but the specified range (%d-%d) requires "
+"exactly %d values."
+msgstr ""
+
+#: src/language/stats/npar.q:422 src/language/stats/t-test.q:485
+#, c-format
+msgid ""
+"PAIRED was specified but the number of variables preceding WITH (%d) did not "
+"match the number following (%d)."
+msgstr ""
+
+#: src/language/stats/npar-summary.c:111
+msgid "Descriptive Statistics"
+msgstr ""
+
+#: src/language/stats/npar-summary.c:148
+msgid "25th"
+msgstr ""
+
+#: src/language/stats/npar-summary.c:151
+msgid "50th (Median)"
+msgstr ""
+
+#: src/language/stats/npar-summary.c:154
+msgid "75th"
+msgstr ""
+
 #: src/language/stats/oneway.q:169
 msgid "Number of contrast coefficients must equal the number of groups"
 msgstr ""
 #: src/language/stats/oneway.q:169
 msgid "Number of contrast coefficients must equal the number of groups"
 msgstr ""
@@ -3092,21 +3024,21 @@ msgstr ""
 msgid "`%s' is not a variable name"
 msgstr ""
 
 msgid "`%s' is not a variable name"
 msgstr ""
 
-#: src/language/stats/oneway.q:278 src/language/stats/regression.q:307
+#: src/language/stats/oneway.q:278 src/language/stats/regression.q:306
 msgid "Sum of Squares"
 msgstr ""
 
 msgid "Sum of Squares"
 msgstr ""
 
-#: src/language/stats/oneway.q:280 src/language/stats/regression.q:309
+#: src/language/stats/oneway.q:280 src/language/stats/regression.q:308
 msgid "Mean Square"
 msgstr ""
 
 msgid "Mean Square"
 msgstr ""
 
-#: src/language/stats/oneway.q:281 src/language/stats/regression.q:310
+#: src/language/stats/oneway.q:281 src/language/stats/regression.q:309
 #: src/language/stats/t-test.q:978
 msgid "F"
 msgstr ""
 
 #: src/language/stats/oneway.q:282 src/language/stats/oneway.q:536
 #: src/language/stats/t-test.q:978
 msgid "F"
 msgstr ""
 
 #: src/language/stats/oneway.q:282 src/language/stats/oneway.q:536
-#: src/language/stats/regression.q:215 src/language/stats/regression.q:311
+#: src/language/stats/regression.q:214 src/language/stats/regression.q:310
 msgid "Significance"
 msgstr ""
 
 msgid "Significance"
 msgstr ""
 
@@ -3118,7 +3050,7 @@ msgstr ""
 msgid "Within Groups"
 msgstr ""
 
 msgid "Within Groups"
 msgstr ""
 
-#: src/language/stats/oneway.q:352 src/language/stats/regression.q:337
+#: src/language/stats/oneway.q:352 src/language/stats/regression.q:336
 msgid "ANOVA"
 msgstr ""
 
 msgid "ANOVA"
 msgstr ""
 
@@ -3154,7 +3086,7 @@ msgstr ""
 msgid "Value of Contrast"
 msgstr ""
 
 msgid "Value of Contrast"
 msgstr ""
 
-#: src/language/stats/oneway.q:679 src/language/stats/regression.q:214
+#: src/language/stats/oneway.q:679 src/language/stats/regression.q:213
 #: src/language/stats/t-test.q:980 src/language/stats/t-test.q:1172
 #: src/language/stats/t-test.q:1265
 msgid "t"
 #: src/language/stats/t-test.q:980 src/language/stats/t-test.q:1172
 #: src/language/stats/t-test.q:1265
 msgid "t"
@@ -3226,63 +3158,59 @@ msgstr ""
 msgid "Too many variables in INTO clause."
 msgstr ""
 
 msgid "Too many variables in INTO clause."
 msgstr ""
 
-#: src/language/stats/regression.q:166
+#: src/language/stats/regression.q:165
 msgid "R"
 msgstr ""
 
 msgid "R"
 msgstr ""
 
-#: src/language/stats/regression.q:167
+#: src/language/stats/regression.q:166
 msgid "R Square"
 msgstr ""
 
 msgid "R Square"
 msgstr ""
 
-#: src/language/stats/regression.q:168
+#: src/language/stats/regression.q:167
 msgid "Adjusted R Square"
 msgstr ""
 
 msgid "Adjusted R Square"
 msgstr ""
 
-#: src/language/stats/regression.q:169
+#: src/language/stats/regression.q:168
 msgid "Std. Error of the Estimate"
 msgstr ""
 
 msgid "Std. Error of the Estimate"
 msgstr ""
 
-#: src/language/stats/regression.q:174
+#: src/language/stats/regression.q:173
 msgid "Model Summary"
 msgstr ""
 
 msgid "Model Summary"
 msgstr ""
 
-#: src/language/stats/regression.q:211
+#: src/language/stats/regression.q:210
 msgid "B"
 msgstr ""
 
 msgid "B"
 msgstr ""
 
-#: src/language/stats/regression.q:213
+#: src/language/stats/regression.q:212
 msgid "Beta"
 msgstr ""
 
 msgid "Beta"
 msgstr ""
 
-#: src/language/stats/regression.q:216
+#: src/language/stats/regression.q:215
 msgid "(Constant)"
 msgstr ""
 
 msgid "(Constant)"
 msgstr ""
 
-#: src/language/stats/regression.q:276
+#: src/language/stats/regression.q:275
 msgid "Coefficients"
 msgstr ""
 
 msgid "Coefficients"
 msgstr ""
 
-#: src/language/stats/regression.q:313
+#: src/language/stats/regression.q:312
 msgid "Regression"
 msgstr ""
 
 msgid "Regression"
 msgstr ""
 
-#: src/language/stats/regression.q:314
-msgid "Residual"
-msgstr ""
-
-#: src/language/stats/regression.q:392
+#: src/language/stats/regression.q:391
 msgid "Model"
 msgstr ""
 
 msgid "Model"
 msgstr ""
 
-#: src/language/stats/regression.q:393
+#: src/language/stats/regression.q:392
 msgid "Covariances"
 msgstr ""
 
 msgid "Covariances"
 msgstr ""
 
-#: src/language/stats/regression.q:408
+#: src/language/stats/regression.q:407
 msgid "Coefficient Correlations"
 msgstr ""
 
 msgid "Coefficient Correlations"
 msgstr ""
 
-#: src/language/stats/regression.q:1132
+#: src/language/stats/regression.q:1131
 msgid "Dependent variable must be numeric."
 msgstr ""
 
 msgid "Dependent variable must be numeric."
 msgstr ""
 
@@ -3320,13 +3248,6 @@ msgid ""
 "When applying GROUPS to a string variable, two values must be specified."
 msgstr ""
 
 "When applying GROUPS to a string variable, two values must be specified."
 msgstr ""
 
-#: src/language/stats/t-test.q:485
-#, c-format
-msgid ""
-"PAIRED was specified but the number of variables preceding WITH (%d) did not "
-"match the number following (%d)."
-msgstr ""
-
 #: src/language/stats/t-test.q:502
 msgid "At least two variables must be specified on PAIRS."
 msgstr ""
 #: src/language/stats/t-test.q:502
 msgid "At least two variables must be specified on PAIRS."
 msgstr ""
index ada1fa38f14083cbb5dae5b5bcc2c4eb54149081..267a695ac2bfeca4be9c6eae27cb99c0a2f5dcb4 100644 (file)
@@ -97,7 +97,7 @@ casefilter_create (bool excl, struct variable **vars, int n_vars)
    filter considers. N_VARS is the size of VARS */
 void
 casefilter_add_variables (struct casefilter *filter,
    filter considers. N_VARS is the size of VARS */
 void
 casefilter_add_variables (struct casefilter *filter,
-                          struct variable **vars, int n_vars)
+                         struct variable *const *vars, int n_vars)
 {
   int i;
 
 {
   int i;
 
@@ -117,5 +117,3 @@ casefilter_destroy (struct casefilter *filter)
   free (filter->vars);
   free (filter);
 }
   free (filter->vars);
   free (filter);
 }
-
-
index 356c6d78cd5c485062aba1dae7802eadf59158bb..0d0ee16e01833e54e3711bfd6d4d2713319925aa 100644 (file)
@@ -35,7 +35,8 @@ struct casefilter * casefilter_create (bool, struct variable **, int);
 
 /* Add the variables in VARS to the list of variables for which the
    filter considers. N_VARS is the size of VARS */
 
 /* Add the variables in VARS to the list of variables for which the
    filter considers. N_VARS is the size of VARS */
-void casefilter_add_variables (struct casefilter *, struct variable **, int);
+void casefilter_add_variables (struct casefilter *, 
+                              struct variable *const*, int);
 
 /* Destroy the filter FILTER */
 void casefilter_destroy (struct casefilter *); 
 
 /* Destroy the filter FILTER */
 void casefilter_destroy (struct casefilter *); 
@@ -43,7 +44,10 @@ void casefilter_destroy (struct casefilter *);
 /* Returns true iff the entire case should be skipped */
 bool casefilter_skip_case (const struct casefilter *, const struct ccase *);
 
 /* Returns true iff the entire case should be skipped */
 bool casefilter_skip_case (const struct casefilter *, const struct ccase *);
 
-/* Returns true iff the variable V in case C is missing */
+/* Returns true iff the variable V in case C is missing.
+   Note that this function's behaviour is independent of the set of 
+   variables  contained by the filter.
+ */
 bool casefilter_variable_missing (const struct casefilter *f, 
                                   const struct ccase *c, 
                                   const struct variable *v);
 bool casefilter_variable_missing (const struct casefilter *f, 
                                   const struct ccase *c, 
                                   const struct variable *v);
index 3a5024034088210d775c135239eed1de5c36acad..cf576b12ed2872954c1eb24e1dd3d1a27e37738f 100644 (file)
@@ -64,10 +64,9 @@ struct variable
     struct vardict_info vardict;    
 
     /* Short name, used only for system and portable file input
     struct vardict_info vardict;    
 
     /* Short name, used only for system and portable file input
-       and output.  Upper case only.  There is no index for short
-       names.  Short names are not necessarily unique.  Any
-       variable may have no short name, indicated by an empty
-       string. */
+       and output.  Upper case only. Short names are not necessarily
+       unique.  Any variable may have no short name, indicated by an
+       empty string. */
     char short_name[SHORT_NAME_LEN + 1];
 
     /* Each command may use these fields as needed. */
     char short_name[SHORT_NAME_LEN + 1];
 
     /* Each command may use these fields as needed. */
index 732d8f2a403b94e2c5d9cea311c115468d698acc..989090446e96246eaa5af760ae3512ed06ba426f 100644 (file)
@@ -105,6 +105,7 @@ DEF_CMD (S_DATA, 0, "LIST", cmd_list)
 DEF_CMD (S_DATA, 0, "MATCH FILES", cmd_match_files)
 DEF_CMD (S_DATA, 0, "MEANS", cmd_means)
 DEF_CMD (S_DATA, 0, "MODIFY VARS", cmd_modify_vars)
 DEF_CMD (S_DATA, 0, "MATCH FILES", cmd_match_files)
 DEF_CMD (S_DATA, 0, "MEANS", cmd_means)
 DEF_CMD (S_DATA, 0, "MODIFY VARS", cmd_modify_vars)
+DEF_CMD (S_DATA, 0, "NPAR TESTS", cmd_npar_tests)
 DEF_CMD (S_DATA, 0, "ONEWAY", cmd_oneway)
 DEF_CMD (S_DATA, 0, "PEARSON CORRELATIONS", cmd_correlations)
 DEF_CMD (S_DATA, 0, "RANK", cmd_rank)
 DEF_CMD (S_DATA, 0, "ONEWAY", cmd_oneway)
 DEF_CMD (S_DATA, 0, "PEARSON CORRELATIONS", cmd_correlations)
 DEF_CMD (S_DATA, 0, "RANK", cmd_rank)
@@ -202,7 +203,6 @@ UNIMPL_CMD ("NAIVEBAYES", "Small sample bayesian prediction")
 UNIMPL_CMD ("NLR", "Non Linear Regression")
 UNIMPL_CMD ("NOMREG", "Multinomial logistic regression")
 UNIMPL_CMD ("NONPAR CORR", "Nonparametric correlation")
 UNIMPL_CMD ("NLR", "Non Linear Regression")
 UNIMPL_CMD ("NOMREG", "Multinomial logistic regression")
 UNIMPL_CMD ("NONPAR CORR", "Nonparametric correlation")
-UNIMPL_CMD ("NPAR TESTS", "Nonparametric tests")
 UNIMPL_CMD ("NUMBERED", "")
 UNIMPL_CMD ("OLAP CUBES", "On-line analytical processing")
 UNIMPL_CMD ("OMS", "Output management")
 UNIMPL_CMD ("NUMBERED", "")
 UNIMPL_CMD ("OLAP CUBES", "On-line analytical processing")
 UNIMPL_CMD ("OMS", "Output management")
index bb3e29218cf0e76714e45c4d8a7bd4528fe3b6d4..05cba5c35aa5d81aa0ef46d868db5707b144b97b 100644 (file)
@@ -1,3 +1,13 @@
+Wed Dec 20 18:45:31 WST 2006 John Darrington <john@darrington.wattle.id.au>
+
+       * binomial.c binomial.h : New files.  Thanks to Jason Stover 
+          for assistance with these.
+
+       * chisquare.c chisquare.h freq.c freq.h npar-summary.c npar-summary.h 
+         npar.h npar.q: New files.  Implementing NPAR TESTS.
+
+       * frequencies.q  : Moved  structure definitions into freq.[ch]
+
 Sat Dec 16 22:26:44 2006  Ben Pfaff  <blp@gnu.org>
 
        Make it possible to pull cases from the active file with a
 Sat Dec 16 22:26:44 2006  Ben Pfaff  <blp@gnu.org>
 
        Make it possible to pull cases from the active file with a
index ef48ae5f360472752d7d47dd77a8d909aa6ffc2b..5060539d1a82eb724c662d316d3320b1d1a110f7 100644 (file)
@@ -8,18 +8,29 @@ src_language_stats_built_sources = \
        src/language/stats/examine.c \
        src/language/stats/frequencies.c \
        src/language/stats/means.c \
        src/language/stats/examine.c \
        src/language/stats/frequencies.c \
        src/language/stats/means.c \
+       src/language/stats/npar.c \
        src/language/stats/oneway.c \
        src/language/stats/rank.c \
        src/language/stats/regression.c \
        src/language/stats/t-test.c
        src/language/stats/oneway.c \
        src/language/stats/rank.c \
        src/language/stats/regression.c \
        src/language/stats/t-test.c
+
 language_stats_sources = \
        src/language/stats/aggregate.c \
        src/language/stats/autorecode.c \
 language_stats_sources = \
        src/language/stats/aggregate.c \
        src/language/stats/autorecode.c \
+       src/language/stats/binomial.c \
+       src/language/stats/binomial.h \
+       src/language/stats/chisquare.c \
+       src/language/stats/chisquare.h \
        src/language/stats/descriptives.c \
        src/language/stats/descriptives.c \
+       src/language/stats/npar.h \
        src/language/stats/sort-cases.c \
        src/language/stats/sort-criteria.c \
        src/language/stats/sort-criteria.h \
        src/language/stats/flip.c \
        src/language/stats/sort-cases.c \
        src/language/stats/sort-criteria.c \
        src/language/stats/sort-criteria.h \
        src/language/stats/flip.c \
+       src/language/stats/freq.c \
+       src/language/stats/freq.h \
+       src/language/stats/npar-summary.c \
+       src/language/stats/npar-summary.h \
        src/language/stats/regression-export.h \
        $(src_language_stats_built_sources)
 
        src/language/stats/regression-export.h \
        $(src_language_stats_built_sources)
 
diff --git a/src/language/stats/binomial.c b/src/language/stats/binomial.c
new file mode 100644 (file)
index 0000000..a27e842
--- /dev/null
@@ -0,0 +1,270 @@
+/* PSPP - computes sample statistics.
+   Copyright (C) 2006 Free Software Foundation, Inc.
+   Written by John Darrington <john@darrington.wattle.id.au>
+
+   This program is free software; you can redistribute it and/or
+   modify it under the terms of the GNU General Public License as
+   published by the Free Software Foundation; either version 2 of the
+   License, or (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful, but
+   WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, write to the Free Software
+   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+   02110-1301, USA. */
+
+#include <config.h>
+#include <libpspp/compiler.h>
+#include <output/table.h>
+#include <libpspp/alloc.h>
+
+#include <data/case.h>
+#include <data/casefile.h>
+#include <data/dictionary.h>
+#include <data/procedure.h>
+#include <data/variable.h>
+#include <data/value.h>
+#include <data/value-labels.h>
+#include <data/casefilter.h>
+
+#include <libpspp/message.h>
+#include <libpspp/assertion.h>
+
+#include "binomial.h"
+#include "freq.h"
+
+#include "gettext.h"
+#define _(msgid) gettext (msgid)
+
+#include <libpspp/misc.h>
+
+#include <gsl/gsl_cdf.h>
+#include <gsl/gsl_randist.h>
+#include <gsl-extras/gsl-extras.h>
+
+#include <minmax.h>
+
+#include <libpspp/hash.h>
+
+static double calculate_binomial_internal (double n1, double n2,
+                                          double p);
+
+
+static void
+swap (double *i1, double *i2)
+{
+  double temp = *i1;
+  *i1 = *i2;
+  *i2 = temp;
+}
+
+static double
+calculate_binomial (double n1, double n2, double p)
+{
+  const double n = n1 + n2;
+  const bool test_reversed = (n1 / n > p ) ;
+  if ( test_reversed )
+    {
+      p = 1 - p ;
+      swap (&n1, &n2);
+    }
+
+  return calculate_binomial_internal (n1, n2, p);
+}
+
+static double
+calculate_binomial_internal (double n1, double n2, double p)
+{
+  /* SPSS Statistical Algorithms has completely different and WRONG 
+     advice here. */
+
+  double sig1tailed = gslextras_cdf_binomial_P (n1, n1 + n2, p);
+
+  if ( p == 0.5 )
+    return sig1tailed > 0.5 ? 1.0 :sig1tailed * 2.0;
+
+  return sig1tailed ;
+}
+
+static void
+do_binomial (const struct dictionary *dict,
+            const struct casefile *cf,
+            const struct binomial_test *bst,
+            struct freq *cat1,
+            struct freq *cat2,
+            const struct casefilter *filter
+            )
+{
+  bool warn = true;
+
+  const struct one_sample_test *ost = (const struct one_sample_test *) bst;
+  struct ccase c;
+  struct casereader *r = casefile_get_reader (cf, NULL);
+
+  while (casereader_read(r, &c))
+    {
+      int v;
+      double w =
+       dict_get_case_weight (dict, &c, &warn);
+
+      for (v = 0 ; v < ost->n_vars ; ++v )
+       {
+         const struct variable *var = ost->vars[v];
+         const union value *value = case_data (&c, var);
+
+         if ( casefilter_variable_missing (filter, &c, var))
+           break;
+
+         if ( NULL == cat1[v].value )
+           {
+             cat1[v].value = value_dup (value, var_get_width (var));
+             cat1[v].count = w;
+           }
+         else if ( 0 == compare_values (cat1[v].value, value,
+                                        var_get_width (var)))
+           cat1[v].count += w;
+         else if ( NULL == cat2[v].value )
+           {
+             cat2[v].value = value_dup (value, var_get_width (var));
+             cat2[v].count = w;
+           }
+         else if ( 0 == compare_values (cat2[v].value, value,
+                                        var_get_width (var)))
+           cat2[v].count += w;
+         else if ( bst->category1 == SYSMIS)
+           msg (ME, _("Variable %s is not dichotomous"), var_get_name (var));
+       }
+
+      case_destroy (&c);
+    }
+  casereader_destroy (r);
+}
+
+
+
+void
+binomial_execute (const struct dataset *ds,
+                 const struct casefile *cf,
+                 struct casefilter *filter,
+                 const struct npar_test *test)
+{
+  int v;
+  const struct binomial_test *bst = (const struct binomial_test *) test;
+  const struct one_sample_test *ost = (const struct one_sample_test*) test;
+
+  struct freq *cat1 = xzalloc (sizeof (*cat1) * ost->n_vars);
+  struct freq *cat2 = xzalloc (sizeof (*cat1) * ost->n_vars);
+  struct tab_table *table ;
+
+  assert ((bst->category1 == SYSMIS) == (bst->category2 == SYSMIS) );
+
+  if ( bst->category1 != SYSMIS )
+    {
+      union value v;
+      v.f = bst->category1;
+      cat1->value = value_dup (&v, 0);
+    }
+
+  if ( bst->category2 != SYSMIS )
+    {
+      union value v;
+      v.f = bst->category2;
+      cat2->value = value_dup (&v, 0);
+    }
+
+  do_binomial (dataset_dict(ds), cf, bst, cat1, cat2, filter);
+
+  table = tab_create (7, ost->n_vars * 3 + 1, 0);
+
+  tab_dim (table, tab_natural_dimensions);
+
+  tab_title (table, _("Binomial Test"));
+
+  tab_headers (table, 2, 0, 1, 0);
+
+  tab_box (table, TAL_1, TAL_1, -1, TAL_1,
+          0, 0, table->nc - 1, tab_nr(table) - 1 );
+
+  for (v = 0 ; v < ost->n_vars; ++v)
+    {
+      double n_total, sig;
+      const struct variable *var = ost->vars[v];
+      tab_hline (table, TAL_1, 0, tab_nc (table) -1, 1 + v * 3);
+
+      /* Titles */
+      tab_text (table, 0, 1 + v * 3, TAB_LEFT,
+               var_to_string (var));
+
+      tab_text (table, 1, 1 + v * 3, TAB_LEFT,
+               _("Group1"));
+
+      tab_text (table, 1, 2 + v * 3, TAB_LEFT,
+               _("Group2"));
+
+      tab_text (table, 1, 3 + v * 3, TAB_LEFT,
+               _("Total"));
+
+      /* Test Prop */
+      tab_float (table, 5, 1 + v * 3, TAB_NONE, bst->p, 8, 3);
+
+      /* Category labels */
+      tab_text (table, 2, 1 + v * 3, TAB_NONE,
+               var_get_value_name (var, cat1[v].value));
+
+      tab_text (table, 2, 2 + v * 3, TAB_NONE,
+               var_get_value_name (var, cat2[v].value));
+
+      /* Observed N */
+      tab_float (table, 3, 1 + v * 3, TAB_NONE,
+                cat1[v].count, 8, 0);
+
+      tab_float (table, 3, 2 + v * 3, TAB_NONE,
+                cat2[v].count, 8, 0);
+
+      n_total = cat1[v].count + cat2[v].count;
+
+
+      tab_float (table, 3, 3 + v * 3, TAB_NONE,
+                n_total, 8, 0);
+
+      /* Observed Proportions */
+
+      tab_float (table, 4, 1 + v * 3, TAB_NONE,
+                cat1[v].count / n_total, 8, 3);
+
+      tab_float (table, 4, 2 + v * 3, TAB_NONE,
+                cat2[v].count / n_total, 8, 3);
+
+      tab_float (table, 4, 3 + v * 3, TAB_NONE,
+                (cat1[v].count + cat2[v].count) / n_total, 8, 2);
+
+
+      /* Significance */
+      sig = calculate_binomial (cat1[v].count, cat2[v].count,
+                                      bst->p);
+
+      tab_float (table, 6, 1 + v * 3, TAB_NONE,
+                sig, 8, 3);
+    }
+
+  tab_text (table,  2, 0,  TAB_CENTER, _("Category"));
+  tab_text (table,  3, 0,  TAB_CENTER, _("N"));
+  tab_text (table,  4, 0,  TAB_CENTER, _("Observed Prop."));
+  tab_text (table,  5, 0,  TAB_CENTER, _("Test Prop."));
+
+  tab_text (table,  6, 0,  TAB_CENTER | TAT_PRINTF,
+           _("Exact Sig. (%d-tailed)"),
+           bst->p == 0.5 ? 2: 1);
+
+  tab_vline (table, TAL_2, 2, 0, tab_nr (table) -1);
+
+  free (cat1);
+  free (cat2);
+
+  tab_submit (table);
+
+}
diff --git a/src/language/stats/binomial.h b/src/language/stats/binomial.h
new file mode 100644 (file)
index 0000000..bcfc69b
--- /dev/null
@@ -0,0 +1,49 @@
+/* PSPP - computes sample statistics.
+   Copyright (C) 2006 Free Software Foundation, Inc.
+   Written by John Darrington <john@darrington.wattle.id.au>
+
+   This program is free software; you can redistribute it and/or
+   modify it under the terms of the GNU General Public License as
+   published by the Free Software Foundation; either version 2 of the
+   License, or (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful, but
+   WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, write to the Free Software
+   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+   02110-1301, USA. */
+
+#if !binomial_h
+#define binomial_h 1
+
+#include <config.h>
+#include <stddef.h>
+#include <stdbool.h>
+
+#include "npar.h"
+
+
+struct binomial_test
+{
+  struct one_sample_test parent;
+  double p;
+  double category1;
+  double category2;
+  double cutpoint;
+};
+
+
+struct casefile;
+struct dataset;
+
+
+void binomial_execute (const struct dataset *, 
+                      const struct casefile *, 
+                      struct casefilter *, 
+                      const struct npar_test *);
+
+#endif
diff --git a/src/language/stats/chisquare.c b/src/language/stats/chisquare.c
new file mode 100644 (file)
index 0000000..3accc75
--- /dev/null
@@ -0,0 +1,497 @@
+/* PSPP - computes sample statistics.
+   Copyright (C) 2006 Free Software Foundation, Inc.
+   Written by John Darrington <john@darrington.wattle.id.au>
+
+   This program is free software; you can redistribute it and/or
+   modify it under the terms of the GNU General Public License as
+   published by the Free Software Foundation; either version 2 of the
+   License, or (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful, but
+   WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, write to the Free Software
+   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+   02110-1301, USA. */
+
+#include <config.h>
+#include <libpspp/compiler.h>
+#include <libpspp/assertion.h>
+
+#include <stdlib.h>
+
+#include <data/case.h>
+#include <data/casefile.h>
+#include <data/casefilter.h>
+#include <data/variable.h>
+#include <data/dictionary.h>
+#include <data/procedure.h>
+
+#include <libpspp/message.h>
+#include <libpspp/hash.h>
+#include <libpspp/alloc.h>
+
+#include <gsl/gsl_cdf.h>
+
+#include <output/table.h>
+#include <data/value-labels.h>
+
+#include "npar.h"
+#include "chisquare.h"
+#include "freq.h"
+
+#include <math.h>
+
+#include "gettext.h"
+#define _(msgid) gettext (msgid)
+
+
+
+
+/* Return a hash table containing the frequency counts of each 
+   value of VAR in CF .
+   It is the caller's responsibility to free the hash table when 
+   no longer required.
+*/
+static struct hsh_table *
+create_freq_hash_with_range (const struct dictionary *dict, 
+                            const struct casefile *cf, 
+                            struct casefilter *filter,
+                            const struct variable *var, 
+                            double lo, 
+                            double hi)
+{
+  bool warn = true;
+  float i_d;
+  struct ccase c;
+  struct casereader *r = casefile_get_reader (cf, filter);
+
+  struct hsh_table *freq_hash = 
+    hsh_create (4, compare_freq, hash_freq, 
+               free_freq_mutable_hash,
+               (void *) var);
+
+  /* Populate the hash with zero entries */
+  for (i_d = trunc (lo); i_d <= trunc (hi); i_d += 1.0 ) 
+    {
+      union value the_value;
+      struct freq_mutable *fr = xmalloc (sizeof (*fr));
+
+      the_value.f = i_d;
+
+      fr->value = value_dup (&the_value, 0);
+      fr->count = 0;
+
+      hsh_insert (freq_hash, fr);
+    }
+
+  while (casereader_read(r, &c))
+    {
+      union value obs_value;
+      struct freq **existing_fr;
+      struct freq *fr = xmalloc(sizeof  (*fr));
+      fr->value = case_data (&c, var);
+
+      if ( casefilter_variable_missing (filter, &c, var))
+       {
+         free (fr);
+         continue;
+       }
+
+      fr->count = dict_get_case_weight (dict, &c, &warn);
+
+      obs_value.f = trunc (fr->value->f);
+
+      if ( obs_value.f < lo || obs_value.f > hi) 
+       {
+         free (fr);
+         case_destroy (&c);
+         continue;
+       }
+
+      fr->value = &obs_value;
+
+      existing_fr = (struct freq **) hsh_probe (freq_hash, fr);
+
+      /* This must exist in the hash, because we previously populated it 
+        with zero counts */
+      assert (*existing_fr);
+
+      (*existing_fr)->count += fr->count;
+      free (fr);
+
+      case_destroy (&c);
+    }
+  casereader_destroy (r);
+
+  return freq_hash;
+}
+
+
+/* Return a hash table containing the frequency counts of each 
+   value of VAR in CF .
+   It is the caller's responsibility to free the hash table when 
+   no longer required.
+*/
+static struct hsh_table *
+create_freq_hash (const struct dictionary *dict, 
+                 const struct casefile *cf, 
+                 struct casefilter *filter, 
+                 const struct variable *var)
+{
+  bool warn = true;
+  struct ccase c;
+  struct casereader *r = casefile_get_reader (cf, filter);
+
+  struct hsh_table *freq_hash = 
+    hsh_create (4, compare_freq, hash_freq, 
+               free_freq_hash,
+               (void *) var);
+
+  while (casereader_read(r, &c))
+    {
+      struct freq **existing_fr;
+      struct freq *fr = xmalloc(sizeof  (*fr));
+      fr->value = case_data (&c, var );
+
+      if ( casefilter_variable_missing (filter, &c, var))
+       {
+         free (fr);
+         continue;
+       }
+
+      fr->count = dict_get_case_weight (dict, &c, &warn);
+
+      existing_fr = (struct freq **) hsh_probe (freq_hash, fr);
+      if ( *existing_fr) 
+       {
+         (*existing_fr)->count += fr->count;
+         free (fr);
+       }
+      else
+       {
+         *existing_fr = fr;
+       }
+
+      case_destroy (&c);
+    }
+  casereader_destroy (r);
+
+  return freq_hash;
+}
+
+
+
+static struct tab_table *
+create_variable_frequency_table (const struct dictionary *dict, 
+                                const struct casefile *cf, 
+                                struct casefilter *filter,
+                                const struct chisquare_test *test, 
+                                int v, 
+                                struct hsh_table **freq_hash)
+
+{
+  int i;
+  const struct one_sample_test *ost = (const struct one_sample_test*)test;
+  int n_cells;
+  struct tab_table *table ;
+  const struct variable *var =  ost->vars[v];
+
+  *freq_hash = create_freq_hash (dict, cf, filter, var);
+      
+  n_cells = hsh_count (*freq_hash);
+
+  if ( test->n_expected > 0 && n_cells != test->n_expected ) 
+    {
+      msg(ME, _("CHISQUARE test specified %d expected values, but"
+               " %d distinct values were encountered in variable %s."), 
+         test->n_expected, n_cells, 
+         var_get_name (var)
+         );
+      return NULL;
+    }
+
+  table = tab_create(4, n_cells + 2, 0);
+  tab_dim (table, tab_natural_dimensions);
+
+  tab_title (table, var_to_string(var));
+  tab_text (table, 1, 0, TAB_LEFT, _("Observed N"));
+  tab_text (table, 2, 0, TAB_LEFT, _("Expected N"));
+  tab_text (table, 3, 0, TAB_LEFT, _("Residual"));
+       
+  tab_headers (table, 1, 0, 1, 0);
+
+  tab_box (table, TAL_1, TAL_1, -1, -1, 
+          0, 0, table->nc - 1, tab_nr(table) - 1 );
+
+  tab_hline (table, TAL_1, 0, tab_nc(table) - 1, 1);
+
+  tab_vline (table, TAL_2, 1, 0, tab_nr(table) - 1);
+  for ( i = 2 ; i < 4 ; ++i ) 
+    tab_vline (table, TAL_1, i, 0, tab_nr(table) - 1);
+
+
+  tab_text (table, 0, table->nr - 1, TAB_LEFT, _("Total"));
+
+  return table;
+}
+
+
+static struct tab_table *
+create_combo_frequency_table (const struct chisquare_test *test)
+{
+  int i;
+  const struct one_sample_test *ost = (const struct one_sample_test*)test;
+
+  struct tab_table *table ;
+
+  int n_cells = test->hi - test->lo + 1;
+
+  table = tab_create(1 + ost->n_vars * 4, n_cells + 3, 0);
+  tab_dim (table, tab_natural_dimensions);
+
+  tab_title (table, _("Frequencies"));
+  for ( i = 0 ; i < ost->n_vars ; ++i ) 
+    {
+      const struct variable *var = ost->vars[i];
+      tab_text (table, i * 4 + 1, 1, TAB_LEFT, _("Category"));
+      tab_text (table, i * 4 + 2, 1, TAB_LEFT, _("Observed N"));
+      tab_text (table, i * 4 + 3, 1, TAB_LEFT, _("Expected N"));
+      tab_text (table, i * 4 + 4, 1, TAB_LEFT, _("Residual"));
+
+      tab_vline (table, TAL_2, i * 4 + 1, 
+                0, tab_nr (table) - 1);
+
+      tab_vline (table, TAL_1, i * 4 + 2, 
+                0, tab_nr (table) - 1);
+
+      tab_vline (table, TAL_1, i * 4 + 3, 
+                1, tab_nr (table) - 1);
+
+      tab_vline (table, TAL_1, i * 4 + 4, 
+                1, tab_nr (table) - 1);
+
+
+      tab_joint_text (table, 
+                     i * 4 + 1, 0,
+                     i * 4 + 4, 0,
+                     TAB_CENTER, 
+                     var_to_string (var));
+    }
+
+  for ( i = test->lo ; i <= test->hi ; ++i ) 
+    tab_float (table, 0, 2 + i - test->lo, 
+              TAB_LEFT, 1 + i - test->lo, 8, 0);
+       
+  tab_headers (table, 1, 0, 2, 0);
+
+  tab_box (table, TAL_1, TAL_1, -1, -1, 
+          0, 0, table->nc - 1, tab_nr(table) - 1 );
+
+  tab_hline (table, TAL_1, 1, tab_nc(table) - 1, 1);
+  tab_hline (table, TAL_1, 0, tab_nc(table) - 1, 2);
+
+  tab_text (table, 0, table->nr - 1, TAB_LEFT, _("Total"));
+
+  return table;
+}
+
+
+static struct tab_table *
+create_stats_table (const struct chisquare_test *test)
+{
+  const struct one_sample_test *ost = (const struct one_sample_test*) test;
+  
+  struct tab_table *table = tab_create (1 + ost->n_vars, 4, 0);
+  tab_dim (table, tab_natural_dimensions);
+  tab_title (table, _("Test Statistics"));
+  tab_headers (table, 1, 0, 1, 0);
+
+  tab_box (table, TAL_1, TAL_1, -1, -1,
+          0, 0, tab_nc(table) - 1, tab_nr(table) - 1 );
+
+  tab_box (table, -1, -1, -1, TAL_1,
+          1, 0, tab_nc(table) - 1, tab_nr(table) - 1 );
+
+
+  tab_vline (table, TAL_2, 1, 0, tab_nr (table) - 1);
+  tab_hline (table, TAL_1, 0, tab_nc (table) - 1, 1);
+  
+
+  tab_text (table, 0, 1, TAB_LEFT, _("Chi-Square"));
+  tab_text (table, 0, 2, TAB_LEFT, _("df"));
+  tab_text (table, 0, 3, TAB_LEFT, _("Asymp. Sig."));
+
+  return table;
+}
+
+
+void 
+chisquare_execute (const struct dataset *ds,
+                  const struct casefile *cf, 
+                  struct casefilter *filter,
+                  const struct npar_test *test)
+{
+  const struct dictionary *dict = dataset_dict (ds);
+  int v, i;
+  struct one_sample_test *ost = (struct one_sample_test *) test;
+  struct chisquare_test *cst = (struct chisquare_test *) test;
+  struct tab_table *stats_table = create_stats_table (cst);
+  int n_cells = 0;
+  double total_expected = 0.0;
+
+  double *df = xzalloc (sizeof (*df) * ost->n_vars);
+  double *xsq = xzalloc (sizeof (*df) * ost->n_vars);
+  
+  for ( i = 0 ; i < cst->n_expected ; ++i ) 
+    total_expected += cst->expected[i];
+
+  if ( cst->ranged == false ) 
+    {
+      for ( v = 0 ; v < ost->n_vars ; ++v ) 
+       {
+         double total_obs = 0.0;
+         struct hsh_table *freq_hash = NULL;
+         struct tab_table *freq_table = 
+           create_variable_frequency_table(dict, cf, filter, cst, 
+                                           v, &freq_hash);
+
+         struct freq **ff = (struct freq **) hsh_sort (freq_hash);
+
+         if ( NULL == freq_table ) 
+           {
+             hsh_destroy (freq_hash);
+             continue;
+           }
+
+         n_cells = hsh_count (freq_hash);
+
+         for ( i = 0 ; i < n_cells ; ++i ) 
+           total_obs += ff[i]->count;
+
+         xsq[v] = 0.0;
+         for ( i = 0 ; i < n_cells ; ++i ) 
+           {
+             double exp;
+             const union value *observed_value = ff[i]->value;
+
+             /* The key */
+             tab_text (freq_table, 0, i + 1, TAB_LEFT, 
+                       var_get_value_name (ost->vars[v], observed_value));
+
+             /* The observed N */
+             tab_float (freq_table, 1, i + 1, TAB_NONE,
+                        ff[i]->count, 8, 0);
+
+             if ( cst->n_expected > 0 )
+               exp = cst->expected[i] * total_obs / total_expected ; 
+             else
+               exp = total_obs / (double) n_cells; 
+
+             tab_float (freq_table, 2, i + 1, TAB_NONE,
+                        exp, 8, 2);
+
+             /* The residual */
+             tab_float (freq_table, 3, i + 1, TAB_NONE,
+                        ff[i]->count - exp, 8, 2);
+
+             xsq[v] += (ff[i]->count - exp) * (ff[i]->count - exp) / exp;
+           }
+
+         df[v] = n_cells - 1.0;
+
+         tab_float (freq_table, 1, i + 1, TAB_NONE,
+                    total_obs, 8, 0);
+
+         tab_submit (freq_table);
+
+         hsh_destroy (freq_hash);
+       }
+    }
+  else  /* ranged == true */
+    {
+      struct tab_table *freq_table = create_combo_frequency_table (cst);
+      
+      n_cells = cst->hi - cst->lo + 1;
+
+      for ( v = 0 ; v < ost->n_vars ; ++v ) 
+       {
+         double total_obs = 0.0;
+         struct hsh_table *freq_hash = 
+           create_freq_hash_with_range (dict, cf, filter, ost->vars[v], 
+                                        cst->lo, cst->hi);
+
+         struct freq **ff = (struct freq **) hsh_sort (freq_hash);
+
+         assert ( n_cells == hsh_count (freq_hash));
+
+         for ( i = 0 ; i < hsh_count (freq_hash) ; ++i ) 
+           total_obs += ff[i]->count;
+
+         xsq[v] = 0.0;
+         for ( i = 0 ; i < hsh_count (freq_hash) ; ++i ) 
+           {
+             double exp;
+
+             const union value *observed_value = ff[i]->value;
+
+             /* The key */
+             tab_text  (freq_table, v * 4 + 1, i + 2 , TAB_LEFT, 
+                        var_get_value_name (ost->vars[v], observed_value));
+
+             /* The observed N */
+             tab_float (freq_table, v * 4 + 2, i + 2 , TAB_NONE,
+                        ff[i]->count, 8, 0);
+
+             if ( cst->n_expected > 0 )
+               exp = cst->expected[i] * total_obs / total_expected ; 
+             else
+               exp = total_obs / (double) hsh_count (freq_hash); 
+
+             /* The expected N */
+             tab_float (freq_table, v * 4 + 3, i + 2 , TAB_NONE,
+                        exp, 8, 2);
+
+             /* The residual */
+             tab_float (freq_table, v * 4 + 4, i + 2 , TAB_NONE,
+                        ff[i]->count - exp, 8, 2);
+
+             xsq[v] += (ff[i]->count - exp) * (ff[i]->count - exp) / exp;
+           }
+
+         
+         tab_float (freq_table, v * 4 + 2, tab_nr (freq_table) - 1, TAB_NONE,
+                    total_obs, 8, 0);
+         
+         df[v] = n_cells - 1.0;
+         
+         hsh_destroy (freq_hash);
+       }
+
+      tab_submit (freq_table);
+    }
+
+
+  /* Populate the summary statistics table */
+  for ( v = 0 ; v < ost->n_vars ; ++v ) 
+    {
+      const struct variable *var = ost->vars[v];
+
+      tab_text (stats_table, 1 + v, 0, TAB_CENTER, var_get_name (var));
+
+      tab_float (stats_table, 1 + v, 1, TAB_NONE, xsq[v], 8,3);
+      tab_float (stats_table, 1 + v, 2, TAB_NONE, df[v], 8,0);
+
+      tab_float (stats_table, 1 + v, 3, TAB_NONE, 
+                gsl_cdf_chisq_Q (xsq[v], df[v]), 8,3);
+    }
+
+  free (xsq);
+  free (df);
+
+  tab_submit (stats_table);
+}
+
diff --git a/src/language/stats/chisquare.h b/src/language/stats/chisquare.h
new file mode 100644 (file)
index 0000000..4310bb1
--- /dev/null
@@ -0,0 +1,56 @@
+/* PSPP - computes sample statistics.
+   Copyright (C) 2006 Free Software Foundation, Inc.
+   Written by John Darrington <john@darrington.wattle.id.au>
+
+   This program is free software; you can redistribute it and/or
+   modify it under the terms of the GNU General Public License as
+   published by the Free Software Foundation; either version 2 of the
+   License, or (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful, but
+   WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, write to the Free Software
+   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+   02110-1301, USA. */
+
+#if !chisquare_h
+#define chisquare_h 1
+
+#include <config.h>
+#include <stddef.h>
+#include <stdbool.h>
+
+#include "npar.h"
+struct chisquare_test
+{
+  struct one_sample_test parent;  
+
+  bool ranged ;     /* True if this test has a range specified */
+
+  int lo;           /* Lower bound of range (undefined if RANGED is false) */
+  int hi;           /* Upper bound of range (undefined if RANGED is false) */
+
+  double *expected; 
+  int n_expected;
+};
+
+struct casefile;
+struct dictionary ;
+struct hsh_table;
+
+void chisquare_insert_variables (const struct npar_test *test,
+                                struct hsh_table *variables);
+
+
+void chisquare_execute (const struct dataset *ds, 
+                       const struct casefile *cf, 
+                       struct casefilter *filter,
+                       const struct npar_test *test);
+
+
+
+#endif
diff --git a/src/language/stats/freq.c b/src/language/stats/freq.c
new file mode 100644 (file)
index 0000000..9ecc379
--- /dev/null
@@ -0,0 +1,61 @@
+/* PSPP - computes sample statistics.
+   Copyright (C) 2006 Free Software Foundation, Inc.
+   Written by John Darrington <john@darrington.wattle.id.au>
+
+   This program is free software; you can redistribute it and/or
+   modify it under the terms of the GNU General Public License as
+   published by the Free Software Foundation; either version 2 of the
+   License, or (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful, but
+   WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, write to the Free Software
+   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+   02110-1301, USA. */
+
+#include <config.h>
+#include <data/variable.h>
+#include <data/value.h>
+#include <libpspp/compiler.h>
+
+#include <stdlib.h>
+
+#include "freq.h"
+
+int 
+compare_freq ( const void *_f1, const void *_f2, const void *_var)
+{
+  const struct freq *f1 = _f1;
+  const struct freq *f2 = _f2;
+  const struct variable *var = _var;
+
+  return  compare_values (f1->value, f2->value, var_get_width (var) );
+}
+
+unsigned int
+hash_freq (const void *_f, const void *_var)
+{
+  const struct freq *f = _f;
+  const struct variable *var  = _var;
+
+  return hash_value (f->value, var_get_width (var));
+}
+
+/* Free function to be used on FR whose value parameter has been copied */
+void 
+free_freq_mutable_hash (void *fr, const void *var UNUSED)
+{
+  struct freq_mutable *freq = fr;
+  free (freq->value);
+  free (freq);
+}
+
+void 
+free_freq_hash (void *fr, const void *var UNUSED)
+{
+  free (fr);
+}
diff --git a/src/language/stats/freq.h b/src/language/stats/freq.h
new file mode 100644 (file)
index 0000000..365f178
--- /dev/null
@@ -0,0 +1,51 @@
+/* PSPP - computes sample statistics.
+   Copyright (C) 2006 Free Software Foundation, Inc.
+   Written by John Darrington <john@darrington.wattle.id.au>
+
+   This program is free software; you can redistribute it and/or
+   modify it under the terms of the GNU General Public License as
+   published by the Free Software Foundation; either version 2 of the
+   License, or (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful, but
+   WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, write to the Free Software
+   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+   02110-1301, USA. */
+
+#ifndef freq_h
+#define freq_h
+
+union value ;
+/* Frequency table entry. */
+struct freq
+  {
+    const union value *value;  /* The value. */
+    double count;              /* The number of occurrences of the value. */
+  };
+
+/* Non const version of frequency table entry. */
+struct freq_mutable
+  {
+    union value *value;                /* The value. */
+    double count;              /* The number of occurrences of the value. */
+  };
+
+
+int compare_freq ( const void *_f1, const void *_f2, const void *_var);
+
+unsigned int hash_freq (const void *_f, const void *_var);
+
+/* Free function for struct freq */
+void free_freq_hash (void *fr, const void *aux);
+
+/* Free function for struct freq_mutable */
+void free_freq_mutable_hash (void *fr, const void *var);
+
+
+
+#endif
index 077cae5c970a38b175b9e073f858355c7101674e..535e69070f8e2761d09c7ef245f6475a68d5af57 100644 (file)
@@ -58,6 +58,8 @@
 #include <output/output.h>
 #include <output/table.h>
 
 #include <output/output.h>
 #include <output/table.h>
 
+#include "freq.h"
+
 #include "minmax.h"
 
 #include "gettext.h"
 #include "minmax.h"
 
 #include "gettext.h"
@@ -203,13 +205,6 @@ static struct pool *gen_pool;      /* General mode. */
 
 /* Frequency tables. */
 
 
 /* Frequency tables. */
 
-/* Frequency table entry. */
-struct freq
-  {
-    union value *v;            /* The value. */
-    double c;                  /* The number of occurrences of the value. */
-  };
-
 /* Types of frequency tables. */
 enum
   {
 /* Types of frequency tables. */
 enum
   {
@@ -286,7 +281,6 @@ static void dump_condensed (struct variable *);
 static void dump_statistics (struct variable *, int show_varname);
 static void cleanup_freq_tab (struct variable *);
 
 static void dump_statistics (struct variable *, int show_varname);
 static void cleanup_freq_tab (struct variable *);
 
-static hsh_hash_func hash_value_numeric, hash_value_alpha;
 static hsh_compare_func compare_value_numeric_a, compare_value_alpha_a;
 static hsh_compare_func compare_value_numeric_d, compare_value_alpha_d;
 static hsh_compare_func compare_freq_numeric_a, compare_freq_alpha_a;
 static hsh_compare_func compare_value_numeric_a, compare_value_alpha_a;
 static hsh_compare_func compare_value_numeric_d, compare_value_alpha_d;
 static hsh_compare_func compare_freq_numeric_a, compare_freq_alpha_a;
@@ -526,16 +520,16 @@ calc (const struct ccase *c, void *aux UNUSED, const struct dataset *ds)
               struct freq target;
              struct freq **fpp;
 
               struct freq target;
              struct freq **fpp;
 
-              target.v = (union value *) val;
+              target.value = (union value *) val;
               fpp = (struct freq **) hsh_probe (ft->data, &target);
 
              if (*fpp != NULL)
               fpp = (struct freq **) hsh_probe (ft->data, &target);
 
              if (*fpp != NULL)
-               (*fpp)->c += weight;
+               (*fpp)->count += weight;
              else
                {
                  struct freq *fp = pool_alloc (gen_pool, sizeof *fp);
              else
                {
                  struct freq *fp = pool_alloc (gen_pool, sizeof *fp);
-                  fp->c = weight;
-                  fp->v = pool_clone (gen_pool,
+                  fp->count = weight;
+                  fp->value = pool_clone (gen_pool,
                                       val, MAX (MAX_SHORT_STRING, vf->width));
                   *fpp = fp;
                }
                                       val, MAX (MAX_SHORT_STRING, vf->width));
                   *fpp = fp;
                }
@@ -580,20 +574,7 @@ precalc (const struct ccase *first, void *aux UNUSED, const struct dataset *ds)
 
       if (ft->mode == FRQM_GENERAL)
        {
 
       if (ft->mode == FRQM_GENERAL)
        {
-          hsh_hash_func *hash;
-         hsh_compare_func *compare;
-
-         if (var_is_numeric (v))
-            {
-              hash = hash_value_numeric;
-              compare = compare_value_numeric_a; 
-            }
-         else 
-            {
-              hash = hash_value_alpha;
-              compare = compare_value_alpha_a;
-            }
-         ft->data = hsh_create (16, compare, hash, NULL, v);
+         ft->data = hsh_create (16, compare_freq, hash_freq, NULL, v);
        }
       else
        {
        }
       else
        {
@@ -719,7 +700,7 @@ not_missing (const void *f_, const void *v_)
   const struct freq *f = f_;
   const struct variable *v = v_;
 
   const struct freq *f = f_;
   const struct variable *v = v_;
 
-  return !var_is_value_missing (v, f->v);
+  return !var_is_value_missing (v, f->value);
 }
 
 /* Summarizes the frequency table data for variable V. */
 }
 
 /* Summarizes the frequency table data for variable V. */
@@ -764,7 +745,7 @@ postprocess_freq_tab (struct variable *v)
   for(i = 0 ;  i < ft->n_valid ; ++i ) 
     {
       f = &ft->valid[i];
   for(i = 0 ;  i < ft->n_valid ; ++i ) 
     {
       f = &ft->valid[i];
-      ft->valid_cases += f->c;
+      ft->valid_cases += f->count;
 
     }
 
 
     }
 
@@ -772,7 +753,7 @@ postprocess_freq_tab (struct variable *v)
   for(i = 0 ;  i < ft->n_missing ; ++i ) 
     {
       f = &ft->missing[i];
   for(i = 0 ;  i < ft->n_missing ; ++i ) 
     {
       f = &ft->missing[i];
-      ft->total_cases += f->c;
+      ft->total_cases += f->count;
     }
 
 }
     }
 
 }
@@ -993,25 +974,6 @@ add_percentile (double x)
 
 /* Comparison functions. */
 
 
 /* Comparison functions. */
 
-/* Hash of numeric values. */
-static unsigned
-hash_value_numeric (const void *value_, const void *aux UNUSED)
-{
-  const struct freq *value = value_;
-  return hsh_hash_double (value->v[0].f);
-}
-
-/* Hash of string values. */
-static unsigned
-hash_value_alpha (const void *value_, const void *v_)
-{
-  const struct freq *value = value_;
-  const struct variable *v = v_;
-  struct var_freqs *vf = get_var_freqs (v);
-
-  return hsh_hash_bytes (value->v[0].s, vf->width);
-}
-
 /* Ascending numeric compare of values. */
 static int
 compare_value_numeric_a (const void *a_, const void *b_, const void *aux UNUSED)
 /* Ascending numeric compare of values. */
 static int
 compare_value_numeric_a (const void *a_, const void *b_, const void *aux UNUSED)
@@ -1019,9 +981,9 @@ compare_value_numeric_a (const void *a_, const void *b_, const void *aux UNUSED)
   const struct freq *a = a_;
   const struct freq *b = b_;
 
   const struct freq *a = a_;
   const struct freq *b = b_;
 
-  if (a->v[0].f > b->v[0].f)
+  if (a->value[0].f > b->value[0].f)
     return 1;
     return 1;
-  else if (a->v[0].f < b->v[0].f)
+  else if (a->value[0].f < b->value[0].f)
     return -1;
   else
     return 0;
     return -1;
   else
     return 0;
@@ -1036,7 +998,7 @@ compare_value_alpha_a (const void *a_, const void *b_, const void *v_)
   const struct variable *v = v_;
   struct var_freqs *vf = get_var_freqs (v);
 
   const struct variable *v = v_;
   struct var_freqs *vf = get_var_freqs (v);
 
-  return memcmp (a->v[0].s, b->v[0].s, vf->width);
+  return memcmp (a->value[0].s, b->value[0].s, vf->width);
 }
 
 /* Descending numeric compare of values. */
 }
 
 /* Descending numeric compare of values. */
@@ -1061,14 +1023,14 @@ compare_freq_numeric_a (const void *a_, const void *b_, const void *aux UNUSED)
   const struct freq *a = a_;
   const struct freq *b = b_;
 
   const struct freq *a = a_;
   const struct freq *b = b_;
 
-  if (a->c > b->c)
+  if (a->count > b->count)
     return 1;
     return 1;
-  else if (a->c < b->c)
+  else if (a->count < b->count)
     return -1;
 
     return -1;
 
-  if (a->v[0].f > b->v[0].f)
+  if (a->value[0].f > b->value[0].f)
     return 1;
     return 1;
-  else if (a->v[0].f < b->v[0].f)
+  else if (a->value[0].f < b->value[0].f)
     return -1;
   else
     return 0;
     return -1;
   else
     return 0;
@@ -1084,12 +1046,12 @@ compare_freq_alpha_a (const void *a_, const void *b_, const void *v_)
   const struct variable *v = v_;
   struct var_freqs *vf = get_var_freqs (v);
 
   const struct variable *v = v_;
   struct var_freqs *vf = get_var_freqs (v);
 
-  if (a->c > b->c)
+  if (a->count > b->count)
     return 1;
     return 1;
-  else if (a->c < b->c)
+  else if (a->count < b->count)
     return -1;
   else
     return -1;
   else
-    return memcmp (a->v[0].s, b->v[0].s, vf->width);
+    return memcmp (a->value[0].s, b->value[0].s, vf->width);
 }
 
 /* Descending numeric compare of frequency;
 }
 
 /* Descending numeric compare of frequency;
@@ -1100,14 +1062,14 @@ compare_freq_numeric_d (const void *a_, const void *b_, const void *aux UNUSED)
   const struct freq *a = a_;
   const struct freq *b = b_;
 
   const struct freq *a = a_;
   const struct freq *b = b_;
 
-  if (a->c > b->c)
+  if (a->count > b->count)
     return -1;
     return -1;
-  else if (a->c < b->c)
+  else if (a->count < b->count)
     return 1;
 
     return 1;
 
-  if (a->v[0].f > b->v[0].f)
+  if (a->value[0].f > b->value[0].f)
     return 1;
     return 1;
-  else if (a->v[0].f < b->v[0].f)
+  else if (a->value[0].f < b->value[0].f)
     return -1;
   else
     return 0;
     return -1;
   else
     return 0;
@@ -1123,12 +1085,12 @@ compare_freq_alpha_d (const void *a_, const void *b_, const void *v_)
   const struct variable *v = v_;
   struct var_freqs *vf = get_var_freqs (v);
 
   const struct variable *v = v_;
   struct var_freqs *vf = get_var_freqs (v);
 
-  if (a->c > b->c)
+  if (a->count > b->count)
     return -1;
     return -1;
-  else if (a->c < b->c)
+  else if (a->count < b->count)
     return 1;
   else
     return 1;
   else
-    return memcmp (a->v[0].s, b->v[0].s, vf->width);
+    return memcmp (a->value[0].s, b->value[0].s, vf->width);
 }
 \f
 /* Frequency table display. */
 }
 \f
 /* Frequency table display. */
@@ -1206,21 +1168,26 @@ dump_full (struct variable *v)
     {
       double percent, valid_percent;
 
     {
       double percent, valid_percent;
 
-      cum_freq += f->c;
+      cum_freq += f->count;
 
 
-      percent = f->c / ft->total_cases * 100.0;
-      valid_percent = f->c / ft->valid_cases * 100.0;
+      percent = f->count / ft->total_cases * 100.0;
+      valid_percent = f->count / ft->valid_cases * 100.0;
       cum_total += valid_percent;
 
       if (lab)
        {
       cum_total += valid_percent;
 
       if (lab)
        {
-         const char *label = var_lookup_value_label (v, &f->v[0]);
+#if 0
+<<<<<<< frequencies.q
+         const char *label = val_labs_find (v->val_labs, f->value[0]);
+=======
+#endif
+         const char *label = var_lookup_value_label (v, &f->value[0]);
          if (label != NULL)
            tab_text (t, 0, r, TAB_LEFT, label);
        }
 
          if (label != NULL)
            tab_text (t, 0, r, TAB_LEFT, label);
        }
 
-      tab_value (t, 0 + lab, r, TAB_NONE, f->v, &vf->print);
-      tab_float (t, 1 + lab, r, TAB_NONE, f->c, 8, 0);
+      tab_value (t, 0 + lab, r, TAB_NONE, f->value, &vf->print);
+      tab_float (t, 1 + lab, r, TAB_NONE, f->count, 8, 0);
       tab_float (t, 2 + lab, r, TAB_NONE, percent, 5, 1);
       tab_float (t, 3 + lab, r, TAB_NONE, valid_percent, 5, 1);
       tab_float (t, 4 + lab, r, TAB_NONE, cum_total, 5, 1);
       tab_float (t, 2 + lab, r, TAB_NONE, percent, 5, 1);
       tab_float (t, 3 + lab, r, TAB_NONE, valid_percent, 5, 1);
       tab_float (t, 4 + lab, r, TAB_NONE, cum_total, 5, 1);
@@ -1228,19 +1195,19 @@ dump_full (struct variable *v)
     }
   for (; f < &ft->valid[n_categories]; f++)
     {
     }
   for (; f < &ft->valid[n_categories]; f++)
     {
-      cum_freq += f->c;
+      cum_freq += f->count;
 
       if (lab)
        {
 
       if (lab)
        {
-         const char *label = var_lookup_value_label (v, &f->v[0]);
+         const char *label = var_lookup_value_label (v, &f->value[0]);
          if (label != NULL)
            tab_text (t, 0, r, TAB_LEFT, label);
        }
 
          if (label != NULL)
            tab_text (t, 0, r, TAB_LEFT, label);
        }
 
-      tab_value (t, 0 + lab, r, TAB_NONE, f->v, &vf->print);
-      tab_float (t, 1 + lab, r, TAB_NONE, f->c, 8, 0);
+      tab_value (t, 0 + lab, r, TAB_NONE, f->value, &vf->print);
+      tab_float (t, 1 + lab, r, TAB_NONE, f->count, 8, 0);
       tab_float (t, 2 + lab, r, TAB_NONE,
       tab_float (t, 2 + lab, r, TAB_NONE,
-                    f->c / ft->total_cases * 100.0, 5, 1);
+                    f->count / ft->total_cases * 100.0, 5, 1);
       tab_text (t, 3 + lab, r, TAB_NONE, _("Missing"));
       r++;
     }
       tab_text (t, 3 + lab, r, TAB_NONE, _("Missing"));
       r++;
     }
@@ -1309,21 +1276,21 @@ dump_condensed (struct variable *v)
     {
       double percent;
 
     {
       double percent;
 
-      percent = f->c / ft->total_cases * 100.0;
-      cum_total += f->c / ft->valid_cases * 100.0;
+      percent = f->count / ft->total_cases * 100.0;
+      cum_total += f->count / ft->valid_cases * 100.0;
 
 
-      tab_value (t, 0, r, TAB_NONE, f->v, &vf->print);
-      tab_float (t, 1, r, TAB_NONE, f->c, 8, 0);
+      tab_value (t, 0, r, TAB_NONE, f->value, &vf->print);
+      tab_float (t, 1, r, TAB_NONE, f->count, 8, 0);
       tab_float (t, 2, r, TAB_NONE, percent, 3, 0);
       tab_float (t, 3, r, TAB_NONE, cum_total, 3, 0);
       r++;
     }
   for (; f < &ft->valid[n_categories]; f++)
     {
       tab_float (t, 2, r, TAB_NONE, percent, 3, 0);
       tab_float (t, 3, r, TAB_NONE, cum_total, 3, 0);
       r++;
     }
   for (; f < &ft->valid[n_categories]; f++)
     {
-      tab_value (t, 0, r, TAB_NONE, f->v, &vf->print);
-      tab_float (t, 1, r, TAB_NONE, f->c, 8, 0);
+      tab_value (t, 0, r, TAB_NONE, f->value, &vf->print);
+      tab_float (t, 1, r, TAB_NONE, f->count, 8, 0);
       tab_float (t, 2, r, TAB_NONE,
       tab_float (t, 2, r, TAB_NONE,
-                f->c / ft->total_cases * 100.0, 3, 0);
+                f->count / ft->total_cases * 100.0, 3, 0);
       r++;
     }
 
       r++;
     }
 
@@ -1386,7 +1353,7 @@ calc_stats (struct variable *v, double d[frq_n_stats])
     {
       static double prev_value = SYSMIS;
       f = &ft->valid[idx]; 
     {
       static double prev_value = SYSMIS;
       f = &ft->valid[idx]; 
-      rank += f->c ;
+      rank += f->count ;
       for (i = 0; i < n_percentiles; i++) 
         {
          double tp;
       for (i = 0; i < n_percentiles; i++) 
         {
          double tp;
@@ -1401,7 +1368,7 @@ calc_stats (struct variable *v, double d[frq_n_stats])
 
          if ( percentiles[i].flag ) 
            {
 
          if ( percentiles[i].flag ) 
            {
-             percentiles[i].x2 = f->v[0].f;
+             percentiles[i].x2 = f->value[0].f;
              percentiles[i].x1 = prev_value;
              percentiles[i].flag2 = 1;
              continue;
              percentiles[i].x1 = prev_value;
              percentiles[i].flag2 = 1;
              continue;
@@ -1409,9 +1376,9 @@ calc_stats (struct variable *v, double d[frq_n_stats])
 
           if (rank >  tp ) 
          {
 
           if (rank >  tp ) 
          {
-           if ( f->c > 1 && rank - (f->c - 1) > tp ) 
+           if ( f->count > 1 && rank - (f->count - 1) > tp ) 
              {
              {
-               percentiles[i].x2 = percentiles[i].x1 = f->v[0].f;
+               percentiles[i].x2 = percentiles[i].x1 = f->value[0].f;
                percentiles[i].flag2 = 1;
              }
            else
                percentiles[i].flag2 = 1;
              }
            else
@@ -1422,14 +1389,14 @@ calc_stats (struct variable *v, double d[frq_n_stats])
            continue;
          }
         }
            continue;
          }
         }
-      prev_value = f->v[0].f;
+      prev_value = f->value[0].f;
     }
 
   for (i = 0; i < n_percentiles; i++) 
     {
       /* Catches the case when p == 100% */
       if ( ! percentiles[i].flag2 ) 
     }
 
   for (i = 0; i < n_percentiles; i++) 
     {
       /* Catches the case when p == 100% */
       if ( ! percentiles[i].flag2 ) 
-       percentiles[i].x1 = percentiles[i].x2 = f->v[0].f;
+       percentiles[i].x1 = percentiles[i].x2 = f->value[0].f;
 
       /*
       printf("percentile %d (p==%.2f); X1 = %g; X2 = %g\n",
 
       /*
       printf("percentile %d (p==%.2f); X1 = %g; X2 = %g\n",
@@ -1465,12 +1432,12 @@ calc_stats (struct variable *v, double d[frq_n_stats])
   X_mode = SYSMIS;
   for (f = ft->valid; f < ft->missing; f++)
     {
   X_mode = SYSMIS;
   for (f = ft->valid; f < ft->missing; f++)
     {
-      if (most_often < f->c) 
+      if (most_often < f->count
         {
         {
-          most_often = f->c;
-          X_mode = f->v[0].f;
+          most_often = f->count;
+          X_mode = f->value[0].f;
         }
         }
-      else if (most_often == f->c) 
+      else if (most_often == f->count
         {
           /* A duplicate mode is undefined.
              FIXME: keep track of *all* the modes. */
         {
           /* A duplicate mode is undefined.
              FIXME: keep track of *all* the modes. */
@@ -1481,16 +1448,16 @@ calc_stats (struct variable *v, double d[frq_n_stats])
   /* Calculate moments. */
   m = moments_create (MOMENT_KURTOSIS);
   for (f = ft->valid; f < ft->missing; f++)
   /* Calculate moments. */
   m = moments_create (MOMENT_KURTOSIS);
   for (f = ft->valid; f < ft->missing; f++)
-    moments_pass_one (m, f->v[0].f, f->c);
+    moments_pass_one (m, f->value[0].f, f->count);
   for (f = ft->valid; f < ft->missing; f++)
   for (f = ft->valid; f < ft->missing; f++)
-    moments_pass_two (m, f->v[0].f, f->c);
+    moments_pass_two (m, f->value[0].f, f->count);
   moments_calculate (m, NULL, &d[frq_mean], &d[frq_variance],
                      &d[frq_skew], &d[frq_kurt]);
   moments_destroy (m);
                      
   /* Formulas below are taken from _SPSS Statistical Algorithms_. */
   moments_calculate (m, NULL, &d[frq_mean], &d[frq_variance],
                      &d[frq_skew], &d[frq_kurt]);
   moments_destroy (m);
                      
   /* Formulas below are taken from _SPSS Statistical Algorithms_. */
-  d[frq_min] = ft->valid[0].v[0].f;
-  d[frq_max] = ft->valid[ft->n_valid - 1].v[0].f;
+  d[frq_min] = ft->valid[0].value[0].f;
+  d[frq_max] = ft->valid[ft->n_valid - 1].value[0].f;
   d[frq_mode] = X_mode;
   d[frq_range] = d[frq_max] - d[frq_min];
   d[frq_median] = *median_value;
   d[frq_mode] = X_mode;
   d[frq_range] = d[frq_max] - d[frq_min];
   d[frq_median] = *median_value;
@@ -1595,11 +1562,11 @@ freq_tab_to_hist(const struct freq_tab *ft, const struct variable *var)
   /* Find out the extremes of the x value */
   for ( frq = hsh_first(fh, &hi); frq != 0; frq = hsh_next(fh, &hi) ) 
     {
   /* Find out the extremes of the x value */
   for ( frq = hsh_first(fh, &hi); frq != 0; frq = hsh_next(fh, &hi) ) 
     {
-      if ( var_is_value_missing(var, frq->v))
+      if ( var_is_value_missing(var, frq->value))
        continue;
 
        continue;
 
-      if ( frq->v[0].f < x_min ) x_min = frq->v[0].f ;
-      if ( frq->v[0].f > x_max ) x_max = frq->v[0].f ;
+      if ( frq->value[0].f < x_min ) x_min = frq->value[0].f ;
+      if ( frq->value[0].f > x_max ) x_max = frq->value[0].f ;
     }
 
   hist = histogram_create(bins, x_min, x_max);
     }
 
   hist = histogram_create(bins, x_min, x_max);
@@ -1607,7 +1574,7 @@ freq_tab_to_hist(const struct freq_tab *ft, const struct variable *var)
   for( i = 0 ; i < ft->n_valid ; ++i ) 
     {
       frq = &ft->valid[i];
   for( i = 0 ; i < ft->n_valid ; ++i ) 
     {
       frq = &ft->valid[i];
-      gsl_histogram_accumulate(hist, frq->v[0].f, frq->c);
+      gsl_histogram_accumulate(hist, frq->value[0].f, frq->count);
     }
 
   return hist;
     }
 
   return hist;
@@ -1640,9 +1607,8 @@ freq_tab_to_slice_array(const struct freq_tab *frq_tab,
     {
       const struct freq *frq = &frq_tab->valid[i];
 
     {
       const struct freq *frq = &frq_tab->valid[i];
 
-      slices[i].label = var_get_value_name (var, frq->v);
-
-      slices[i].magnetude = frq->c;
+      slices[i].label = var_get_value_name (var, frq->value);
+      slices[i].magnetude = frq->count;
     }
 
   return slices;
     }
 
   return slices;
diff --git a/src/language/stats/npar-summary.c b/src/language/stats/npar-summary.c
new file mode 100644 (file)
index 0000000..7dbe6d2
--- /dev/null
@@ -0,0 +1,171 @@
+/* PSPP - computes sample statistics.
+   Copyright (C) 2006 Free Software Foundation, Inc.
+   Written by John Darrington <john@darrington.wattle.id.au>
+
+   This program is free software; you can redistribute it and/or
+   modify it under the terms of the GNU General Public License as
+   published by the Free Software Foundation; either version 2 of the
+   License, or (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful, but
+   WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, write to the Free Software
+   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+   02110-1301, USA. */
+
+#include <config.h>
+#include <output/table.h>
+#include <libpspp/hash.h>
+#include <data/variable.h>
+#include "npar-summary.h"
+#include <math/moments.h>
+#include <data/casefile.h>
+#include <data/casefilter.h>
+#include <data/case.h>
+#include <data/dictionary.h>
+#include <math.h>
+#include <minmax.h>
+
+#include "gettext.h"
+#define _(msgid) gettext (msgid)
+
+
+void
+npar_summary_calc_descriptives (struct descriptives *desc,
+                               const struct casefile *cf,
+                               struct casefilter *filter, 
+                               const struct dictionary *dict,
+                               const struct variable *const *vv, 
+                               int n_vars UNUSED)
+{
+  int i = 0;
+  while (*vv)
+    {
+      bool warn = true;
+      double minimum = DBL_MAX;
+      double maximum = -DBL_MAX;
+      double var;
+      struct moments1 *moments = moments1_create (MOMENT_VARIANCE);
+      struct casereader *r = casefile_get_reader (cf, filter);
+      struct ccase c;
+      const struct variable *v = *vv++;
+
+      while (casereader_read(r, &c))
+       {
+         const union value *val = case_data (&c, v);
+         double w = dict_get_case_weight (dict, &c, &warn);
+
+         if ( ! casefilter_variable_missing (filter, &c, v ))
+           {
+             minimum = MIN (minimum, val->f);
+             maximum = MAX (maximum, val->f);
+             moments1_add (moments, val->f, w); 
+           }
+         case_destroy (&c);
+       }
+      casereader_destroy (r);
+
+      moments1_calculate (moments, 
+                         &desc[i].n, 
+                         &desc[i].mean, 
+                         &var,
+                         NULL, NULL);
+
+      desc[i].std_dev = sqrt (var);
+
+      moments1_destroy (moments);
+      
+      desc[i].min = minimum;
+      desc[i].max = maximum;
+      
+      i++;
+    }
+}
+
+
+
+void
+do_summary_box (const struct descriptives *desc, 
+               const struct variable *const *vv,
+               int n_vars)
+{
+  int v;
+  bool quartiles = false;
+
+  int col;
+  int columns = 1 ;
+  struct tab_table *table ;
+
+
+  if ( desc ) columns += 5;
+  if ( quartiles ) columns += 3;
+
+  table = tab_create (columns, 2 + n_vars, 0);
+
+  tab_dim (table, tab_natural_dimensions);
+
+  tab_title (table, _("Descriptive Statistics"));
+       
+  tab_headers (table, 1, 0, 1, 0);
+
+  tab_box (table, TAL_1, TAL_1, -1, TAL_1, 
+          0, 0, table->nc - 1, tab_nr(table) - 1 );
+
+  tab_hline (table, TAL_2, 0, tab_nc (table) -1, 2);
+  tab_vline (table, TAL_2, 1, 0, tab_nr (table) - 1);
+
+  col = 1;
+  if ( desc ) 
+    {
+      tab_joint_text (table, col, 0, col, 1, TAT_TITLE | TAB_CENTER, 
+                     _("N"));
+      col++;
+      tab_joint_text (table, col, 0, col, 1, TAT_TITLE | TAB_CENTER, 
+                     _("Mean"));
+      col++;
+      tab_joint_text (table, col, 0, col, 1, TAT_TITLE | TAB_CENTER, 
+                     _("Std. Deviation"));
+      col++;
+      tab_joint_text (table, col, 0, col, 1, TAT_TITLE | TAB_CENTER, 
+                     _("Minimum"));
+      col++;
+      tab_joint_text (table, col, 0, col, 1, TAT_TITLE | TAB_CENTER, 
+                     _("Maximum"));
+      col++;
+    }
+
+  if ( quartiles ) 
+    {
+      tab_joint_text (table, col, 0, col + 2, 0, TAT_TITLE | TAB_CENTER,
+                     _("Percentiles"));
+      tab_hline (table, TAL_1, col, col + 2, 1);
+
+      tab_text (table, col, 1, TAT_TITLE | TAB_CENTER, 
+               _("25th"));
+      col++;
+      tab_text (table, col, 1, TAT_TITLE | TAB_CENTER, 
+               _("50th (Median)"));
+      col++;
+      tab_text (table, col, 1, TAT_TITLE | TAB_CENTER, 
+               _("75th"));
+      col++;
+    }
+
+  for ( v = 0 ; v < n_vars ; ++v ) 
+    {
+      tab_text (table, 0, 2 + v, TAT_NONE, var_to_string (vv[v]));
+
+      tab_float (table, 1, 2 + v, TAT_NONE, desc[v].n, 8, 0);
+      tab_float (table, 2, 2 + v, TAT_NONE, desc[v].mean, 8, 3);
+      tab_float (table, 3, 2 + v, TAT_NONE, desc[v].std_dev, 8, 3);
+      tab_float (table, 4, 2 + v, TAT_NONE, desc[v].min, 8, 3);
+      tab_float (table, 5, 2 + v, TAT_NONE, desc[v].max, 8, 3);
+    }
+
+
+  tab_submit (table);
+}
diff --git a/src/language/stats/npar-summary.h b/src/language/stats/npar-summary.h
new file mode 100644 (file)
index 0000000..e8132e5
--- /dev/null
@@ -0,0 +1,53 @@
+/* PSPP - computes sample statistics.
+   Copyright (C) 2006 Free Software Foundation, Inc.
+   Written by John Darrington <john@darrington.wattle.id.au>
+
+   This program is free software; you can redistribute it and/or
+   modify it under the terms of the GNU General Public License as
+   published by the Free Software Foundation; either version 2 of the
+   License, or (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful, but
+   WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, write to the Free Software
+   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+   02110-1301, USA. */
+
+#if !n_par_summary_h
+#define n_par_summary_h 1
+
+#include <config.h>
+
+struct variable ;
+struct casefile ;
+struct dictionary;
+struct casefilter;
+
+struct descriptives
+{
+  double n;
+  double mean;
+  double std_dev;
+  double min;
+  double max;
+};
+
+void npar_summary_calc_descriptives (struct descriptives *desc,
+                                    const struct casefile *cf,
+                                    struct casefilter *filter,
+                                    const struct dictionary *dict,
+                                    const struct variable *const *vv, 
+                                    int n_vars);
+
+
+void do_summary_box (const struct descriptives *desc, 
+                    const struct variable *const *vv,
+                    int n_vars);
+
+
+
+#endif
diff --git a/src/language/stats/npar.h b/src/language/stats/npar.h
new file mode 100644 (file)
index 0000000..9118a44
--- /dev/null
@@ -0,0 +1,56 @@
+/* PSPP - computes sample statistics.
+   Copyright (C) 2006 Free Software Foundation, Inc.
+   Written by John Darrington <john@darrington.wattle.id.au>
+
+   This program is free software; you can redistribute it and/or
+   modify it under the terms of the GNU General Public License as
+   published by the Free Software Foundation; either version 2 of the
+   License, or (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful, but
+   WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, write to the Free Software
+   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+   02110-1301, USA. */
+
+#if !npar_h
+#define npar_h 1
+
+typedef struct variable *var_ptr;
+typedef var_ptr variable_pair[2];
+
+struct hsh_table;
+struct casefilter ;
+
+struct npar_test
+{
+  void (*execute) (const struct dataset *, 
+                  const struct casefile *, 
+                  struct casefilter *,
+                  const struct npar_test *
+                  );
+
+  void (*insert_variables) (const struct npar_test *, 
+                           struct hsh_table *);
+};
+
+struct one_sample_test
+{
+  struct npar_test parent;
+  struct variable **vars;
+  size_t n_vars;
+};
+
+struct two_sample_test
+{
+  struct npar_test parent;
+  variable_pair *pairs;
+  size_t n_pairs;
+};
+
+
+#endif
diff --git a/src/language/stats/npar.q b/src/language/stats/npar.q
new file mode 100644 (file)
index 0000000..2881ff9
--- /dev/null
@@ -0,0 +1,569 @@
+/* PSPP - NPAR TESTS. -*-c-*-
+
+Copyright (C) 2006 Free Software Foundation, Inc.
+Author: John Darrington <john@darrington.wattle.id.au>, 
+
+This program is free software; you can redistribute it and/or
+modify it under the terms of the GNU General Public License as
+published by the Free Software Foundation; either version 2 of the
+License, or (at your option) any later version.
+
+This program is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301, USA. */
+
+#include <config.h>
+
+#include <language/lexer/lexer.h>
+#include <language/lexer/variable-parser.h>
+#include <language/command.h>
+#include <data/procedure.h>
+#include <libpspp/pool.h>
+#include <libpspp/hash.h>
+
+#include <data/casefilter.h>
+#include <data/case.h>
+#include <data/casefile.h>
+#include <math/moments.h>
+#include <data/dictionary.h>
+#include <language/stats/chisquare.h>
+#include <language/stats/binomial.h>
+#include <math.h>
+
+#include "npar.h"
+#include "npar-summary.h"
+
+#include "gettext.h"
+#define _(msgid) gettext (msgid)
+
+/* (headers) */
+
+/* (specification)
+   "NPAR TESTS" (npar_):
+   +chisquare=custom;
+   +binomial=custom;
+   +wilcoxon=custom;
+   +mcnemar=custom;
+   +sign=custom;
+   +cochran=varlist;
+   +friedman=varlist;
+   +kendall=varlist;
+   missing=miss:!analysis/listwise,
+           incl:include/!exclude;
+   +statistics[st_]=descriptives,quartiles,all.
+*/
+/* (declarations) */
+/* (functions) */
+
+
+static struct cmd_npar_tests cmd;
+
+
+struct npar_specs
+{
+  struct pool *pool;
+  struct npar_test **test;
+  size_t n_tests;
+
+  const struct variable *const* vv; /* Compendium of all variables 
+                                      (those mentioned on ANY subcommand */
+  int n_vars; /* Number of variables in vv */
+
+  struct casefilter *filter; /* The missing value filter */
+
+  bool descriptives;       /* Descriptive statistics should be calculated */
+  bool quartiles;          /* Quartiles should be calculated */
+};
+
+void one_sample_insert_variables (const struct npar_test *test,
+                                 struct hsh_table *variables);
+
+static bool 
+npar_execute(const struct ccase *first UNUSED,
+            const struct casefile *cf, void *aux, 
+            const struct dataset *ds)
+{
+  int t;
+  const struct npar_specs *specs = aux;
+  struct descriptives *summary_descriptives = NULL;
+
+  for ( t = 0 ; t < specs->n_tests; ++t ) 
+    {
+      const struct npar_test *test = specs->test[t];
+      if ( NULL == test->execute )
+       {
+         msg (SW, _("NPAR subcommand not currently implemented."));
+         continue;
+       }
+      test->execute (ds, cf, specs->filter, test);
+    }
+
+  if ( specs->descriptives )
+    {
+      summary_descriptives = xnmalloc (sizeof (*summary_descriptives), 
+                                      specs->n_vars);
+
+      npar_summary_calc_descriptives (summary_descriptives, cf, 
+                                     specs->filter,
+                                     dataset_dict (ds),
+                                     specs->vv, specs->n_vars);
+    }
+
+  if ( specs->descriptives || specs->quartiles ) 
+    do_summary_box (summary_descriptives, specs->vv, specs->n_vars );
+
+  free (summary_descriptives);
+  
+  return true;
+}
+
+
+int
+cmd_npar_tests (struct lexer *lexer, struct dataset *ds)
+{
+  bool ok;
+  int i;
+  struct npar_specs npar_specs = {0, 0, 0, 0, 0, 0, 0, 0};
+  struct hsh_table *var_hash;
+  npar_specs.pool = pool_create ();
+
+  var_hash = hsh_create_pool (npar_specs.pool, 0, 
+                             compare_vars_by_name, hash_var_by_name, 
+                             NULL, NULL);
+
+  if ( ! parse_npar_tests (lexer, ds, &cmd, &npar_specs) ) 
+    {
+      pool_destroy (npar_specs.pool);
+      return CMD_FAILURE;
+    }
+
+  for (i = 0; i < npar_specs.n_tests; ++i ) 
+    {
+      const struct npar_test *test = npar_specs.test[i];
+      test->insert_variables (test, var_hash);
+    }
+
+  npar_specs.vv =  (const struct variable *const *) hsh_data (var_hash);
+  npar_specs.n_vars = hsh_count (var_hash);
+  
+  if ( cmd.sbc_statistics ) 
+    {
+      int i;
+
+      for ( i = 0 ; i < NPAR_ST_count; ++i ) 
+       {
+         if ( cmd.a_statistics[i] ) 
+           {
+             switch ( i ) 
+               {
+               case NPAR_ST_DESCRIPTIVES:
+                 npar_specs.descriptives = true;
+                 break;
+               case NPAR_ST_QUARTILES:
+                 npar_specs.quartiles = true;
+                 break;
+               case NPAR_ST_ALL:
+                 npar_specs.quartiles = true;
+                 npar_specs.descriptives = true;
+                 break;
+               default:
+                 NOT_REACHED();
+               };
+           }
+       }
+    }
+
+  npar_specs.filter = 
+    casefilter_create (cmd.incl == NPAR_EXCLUDE, 0, 0);
+
+  if ( cmd.miss == NPAR_LISTWISE ) 
+    casefilter_add_variables (npar_specs.filter, 
+                             npar_specs.vv, 
+                             npar_specs.n_vars);
+
+  ok = multipass_procedure_with_splits (ds, npar_execute, &npar_specs);
+
+  casefilter_destroy (npar_specs.filter);
+
+  hsh_destroy (var_hash);
+
+  pool_destroy (npar_specs.pool);
+
+  return ok ? CMD_SUCCESS : CMD_CASCADING_FAILURE;
+}
+
+int
+npar_custom_chisquare(struct lexer *lexer, struct dataset *ds, struct cmd_npar_tests *cmd UNUSED, void *aux )
+{
+  struct npar_specs *specs = aux;
+
+  struct chisquare_test *cstp = pool_alloc(specs->pool, sizeof(*cstp));
+  struct one_sample_test *tp = (struct one_sample_test *) cstp;
+
+  ((struct npar_test *)tp)->execute = chisquare_execute;
+  ((struct npar_test *)tp)->insert_variables = one_sample_insert_variables;
+
+  if (!parse_variables_pool (lexer, specs->pool, dataset_dict (ds), 
+                            &tp->vars, &tp->n_vars,
+                            PV_NO_SCRATCH | PV_NO_DUPLICATE))
+    {
+      return 2;
+    }
+
+  cstp->ranged = false;
+
+  if ( lex_match (lexer, '('))
+    {
+      cstp->ranged = true;
+      if ( ! lex_force_num (lexer)) return 0;
+      cstp->lo = lex_integer (lexer);
+      lex_get (lexer);
+      lex_force_match (lexer, ',');
+      if (! lex_force_num (lexer) ) return 0;
+      cstp->hi = lex_integer (lexer);
+      if ( cstp->lo >= cstp->hi ) 
+       {
+         msg(ME, 
+             _("The specified value of HI (%d) is "
+               "lower than the specified value of LO (%d)"), 
+             cstp->hi, cstp->lo);
+         return 0;
+       }
+      lex_get (lexer);
+      if (! lex_force_match (lexer, ')')) return 0;
+    }
+
+  cstp->n_expected = 0;
+  cstp->expected = NULL;
+  if ( lex_match (lexer, '/') ) 
+    {
+      if ( lex_match_id (lexer, "EXPECTED") ) 
+       {
+         lex_force_match (lexer, '=');
+         if ( ! lex_match_id (lexer, "EQUAL") ) 
+           {
+             double f;
+             int n;
+             while ( lex_is_number(lexer) ) 
+               {
+                 int i;
+                 n = 1;
+                 f = lex_number (lexer);
+                 lex_get (lexer);
+                 if ( lex_match (lexer, '*'))
+                   {
+                     n = f;
+                     f = lex_number (lexer);
+                     lex_get (lexer);
+                   }
+                 lex_match (lexer, ',');
+
+                 cstp->n_expected += n;
+                 cstp->expected = pool_realloc (specs->pool,
+                                                cstp->expected, 
+                                                sizeof(double) * 
+                                                cstp->n_expected);
+                 for ( i = cstp->n_expected - n ;
+                       i < cstp->n_expected; 
+                       ++i ) 
+                   cstp->expected[i] = f;
+                 
+               }
+           }
+       }     
+      else
+       lex_put_back (lexer, '/');
+    }
+
+  if ( cstp->ranged && cstp->n_expected > 0 && 
+       cstp->n_expected != cstp->hi - cstp->lo + 1 ) 
+    {
+      msg(ME, 
+         _("%d expected values were given, but the specified "
+           "range (%d-%d) requires exactly %d values."), 
+         cstp->n_expected, cstp->lo, cstp->hi, 
+         cstp->hi - cstp->lo +1);
+      return 0;
+    }
+
+  specs->n_tests++;
+  specs->test = pool_realloc (specs->pool, 
+                             specs->test, 
+                             sizeof(*specs->test) * specs->n_tests);
+
+  specs->test[specs->n_tests - 1] = (struct npar_test *) tp;
+
+  return 1;
+}
+
+
+int
+npar_custom_binomial(struct lexer *lexer, struct dataset *ds, struct cmd_npar_tests *cmd UNUSED, void *aux)
+{
+  struct npar_specs *specs = aux;
+  struct binomial_test *btp = pool_alloc(specs->pool, sizeof(*btp));
+  struct one_sample_test *tp = (struct one_sample_test *) btp;
+
+  ((struct npar_test *)tp)->execute = binomial_execute;
+  ((struct npar_test *)tp)->insert_variables = one_sample_insert_variables;
+
+  btp->category1 = btp->category2 = btp->cutpoint = SYSMIS;
+
+  if ( lex_match(lexer, '(') ) 
+    {
+      if ( lex_force_num (lexer) ) 
+       {
+         btp->p = lex_number (lexer);
+         lex_get (lexer);
+         lex_force_match (lexer, ')');
+       }
+      else
+       return 0;
+    }
+
+  if ( lex_match (lexer, '=') ) 
+    {
+      if (parse_variables_pool (lexer, specs->pool, dataset_dict (ds), 
+                               &tp->vars, &tp->n_vars,
+                               PV_NUMERIC | PV_NO_SCRATCH | PV_NO_DUPLICATE) )
+       {
+         if ( lex_match (lexer, '('))
+           {
+             lex_force_num (lexer);
+             btp->category1 = lex_number (lexer);
+             lex_get (lexer);
+             if ( ! lex_force_match (lexer, ',')) return 2;
+             if ( ! lex_force_num (lexer) ) return 2;
+             btp->category2 = lex_number (lexer);
+             lex_get (lexer);
+             lex_force_match (lexer, ')');
+           }
+       }
+      else
+       return 2;
+    }
+  else
+    {
+      if ( lex_match (lexer, '(') ) 
+       {
+         lex_force_num (lexer);
+         btp->cutpoint = lex_number (lexer);
+         lex_get (lexer);
+         lex_force_match (lexer, ')');
+       }
+    }
+
+  specs->n_tests++;
+  specs->test = pool_realloc (specs->pool, 
+                             specs->test, 
+                             sizeof(*specs->test) * specs->n_tests);
+
+  specs->test[specs->n_tests - 1] = (struct npar_test *) tp;
+
+  return 1;
+}
+
+
+bool parse_two_sample_related_test (struct lexer *lexer, 
+                                   const struct dictionary *dict, 
+                                   struct cmd_npar_tests *cmd, 
+                                   struct two_sample_test *test_parameters,
+                                   struct pool *pool
+                                   );
+
+
+bool
+parse_two_sample_related_test (struct lexer *lexer, 
+                              const struct dictionary *dict, 
+                              struct cmd_npar_tests *cmd UNUSED, 
+                              struct two_sample_test *test_parameters,
+                              struct pool *pool
+                              )
+{
+  int n = 0;
+  bool paired = false;
+  bool with = false;
+  struct variable **vlist1;
+  size_t n_vlist1;
+
+  struct variable **vlist2;
+  size_t n_vlist2;
+
+  if (!parse_variables_pool (lexer, pool, 
+                            dict, 
+                            &vlist1, &n_vlist1,
+                            PV_NUMERIC | PV_NO_SCRATCH | PV_NO_DUPLICATE) )
+    return false;
+
+  if ( lex_match(lexer, T_WITH))
+    {
+      with = true;
+      if ( !parse_variables_pool (lexer, pool, dict,
+                                 &vlist2, &n_vlist2,
+                                 PV_NUMERIC | PV_NO_SCRATCH | PV_NO_DUPLICATE) )
+       return false;
+      
+      paired = (lex_match (lexer, '(') && 
+               lex_match_id (lexer, "PAIRED") && lex_match (lexer, ')'));
+    }
+  
+
+  if ( with ) 
+    {
+      if (paired) 
+       {
+         if ( n_vlist1 != n_vlist2) 
+           msg (SE, _("PAIRED was specified but the number of variables "
+                      "preceding WITH (%d) did not match the number "
+                      "following (%d)."), n_vlist1, n_vlist2);
+
+         test_parameters->n_pairs = n_vlist1 ;
+       }
+      else
+       {
+         test_parameters->n_pairs = n_vlist1 * n_vlist2;
+       }
+    }
+  else
+    {
+      test_parameters->n_pairs = (n_vlist1 * (n_vlist1 - 1)) / 2 ;
+    }
+
+  test_parameters->pairs = 
+    pool_alloc (pool, sizeof ( variable_pair) * test_parameters->n_pairs);
+
+  if ( with ) 
+    {
+      if (paired)
+       {
+         int i;
+         assert (n_vlist1 == n_vlist2);
+         for ( i = 0 ; i < n_vlist1; ++i )
+           {
+             test_parameters->pairs[n][0] = vlist1[i];
+             test_parameters->pairs[n][1] = vlist2[i];
+             n++;
+           }
+       }
+      else
+       {
+         int i,j;
+         for ( i = 0 ; i < n_vlist1; ++i )
+           {
+             for ( j = 0 ; j < n_vlist2; ++j )
+               {
+                 test_parameters->pairs[n][0] = vlist1[i];
+                 test_parameters->pairs[n][1] = vlist2[j];
+                 n++;
+               }
+           }
+       }
+    }
+  else
+    {
+      int i,j;
+      for ( i = 0 ; i < n_vlist1 - 1; ++i )
+       {
+         for ( j = i + 1 ; j < n_vlist1; ++j ) 
+           {
+             assert ( n < test_parameters->n_pairs);
+             test_parameters->pairs[n][0] = vlist1[i];
+             test_parameters->pairs[n][1] = vlist1[j];
+             n++;
+           }
+       }
+    }
+
+  assert ( n == test_parameters->n_pairs);
+
+  return true;
+}
+
+int
+npar_custom_wilcoxon (struct lexer *lexer, 
+                     struct dataset *ds, 
+                     struct cmd_npar_tests *cmd, void *aux )
+{
+  struct npar_specs *specs = aux;
+
+  struct two_sample_test *tp = pool_alloc(specs->pool, sizeof(*tp));
+  ((struct npar_test *)tp)->execute = NULL;
+
+  if (!parse_two_sample_related_test (lexer, dataset_dict (ds), cmd, 
+                                     tp, specs->pool) ) 
+    return 0;
+  
+  specs->n_tests++;
+  specs->test = pool_realloc (specs->pool, 
+                             specs->test, 
+                             sizeof(*specs->test) * specs->n_tests);
+  specs->test[specs->n_tests - 1] = (struct npar_test *) tp;
+
+  return 1;
+}
+
+int
+npar_custom_mcnemar (struct lexer *lexer, 
+                    struct dataset *ds, 
+                    struct cmd_npar_tests *cmd, void *aux )
+{
+  struct npar_specs *specs = aux;
+
+  struct two_sample_test *tp = pool_alloc(specs->pool, sizeof(*tp));
+  ((struct npar_test *)tp)->execute = NULL;
+
+
+  if (!parse_two_sample_related_test (lexer, dataset_dict (ds), 
+                                     cmd, tp, specs->pool) ) 
+    return 0;
+  
+  specs->n_tests++;
+  specs->test = pool_realloc (specs->pool, 
+                             specs->test, 
+                             sizeof(*specs->test) * specs->n_tests);
+  specs->test[specs->n_tests - 1] = (struct npar_test *) tp;
+  
+  return 1;
+}
+
+int
+npar_custom_sign (struct lexer *lexer, struct dataset *ds, 
+                 struct cmd_npar_tests *cmd, void *aux )
+{
+  struct npar_specs *specs = aux;
+
+  struct two_sample_test *tp = pool_alloc(specs->pool, sizeof(*tp));
+  ((struct npar_test *)tp)->execute = NULL;
+
+
+  if (!parse_two_sample_related_test (lexer, dataset_dict (ds), cmd, 
+                                     tp, specs->pool) ) 
+    return 0;
+  
+  specs->n_tests++;
+  specs->test = pool_realloc (specs->pool, 
+                             specs->test, 
+                             sizeof(*specs->test) * specs->n_tests);
+  specs->test[specs->n_tests - 1] = (struct npar_test *) tp;
+
+  return 1;
+}
+
+/* Insert the variables for TEST into VAR_HASH */
+void
+one_sample_insert_variables (const struct npar_test *test,
+                           struct hsh_table *var_hash)
+{
+  int i;
+  struct one_sample_test *ost = (struct one_sample_test *) test;
+
+  for ( i = 0 ; i < ost->n_vars ; ++i ) 
+    hsh_insert (var_hash, ost->vars[i]);
+}
+
index 2f1b676f8c72fcfe0549fa61cc1c0b7064f169a7..947dc4456531c2683c2d187ed7406a90f3eb065d 100644 (file)
@@ -27,6 +27,8 @@ TESTS = \
        tests/command/missing-values.sh \
        tests/command/no_case_size.sh \
        tests/command/n_of_cases.sh \
        tests/command/missing-values.sh \
        tests/command/no_case_size.sh \
        tests/command/n_of_cases.sh \
+       tests/command/npar-binomial.sh \
+       tests/command/npar-chisquare.sh \
        tests/command/oneway.sh \
        tests/command/oneway-missing.sh \
        tests/command/oneway-with-splits.sh \
        tests/command/oneway.sh \
        tests/command/oneway-missing.sh \
        tests/command/oneway-with-splits.sh \
diff --git a/tests/command/npar-binomial.sh b/tests/command/npar-binomial.sh
new file mode 100755 (executable)
index 0000000..5fd3815
--- /dev/null
@@ -0,0 +1,323 @@
+#!/bin/sh
+
+# This program tests the BINOMIAL subcommand of the NPAR TESTS command.
+
+TEMPDIR=/tmp/pspp-tst-$$
+TESTFILE=$TEMPDIR/`basename $0`.sps
+
+# ensure that top_srcdir and top_builddir  are absolute
+if [ -z "$top_srcdir" ] ; then top_srcdir=. ; fi
+if [ -z "$top_builddir" ] ; then top_builddir=. ; fi
+top_srcdir=`cd $top_srcdir; pwd`
+top_builddir=`cd $top_builddir; pwd`
+
+PSPP=$top_builddir/src/ui/terminal/pspp
+
+STAT_CONFIG_PATH=$top_srcdir/config
+export STAT_CONFIG_PATH
+
+LANG=C
+export LANG
+
+
+cleanup()
+{
+     if [ x"$PSPP_TEST_NO_CLEANUP" != x ] ; then 
+       echo "NOT cleaning $TEMPDIR"
+       return ; 
+     fi
+     rm -rf $TEMPDIR
+}
+
+
+fail()
+{
+    echo $activity
+    echo FAILED
+    cleanup;
+    exit 1;
+}
+
+
+no_result()
+{
+    echo $activity
+    echo NO RESULT;
+    cleanup;
+    exit 2;
+}
+
+pass()
+{
+    cleanup;
+    exit 0;
+}
+
+mkdir -p $TEMPDIR
+
+cd $TEMPDIR
+
+
+# Tests for exact calculations
+activity="create file 1"
+cat <<EOF > $TESTFILE
+ECHO 'P < 0.5; N1/N2 < 1' .
+
+NEW FILE.
+
+DATA LIST LIST NOTABLE /x * w *.
+BEGIN DATA.
+1   6
+2   15
+END DATA.
+
+WEIGHT BY w.
+
+NPAR TESTS
+       /BINOMIAL(0.3) = x
+       .
+
+
+ECHO 'P < 0.5; N1/N2 > 1' .
+
+NEW FILE.
+
+DATA LIST LIST NOTABLE /x * w *.
+BEGIN DATA.
+1   7
+2   6
+END DATA.
+
+WEIGHT BY w.
+
+NPAR TESTS
+       /BINOMIAL(0.4) = x
+       .
+
+
+
+ECHO 'P < 0.5; N1/N2 = 1' .
+
+NEW FILE.
+
+DATA LIST LIST NOTABLE /x * w *.
+BEGIN DATA.
+1   8
+2   8
+END DATA.
+
+WEIGHT BY w.
+
+NPAR TESTS
+       /BINOMIAL(0.4) = x
+       .
+
+ECHO 'P > 0.5; N1/N2 < 1' .
+
+NEW FILE.
+
+DATA LIST LIST NOTABLE /x * w *.
+BEGIN DATA.
+1   11
+2   12
+END DATA.
+
+WEIGHT BY w.
+
+NPAR TESTS
+       /BINOMIAL(0.6) = x
+       .
+
+
+ECHO 'P > 0.5; N1/N2 > 1' .
+
+NEW FILE.
+
+DATA LIST LIST NOTABLE /x * w *.
+BEGIN DATA.
+1   11
+2   9
+END DATA.
+
+WEIGHT BY w.
+
+NPAR TESTS
+       /BINOMIAL(0.6) = x
+
+ECHO 'P > 0.5; N1/N2 == 1' .
+
+NEW FILE.
+
+DATA LIST LIST NOTABLE /x * w *.
+BEGIN DATA.
+1   11
+2   11
+END DATA.
+
+WEIGHT BY w.
+
+NPAR TESTS
+       /BINOMIAL(0.6) = x
+       .
+
+ECHO 'P == 0.5; N1/N2 < 1' .
+
+NEW FILE.
+
+DATA LIST LIST NOTABLE /x * w *.
+BEGIN DATA.
+1   8
+2   15
+END DATA.
+
+WEIGHT BY w.
+
+NPAR TESTS
+       /BINOMIAL(0.5) = x
+       .
+
+
+ECHO 'P == 0.5; N1/N2 > 1' .
+
+NEW FILE.
+
+DATA LIST LIST NOTABLE /x * w *.
+BEGIN DATA.
+1   12
+2   6
+END DATA.
+
+WEIGHT BY w.
+
+NPAR TESTS
+       /BINOMIAL(0.5) = x
+
+ECHO 'P == 0.5; N1/N2 == 1' .
+
+NEW FILE.
+
+DATA LIST LIST NOTABLE /x * w *.
+BEGIN DATA.
+1   10
+2   10
+END DATA.
+
+WEIGHT BY w.
+
+NPAR TESTS
+       /BINOMIAL(0.5) = x
+       .
+EOF
+if [ $? -ne 0 ] ; then no_result ; fi
+
+
+activity="run program 1"
+$SUPERVISOR $PSPP --testing-mode -o raw-ascii $TESTFILE
+if [ $? -ne 0 ] ; then no_result ; fi
+
+activity="compare output 1"
+diff $TEMPDIR/pspp.list - << EOF
+P < 0.5; N1/N2 < 1
+
+1.1 NPAR TESTS.  Binomial Test
++-+------#--------+--+--------------+----------+---------------------+
+| |      #Category| N|Observed Prop.|Test Prop.|Exact Sig. (1-tailed)|
++-+------#--------+--+--------------+----------+---------------------+
+|x|Group1#    1.00| 6|          .286|      .300|                 .551|
+| |Group2#    2.00|15|          .714|          |                     |
+| |Total #        |21|          1.00|          |                     |
++-+------#--------+--+--------------+----------+---------------------+
+
+P < 0.5; N1/N2 > 1
+
+2.1 NPAR TESTS.  Binomial Test
++-+------#--------+--+--------------+----------+---------------------+
+| |      #Category| N|Observed Prop.|Test Prop.|Exact Sig. (1-tailed)|
++-+------#--------+--+--------------+----------+---------------------+
+|x|Group1#    1.00| 7|          .538|      .400|                 .229|
+| |Group2#    2.00| 6|          .462|          |                     |
+| |Total #        |13|          1.00|          |                     |
++-+------#--------+--+--------------+----------+---------------------+
+
+P < 0.5; N1/N2 = 1
+
+3.1 NPAR TESTS.  Binomial Test
++-+------#--------+--+--------------+----------+---------------------+
+| |      #Category| N|Observed Prop.|Test Prop.|Exact Sig. (1-tailed)|
++-+------#--------+--+--------------+----------+---------------------+
+|x|Group1#    1.00| 8|          .500|      .400|                 .284|
+| |Group2#    2.00| 8|          .500|          |                     |
+| |Total #        |16|          1.00|          |                     |
++-+------#--------+--+--------------+----------+---------------------+
+
+P > 0.5; N1/N2 < 1
+
+4.1 NPAR TESTS.  Binomial Test
++-+------#--------+--+--------------+----------+---------------------+
+| |      #Category| N|Observed Prop.|Test Prop.|Exact Sig. (1-tailed)|
++-+------#--------+--+--------------+----------+---------------------+
+|x|Group1#    1.00|11|          .478|      .600|                 .164|
+| |Group2#    2.00|12|          .522|          |                     |
+| |Total #        |23|          1.00|          |                     |
++-+------#--------+--+--------------+----------+---------------------+
+
+P > 0.5; N1/N2 > 1
+
+5.1 NPAR TESTS.  Binomial Test
++-+------#--------+--+--------------+----------+---------------------+
+| |      #Category| N|Observed Prop.|Test Prop.|Exact Sig. (1-tailed)|
++-+------#--------+--+--------------+----------+---------------------+
+|x|Group1#    1.00|11|          .550|      .600|                 .404|
+| |Group2#    2.00| 9|          .450|          |                     |
+| |Total #        |20|          1.00|          |                     |
++-+------#--------+--+--------------+----------+---------------------+
+
+P > 0.5; N1/N2 == 1
+
+6.1 NPAR TESTS.  Binomial Test
++-+------#--------+--+--------------+----------+---------------------+
+| |      #Category| N|Observed Prop.|Test Prop.|Exact Sig. (1-tailed)|
++-+------#--------+--+--------------+----------+---------------------+
+|x|Group1#    1.00|11|          .500|      .600|                 .228|
+| |Group2#    2.00|11|          .500|          |                     |
+| |Total #        |22|          1.00|          |                     |
++-+------#--------+--+--------------+----------+---------------------+
+
+P == 0.5; N1/N2 < 1
+
+7.1 NPAR TESTS.  Binomial Test
++-+------#--------+--+--------------+----------+---------------------+
+| |      #Category| N|Observed Prop.|Test Prop.|Exact Sig. (2-tailed)|
++-+------#--------+--+--------------+----------+---------------------+
+|x|Group1#    1.00| 8|          .348|      .500|                 .210|
+| |Group2#    2.00|15|          .652|          |                     |
+| |Total #        |23|          1.00|          |                     |
++-+------#--------+--+--------------+----------+---------------------+
+
+P == 0.5; N1/N2 > 1
+
+8.1 NPAR TESTS.  Binomial Test
++-+------#--------+--+--------------+----------+---------------------+
+| |      #Category| N|Observed Prop.|Test Prop.|Exact Sig. (2-tailed)|
++-+------#--------+--+--------------+----------+---------------------+
+|x|Group1#    1.00|12|          .667|      .500|                 .238|
+| |Group2#    2.00| 6|          .333|          |                     |
+| |Total #        |18|          1.00|          |                     |
++-+------#--------+--+--------------+----------+---------------------+
+
+P == 0.5; N1/N2 == 1
+
+9.1 NPAR TESTS.  Binomial Test
++-+------#--------+--+--------------+----------+---------------------+
+| |      #Category| N|Observed Prop.|Test Prop.|Exact Sig. (2-tailed)|
++-+------#--------+--+--------------+----------+---------------------+
+|x|Group1#    1.00|10|          .500|      .500|                1.000|
+| |Group2#    2.00|10|          .500|          |                     |
+| |Total #        |20|          1.00|          |                     |
++-+------#--------+--+--------------+----------+---------------------+
+
+EOF
+if [ $? -ne 0 ] ; then fail ; fi
+
+
+pass;
diff --git a/tests/command/npar-chisquare.sh b/tests/command/npar-chisquare.sh
new file mode 100755 (executable)
index 0000000..5e2e45c
--- /dev/null
@@ -0,0 +1,357 @@
+#!/bin/sh
+
+# This program tests the chisquare subcommand of the NPAR command.
+
+TEMPDIR=/tmp/pspp-tst-$$
+TESTFILE=$TEMPDIR/`basename $0`.sps
+
+# ensure that top_srcdir and top_builddir  are absolute
+if [ -z "$top_srcdir" ] ; then top_srcdir=. ; fi
+if [ -z "$top_builddir" ] ; then top_builddir=. ; fi
+top_srcdir=`cd $top_srcdir; pwd`
+top_builddir=`cd $top_builddir; pwd`
+
+PSPP=$top_builddir/src/ui/terminal/pspp
+
+STAT_CONFIG_PATH=$top_srcdir/config
+export STAT_CONFIG_PATH
+
+LANG=C
+export LANG
+
+
+cleanup()
+{
+     if [ x"$PSPP_TEST_NO_CLEANUP" != x ] ; then 
+       echo "NOT cleaning $TEMPDIR"
+       return ; 
+     fi
+     rm -rf $TEMPDIR
+}
+
+
+fail()
+{
+    echo $activity
+    echo FAILED
+    cleanup;
+    exit 1;
+}
+
+
+no_result()
+{
+    echo $activity
+    echo NO RESULT;
+    cleanup;
+    exit 2;
+}
+
+pass()
+{
+    cleanup;
+    exit 0;
+}
+
+mkdir -p $TEMPDIR
+
+cd $TEMPDIR
+
+activity="create file 1"
+cat <<EOF > $TESTFILE
+DATA LIST NOTABLE LIST /x * y * w *.
+BEGIN DATA.
+1   2  1
+2   1  3
+3.1 1  4
+3.2 2  1
+4   2  2
+5   3  1
+1   4  2
+END DATA.
+
+WEIGHT BY w.
+
+NPAR TESTS
+  CHISQUARE=x y
+  .
+
+NPAR TESTS
+  CHISQUARE=y
+  /EXPECTED=3 4 5 4
+  .
+
+NPAR TESTS
+  CHISQUARE=x y(2, 4)
+  /EXPECTED = 6 10 3
+  .
+
+EOF
+if [ $? -ne 0 ] ; then no_result ; fi
+
+
+activity="run program 1"
+$SUPERVISOR $PSPP --testing-mode -o raw-ascii $TESTFILE
+if [ $? -ne 0 ] ; then no_result ; fi
+
+activity="compare output 1"
+diff $TEMPDIR/pspp.list - << EOF
+1.1 NPAR TESTS.  x
++--------#----------+----------+--------+
+|        #Observed N|Expected N|Residual|
++--------#----------+----------+--------+
+|    1.00#         3|      2.33|     .67|
+|    2.00#         3|      2.33|     .67|
+|    3.10#         4|      2.33|    1.67|
+|    3.20#         1|      2.33|   -1.33|
+|    4.00#         2|      2.33|    -.33|
+|    5.00#         1|      2.33|   -1.33|
+|Total   #        14|          |        |
++--------#----------+----------+--------+
+
+1.2 NPAR TESTS.  y
++--------#----------+----------+--------+
+|        #Observed N|Expected N|Residual|
++--------#----------+----------+--------+
+|    1.00#         7|      3.50|    3.50|
+|    2.00#         4|      3.50|     .50|
+|    3.00#         1|      3.50|   -2.50|
+|    4.00#         2|      3.50|   -1.50|
+|Total   #        14|          |        |
++--------#----------+----------+--------+
+
+1.3 NPAR TESTS.  Test Statistics
++-----------#-----+-----+
+|           #  x  |  y  |
++-----------#-----+-----+
+|Chi-Square #3.143|6.000|
+|df         #    5|    3|
+|Asymp. Sig.# .678| .112|
++-----------#-----+-----+
+
+2.1 NPAR TESTS.  y
++--------#----------+----------+--------+
+|        #Observed N|Expected N|Residual|
++--------#----------+----------+--------+
+|    1.00#         7|      2.63|    4.38|
+|    2.00#         4|      3.50|     .50|
+|    3.00#         1|      4.38|   -3.38|
+|    4.00#         2|      3.50|   -1.50|
+|Total   #        14|          |        |
++--------#----------+----------+--------+
+
+2.2 NPAR TESTS.  Test Statistics
++-----------#------+
+|           #   y  |
++-----------#------+
+|Chi-Square #10.610|
+|df         #     3|
+|Asymp. Sig.#  .014|
++-----------#------+
+
+3.1 NPAR TESTS.  Frequencies
++-----#---------------------------------------#---------------------------------------+
+|     #                   x                   #                   y                   |
+|     #--------+----------+----------+--------#--------+----------+----------+--------+
+|     #Category|Observed N|Expected N|Residual#Category|Observed N|Expected N|Residual|
++-----#--------+----------+----------+--------#--------+----------+----------+--------+
+|1    #    2.00|         3|      3.16|    -.16#    2.00|         4|      2.21|    1.79|
+|2    #    3.00|         5|      5.26|    -.26#    3.00|         1|      3.68|   -2.68|
+|3    #    4.00|         2|      1.58|     .42#    4.00|         2|      1.11|     .89|
+|Total#        |        10|          |        #        |         7|          |        |
++-----#--------+----------+----------+--------#--------+----------+----------+--------+
+
+3.2 NPAR TESTS.  Test Statistics
++-----------#----+-----+
+|           #  x |  y  |
++-----------#----+-----+
+|Chi-Square #.133|4.129|
+|df         #   2|    2|
+|Asymp. Sig.#.936| .127|
++-----------#----+-----+
+
+EOF
+if [ $? -ne 0 ] ; then fail ; fi
+
+
+activity="create file 2"
+cat <<EOF > $TESTFILE
+DATA LIST NOTABLE LIST /x * y * w *.
+BEGIN DATA.
+1   2  1
+2   1  3
+3.1 1  4
+3.2 2  1
+4   2  2
+5   3  1
+1   4  2
+END DATA.
+
+WEIGHT BY w.
+
+NPAR TESTS
+  CHISQUARE=y
+  /EXPECTED = 3 4 5 4 3 1
+  .
+EOF
+if [ $? -ne 0 ] ; then no_result ; fi
+
+
+activity="run program 2"
+$SUPERVISOR $PSPP --testing-mode -o raw-ascii $TESTFILE  > $TEMPDIR/output
+if [ $? -eq 0 ] ; then no_result ; fi
+
+activity="compare errors 2"
+diff  $TEMPDIR/output - << EOF
+error: CHISQUARE test specified 6 expected values, but 4 distinct values were encountered in variable y.
+EOF
+if [ $? -ne 0 ] ; then fail ; fi
+
+
+activity="create file 3"
+cat <<EOF > $TESTFILE
+DATA LIST NOTABLE LIST /x * y * w * .
+BEGIN DATA.
+1   2  1 
+2   1  3
+3.1 1  4
+3.2 2  1
+4   2  2
+5   3  1
+1   4  2
+.   5  1
+END DATA.
+
+WEIGHT BY w.
+
+MISSING VALUES x (4).
+
+NPAR TESTS
+  CHISQUARE=x y(-2,5)
+  /MISSING=ANALYSIS
+  /STATISTICS=DESCRIPTIVES
+  .
+EOF
+if [ $? -ne 0 ] ; then no_result ; fi
+
+
+activity="run program 3"
+$SUPERVISOR $PSPP --testing-mode -o raw-ascii $TESTFILE 
+if [ $? -ne 0 ] ; then no_result ; fi
+
+
+activity="compare output 3"
+diff $TEMPDIR/pspp.list - <<EOF
+1.1 NPAR TESTS.  Frequencies
++-----#---------------------------------------#---------------------------------------+
+|     #                   x                   #                   y                   |
+|     #--------+----------+----------+--------#--------+----------+----------+--------+
+|     #Category|Observed N|Expected N|Residual#Category|Observed N|Expected N|Residual|
++-----#--------+----------+----------+--------#--------+----------+----------+--------+
+|1    #   -2.00|         0|      1.50|   -1.50#   -2.00|         0|      1.88|   -1.88|
+|2    #   -1.00|         0|      1.50|   -1.50#   -1.00|         0|      1.88|   -1.88|
+|3    #     .00|         0|      1.50|   -1.50#     .00|         0|      1.88|   -1.88|
+|4    #    1.00|         3|      1.50|    1.50#    1.00|         7|      1.88|    5.13|
+|5    #    2.00|         3|      1.50|    1.50#    2.00|         4|      1.88|    2.13|
+|6    #    3.00|         5|      1.50|    3.50#    3.00|         1|      1.88|    -.88|
+|7    #    4.00|         0|      1.50|   -1.50#    4.00|         2|      1.88|     .13|
+|8    #    5.00|         1|      1.50|    -.50#    5.00|         1|      1.88|    -.88|
+|Total#        |        12|          |        #        |        15|          |        |
++-----#--------+----------+----------+--------#--------+----------+----------+--------+
+
+1.2 NPAR TESTS.  Test Statistics
++-----------#------+------+
+|           #   x  |   y  |
++-----------#------+------+
+|Chi-Square #17.333|22.867|
+|df         #     7|     7|
+|Asymp. Sig.#  .015|  .002|
++-----------#------+------+
+
+1.3 NPAR TESTS.  Descriptive Statistics
++-#--+-----+-----+-----+-----+
+| # N| Mean| Std.|Minim|Maxim|
+| #  |     |Devia|  um |  um |
+#=#==#=====#=====#=====#=====#
+|x#12|2.467|1.193|1.000|5.000|
+|y#15|2.067|1.335|1.000|5.000|
++-#--+-----+-----+-----+-----+
+
+EOF
+if [ $? -ne 0 ] ; then fail ; fi
+
+
+activity="create file 4"
+cat <<EOF > $TESTFILE
+DATA LIST NOTABLE LIST /x * y * w * .
+BEGIN DATA.
+1   2  1 
+2   1  3
+3.1 1  4
+3.2 2  1
+4   2  2
+5   3  1
+1   4  2
+.   5  1
+END DATA.
+
+WEIGHT BY w.
+
+* MISSING VALUES x (4).
+
+NPAR TESTS
+  CHISQUARE=x y(-2,5)
+  /MISSING=LISTWISE
+  /STATISTICS=DESCRIPTIVES
+  .
+EOF
+if [ $? -ne 0 ] ; then no_result ; fi
+
+
+activity="run program 4"
+$SUPERVISOR $PSPP --testing-mode -o raw-ascii $TESTFILE 
+if [ $? -ne 0 ] ; then no_result ; fi
+
+
+activity="compare output 4"
+diff $TEMPDIR/pspp.list - <<EOF
+1.1 NPAR TESTS.  Frequencies
++-----#---------------------------------------#---------------------------------------+
+|     #                   x                   #                   y                   |
+|     #--------+----------+----------+--------#--------+----------+----------+--------+
+|     #Category|Observed N|Expected N|Residual#Category|Observed N|Expected N|Residual|
++-----#--------+----------+----------+--------#--------+----------+----------+--------+
+|1    #   -2.00|         0|      1.75|   -1.75#   -2.00|         0|      1.75|   -1.75|
+|2    #   -1.00|         0|      1.75|   -1.75#   -1.00|         0|      1.75|   -1.75|
+|3    #     .00|         0|      1.75|   -1.75#     .00|         0|      1.75|   -1.75|
+|4    #    1.00|         3|      1.75|    1.25#    1.00|         7|      1.75|    5.25|
+|5    #    2.00|         3|      1.75|    1.25#    2.00|         4|      1.75|    2.25|
+|6    #    3.00|         5|      1.75|    3.25#    3.00|         1|      1.75|    -.75|
+|7    #    4.00|         2|      1.75|     .25#    4.00|         2|      1.75|     .25|
+|8    #    5.00|         1|      1.75|    -.75#    5.00|         0|      1.75|   -1.75|
+|Total#        |        14|          |        #        |        14|          |        |
++-----#--------+----------+----------+--------#--------+----------+----------+--------+
+
+1.2 NPAR TESTS.  Test Statistics
++-----------#------+------+
+|           #   x  |   y  |
++-----------#------+------+
+|Chi-Square #13.429|26.000|
+|df         #     7|     7|
+|Asymp. Sig.#  .062|  .001|
++-----------#------+------+
+
+1.3 NPAR TESTS.  Descriptive Statistics
++-#--+-----+-----+-----+-----+
+| # N| Mean| Std.|Minim|Maxim|
+| #  |     |Devia|  um |  um |
+#=#==#=====#=====#=====#=====#
+|x#14|2.686|1.231|1.000|5.000|
+|y#14|1.857|1.099|1.000|4.000|
++-#--+-----+-----+-----+-----+
+
+EOF
+if [ $? -ne 0 ] ; then fail ; fi
+
+
+pass;