Drop first category of each variable from covariance matrix.
[pspp-builds.git] / src / math / covariance.c
index c247148ee9f88d64a29edf36e087d79ab21e95cd..d60d609e45681ffc7858abb83490b0b07b09fb46 100644 (file)
@@ -338,7 +338,9 @@ covariance_accumulate_pass2 (struct covariance *cov, const struct ccase *c)
       assert (cov->state == 1);
       cov->state = 2;
 
-      cov->dim = cov->n_vars + categoricals_total (cov->categoricals);
+      cov->dim = cov->n_vars +
+       categoricals_total (cov->categoricals) - categoricals_get_n_variables (cov->categoricals);
+
       cov->n_cm = (cov->dim * (cov->dim - 1)  ) / 2;
       cov->cm = xcalloc (sizeof *cov->cm, cov->n_cm);