/* PSPP - linear regression.
Copyright (C) 2005 Free Software Foundation, Inc.
/* PSPP - linear regression.
Copyright (C) 2005 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
#include <math/design-matrix.h>
#include <math/coefficient.h>
#include <math/linreg/linreg.h>
#include <math/design-matrix.h>
#include <math/coefficient.h>
#include <math/linreg/linreg.h>
tab_float (t, 6, j + 1, 0, pval, 10, 2);
}
tab_title (t, _("Coefficients"));
tab_float (t, 6, j + 1, 0, pval, 10, 2);
}
tab_title (t, _("Coefficients"));
n_vals = (*model->get_vars) (model, vars);
vals = xnmalloc (n_vals, sizeof (*vals));
n_vals = (*model->get_vars) (model, vars);
vals = xnmalloc (n_vals, sizeof (*vals));
n_vals = (*model->get_vars) (model, vars);
vals = xnmalloc (n_vals, sizeof (*vals));
n_vals = (*model->get_vars) (model, vars);
vals = xnmalloc (n_vals, sizeof (*vals));
output->f = (*model->residual) ((const struct variable **) vars,
vals, obs, model, n_vals);
free (vals);
output->f = (*model->residual) ((const struct variable **) vars,
vals, obs, model, n_vals);
free (vals);
fprintf (fp, "%s", reg_export_categorical_encode_1);
varlist = xnmalloc (c->n_indeps, sizeof (*varlist));
for (i = 1; i < c->n_indeps; i++) /* c->coeff[0] is the intercept. */
{
fprintf (fp, "%s", reg_export_categorical_encode_1);
varlist = xnmalloc (c->n_indeps, sizeof (*varlist));
for (i = 1; i < c->n_indeps; i++) /* c->coeff[0] is the intercept. */
{
fprintf (fp, "%s.name = \"%s\";\n\t",
var_get_name (varlist[i]),
var_get_name (varlist[i]));
fprintf (fp, "%s.n_vals = %d;\n\t",
var_get_name (varlist[i]),
fprintf (fp, "%s.name = \"%s\";\n\t",
var_get_name (varlist[i]),
var_get_name (varlist[i]));
fprintf (fp, "%s.n_vals = %d;\n\t",
var_get_name (varlist[i]),
fprintf (fp, "%s.values[%d] = \"%s\";\n\t",
var_get_name (varlist[i]), j,
fprintf (fp, "%s.values[%d] = \"%s\";\n\t",
var_get_name (varlist[i]), j,
- val = case_data (&c, v->fv);
+ val = case_data (&c, v);
+ if (mom != NULL)
+ {
+ moments_pass_one (mom->m, val->f, 1.0);
+ }
static int
prepare_data (int n_data, int is_missing_case[],
struct variable **indep_vars,
static int
prepare_data (int n_data, int is_missing_case[],
struct variable **indep_vars,
- mark_missing_cases (cf, v_variables[i], is_missing_case, n_data);
+ mark_missing_cases (cf, v_variables[i], is_missing_case, n_data, mom + i);
- n_data = mark_missing_cases (cf, depvar, is_missing_case, n_data);
+ n_data = mark_missing_cases (cf, depvar, is_missing_case, n_data, NULL);
+ mom = xnmalloc (n_variables, sizeof (*mom));
+ for (i = 0; i < n_variables; i++)
+ {
+ (mom + i)->m = moments_create (MOMENT_VARIANCE);
+ (mom + i)->v = v_variables[i];
+ }
}
n_data = prepare_data (n_cases, is_missing_case, indep_vars,
cmd.v_dependent[k],
}
n_data = prepare_data (n_cases, is_missing_case, indep_vars,
cmd.v_dependent[k],
/*
Independent/dependent variable separation. The
'variables' subcommand specifies a varlist which contains
/*
Independent/dependent variable separation. The
'variables' subcommand specifies a varlist which contains