gsl_matrix_set (design, j, i, tmp);
}
}
- sw = gsl_matrix_calloc (cache->n_indeps + 1, cache->n_indeps + 1);
- xtx = gsl_matrix_submatrix (sw, 0, 0, cache->n_indeps, cache->n_indeps);
+ sw = gsl_matrix_calloc (cache->n_coeffs + 1, cache->n_coeffs + 1);
+ xtx = gsl_matrix_submatrix (sw, 0, 0, cache->n_coeffs, cache->n_coeffs);
for (i = 0; i < xtx.matrix.size1; i++)
{
}
}
- gsl_matrix_set (sw, cache->n_indeps, cache->n_indeps, cache->sst);
- xty = gsl_matrix_column (sw, cache->n_indeps);
+ gsl_matrix_set (sw, cache->n_coeffs, cache->n_coeffs, cache->sst);
+ xty = gsl_matrix_column (sw, cache->n_coeffs);
/*
This loop starts at 1, with i=0 outside the loop, so we can get
the model sum of squares due to the first independent variable.
gsl_vector_set (&(xty.vector), 0, tmp);
tmp *= tmp / gsl_vector_get (cache->ssx, 0);
gsl_vector_set (cache->ss_indeps, 0, tmp);
- for (i = 1; i < cache->n_indeps; i++)
+ for (i = 1; i < cache->n_coeffs; i++)
{
xi = gsl_matrix_column (design, i);
gsl_blas_ddot (&(xi.vector), Y, &tmp);
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,
size_t i;
size_t j;
size_t k;
+ size_t n_coeffs = 0;
assert (cm != NULL);
cov = covariance_to_design (cm);
assert (c != NULL);
assert (cov->m->size1 > 0);
assert (cov->m->size2 == cov->m->size1);
- permutation = xnmalloc (1 + c->n_indeps, sizeof (*permutation));
model_vars = xnmalloc (1 + c->n_indeps, sizeof (*model_vars));
/*
Put the model variables in the right order in MODEL_VARS.
+ Count the number of coefficients.
*/
for (i = 0; i < c->n_indeps; i++)
{
}
model_vars[i] = c->depvar;
result = covariance_matrix_create (1 + c->n_indeps, model_vars);
+ permutation = xnmalloc (design_matrix_get_n_cols (result), sizeof (*permutation));
+
for (j = 0; j < cov->m->size2; j++)
{
k = 0;
assert (c != NULL);
return (c->sse / c->dfe);
}
-