From: Jason Stover Date: Sun, 9 Apr 2006 19:46:29 +0000 (+0000) Subject: call residual function instead of predict to get residual X-Git-Tag: v0.6.0~996 X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=814e5d005b8108f9fe1c78b60afce20eeccccd6c;p=pspp-builds.git call residual function instead of predict to get residual --- diff --git a/src/language/stats/regression.q b/src/language/stats/regression.q index 3037f72c..d5536e80 100644 --- a/src/language/stats/regression.q +++ b/src/language/stats/regression.q @@ -507,11 +507,13 @@ subcommand_save (int save, pspp_linreg_cache *lc, const struct casefile *cf, int int i; int case_num; double residual; - const union value **vals; + const union value **vals = NULL; + const union value *obs = NULL; struct casereader *r; struct ccase c; assert (lc != NULL); + assert (lc->depvar != NULL); assert (is_missing != NULL); if (save) @@ -526,9 +528,13 @@ subcommand_save (int save, pspp_linreg_cache *lc, const struct casefile *cf, int for (i = 0; i < n_variables; ++i) { vals[i] = case_data (&c, v_variables[i]->fv); + if (v_variables[i]->index == lc->depvar->index) + { + obs = vals[i]; + } } - residual = (*lc->predict) ((const struct variable **) v_variables, - (const union value **) vals, lc, n_variables); + residual = (*lc->residual) ((const struct variable **) v_variables, + (const union value **) vals, obs, lc, n_variables); } } free (vals);