REGRESSION: Added calculation of the coefficients' confidence interval.
[pspp] / tests / language / stats / regression.at
index d401953f12defc51e3f64dbccfb80168e513248a..60d077d29b0487a4f53144de9fc4dbff1d1d2826 100644 (file)
@@ -32,11 +32,11 @@ Table: ANOVA (v2)
 ,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
@@ -1688,6 +1688,7 @@ 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
 Table: Reading free-form data from INLINE.
 Variable,Format
@@ -1705,10 +1706,10 @@ Table: ANOVA (v0)
 ,Total,98673.63,1499,,,
 
 Table: Coefficients (v0)
+,,Unstandardized Coefficients,,Standardized Coefficients,,
 ,,B,Std. Error,Beta,t,Sig.
 ,(Constant),1.24,.42,.00,2.95,.00
 ,v1,1.37,.72,.05,1.89,.06
-,,,,,,
 ])
 AT_CLEANUP
 
@@ -1811,3 +1812,246 @@ regression /variables=v0 v1
 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