regression.ds = ds;
- /* Accept an optional, completely pointless "/VARIABLES=" */
- lex_match (lexer, T_SLASH);
- if (lex_match_id (lexer, "VARIABLES"))
- {
- if (!lex_force_match (lexer, T_EQUALS))
- goto error;
- }
-
- if (!parse_variables_const (lexer, dict,
- ®ression.vars, ®ression.n_vars,
- PV_NO_DUPLICATE | PV_NUMERIC))
- goto error;
-
-
+ bool variables_seen = false;
+ bool method_seen = false;
+ bool dependent_seen = false;
while (lex_token (lexer) != T_ENDCMD)
{
lex_match (lexer, T_SLASH);
- if (lex_match_id (lexer, "DEPENDENT"))
+ if (lex_match_id (lexer, "VARIABLES"))
+ {
+ if (method_seen)
+ {
+ msg (SE, _("VARIABLES may not appear after %s"), "METHOD");
+ goto error;
+ }
+ if (dependent_seen)
+ {
+ msg (SE, _("VARIABLES may not appear after %s"), "DEPENDENT");
+ goto error;
+ }
+ variables_seen = true;
+ lex_match (lexer, T_EQUALS);
+
+ if (!parse_variables_const (lexer, dict,
+ ®ression.vars, ®ression.n_vars,
+ PV_NO_DUPLICATE | PV_NUMERIC))
+ goto error;
+ }
+ else if (lex_match_id (lexer, "DEPENDENT"))
{
+ dependent_seen = true;
lex_match (lexer, T_EQUALS);
free (regression.dep_vars);
}
else if (lex_match_id (lexer, "METHOD"))
{
+ method_seen = true;
lex_match (lexer, T_EQUALS);
if (!lex_force_match_id (lexer, "ENTER"))
{
goto error;
}
+
+ if (! variables_seen)
+ {
+ if (!parse_variables_const (lexer, dict,
+ ®ression.vars, ®ression.n_vars,
+ PV_NO_DUPLICATE | PV_NUMERIC))
+ goto error;
+ }
}
else if (lex_match_id (lexer, "STATISTICS"))
{
AT_CHECK([pspp -o pspp.csv empty-parens.sps], [1], [ignore])
AT_CLEANUP
+
+
+
+
+AT_SETUP([LINEAR REGRESSION varibles on ENTER subcommand])
+AT_DATA([regression.sps], [dnl
+SET FORMAT=F10.3.
+
+DATA LIST notable LIST /number * value *.
+BEGIN DATA
+ 16 7.25
+ 0 .00
+ 1 .10
+ 9 27.9
+ 0 .00
+ 7 3.65
+ 14 16.8
+ 24 9.15
+ 0 .00
+ 24 19.0
+ 7 4.05
+ 12 7.90
+ 6 .75
+ 11 1.40
+ 0 .00
+ 3 2.30
+ 12 7.60
+ 11 6.80
+ 16 8.65
+END DATA.
+
+REGRESSION
+ /STATISTICS COEFF R ANOVA
+ /DEPENDENT value
+ /METHOD=ENTER number.
+])
+
+
+AT_CHECK([pspp -O format=csv regression.sps], [0], [dnl
+Table: Model Summary (value)
+,R,R Square,Adjusted R Square,Std. Error of the Estimate
+,.612,.374,.338,6.176
+
+Table: ANOVA (value)
+,,Sum of Squares,df,Mean Square,F,Sig.
+,Regression,388.065,1,388.065,10.173,.005
+,Residual,648.498,17,38.147,,
+,Total,1036.563,18,,,
+
+Table: Coefficients (value)
+,,Unstandardized Coefficients,,Standardized Coefficients,,
+,,B,Std. Error,Beta,t,Sig.
+,(Constant),.927,2.247,.000,.413,.685
+,number,.611,.192,.612,3.189,.005
+])
+
+AT_CLEANUP