projects
/
pspp-builds.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
pspp_coeff_var_to_coeff: Guard against a null pointer in coefs[i]->v_info.
[pspp-builds.git]
/
src
/
language
/
stats
/
glm.q
diff --git
a/src/language/stats/glm.q
b/src/language/stats/glm.q
index ad8bf55e9dfd5dfee172289eb099e42c8922ab22..ddc2a78ba00388e8e507a2f32ce6e753aba25b77 100644
(file)
--- a/
src/language/stats/glm.q
+++ b/
src/language/stats/glm.q
@@
-151,13
+151,18
@@
glm_custom_dependent (struct lexer *lexer, struct dataset *ds,
return 1;
}
return 1;
}
+/*
+ COV is the covariance matrix for variables included in the
+ model. That means the dependent variable is in there, too.
+ */
static void
static void
-coeff_init (pspp_linreg_cache * c, struct design_matrix *
dm
)
+coeff_init (pspp_linreg_cache * c, struct design_matrix *
cov
)
{
{
- c->coeff = xnmalloc (dm->m->size2 + 1, sizeof (*c->coeff));
+ c->coeff = xnmalloc (cov->m->size2, sizeof (*c->coeff));
+ c->n_coeffs = cov->m->size2 - 1;
c->coeff[0] = xmalloc (sizeof (*(c->coeff[0]))); /* The first coefficient is the intercept. */
c->coeff[0]->v_info = NULL; /* Intercept has no associated variable. */
c->coeff[0] = xmalloc (sizeof (*(c->coeff[0]))); /* The first coefficient is the intercept. */
c->coeff[0]->v_info = NULL; /* Intercept has no associated variable. */
- pspp_coeff_init (c->coeff + 1,
dm
);
+ pspp_coeff_init (c->coeff + 1,
cov
);
}
/*
}
/*
@@
-339,8
+344,7
@@
run_glm (struct casereader *input,
}
}
}
}
}
}
- model = pspp_linreg_cache_alloc (n_data, n_indep);
- model->depvar = v_dependent;
+ model = pspp_linreg_cache_alloc (v_dependent, indep_vars, n_data, n_indep);
/*
For large data sets, use QR decomposition.
*/
/*
For large data sets, use QR decomposition.
*/