Return 0.0 for mean of a categorical variable. Fixes bug mentioned in bug report...
[pspp-builds.git] / src / math / linreg.c
index 2fb98cf76822d020c4369d31acdf8ce0a91b1457..2b4f7c9069000705425e7c6af8940e0cccb1315a 100644 (file)
@@ -626,7 +626,7 @@ double pspp_linreg_get_indep_variable_mean (pspp_linreg_cache *c, const struct v
       coef = pspp_linreg_get_coeff (c, v, NULL);
       return pspp_coeff_get_mean (coef);
     }
-  return GSL_NAN;
+  return 0.0;
 }
 
 void pspp_linreg_set_indep_variable_mean (pspp_linreg_cache *c, const struct variable *v, 
@@ -741,3 +741,8 @@ pspp_linreg_with_cov (const struct design_matrix *full_cov,
   covariance_matrix_destroy (cov);
 }
 
+double pspp_linreg_mse (const pspp_linreg_cache *c)
+{
+  assert (c != NULL);
+  return (c->sse / c->dfe);
+}