+/*
+ The mean is subtracted from the original data before computing the
+ coefficients. The mean is NOT added back, so if you want to predict
+ a new value, you must add the mean to X_hat[m] to get the correct
+ value.
+ */
+static void
+subtract_mean (gsl_matrix *m, struct innovations_estimate **est)
+{
+ size_t i;
+ size_t j;
+ double tmp;
+
+ for (i = 0; i < m->size1; i++)
+ {
+ for (j = 0; j < m->size2; j++)
+ {
+ tmp = gsl_matrix_get (m, i, j) - est[j]->mean;
+ gsl_matrix_set (m, i, j, tmp);
+ }
+ }
+}