)
{
msg (ME, _("Dependent variable's values are not dichotomous."));
+ case_unref (c);
goto error;
}
}
work.warn_bad_weight = true;
work.cats = NULL;
work.beta_hat = NULL;
+ work.hessian = NULL;
/* Get the initial estimates of \beta and their standard errors.
And perform other auxilliary initialisation. */
if (! initial_pass (cmd, &work, input))
- return false;
+ goto error;
for (i = 0; i < cmd->n_cat_predictors; ++i)
{
msg (ME, _("Category %s does not have at least two distinct values. Logistic regression will not be run."),
ds_cstr(&str));
ds_destroy (&str);
- return false;
+ goto error;
}
}
if (converged)
break;
}
- casereader_destroy (input);
+
if ( ! converged)
output_classification_table (cmd, &work);
output_variables (cmd, &work);
+ casereader_destroy (input);
gsl_matrix_free (work.hessian);
gsl_vector_free (work.beta_hat);
-
categoricals_destroy (work.cats);
return true;
+
+ error:
+ casereader_destroy (input);
+ gsl_matrix_free (work.hessian);
+ gsl_vector_free (work.beta_hat);
+ categoricals_destroy (work.cats);
+
+ return false;
}
struct variable_node
int
cmd_logistic (struct lexer *lexer, struct dataset *ds)
{
+ int i;
/* Temporary location for the predictor variables.
These may or may not include the categorical predictors */
const struct variable **pred_vars;
ok = proc_commit (ds) && ok;
}
+ for (i = 0 ; i < lr.n_cat_predictors; ++i)
+ {
+ interaction_destroy (lr.cat_predictors[i]);
+ }
free (lr.predictor_vars);
free (lr.cat_predictors);
free (lr.indep_vars);
error:
+ for (i = 0 ; i < lr.n_cat_predictors; ++i)
+ {
+ interaction_destroy (lr.cat_predictors[i]);
+ }
free (lr.predictor_vars);
free (lr.cat_predictors);
free (lr.indep_vars);