projects
/
pspp
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
REGRESSION: Correctly handle data in temporary file for SAVE subcommand.
[pspp]
/
src
/
language
/
stats
/
regression.c
diff --git
a/src/language/stats/regression.c
b/src/language/stats/regression.c
index 52009e29683a72e4722df66674aead46fd1e2562..a6c6cbacc66183b646aee12e36a63a3649314cc6 100644
(file)
--- a/
src/language/stats/regression.c
+++ b/
src/language/stats/regression.c
@@
-1,5
+1,5
@@
/* PSPP - a program for statistical analysis.
/* PSPP - a program for statistical analysis.
- Copyright (C) 2005, 2009, 2010, 2011, 2012, 2013, 2014 Free Software Foundation, Inc.
+ Copyright (C) 2005, 2009, 2010, 2011, 2012, 2013, 2014
, 2016
Free Software Foundation, Inc.
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
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
@@
-225,8
+225,7
@@
cmd_regression (struct lexer *lexer, struct dataset *ds)
if (lex_match_id (lexer, "DEPENDENT"))
{
if (lex_match_id (lexer, "DEPENDENT"))
{
- if (!lex_force_match (lexer, T_EQUALS))
- goto error;
+ lex_match (lexer, T_EQUALS);
free (regression.dep_vars);
regression.n_dep_vars = 0;
free (regression.dep_vars);
regression.n_dep_vars = 0;
@@
-248,6
+247,7
@@
cmd_regression (struct lexer *lexer, struct dataset *ds)
}
else if (lex_match_id (lexer, "STATISTICS"))
{
}
else if (lex_match_id (lexer, "STATISTICS"))
{
+ unsigned long statistics = 0;
lex_match (lexer, T_EQUALS);
while (lex_token (lexer) != T_ENDCMD
lex_match (lexer, T_EQUALS);
while (lex_token (lexer) != T_ENDCMD
@@
-255,31
+255,31
@@
cmd_regression (struct lexer *lexer, struct dataset *ds)
{
if (lex_match (lexer, T_ALL))
{
{
if (lex_match (lexer, T_ALL))
{
-
regression.stat
s = ~0;
+
statistic
s = ~0;
}
else if (lex_match_id (lexer, "DEFAULTS"))
{
}
else if (lex_match_id (lexer, "DEFAULTS"))
{
-
regression.stat
s |= STATS_DEFAULT;
+
statistic
s |= STATS_DEFAULT;
}
else if (lex_match_id (lexer, "R"))
{
}
else if (lex_match_id (lexer, "R"))
{
-
regression.stat
s |= STATS_R;
+
statistic
s |= STATS_R;
}
else if (lex_match_id (lexer, "COEFF"))
{
}
else if (lex_match_id (lexer, "COEFF"))
{
-
regression.stat
s |= STATS_COEFF;
+
statistic
s |= STATS_COEFF;
}
else if (lex_match_id (lexer, "ANOVA"))
{
}
else if (lex_match_id (lexer, "ANOVA"))
{
-
regression.stat
s |= STATS_ANOVA;
+
statistic
s |= STATS_ANOVA;
}
else if (lex_match_id (lexer, "BCOV"))
{
}
else if (lex_match_id (lexer, "BCOV"))
{
-
regression.stat
s |= STATS_BCOV;
+
statistic
s |= STATS_BCOV;
}
else if (lex_match_id (lexer, "CI"))
{
}
else if (lex_match_id (lexer, "CI"))
{
-
regression.stat
s |= STATS_CI;
+
statistic
s |= STATS_CI;
if (lex_match (lexer, T_LPAREN))
{
if (lex_match (lexer, T_LPAREN))
{
@@
-294,6
+294,10
@@
cmd_regression (struct lexer *lexer, struct dataset *ds)
goto error;
}
}
goto error;
}
}
+
+ if (statistics)
+ regression.stats = statistics;
+
}
else if (lex_match_id (lexer, "SAVE"))
{
}
else if (lex_match_id (lexer, "SAVE"))
{
@@
-344,8
+348,7
@@
cmd_regression (struct lexer *lexer, struct dataset *ds)
if (regression.resid)
{
if (regression.resid)
{
- workspace.extras ++;
- workspace.res_idx = 0;
+ workspace.res_idx = workspace.extras ++;
workspace.residvars = xcalloc (regression.n_dep_vars, sizeof (*workspace.residvars));
for (i = 0; i < regression.n_dep_vars; ++i)
workspace.residvars = xcalloc (regression.n_dep_vars, sizeof (*workspace.residvars));
for (i = 0; i < regression.n_dep_vars; ++i)
@@
-357,8
+360,7
@@
cmd_regression (struct lexer *lexer, struct dataset *ds)
if (regression.pred)
{
if (regression.pred)
{
- workspace.extras ++;
- workspace.pred_idx = 1;
+ workspace.pred_idx = workspace.extras ++;
workspace.predvars = xcalloc (regression.n_dep_vars, sizeof (*workspace.predvars));
for (i = 0; i < regression.n_dep_vars; ++i)
workspace.predvars = xcalloc (regression.n_dep_vars, sizeof (*workspace.predvars));
for (i = 0; i < regression.n_dep_vars; ++i)
@@
-372,6
+374,10
@@
cmd_regression (struct lexer *lexer, struct dataset *ds)
msg (SW, _("REGRESSION with SAVE ignores TEMPORARY. "
"Temporary transformations will be made permanent."));
msg (SW, _("REGRESSION with SAVE ignores TEMPORARY. "
"Temporary transformations will be made permanent."));
+ if (dict_get_filter (dict))
+ msg (SW, _("REGRESSION with SAVE ignores FILTER. "
+ "All cases will be processed."));
+
workspace.writer = autopaging_writer_create (proto);
caseproto_unref (proto);
}
workspace.writer = autopaging_writer_create (proto);
caseproto_unref (proto);
}
@@
-701,7
+707,7
@@
run_regression (const struct regression *cmd,
for (; (c = casereader_read (r)) != NULL; case_unref (c))
{
for (; (c = casereader_read (r)) != NULL; case_unref (c))
{
- struct ccase *outc = case_c
lone (c
);
+ struct ccase *outc = case_c
reate (casewriter_get_proto (ws->writer)
);
for (k = 0; k < cmd->n_dep_vars; k++)
{
const struct variable **vars = xnmalloc (cmd->n_vars, sizeof (*vars));
for (k = 0; k < cmd->n_dep_vars; k++)
{
const struct variable **vars = xnmalloc (cmd->n_vars, sizeof (*vars));