? np.sps
? npar.patch
? npar4.patch
? npar5.patch
? pspp-0.4.2.tar.gz
? pspp.list
? doc/.dirstamp
? doc/pspp.dvi
? lib/gsl-extras/.deps
? lib/gsl-extras/.dirstamp
? lib/gtksheet/.deps
? lib/gtksheet/.dirstamp
? lib/linreg/.deps
? lib/linreg/.dirstamp
? m4/Makefile.am
? m4/codeset.m4
? m4/gettext.m4
? m4/glibc2.m4
? m4/glibc21.m4
? m4/iconv.m4
? m4/intdiv0.m4
? m4/intmax.m4
? m4/inttypes-pri.m4
? m4/inttypes.m4
? m4/inttypes_h.m4
? m4/isc-posix.m4
? m4/lcmessage.m4
? m4/lib-ld.m4
? m4/lib-link.m4
? m4/lib-prefix.m4
? m4/longdouble.m4
? m4/longlong.m4
? m4/nls.m4
? m4/po.m4
? m4/printf-posix.m4
? m4/progtest.m4
? m4/signed.m4
? m4/size_max.m4
? m4/stdint_h.m4
? m4/uintmax_t.m4
? m4/ulonglong.m4
? m4/wchar_t.m4
? m4/wint_t.m4
? m4/xsize.m4
? po/remove-potcdate.sed
? src/data/.deps
? src/data/.dirstamp
? src/language/.deps
? src/language/.dirstamp
? src/language/control/.deps
? src/language/control/.dirstamp
? src/language/data-io/.deps
? src/language/data-io/.dirstamp
? src/language/data-io/file-handle.c
? src/language/data-io/list.c
? src/language/dictionary/.deps
? src/language/dictionary/.dirstamp
? src/language/expressions/.deps
? src/language/expressions/.dirstamp
? src/language/lexer/.deps
? src/language/lexer/.dirstamp
? src/language/lexer/q2c
? src/language/stats/.deps
? src/language/stats/.dirstamp
? src/language/stats/correlations.c
? src/language/stats/crosstabs.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/tests/.deps
? src/language/tests/.dirstamp
? src/language/utilities/.deps
? src/language/utilities/.dirstamp
? src/language/utilities/set.c
? src/language/xforms/.deps
? src/language/xforms/.dirstamp
? src/libpspp/.deps
? src/libpspp/.dirstamp
? src/libpspp/version.c
? src/math/.deps
? src/math/.dirstamp
? src/math/linreg/.deps
? src/math/linreg/.dirstamp
? src/math/ts/.deps
? src/math/ts/.dirstamp
? src/output/.deps
? src/output/.dirstamp
? src/output/charts/.deps
? src/output/charts/.dirstamp
? src/ui/.deps
? src/ui/.dirstamp
? src/ui/gui/.deps
? src/ui/gui/.dirstamp
? src/ui/gui/psppire
? src/ui/terminal/.deps
? src/ui/terminal/.dirstamp
? src/ui/terminal/pspp
? tests/formats/.deps
? tests/formats/.dirstamp
? tests/formats/inexactify
? tests/libpspp/.deps
? tests/libpspp/.dirstamp
? tests/libpspp/ll-test
? tests/libpspp/llx-test
Index: doc/statistics.texi
===================================================================
RCS file: /sources/pspp/pspp/doc/statistics.texi,v
retrieving revision 1.13
diff -b -w -U3 -r1.13 statistics.texi
--- doc/statistics.texi	1 Dec 2006 06:21:05 -0000	1.13
+++ doc/statistics.texi	19 Dec 2006 11:45:23 -0000
@@ -9,6 +9,7 @@
 * 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.
@@ -304,7 +305,7 @@
 large quantity of output.
 
 
-@node CROSSTABS, T-TEST, EXAMINE, Statistics
+@node CROSSTABS, NPAR TESTS, EXAMINE, Statistics
 @section CROSSTABS
 
 @vindex CROSSTABS
@@ -493,11 +494,122 @@
 
 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
+
 @display
 T-TEST
         /MISSING=@{ANALYSIS,LISTWISE@} @{EXCLUDE,INCLUDE@}
Index: po/de.po
===================================================================
RCS file: /sources/pspp/pspp/po/de.po,v
retrieving revision 1.25
diff -b -w -U3 -r1.25 de.po
--- po/de.po	17 Dec 2006 00:01:04 -0000	1.25
+++ po/de.po	19 Dec 2006 11:45:24 -0000
@@ -10,7 +10,7 @@
 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-19 20:34+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"
@@ -320,8 +320,8 @@
 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
@@ -329,8 +329,8 @@
 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
@@ -673,100 +673,100 @@
 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 ""
 
-#: 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 ""
 
-#: 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 ""
 
-#: src/data/sys-file-reader.c:916
+#: src/data/sys-file-reader.c:920
 #, 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 ""
 
-#: 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 ""
 
-#: 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 ""
 
-#: 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 ""
 
-#: 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 ""
 
-#: 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 ""
 
-#: 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 ""
 
-#: src/data/sys-file-reader.c:1172
+#: src/data/sys-file-reader.c:1176
 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 ""
 
-#: 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 ""
 
-#: 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 ""
 
-#: src/data/sys-file-reader.c:1468
+#: src/data/sys-file-reader.c:1472
 #, 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 ""
 
-#: src/data/sys-file-reader.c:1557
+#: src/data/sys-file-reader.c:1561
 #, 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"
@@ -781,46 +781,46 @@
 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 ""
 
-#: 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 ""
 
-#: 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 ""
 
-#: 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."
 
-#: 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."
 
-#: 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 ""
 
-#: src/data/variable.c:997
+#: src/data/variable.c:996
 msgid "ordinary"
 msgstr ""
 
-#: src/data/variable.c:999
+#: src/data/variable.c:998
 msgid "system"
 msgstr ""
 
-#: src/data/variable.c:1001
+#: src/data/variable.c:1000
 msgid "scratch"
 msgstr ""
 
@@ -1728,8 +1728,8 @@
 #: 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 ""
 
@@ -2408,6 +2408,101 @@
 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."
@@ -2443,33 +2538,19 @@
 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
-#: 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/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/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"
 
@@ -2515,13 +2596,6 @@
 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 ""
@@ -2538,10 +2612,6 @@
 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 ""
@@ -2712,9 +2782,10 @@
 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 ""
 
@@ -2722,17 +2793,17 @@
 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
-#: 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
-#: src/language/stats/frequencies.q:129
+#: src/language/stats/frequencies.q:131
 msgid "Kurtosis"
 msgstr ""
 
@@ -2741,7 +2812,7 @@
 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 ""
 
@@ -2750,21 +2821,23 @@
 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
-#: 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
-#: 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 ""
 
-#: 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 ""
 
@@ -2844,7 +2917,7 @@
 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 ""
 
@@ -2870,13 +2943,14 @@
 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 ""
 
-#: 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 ""
 
@@ -2916,7 +2990,7 @@
 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 ""
 
@@ -2990,87 +3064,87 @@
 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 ""
 
-#: src/language/stats/frequencies.q:126
+#: src/language/stats/frequencies.q:128
 msgid "Mode"
 msgstr ""
 
-#: src/language/stats/frequencies.q:130
+#: src/language/stats/frequencies.q:132
 msgid "S.E. Kurt"
 msgstr ""
 
-#: src/language/stats/frequencies.q:132
+#: src/language/stats/frequencies.q:134
 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 ""
 
-#: 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 ""
 
-#: 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 ""
 
-#: src/language/stats/frequencies.q:842
+#: src/language/stats/frequencies.q:823
 #, 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 ""
 
-#: src/language/stats/frequencies.q:922
+#: src/language/stats/frequencies.q:903
 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 ""
 
-#: src/language/stats/frequencies.q:941
+#: src/language/stats/frequencies.q:922
 #, 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 ""
 
-#: 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 ""
 
-#: src/language/stats/frequencies.q:1199
+#: src/language/stats/frequencies.q:1161
 msgid "Value Label"
 msgstr ""
 
-#: src/language/stats/frequencies.q:1301
+#: src/language/stats/frequencies.q:1268
 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 ""
 
-#: 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 ""
@@ -3083,6 +3157,46 @@
 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 ""
@@ -3097,21 +3211,21 @@
 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 ""
 
-#: 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 ""
 
-#: 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/regression.q:215 src/language/stats/regression.q:311
+#: src/language/stats/regression.q:214 src/language/stats/regression.q:310
 msgid "Significance"
 msgstr ""
 
@@ -3123,7 +3237,7 @@
 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 ""
 
@@ -3159,7 +3273,7 @@
 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"
@@ -3231,63 +3345,59 @@
 msgid "Too many variables in INTO clause."
 msgstr ""
 
-#: src/language/stats/regression.q:166
+#: src/language/stats/regression.q:165
 msgid "R"
 msgstr ""
 
-#: src/language/stats/regression.q:167
+#: src/language/stats/regression.q:166
 msgid "R Square"
 msgstr ""
 
-#: src/language/stats/regression.q:168
+#: src/language/stats/regression.q:167
 msgid "Adjusted R Square"
 msgstr ""
 
-#: src/language/stats/regression.q:169
+#: src/language/stats/regression.q:168
 msgid "Std. Error of the Estimate"
 msgstr ""
 
-#: src/language/stats/regression.q:174
+#: src/language/stats/regression.q:173
 msgid "Model Summary"
 msgstr ""
 
-#: src/language/stats/regression.q:211
+#: src/language/stats/regression.q:210
 msgid "B"
 msgstr ""
 
-#: src/language/stats/regression.q:213
+#: src/language/stats/regression.q:212
 msgid "Beta"
 msgstr ""
 
-#: src/language/stats/regression.q:216
+#: src/language/stats/regression.q:215
 msgid "(Constant)"
 msgstr ""
 
-#: src/language/stats/regression.q:276
+#: src/language/stats/regression.q:275
 msgid "Coefficients"
 msgstr ""
 
-#: src/language/stats/regression.q:313
+#: src/language/stats/regression.q:312
 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 ""
 
-#: src/language/stats/regression.q:393
+#: src/language/stats/regression.q:392
 msgid "Covariances"
 msgstr ""
 
-#: src/language/stats/regression.q:408
+#: src/language/stats/regression.q:407
 msgid "Coefficient Correlations"
 msgstr ""
 
-#: src/language/stats/regression.q:1132
+#: src/language/stats/regression.q:1131
 msgid "Dependent variable must be numeric."
 msgstr ""
 
@@ -3325,13 +3435,6 @@
 "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 ""
Index: po/pspp.pot
===================================================================
RCS file: /sources/pspp/pspp/po/pspp.pot,v
retrieving revision 1.109
diff -b -w -U3 -r1.109 pspp.pot
--- po/pspp.pot	17 Dec 2006 00:01:05 -0000	1.109
+++ po/pspp.pot	19 Dec 2006 11:45:25 -0000
@@ -8,7 +8,7 @@
 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-19 20:34+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"
@@ -319,8 +319,8 @@
 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
@@ -328,8 +328,8 @@
 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
@@ -669,100 +669,100 @@
 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 ""
 
-#: 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 ""
 
-#: 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 ""
 
-#: src/data/sys-file-reader.c:916
+#: src/data/sys-file-reader.c:920
 #, 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 ""
 
-#: 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 ""
 
-#: 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 ""
 
-#: 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 ""
 
-#: 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 ""
 
-#: 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 ""
 
-#: 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 ""
 
-#: src/data/sys-file-reader.c:1172
+#: src/data/sys-file-reader.c:1176
 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 ""
 
-#: 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 ""
 
-#: 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 ""
 
-#: src/data/sys-file-reader.c:1468
+#: src/data/sys-file-reader.c:1472
 #, 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 ""
 
-#: src/data/sys-file-reader.c:1557
+#: src/data/sys-file-reader.c:1561
 #, 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 ""
 
@@ -776,46 +776,46 @@
 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 ""
 
-#: 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 ""
 
-#: 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 ""
 
-#: src/data/variable.c:272
+#: src/data/variable.c:271
 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 ""
 
-#: 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 ""
 
-#: src/data/variable.c:997
+#: src/data/variable.c:996
 msgid "ordinary"
 msgstr ""
 
-#: src/data/variable.c:999
+#: src/data/variable.c:998
 msgid "system"
 msgstr ""
 
-#: src/data/variable.c:1001
+#: src/data/variable.c:1000
 msgid "scratch"
 msgstr ""
 
@@ -1723,8 +1723,8 @@
 #: 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 ""
 
@@ -2403,6 +2403,101 @@
 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."
@@ -2438,33 +2533,19 @@
 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
-#: 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/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/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 ""
 
@@ -2510,13 +2591,6 @@
 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 ""
@@ -2533,10 +2607,6 @@
 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 ""
@@ -2707,9 +2777,10 @@
 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 ""
 
@@ -2717,17 +2788,17 @@
 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
-#: 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
-#: src/language/stats/frequencies.q:129
+#: src/language/stats/frequencies.q:131
 msgid "Kurtosis"
 msgstr ""
 
@@ -2736,7 +2807,7 @@
 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 ""
 
@@ -2745,21 +2816,23 @@
 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
-#: 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
-#: 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 ""
 
-#: 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 ""
 
@@ -2839,7 +2912,7 @@
 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 ""
 
@@ -2865,13 +2938,14 @@
 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 ""
 
-#: 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 ""
 
@@ -2911,7 +2985,7 @@
 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 ""
 
@@ -2985,87 +3059,87 @@
 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 ""
 
-#: src/language/stats/frequencies.q:126
+#: src/language/stats/frequencies.q:128
 msgid "Mode"
 msgstr ""
 
-#: src/language/stats/frequencies.q:130
+#: src/language/stats/frequencies.q:132
 msgid "S.E. Kurt"
 msgstr ""
 
-#: src/language/stats/frequencies.q:132
+#: src/language/stats/frequencies.q:134
 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 ""
 
-#: 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 ""
 
-#: 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 ""
 
-#: src/language/stats/frequencies.q:842
+#: src/language/stats/frequencies.q:823
 #, 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 ""
 
-#: src/language/stats/frequencies.q:922
+#: src/language/stats/frequencies.q:903
 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 ""
 
-#: src/language/stats/frequencies.q:941
+#: src/language/stats/frequencies.q:922
 #, 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 ""
 
-#: 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 ""
 
-#: src/language/stats/frequencies.q:1199
+#: src/language/stats/frequencies.q:1161
 msgid "Value Label"
 msgstr ""
 
-#: src/language/stats/frequencies.q:1301
+#: src/language/stats/frequencies.q:1268
 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 ""
 
-#: 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 ""
@@ -3078,6 +3152,46 @@
 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 ""
@@ -3092,21 +3206,21 @@
 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 ""
 
-#: 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 ""
 
-#: 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/regression.q:215 src/language/stats/regression.q:311
+#: src/language/stats/regression.q:214 src/language/stats/regression.q:310
 msgid "Significance"
 msgstr ""
 
@@ -3118,7 +3232,7 @@
 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 ""
 
@@ -3154,7 +3268,7 @@
 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"
@@ -3226,63 +3340,59 @@
 msgid "Too many variables in INTO clause."
 msgstr ""
 
-#: src/language/stats/regression.q:166
+#: src/language/stats/regression.q:165
 msgid "R"
 msgstr ""
 
-#: src/language/stats/regression.q:167
+#: src/language/stats/regression.q:166
 msgid "R Square"
 msgstr ""
 
-#: src/language/stats/regression.q:168
+#: src/language/stats/regression.q:167
 msgid "Adjusted R Square"
 msgstr ""
 
-#: src/language/stats/regression.q:169
+#: src/language/stats/regression.q:168
 msgid "Std. Error of the Estimate"
 msgstr ""
 
-#: src/language/stats/regression.q:174
+#: src/language/stats/regression.q:173
 msgid "Model Summary"
 msgstr ""
 
-#: src/language/stats/regression.q:211
+#: src/language/stats/regression.q:210
 msgid "B"
 msgstr ""
 
-#: src/language/stats/regression.q:213
+#: src/language/stats/regression.q:212
 msgid "Beta"
 msgstr ""
 
-#: src/language/stats/regression.q:216
+#: src/language/stats/regression.q:215
 msgid "(Constant)"
 msgstr ""
 
-#: src/language/stats/regression.q:276
+#: src/language/stats/regression.q:275
 msgid "Coefficients"
 msgstr ""
 
-#: src/language/stats/regression.q:313
+#: src/language/stats/regression.q:312
 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 ""
 
-#: src/language/stats/regression.q:393
+#: src/language/stats/regression.q:392
 msgid "Covariances"
 msgstr ""
 
-#: src/language/stats/regression.q:408
+#: src/language/stats/regression.q:407
 msgid "Coefficient Correlations"
 msgstr ""
 
-#: src/language/stats/regression.q:1132
+#: src/language/stats/regression.q:1131
 msgid "Dependent variable must be numeric."
 msgstr ""
 
@@ -3320,13 +3430,6 @@
 "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 ""
Index: src/data/casefilter.c
===================================================================
RCS file: /sources/pspp/pspp/src/data/casefilter.c,v
retrieving revision 1.5
diff -b -w -U3 -r1.5 casefilter.c
--- src/data/casefilter.c	16 Dec 2006 04:26:42 -0000	1.5
+++ src/data/casefilter.c	19 Dec 2006 11:45:25 -0000
@@ -97,7 +97,7 @@
    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;
 
@@ -117,5 +117,3 @@
   free (filter->vars);
   free (filter);
 }
-
-
Index: src/data/casefilter.h
===================================================================
RCS file: /sources/pspp/pspp/src/data/casefilter.h,v
retrieving revision 1.2
diff -b -w -U3 -r1.2 casefilter.h
--- src/data/casefilter.h	16 Dec 2006 04:26:42 -0000	1.2
+++ src/data/casefilter.h	19 Dec 2006 11:45:25 -0000
@@ -35,7 +35,8 @@
 
 /* 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 *); 
@@ -43,7 +44,10 @@
 /* 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);
Index: src/data/variable.c
===================================================================
RCS file: /sources/pspp/pspp/src/data/variable.c,v
retrieving revision 1.19
diff -b -w -U3 -r1.19 variable.c
--- src/data/variable.c	16 Dec 2006 03:40:41 -0000	1.19
+++ src/data/variable.c	19 Dec 2006 11:45:26 -0000
@@ -64,10 +64,9 @@
     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. */
Index: src/language/command.def
===================================================================
RCS file: /sources/pspp/pspp/src/language/command.def,v
retrieving revision 1.11
diff -b -w -U3 -r1.11 command.def
--- src/language/command.def	15 Dec 2006 00:16:02 -0000	1.11
+++ src/language/command.def	19 Dec 2006 11:45:26 -0000
@@ -106,6 +106,7 @@
 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)
@@ -202,7 +203,6 @@
 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")
Index: src/language/stats/automake.mk
===================================================================
RCS file: /sources/pspp/pspp/src/language/stats/automake.mk,v
retrieving revision 1.5
diff -b -w -U3 -r1.5 automake.mk
--- src/language/stats/automake.mk	14 Dec 2006 10:45:20 -0000	1.5
+++ src/language/stats/automake.mk	19 Dec 2006 11:45:26 -0000
@@ -8,18 +8,29 @@
 	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
+
 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/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/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)
 
Index: src/language/stats/binomial.c
===================================================================
RCS file: src/language/stats/binomial.c
diff -N src/language/stats/binomial.c
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ src/language/stats/binomial.c	19 Dec 2006 11:45:26 -0000
@@ -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);
+
+}
Index: src/language/stats/binomial.h
===================================================================
RCS file: src/language/stats/binomial.h
diff -N src/language/stats/binomial.h
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ src/language/stats/binomial.h	19 Dec 2006 11:45:26 -0000
@@ -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
Index: src/language/stats/chisquare.c
===================================================================
RCS file: src/language/stats/chisquare.c
diff -N src/language/stats/chisquare.c
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ src/language/stats/chisquare.c	19 Dec 2006 11:45:26 -0000
@@ -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);
+}
+
Index: src/language/stats/chisquare.h
===================================================================
RCS file: src/language/stats/chisquare.h
diff -N src/language/stats/chisquare.h
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ src/language/stats/chisquare.h	19 Dec 2006 11:45:26 -0000
@@ -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
Index: src/language/stats/freq.c
===================================================================
RCS file: src/language/stats/freq.c
diff -N src/language/stats/freq.c
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ src/language/stats/freq.c	19 Dec 2006 11:45:26 -0000
@@ -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);
+}
Index: src/language/stats/freq.h
===================================================================
RCS file: src/language/stats/freq.h
diff -N src/language/stats/freq.h
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ src/language/stats/freq.h	19 Dec 2006 11:45:26 -0000
@@ -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: src/language/stats/frequencies.q
===================================================================
RCS file: /sources/pspp/pspp/src/language/stats/frequencies.q,v
retrieving revision 1.26
diff -b -w -U3 -r1.26 frequencies.q
--- src/language/stats/frequencies.q	15 Dec 2006 00:16:02 -0000	1.26
+++ src/language/stats/frequencies.q	19 Dec 2006 11:45:27 -0000
@@ -58,6 +58,8 @@
 #include <output/output.h>
 #include <output/table.h>
 
+#include "freq.h"
+
 #include "minmax.h"
 
 #include "gettext.h"
@@ -203,13 +205,6 @@
 
 /* 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
   {
@@ -286,7 +281,6 @@
 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;
@@ -526,16 +520,16 @@
               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)->c += weight;
+		(*fpp)->count += weight;
 	      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;
 		}
@@ -580,20 +574,7 @@
 
       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
 	{
@@ -719,7 +700,7 @@
   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. */
@@ -764,7 +745,7 @@
   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 @@
   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 @@
 
 /* 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)
@@ -1019,9 +981,9 @@
   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;
-  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;
@@ -1036,7 +998,7 @@
   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. */
@@ -1061,14 +1023,14 @@
   const struct freq *a = a_;
   const struct freq *b = b_;
 
-  if (a->c > b->c)
+  if (a->count > b->count)
     return 1;
-  else if (a->c < b->c)
+  else if (a->count < b->count)
     return -1;
 
-  if (a->v[0].f > b->v[0].f)
+  if (a->value[0].f > b->value[0].f)
     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;
@@ -1084,12 +1046,12 @@
   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;
-  else if (a->c < b->c)
+  else if (a->count < b->count)
     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;
@@ -1100,14 +1062,14 @@
   const struct freq *a = a_;
   const struct freq *b = b_;
 
-  if (a->c > b->c)
+  if (a->count > b->count)
     return -1;
-  else if (a->c < b->c)
+  else if (a->count < b->count)
     return 1;
 
-  if (a->v[0].f > b->v[0].f)
+  if (a->value[0].f > b->value[0].f)
     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;
@@ -1123,12 +1085,12 @@
   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;
-  else if (a->c < b->c)
+  else if (a->count < b->count)
     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);
 }
 
 /* Frequency table display. */
@@ -1206,21 +1168,26 @@
     {
       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)
 	{
-	  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);
 	}
 
-      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);
@@ -1228,19 +1195,19 @@
     }
   for (; f < &ft->valid[n_categories]; f++)
     {
-      cum_freq += f->c;
+      cum_freq += f->count;
 
       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);
 	}
 
-      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,
-		     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++;
     }
@@ -1309,21 +1276,21 @@
     {
       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_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,
-		 f->c / ft->total_cases * 100.0, 3, 0);
+		 f->count / ft->total_cases * 100.0, 3, 0);
       r++;
     }
 
@@ -1386,7 +1353,7 @@
     {
       static double prev_value = SYSMIS;
       f = &ft->valid[idx]; 
-      rank += f->c ;
+      rank += f->count ;
       for (i = 0; i < n_percentiles; i++) 
         {
 	  double tp;
@@ -1401,7 +1368,7 @@
 
 	  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;
@@ -1409,9 +1376,9 @@
 
           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
@@ -1422,14 +1389,14 @@
 	    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 ) 
-	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",
@@ -1465,12 +1432,12 @@
   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. */
@@ -1481,16 +1448,16 @@
   /* 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++)
-    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_. */
-  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;
@@ -1595,11 +1562,11 @@
   /* 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;
 
-      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);
@@ -1607,7 +1574,7 @@
   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;
@@ -1640,9 +1607,8 @@
     {
       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;
Index: src/language/stats/npar-summary.c
===================================================================
RCS file: src/language/stats/npar-summary.c
diff -N src/language/stats/npar-summary.c
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ src/language/stats/npar-summary.c	19 Dec 2006 11:45:27 -0000
@@ -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);
+}
Index: src/language/stats/npar-summary.h
===================================================================
RCS file: src/language/stats/npar-summary.h
diff -N src/language/stats/npar-summary.h
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ src/language/stats/npar-summary.h	19 Dec 2006 11:45:27 -0000
@@ -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
Index: src/language/stats/npar.h
===================================================================
RCS file: src/language/stats/npar.h
diff -N src/language/stats/npar.h
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ src/language/stats/npar.h	19 Dec 2006 11:45:27 -0000
@@ -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
Index: src/language/stats/npar.q
===================================================================
RCS file: src/language/stats/npar.q
diff -N src/language/stats/npar.q
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ src/language/stats/npar.q	19 Dec 2006 11:45:27 -0000
@@ -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: tests/automake.mk
===================================================================
RCS file: /sources/pspp/pspp/tests/automake.mk,v
retrieving revision 1.21
diff -b -w -U3 -r1.21 automake.mk
--- tests/automake.mk	11 Dec 2006 15:56:49 -0000	1.21
+++ tests/automake.mk	19 Dec 2006 11:45:27 -0000
@@ -27,6 +27,8 @@
 	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 \
Index: tests/command/npar-binomial.sh
===================================================================
RCS file: tests/command/npar-binomial.sh
diff -N tests/command/npar-binomial.sh
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ tests/command/npar-binomial.sh	19 Dec 2006 11:45:27 -0000
@@ -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;
Index: tests/command/npar-chisquare.sh
===================================================================
RCS file: tests/command/npar-chisquare.sh
diff -N tests/command/npar-chisquare.sh
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ tests/command/npar-chisquare.sh	19 Dec 2006 11:45:27 -0000
@@ -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;
