From: Jason Stover Date: Sun, 6 Apr 2008 21:59:13 +0000 (+0000) Subject: store intercept in proper place when using QR method X-Git-Tag: v0.6.0~42 X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=5b5f08a99c564c2f3e981ae0efe21ffc3c578ac4;p=pspp-builds.git store intercept in proper place when using QR method --- diff --git a/src/math/linreg/ChangeLog b/src/math/linreg/ChangeLog index c92db77a..a93f3b3f 100644 --- a/src/math/linreg/ChangeLog +++ b/src/math/linreg/ChangeLog @@ -1,3 +1,9 @@ +2008-04-06 Jason Stover + + * linreg.c (pspp_linreg): For the QR method of getting the least + squares estimates, store intercept in cache->intercept + instead of coefficienc structure. Partial fix of bug 22788. + 2008-03-10 Jason Stover * linreg.c (pspp_linreg): Remove use of coefficient 0 as intercept. diff --git a/src/math/linreg/linreg.c b/src/math/linreg/linreg.c index 217e201c..0782c36f 100644 --- a/src/math/linreg/linreg.c +++ b/src/math/linreg/linreg.c @@ -397,10 +397,11 @@ pspp_linreg (const gsl_vector * Y, const gsl_matrix * X, wk = gsl_multifit_linear_alloc (design->size1, design->size2); rc = gsl_multifit_linear (design, Y, param_estimates, cache->cov, &(cache->sse), wk); - for (i = 0; i < cache->n_coeffs; i++) + for (i = 1; i < cache->n_coeffs; i++) { cache->coeff[i]->estimate = gsl_vector_get (param_estimates, i); } + cache->intercept = gsl_vector_get (param_estimates, 0); if (rc == GSL_SUCCESS) { gsl_multifit_linear_free (wk);