+ output->f = (*model->predict) ((const struct variable **) vars,
+ vals, model, n_vals);
+ free (vals);
+ free (model_vars);
+ return TRNS_CONTINUE;
+}
+/*
+ Gets the residuals.
+ */
+static int
+regression_trns_resid_proc (void *t_, struct ccase *c, int case_idx UNUSED)
+{
+ size_t i;
+ size_t n_vars;
+ size_t n_vals = 0;
+ struct reg_trns *t = t_;
+ pspp_linreg_cache *model;
+ union value *output;
+ union value *tmp;
+ const union value **vals = NULL;
+ const union value *obs = NULL;
+ struct variable **vars = NULL;
+ struct variable **model_vars = NULL;
+
+ assert (t!= NULL);
+ model = t->c;
+ assert (model != NULL);
+ assert (model->depvar != NULL);
+ assert (model->resid != NULL);
+
+ dict_get_vars (default_dict, &vars, &n_vars, 1u << DC_SYSTEM);
+ vals = xnmalloc (n_vars, sizeof (*vals));
+ model_vars = xnmalloc (n_vars, sizeof (*model_vars));
+ assert (vals != NULL);
+ output = case_data_rw (c, model->resid->fv);
+ assert (output != NULL);
+
+ for (i = 0; i < n_vars; i++)
+ {
+ /* Use neither the predicted values nor the dependent variable. */
+ if (vars[i]->index != model->resid->index &&
+ vars[i]->index != model->depvar->index)
+ {
+ if (vars[i]->type == ALPHA && vars[i]->obs_vals != NULL)
+ {
+ tmp = vars[i]->obs_vals->vals;
+ }
+ else
+ {
+ tmp = NULL;
+ }
+ /*
+ Make sure the variable we use is in the linear model.
+ */
+ if (pspp_linreg_get_coeff (model, vars[i], tmp) != NULL)
+ {
+ vals[n_vals] = case_data (c, i);
+ model_vars[n_vals] = vars[i];
+ n_vals++;
+ }
+ }
+ if (vars[i]->index == model->depvar->index)
+ {
+ obs = case_data (c, i);
+ assert (obs != NULL);
+ }
+ }