Add some tests for empty parens
[pspp] / tests / language / stats / regression.at
index 0ea3efc8a256aabf1bbe963e38d1d80cfa818d70..d487ca8a8becbd7bac7af8e5de3c65798f64f72f 100644 (file)
@@ -1,8 +1,10 @@
-AT_BANNER([REGRESSION])
+AT_BANNER([LINEAR REGRESSION])
 
-AT_SETUP([REGRESSION])
+AT_SETUP([LINEAR REGRESSION - basic])
 AT_DATA([regression.sps], [dnl
-data list list / v0 to v2.
+set format = F22.3.
+data list notable list / v0 to v2.
+filter by v0.
 begin data
  0.65377128  7.735648 -23.97588
 -0.13087553  6.142625 -19.63854
@@ -18,48 +20,242 @@ end data
 regression /variables=v0 v1 v2 /statistics defaults /dependent=v2 /method=enter /save=pred resid.
 list.
 ])
-AT_CHECK([pspp -o pspp.csv regression.sps])
-AT_CHECK([cat pspp.csv], [0], [dnl
-Table: Reading free-form data from INLINE.
-Variable,Format
-v0,F8.0
-v1,F8.0
-v2,F8.0
 
-Table: Model Summary
+AT_CHECK([pspp -O format=csv regression.sps], [0], [dnl
+regression.sps:16: warning: REGRESSION: REGRESSION with SAVE ignores FILTER.  All cases will be processed.
+
+Table: Model Summary (v2)
+,R,R Square,Adjusted R Square,Std. Error of the Estimate
+,.971,.942,.925,1.337
+
+Table: ANOVA (v2)
+,,Sum of Squares,df,Mean Square,F,Sig.
+,Regression,202.753,2,101.376,56.754,.000
+,Residual,12.504,7,1.786,,
+,Total,215.256,9,,,
+
+Table: Coefficients (v2)
+,,Unstandardized Coefficients,,Standardized Coefficients,,
+,,B,Std. Error,Beta,t,Sig.
+,(Constant),2.191,2.357,.000,.930,.380
+,v0,1.813,1.053,.171,1.722,.129
+,v1,-3.427,.332,-1.026,-10.334,.000
+
+Table: Data List
+v0,v1,v2,RES1,PRED1
+.654,7.736,-23.976,-.84,-23.13
+-.131,6.143,-19.639,-.54,-19.10
+.349,7.651,-25.266,-1.87,-23.40
+.692,6.125,-16.571,.97,-17.54
+-.074,8.246,-25.800,.40,-26.20
+-.344,6.032,-17.567,1.53,-19.10
+.760,9.832,-28.360,1.77,-30.13
+-.470,5.344,-16.795,.18,-16.97
+-.061,8.838,-29.257,-1.05,-28.21
+.562,6.200,-18.582,-.54,-18.04
+])
+AT_CLEANUP
+
+
+AT_SETUP([LINEAR REGRESSION - one save])
+AT_DATA([regression.sps], [dnl
+set format = F22.3.
+data list notable list / v0 to v2.
+begin data
+ 0.65377128  7.735648 -23.97588
+-0.13087553  6.142625 -19.63854
+ 0.34880368  7.651430 -25.26557
+ 0.69249021  6.125125 -16.57090
+-0.07368178  8.245789 -25.80001
+-0.34404919  6.031540 -17.56743
+ 0.75981559  9.832291 -28.35977
+-0.46958313  5.343832 -16.79548
+-0.06108490  8.838262 -29.25689
+ 0.56154863  6.200189 -18.58219
+end data
+regression /variables=v0 v1 v2 /statistics defaults /dependent=v2 /method=enter /save=resid.
+regression /variables=v0 v1 v2 /statistics defaults /dependent=v2 /method=enter /save=pred.
+list.
+])
+
+AT_CHECK([pspp -O format=csv regression.sps], [0], [dnl
+Table: Model Summary (v2)
 ,R,R Square,Adjusted R Square,Std. Error of the Estimate
-,.97,.94,.93,1.34
+,.971,.942,.925,1.337
 
-Table: ANOVA
-,,Sum of Squares,df,Mean Square,F,Significance
-,Regression,202.75,2,101.38,56.75,.00
-,Residual,12.50,7,1.79,,
-,Total,215.26,9,,,
+Table: ANOVA (v2)
+,,Sum of Squares,df,Mean Square,F,Sig.
+,Regression,202.753,2,101.376,56.754,.000
+,Residual,12.504,7,1.786,,
+,Total,215.256,9,,,
 
-Table: Coefficients
-,,B,Std. Error,Beta,t,Significance
-,(Constant),2.19,2.36,.00,.93,.38
-,v0,1.81,1.05,.17,1.72,.12
-,v1,-3.43,.33,-1.03,-10.33,.00
-,,,,,,
+Table: Coefficients (v2)
+,,Unstandardized Coefficients,,Standardized Coefficients,,
+,,B,Std. Error,Beta,t,Sig.
+,(Constant),2.191,2.357,.000,.930,.380
+,v0,1.813,1.053,.171,1.722,.129
+,v1,-3.427,.332,-1.026,-10.334,.000
+
+Table: Model Summary (v2)
+,R,R Square,Adjusted R Square,Std. Error of the Estimate
+,.971,.942,.925,1.337
+
+Table: ANOVA (v2)
+,,Sum of Squares,df,Mean Square,F,Sig.
+,Regression,202.753,2,101.376,56.754,.000
+,Residual,12.504,7,1.786,,
+,Total,215.256,9,,,
+
+Table: Coefficients (v2)
+,,Unstandardized Coefficients,,Standardized Coefficients,,
+,,B,Std. Error,Beta,t,Sig.
+,(Constant),2.191,2.357,.000,.930,.380
+,v0,1.813,1.053,.171,1.722,.129
+,v1,-3.427,.332,-1.026,-10.334,.000
 
 Table: Data List
 v0,v1,v2,RES1,PRED1
-.65,7.74,-23.98,-.84,-23.13
--.13,6.14,-19.64,-.54,-19.10
-.35,7.65,-25.27,-1.87,-23.40
-.69,6.13,-16.57,.97,-17.54
--.07,8.25,-25.80,.40,-26.20
--.34,6.03,-17.57,1.53,-19.10
-.76,9.83,-28.36,1.77,-30.13
--.47,5.34,-16.80,.18,-16.97
--.06,8.84,-29.26,-1.05,-28.21
-.56,6.20,-18.58,-.54,-18.04
+.654,7.736,-23.976,-.84,-23.13
+-.131,6.143,-19.639,-.54,-19.10
+.349,7.651,-25.266,-1.87,-23.40
+.692,6.125,-16.571,.97,-17.54
+-.074,8.246,-25.800,.40,-26.20
+-.344,6.032,-17.567,1.53,-19.10
+.760,9.832,-28.360,1.77,-30.13
+-.470,5.344,-16.795,.18,-16.97
+-.061,8.838,-29.257,-1.05,-28.21
+.562,6.200,-18.582,-.54,-18.04
 ])
 AT_CLEANUP
 
+
+# Test to ensure that the /SAVE subcommand works properly when SPLIT is active
+AT_SETUP([LINEAR REGRESSION - SAVE vs SPLITS])
+
+# Generate some test data based on a linear model
+AT_DATA([gen-data.sps], [dnl
+set seed = 1.
+input program.
+loop #c = 1 to 20.
+     compute x0 = rv.normal (0,1).
+     compute x1 = rv.normal (0,2).
+     compute err = rv.normal (0,0.1).
+     compute y = 4 - 2 * x0 + 3 * x1 + err.
+     compute g = (#c > 10).
+     end case.
+end loop.
+end file.
+end input program.
+
+print outfile='regdata.txt' /g x0 x1 y err *.
+execute.
+])
+
+AT_CHECK([pspp -O format=csv gen-data.sps], [0], [ignore])
+
+# Use our test data to create a predictor and a residual variable
+# for G == 0
+AT_DATA([regression0.sps], [dnl
+data list notable file='regdata.txt' list /g x0 x1 y err *.
+
+select if (g = 0).
+
+regression 
+          /variables = x0 x1
+          /dependent = y
+          /statistics = all
+          /save = pred resid.
+          .
+
+print outfile='outdata-g0.txt' /g x0 x1 y err res1 pred1 *.
+execute.
+])
+
+
+AT_CHECK([pspp -O format=csv regression0.sps], [0], [ignore])
+
+# Use our test data to create a predictor and a residual variable
+# for G == 1
+AT_DATA([regression1.sps], [dnl
+data list notable file='regdata.txt' list /g x0 x1 y err *.
+
+select if (g = 1).
+
+regression 
+          /variables = x0 x1
+          /dependent = y
+          /statistics = all
+          /save = pred resid.
+          .
+
+print outfile='outdata-g1.txt' /g x0 x1 y err res1 pred1 *.
+execute.
+])
+
+
+AT_CHECK([pspp -O format=csv regression1.sps], [0], [ignore])
+
+# Use our test data to create a predictor and a residual variable
+# The data is split on G
+AT_DATA([regression-split.sps], [dnl
+data list notable file='regdata.txt' list /g x0 x1 y err *.
+
+split file by g.
+
+regression 
+          /variables = x0 x1
+          /dependent = y
+          /statistics = all
+          /save = pred resid.
+          .
+
+print outfile='outdata-split.txt' /g x0 x1 y err res1 pred1 *.
+execute.
+])
+
+AT_CHECK([pspp -O format=csv regression-split.sps], [0], [ignore])
+
+# The concatenation of G==0 and G==1 should be identical to the SPLIT data
+AT_CHECK([cat outdata-g0.txt outdata-g1.txt | diff outdata-split.txt - ], [0], [])
+
+AT_CLEANUP
+
+
+# Test that the procedure behaves sensibly when presented with
+# multiple dependent variables
+AT_SETUP([LINEAR REGRESSION multiple dependent variables])
+AT_DATA([regression.sps], [dnl
+set seed = 2.
+input program.
+loop #c = 1 to 200.
+     compute x0 = rv.normal (0, 1).
+     compute x1 = rv.normal (0, 2).
+     compute err = rv.normal (0, 0.8).
+     compute y = 2 - 1.5 * x0 + 8.4 * x1 + err.
+     compute ycopy = y.
+     end case.
+end loop.
+end file.
+end input program.
+
+regression 
+          /variables = x0 x1
+          /dependent = y ycopy
+          /statistics = default.
+])
+
+AT_CHECK([pspp -O format=csv regression.sps > output], [0], [ignore])
+
+AT_CHECK([head -16 output > first], [0], [])
+AT_CHECK([tail -16 output > second], [0], [])
+
+AT_CHECK([sed -e 's/ycopy/y/g' second | diff first -], [0], [])
+
+
+AT_CLEANUP
+
 # Tests the QR decomposition used by the REGRESSION command.
-AT_SETUP([REGRESSION test of QR decomposition])
+AT_SETUP([LINEAR REGRESSION test of QR decomposition])
 AT_DATA([regression.sps], [dnl
 data list list / v0 to v1.
 begin data
@@ -1566,27 +1762,445 @@ begin data
 end data
 regression /variables=v0 v1 /statistics defaults /dependent=v0 /method=enter.
 ])
-AT_CHECK([pspp -o pspp.csv regression.sps])
-AT_CHECK([cat pspp.csv], [0], [dnl
+
+AT_CHECK([pspp -O format=csv regression.sps], [0], [dnl
 Table: Reading free-form data from INLINE.
 Variable,Format
 v0,F8.0
 v1,F8.0
 
-Table: Model Summary
+Table: Model Summary (v0)
 ,R,R Square,Adjusted R Square,Std. Error of the Estimate
 ,.05,.00,.00,8.11
 
-Table: ANOVA
-,,Sum of Squares,df,Mean Square,F,Significance
-,Regression,235.23,1,235.23,3.58,.06
+Table: ANOVA (v0)
+,,Sum of Squares,df,Mean Square,F,Sig.
+,Regression,235.23,1,235.23,3.58,.059
 ,Residual,98438.40,1498,65.71,,
 ,Total,98673.63,1499,,,
 
-Table: Coefficients
-,,B,Std. Error,Beta,t,Significance
-,(Constant),1.24,.42,.00,2.95,.00
-,v1,1.37,.72,.05,1.89,.06
-,,,,,,
+Table: Coefficients (v0)
+,,Unstandardized Coefficients,,Standardized Coefficients,,
+,,B,Std. Error,Beta,t,Sig.
+,(Constant),1.24,.42,.00,2.95,.003
+,v1,1.37,.72,.05,1.89,.059
 ])
+
 AT_CLEANUP
+
+AT_SETUP([LINEAR REGRESSION no crash on all missing])
+AT_DATA([regcrash.sps], [dnl
+data list list /x * y.
+begin data.
+ . .
+ . .
+ . .
+ . .
+ . .
+ . .
+ . .
+ . .
+ . .
+ . .
+end data.
+
+
+regression /variables=x y /dependent=y.
+])
+
+AT_CHECK([pspp -o pspp.csv regcrash.sps], [1], [ignore], [ignore])
+
+AT_CLEANUP
+
+
+
+AT_SETUP([LINEAR REGRESSION missing dependent variable])
+
+dnl Test for a bug where missing values in the dependent variable were not being
+dnl ignored like they should have been.
+AT_DATA([reg-mdv-ref.sps], [dnl
+data list notable list / v0 to v2.
+begin data
+ 0.65377128  7.735648 -23.97588
+-0.13087553  6.142625 -19.63854
+ 0.34880368  7.651430 -25.26557
+ 0.69249021  6.125125 -16.57090
+-0.07368178  8.245789 -25.80001
+-0.34404919  6.031540 -17.56743
+ 0.75981559  9.832291 -28.35977
+-0.46958313  5.343832 -16.79548
+-0.06108490  8.838262 -29.25689
+ 0.56154863  6.200189 -18.58219
+end data
+regression /variables=v0 v1
+            /statistics defaults
+            /dependent=v2
+            /method=enter.
+])
+
+AT_CHECK([pspp -o pspp-ref.csv reg-mdv-ref.sps])
+
+AT_DATA([reg-mdv.sps], [dnl
+data list notable list / v0 to v2.
+begin data
+ 0.65377128  7.735648 -23.97588
+-0.13087553  6.142625 -19.63854
+ 0.34880368  7.651430 -25.26557
+ 0.69249021  6.125125 -16.57090
+-0.07368178  8.245789 -25.80001
+-0.34404919  6.031540 -17.56743
+ 0.75981559  9.832291 -28.35977
+-0.46958313  5.343832 -16.79548
+-0.06108490  8.838262 -29.25689
+ 0.56154863  6.200189 -18.58219
+ 0.5         8         9
+end data
+
+missing values v2 (9).
+
+regression /variables=v0 v1
+            /statistics defaults
+            /dependent=v2
+            /method=enter.
+])
+
+AT_CHECK([pspp -o pspp.csv reg-mdv.sps])
+
+AT_CHECK([diff pspp.csv pspp-ref.csv])
+
+
+AT_CLEANUP
+
+AT_SETUP([LINEAR REGRESSION with invalid syntax (and empty dataset)])
+
+AT_DATA([ss.sps], [dnl
+data list notable list / v0 to v2.
+begin data
+end data.
+
+regression /variables=v0 v1
+            /statistics r coeff anova
+            /dependent=v2
+            /method=enter v2.
+])
+
+AT_CHECK([pspp ss.sps], [1], [ignore])
+
+AT_CLEANUP
+
+
+dnl The following example comes from 
+dnl http://www.ats.ucla.edu/stat/spss/output/reg_spss%28long%29.htm
+AT_SETUP([LINEAR REGRESSION coefficient confidence interval])
+
+AT_DATA([conf.sps], [dnl
+set format = F22.3.
+
+data list notable list /math female socst read science *
+begin data.
+    41.00       .00     57.00     57.00     47.00
+    53.00      1.00     61.00     68.00     63.00
+    54.00       .00     31.00     44.00     58.00
+    47.00       .00     56.00     63.00     53.00
+    57.00       .00     61.00     47.00     53.00
+    51.00       .00     61.00     44.00     63.00
+    42.00       .00     61.00     50.00     53.00
+    45.00       .00     36.00     34.00     39.00
+    54.00       .00     51.00     63.00     58.00
+    52.00       .00     51.00     57.00     50.00
+    51.00       .00     61.00     60.00     53.00
+    51.00       .00     61.00     57.00     63.00
+    71.00       .00     71.00     73.00     61.00
+    57.00       .00     46.00     54.00     55.00
+    50.00       .00     56.00     45.00     31.00
+    43.00       .00     56.00     42.00     50.00
+    51.00       .00     56.00     47.00     50.00
+    60.00       .00     56.00     57.00     58.00
+    62.00       .00     61.00     68.00     55.00
+    57.00       .00     46.00     55.00     53.00
+    35.00       .00     41.00     63.00     66.00
+    75.00       .00     66.00     63.00     72.00
+    45.00       .00     56.00     50.00     55.00
+    57.00       .00     61.00     60.00     61.00
+    45.00       .00     46.00     37.00     39.00
+    46.00       .00     31.00     34.00     39.00
+    66.00       .00     66.00     65.00     61.00
+    57.00       .00     46.00     47.00     58.00
+    49.00       .00     46.00     44.00     39.00
+    49.00       .00     41.00     52.00     55.00
+    57.00       .00     51.00     42.00     47.00
+    64.00       .00     61.00     76.00     64.00
+    63.00       .00     71.00     65.00     66.00
+    57.00       .00     31.00     42.00     72.00
+    50.00       .00     61.00     52.00     61.00
+    58.00       .00     66.00     60.00     61.00
+    75.00       .00     66.00     68.00     66.00
+    68.00       .00     66.00     65.00     66.00
+    44.00       .00     36.00     47.00     36.00
+    40.00       .00     51.00     39.00     39.00
+    41.00       .00     51.00     47.00     42.00
+    62.00       .00     51.00     55.00     58.00
+    57.00       .00     51.00     52.00     55.00
+    43.00       .00     41.00     42.00     50.00
+    48.00       .00     66.00     65.00     63.00
+    63.00       .00     46.00     55.00     69.00
+    39.00       .00     47.00     50.00     49.00
+    70.00       .00     51.00     65.00     63.00
+    63.00       .00     46.00     47.00     53.00
+    59.00       .00     51.00     57.00     47.00
+    61.00       .00     56.00     53.00     57.00
+    38.00       .00     41.00     39.00     47.00
+    61.00       .00     46.00     44.00     50.00
+    49.00       .00     71.00     63.00     55.00
+    73.00       .00     66.00     73.00     69.00
+    44.00       .00     42.00     39.00     26.00
+    42.00       .00     32.00     37.00     33.00
+    39.00       .00     46.00     42.00     56.00
+    55.00       .00     41.00     63.00     58.00
+    52.00       .00     51.00     48.00     44.00
+    45.00       .00     61.00     50.00     58.00
+    61.00       .00     66.00     47.00     69.00
+    39.00       .00     46.00     44.00     34.00
+    41.00       .00     36.00     34.00     36.00
+    50.00       .00     61.00     50.00     36.00
+    40.00       .00     26.00     44.00     50.00
+    60.00       .00     66.00     60.00     55.00
+    47.00       .00     26.00     47.00     42.00
+    59.00       .00     44.00     63.00     65.00
+    49.00       .00     36.00     50.00     44.00
+    46.00       .00     51.00     44.00     39.00
+    58.00       .00     61.00     60.00     58.00
+    71.00       .00     66.00     73.00     63.00
+    58.00       .00     66.00     68.00     74.00
+    46.00       .00     51.00     55.00     58.00
+    43.00       .00     31.00     47.00     45.00
+    54.00       .00     61.00     55.00     49.00
+    56.00       .00     66.00     68.00     63.00
+    46.00       .00     46.00     31.00     39.00
+    54.00       .00     56.00     47.00     42.00
+    57.00       .00     56.00     63.00     55.00
+    54.00       .00     36.00     36.00     61.00
+    71.00       .00     56.00     68.00     66.00
+    48.00       .00     56.00     63.00     63.00
+    40.00       .00     41.00     55.00     44.00
+    64.00       .00     66.00     55.00     63.00
+    51.00       .00     56.00     52.00     53.00
+    39.00       .00     56.00     34.00     42.00
+    40.00       .00     31.00     50.00     34.00
+    61.00       .00     56.00     55.00     61.00
+    66.00       .00     46.00     52.00     47.00
+    49.00       .00     46.00     63.00     66.00
+    65.00      1.00     61.00     68.00     69.00
+    52.00      1.00     48.00     39.00     44.00
+    46.00      1.00     51.00     44.00     47.00
+    61.00      1.00     51.00     50.00     63.00
+    72.00      1.00     56.00     71.00     66.00
+    71.00      1.00     71.00     63.00     69.00
+    40.00      1.00     41.00     34.00     39.00
+    69.00      1.00     61.00     63.00     61.00
+    64.00      1.00     66.00     68.00     69.00
+    56.00      1.00     61.00     47.00     66.00
+    49.00      1.00     41.00     47.00     33.00
+    54.00      1.00     51.00     63.00     50.00
+    53.00      1.00     51.00     52.00     61.00
+    66.00      1.00     56.00     55.00     42.00
+    67.00      1.00     56.00     60.00     50.00
+    40.00      1.00     33.00     35.00     51.00
+    46.00      1.00     56.00     47.00     50.00
+    69.00      1.00     71.00     71.00     58.00
+    40.00      1.00     56.00     57.00     61.00
+    41.00      1.00     51.00     44.00     39.00
+    57.00      1.00     66.00     65.00     46.00
+    58.00      1.00     56.00     68.00     59.00
+    57.00      1.00     66.00     73.00     55.00
+    37.00      1.00     41.00     36.00     42.00
+    55.00      1.00     46.00     43.00     55.00
+    62.00      1.00     66.00     73.00     58.00
+    64.00      1.00     56.00     52.00     58.00
+    40.00      1.00     51.00     41.00     39.00
+    50.00      1.00     51.00     60.00     50.00
+    46.00      1.00     56.00     50.00     50.00
+    53.00      1.00     56.00     50.00     39.00
+    52.00      1.00     46.00     47.00     48.00
+    45.00      1.00     46.00     47.00     34.00
+    56.00      1.00     61.00     55.00     58.00
+    45.00      1.00     56.00     50.00     44.00
+    54.00      1.00     41.00     39.00     50.00
+    56.00      1.00     46.00     50.00     47.00
+    41.00      1.00     26.00     34.00     29.00
+    54.00      1.00     56.00     57.00     50.00
+    72.00      1.00     56.00     57.00     54.00
+    56.00      1.00     51.00     68.00     50.00
+    47.00      1.00     46.00     42.00     47.00
+    49.00      1.00     66.00     61.00     44.00
+    60.00      1.00     66.00     76.00     67.00
+    54.00      1.00     46.00     47.00     58.00
+    55.00      1.00     56.00     46.00     44.00
+    33.00      1.00     41.00     39.00     42.00
+    49.00      1.00     61.00     52.00     44.00
+    43.00      1.00     51.00     28.00     44.00
+    50.00      1.00     52.00     42.00     50.00
+    52.00      1.00     51.00     47.00     39.00
+    48.00      1.00     41.00     47.00     44.00
+    58.00      1.00     66.00     52.00     53.00
+    43.00      1.00     61.00     47.00     48.00
+    41.00      1.00     31.00     50.00     55.00
+    43.00      1.00     51.00     44.00     44.00
+    46.00      1.00     41.00     47.00     40.00
+    44.00      1.00     41.00     45.00     34.00
+    43.00      1.00     46.00     47.00     42.00
+    61.00      1.00     56.00     65.00     58.00
+    40.00      1.00     51.00     43.00     50.00
+    49.00      1.00     61.00     47.00     53.00
+    56.00      1.00     66.00     57.00     58.00
+    61.00      1.00     71.00     68.00     55.00
+    50.00      1.00     61.00     52.00     54.00
+    51.00      1.00     61.00     42.00     47.00
+    42.00      1.00     41.00     42.00     42.00
+    67.00      1.00     66.00     66.00     61.00
+    53.00      1.00     61.00     47.00     53.00
+    50.00      1.00     58.00     57.00     51.00
+    51.00      1.00     31.00     47.00     63.00
+    72.00      1.00     61.00     57.00     61.00
+    48.00      1.00     61.00     52.00     55.00
+    40.00      1.00     31.00     44.00     40.00
+    53.00      1.00     61.00     50.00     61.00
+    39.00      1.00     36.00     39.00     47.00
+    63.00      1.00     41.00     57.00     55.00
+    51.00      1.00     37.00     57.00     53.00
+    45.00      1.00     43.00     42.00     50.00
+    39.00      1.00     61.00     47.00     47.00
+    42.00      1.00     39.00     42.00     31.00
+    62.00      1.00     51.00     60.00     61.00
+    44.00      1.00     51.00     44.00     35.00
+    65.00      1.00     66.00     63.00     54.00
+    63.00      1.00     71.00     65.00     55.00
+    54.00      1.00     41.00     39.00     53.00
+    45.00      1.00     36.00     50.00     58.00
+    60.00      1.00     51.00     52.00     56.00
+    49.00      1.00     51.00     60.00     50.00
+    48.00      1.00     51.00     44.00     39.00
+    57.00      1.00     61.00     52.00     63.00
+    55.00      1.00     61.00     55.00     50.00
+    66.00      1.00     56.00     50.00     66.00
+    64.00      1.00     71.00     65.00     58.00
+    55.00      1.00     51.00     52.00     53.00
+    42.00      1.00     36.00     47.00     42.00
+    56.00      1.00     61.00     63.00     55.00
+    53.00      1.00     66.00     50.00     53.00
+    41.00      1.00     41.00     42.00     42.00
+    42.00      1.00     41.00     36.00     50.00
+    53.00      1.00     56.00     50.00     55.00
+    42.00      1.00     51.00     41.00     34.00
+    60.00      1.00     56.00     47.00     50.00
+    52.00      1.00     56.00     55.00     42.00
+    38.00      1.00     46.00     42.00     36.00
+    57.00      1.00     52.00     57.00     55.00
+    58.00      1.00     61.00     55.00     58.00
+    65.00      1.00     61.00     63.00     53.00
+end data.
+
+regression
+ /variables = math female socst read
+ /statistics = coeff r anova ci (95)
+ /dependent = science
+ /method = enter 
+])
+
+AT_CHECK([pspp -O format=csv conf.sps], [0], [dnl
+Table: Model Summary (science)
+,R,R Square,Adjusted R Square,Std. Error of the Estimate
+,.699,.489,.479,7.148
+
+Table: ANOVA (science)
+,,Sum of Squares,df,Mean Square,F,Sig.
+,Regression,9543.721,4,2385.930,46.695,.000
+,Residual,9963.779,195,51.096,,
+,Total,19507.500,199,,,
+
+Table: Coefficients (science)
+,,Unstandardized Coefficients,,Standardized Coefficients,,,95% Confidence Interval for B,
+,,B,Std. Error,Beta,t,Sig.,Lower Bound,Upper Bound
+,(Constant),12.325,3.194,.000,3.859,.000,6.027,18.624
+,math,.389,.074,.368,5.252,.000,.243,.535
+,female,-2.010,1.023,-.101,-1.965,.051,-4.027,.007
+,socst,.050,.062,.054,.801,.424,-.073,.173
+,read,.335,.073,.347,4.607,.000,.192,.479
+])
+
+
+AT_CLEANUP
+
+
+dnl Checks for regression against bug #44877.
+AT_SETUP([LINEAR REGRESSION crash with long string variables])
+AT_DATA([regression.sps], [dnl
+SET DECIMAL=DOT.
+
+DATA LIST notable LIST /text (A24) Y * X1 *
+BEGIN DATA.
+V00276601 0.00 90.00
+V00292909 10.00 30.00
+V00291204 20.00 20.00
+V00300070 0.00 90.00
+END DATA.
+
+REGRESSION
+/VARIABLES= Y
+/DEPENDENT= X1
+/METHOD=ENTER
+/STATISTICS=COEFF R ANOVA
+/SAVE= RESID.
+
+LIST.
+])
+AT_CHECK([pspp -o pspp.csv regression.sps])
+AT_CHECK([cat pspp.csv], [0], [dnl
+Table: Model Summary (X1)
+,R,R Square,Adjusted R Square,Std. Error of the Estimate
+,.95,.89,.84,15.08
+
+Table: ANOVA (X1)
+,,Sum of Squares,df,Mean Square,F,Sig.
+,Regression,3820.45,1,3820.45,16.81,.055
+,Residual,454.55,2,227.27,,
+,Total,4275.00,3,,,
+
+Table: Coefficients (X1)
+,,Unstandardized Coefficients,,Standardized Coefficients,,
+,,B,Std. Error,Beta,t,Sig.
+,(Constant),85.45,10.16,.00,8.41,.004
+,Y,-3.73,.91,-.95,-4.10,.055
+
+Table: Data List
+text,Y,X1,RES1
+V00276601               ,.00,90.00,4.55
+V00292909               ,10.00,30.00,-18.18
+V00291204               ,20.00,20.00,9.09
+V00300070               ,.00,90.00,4.55
+])
+AT_CLEANUP
+
+
+dnl Test for a crash which happened on bad input syntax
+AT_SETUP([LINEAR REGRESSION -- Empty Parentheses])
+
+AT_DATA([empty-parens.sps], [dnl
+set format = F22.3.
+
+data list notable list /math female socst read science *
+begin data.
+    58.00      1.00     61.00     55.00     58.00
+    65.00      1.00     61.00     63.00     53.00
+end data.
+
+regression
+ /variables = math female socst read
+ /statistics = coeff r anova ci ()
+ /dependent = science
+ /method = enter
+])
+
+AT_CHECK([pspp -o pspp.csv empty-parens.sps], [1], [ignore])
+
+AT_CLEANUP