X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;ds=sidebyside;f=src%2Flanguage%2Fstats%2Fglm.q;fp=src%2Flanguage%2Fstats%2Fglm.q;h=ddc2a78ba00388e8e507a2f32ce6e753aba25b77;hb=b4fdd51a0bf62800c53c8a805f31ea735d931029;hp=ad8bf55e9dfd5dfee172289eb099e42c8922ab22;hpb=5f8dc7ca9962b212d623566e287b0f1d365f6398;p=pspp-builds.git diff --git a/src/language/stats/glm.q b/src/language/stats/glm.q index ad8bf55e..ddc2a78b 100644 --- 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; } +/* + COV is the covariance matrix for variables included in the + model. That means the dependent variable is in there, too. + */ 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. */ - 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. */