Continue reforming procedure execution. Change internal_procedure()
[pspp-builds.git] / src / math / linreg / coefficient.c
index 2154ffe4ae0329610dc4d60bec0736bc33710ece..1f5d9ec4031e36b18ac6f4c0fe6c9cf1ffeb8af9 100644 (file)
@@ -60,6 +60,7 @@ pspp_linreg_coeff_init (pspp_linreg_cache * c, struct design_matrix *X)
   struct pspp_linreg_coeff *coeff;
 
   c->coeff = xnmalloc (X->m->size2 + 1, sizeof (*c->coeff));
+  c->coeff->v_info = NULL; /* Intercept has no associated variable. */
   for (i = 0; i < X->m->size2; i++)
     {
       j = i + 1;               /* The first coefficient is the intercept. */
@@ -137,7 +138,8 @@ pspp_linreg_coeff_get_n_vars (struct pspp_linreg_coeff *c)
 }
 
 /*
-  Which variable does this coefficient match?
+  Which variable does this coefficient match? I should be
+  0 unless the coefficient refers to an interaction term.
  */
 const struct variable *
 pspp_linreg_coeff_get_var (struct pspp_linreg_coeff *c, int i)
@@ -164,7 +166,7 @@ pspp_linreg_coeff_get_value (struct pspp_linreg_coeff *c,
     {
       return NULL;
     }
-  if (v->type == NULL)
+  if (v->type == NUMERIC)
     {
       return NULL;
     }
@@ -196,7 +198,7 @@ pspp_linreg_get_coeff (const pspp_linreg_cache * c,
     {
       return NULL;
     }
-  if (c->coeff == NULL || c->n_indeps == NULL || v == NULL)
+  if (c->coeff == NULL || c->n_indeps == 0 || v == NULL)
     {
       return NULL;
     }