Fix behaviour of the REGRESSION /STATISTICS subcommand.
authorJohn Darrington <john@darrington.wattle.id.au>
Thu, 9 Jul 2015 15:46:00 +0000 (17:46 +0200)
committerJohn Darrington <john@darrington.wattle.id.au>
Wed, 22 Jul 2015 17:14:20 +0000 (19:14 +0200)
doc/regression.texi
src/language/stats/regression.c

index 9ff569d4d6bbc814c5d6abce895c14bc2f362901..de639352d001fc6d0194b66e9371333278d3136b 100644 (file)
@@ -20,7 +20,7 @@ the @math{k}th explanatory variable.
 
 @item The dependent variable @math{Y} has the following relationship to the 
 explanatory variables:
-@math{Y_i = b_0 + b_1 X_{1i} + ... + b_k X_{ki} + Z_i} 
+@math{Y_i = b_0 + b_1 X_{1i} + ... + b_k X_{ki} + Z_i}
 where @math{b_0, b_1, @dots{}, b_k} are unknown
 coefficients, and @math{Z_1,@dots{},Z_n} are independent, normally
 distributed @dfn{noise} terms with mean zero and common variance.
@@ -61,7 +61,7 @@ are treated as explanatory variables in the linear model.
 
 All other subcommands are optional:
 
-The @subcmd{STATISTICS} subcommand specifies additional statistics to be displayed.
+The @subcmd{STATISTICS} subcommand specifies which statistics are to be displayed.
 The following keywords are accepted:
 
 @table @subcmd
@@ -82,6 +82,8 @@ Analysis of variance table for the model.
 The covariance matrix for the estimated model coefficients.
 @item DEFAULT
 The same as if R, COEFF, and ANOVA had been selected.
+This is what you get if the /STATISTICS command is not specified,
+or if it is specified without any parameters.
 @end table
 
 The @subcmd{SAVE} subcommand causes @pspp{} to save the residuals or predicted
index 52009e29683a72e4722df66674aead46fd1e2562..51502e5fe03f1515f00d487012543f0cf99234d8 100644 (file)
@@ -248,6 +248,7 @@ cmd_regression (struct lexer *lexer, struct dataset *ds)
         }
       else if (lex_match_id (lexer, "STATISTICS"))
         {
+         unsigned long statistics = 0;
           lex_match (lexer, T_EQUALS);
 
           while (lex_token (lexer) != T_ENDCMD
@@ -255,31 +256,31 @@ cmd_regression (struct lexer *lexer, struct dataset *ds)
             {
               if (lex_match (lexer, T_ALL))
                 {
-                 regression.stats = ~0;
+                 statistics = ~0;
                 }
               else if (lex_match_id (lexer, "DEFAULTS"))
                 {
-                 regression.stats |= STATS_DEFAULT;
+                 statistics |= STATS_DEFAULT;
                 }
               else if (lex_match_id (lexer, "R"))
                 {
-                 regression.stats |= STATS_R;
+                 statistics |= STATS_R;
                 }
               else if (lex_match_id (lexer, "COEFF"))
                 {
-                 regression.stats |= STATS_COEFF;
+                 statistics |= STATS_COEFF;
                 }
               else if (lex_match_id (lexer, "ANOVA"))
                 {
-                 regression.stats |= STATS_ANOVA;
+                 statistics |= STATS_ANOVA;
                 }
               else if (lex_match_id (lexer, "BCOV"))
                 {
-                 regression.stats |= STATS_BCOV;
+                 statistics |= STATS_BCOV;
                 }
               else if (lex_match_id (lexer, "CI"))
                 {
-                 regression.stats |= STATS_CI;
+                 statistics |= STATS_CI;
 
                  if (lex_match (lexer, T_LPAREN))
                    {
@@ -294,6 +295,10 @@ cmd_regression (struct lexer *lexer, struct dataset *ds)
                   goto error;
                 }
             }
+
+         if (statistics)
+           regression.stats = statistics;
+
         }
       else if (lex_match_id (lexer, "SAVE"))
         {