pspp-cvs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Pspp-cvs] Changes to pspp/lib/linreg/linreg.c


From: Jason H Stover
Subject: [Pspp-cvs] Changes to pspp/lib/linreg/linreg.c
Date: Sun, 27 Nov 2005 22:17:00 -0500

Index: pspp/lib/linreg/linreg.c
diff -u pspp/lib/linreg/linreg.c:1.5 pspp/lib/linreg/linreg.c:1.6
--- pspp/lib/linreg/linreg.c:1.5        Sun Oct 30 15:06:18 2005
+++ pspp/lib/linreg/linreg.c    Mon Nov 28 03:17:00 2005
@@ -139,6 +139,7 @@
   gsl_vector_view xty;
   gsl_vector_view xi;
   gsl_vector_view xj;
+  gsl_vector *param_estimates;
 
   size_t i;
   size_t j;
@@ -300,6 +301,8 @@
       /*
          Use QR decomposition via GSL.
        */
+
+      param_estimates = gsl_vector_alloc (1 + X->size2);
       design = gsl_matrix_alloc (X->size1, 1 + X->size2);
 
       for (j = 0; j < X->size1; j++)
@@ -313,11 +316,16 @@
        }
       gsl_multifit_linear_workspace *wk =
        gsl_multifit_linear_alloc (design->size1, design->size2);
-      rc = gsl_multifit_linear (design, Y, cache->param_estimates,
+      rc = gsl_multifit_linear (design, Y, param_estimates,
                                cache->cov, &(cache->sse), wk);
+      for (i = 0; i < cache->n_coeffs; i++)
+       {
+         cache->coeff[i].estimate = gsl_vector_get (param_estimates, i);
+       }
       if (rc == GSL_SUCCESS)
        {
          gsl_multifit_linear_free (wk);
+         gsl_vector_free (param_estimates);
        }
       else
        {




reply via email to

[Prev in Thread] Current Thread [Next in Thread]