+
+/*
+ Free the transformation. Free its linear model if this
+ transformation is the last one.
+ */
+static bool
+regression_trns_free (void *t_)
+{
+ bool result = true;
+ struct reg_trns *t = t_;
+
+ if (t->trns_id == t->n_trns)
+ {
+ result = pspp_linreg_cache_free (t->c);
+ }
+ free (t);
+
+ return result;
+}
+
+/*
+ Gets the predicted values.
+ */
+static int
+regression_trns_pred_proc (void *t_, struct ccase *c,
+ casenumber case_idx UNUSED)
+{
+ size_t i;
+ size_t n_vals;
+ struct reg_trns *trns = t_;
+ pspp_linreg_cache *model;
+ union value *output = NULL;
+ const union value **vals = NULL;
+ const struct variable **vars = NULL;
+
+ assert (trns != NULL);
+ model = trns->c;
+ assert (model != NULL);
+ assert (model->depvar != NULL);
+ assert (model->pred != NULL);
+
+ vars = xnmalloc (model->n_coeffs, sizeof (*vars));
+ n_vals = (*model->get_vars) (model, vars);
+
+ vals = xnmalloc (n_vals, sizeof (*vals));
+ output = case_data_rw (c, model->pred);
+ assert (output != NULL);
+
+ for (i = 0; i < n_vals; i++)
+ {
+ vals[i] = case_data (c, vars[i]);
+ }
+ output->f = (*model->predict) ((const struct variable **) vars,
+ vals, model, n_vals);
+ free (vals);
+ free (vars);
+ return TRNS_CONTINUE;
+}
+
+/*
+ Gets the residuals.
+ */