-/*
- 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_;
- linreg *model;
- union value *output = NULL;
- const union value *tmp;
- double *vals;
- const struct variable **vars = NULL;
-
- assert (trns != NULL);
- model = trns->c;
- assert (model != NULL);
- assert (model->depvar != NULL);
- assert (model->pred != NULL);
-
- vars = linreg_get_vars (model);
- n_vals = linreg_n_coeffs (model);
- vals = xnmalloc (n_vals, sizeof (*vals));
- *c = case_unshare (*c);
-
- output = case_data_rw (*c, model->pred);
-
- for (i = 0; i < n_vals; i++)
- {
- tmp = case_data (*c, vars[i]);
- vals[i] = tmp->f;
- }
- output->f = linreg_predict (model, vals, n_vals);
- free (vals);
- return TRNS_CONTINUE;
-}
-
-/*
- Gets the residuals.
-*/
-static int
-regression_trns_resid_proc (void *t_, struct ccase **c,
- casenumber case_idx UNUSED)
-{
- size_t i;
- size_t n_vals;
- struct reg_trns *trns = t_;
- linreg *model;
- union value *output = NULL;
- const union value *tmp;
- double *vals = NULL;
- double obs;
- const struct variable **vars = NULL;
-
- assert (trns != NULL);
- model = trns->c;
- assert (model != NULL);
- assert (model->depvar != NULL);
- assert (model->resid != NULL);
-
- vars = linreg_get_vars (model);
- n_vals = linreg_n_coeffs (model);
-
- vals = xnmalloc (n_vals, sizeof (*vals));
- *c = case_unshare (*c);
- output = case_data_rw (*c, model->resid);
- assert (output != NULL);
-
- for (i = 0; i < n_vals; i++)
- {
- tmp = case_data (*c, vars[i]);
- vals[i] = tmp->f;
- }
- tmp = case_data (*c, model->depvar);
- obs = tmp->f;
- output->f = linreg_residual (model, obs, vals, n_vals);
- free (vals);
-
- return TRNS_CONTINUE;
-}