Dropped references to unused vector param_estimates
[pspp-builds.git] / lib / linreg / pspp_linreg.h
index 209ee0b8da4ff040bd8ef0eaccb6f27f9cb4ec2b..a8db8a10f8e7979302fa401394e53088239b55d6 100644 (file)
@@ -1,4 +1,4 @@
-/* lib/linreg/linreg.c
+/* lib/linreg/pspp_linreg.h
 
    Copyright (C) 2005 Free Software Foundation, Inc.
    Written by Jason H Stover.
@@ -45,7 +45,7 @@
   Springer. 1998. ISBN 0-387-98542-5.
  */
 #ifndef PSPP_LINREG_H
-#define PSPP_LINREG_H
+#define PSPP_LINREG_H 1
 #include <gsl/gsl_vector.h>
 #include <gsl/gsl_matrix.h>
 #include <gsl/gsl_math.h>
@@ -54,6 +54,7 @@
 #include <gsl/gsl_multifit.h>
 #include <gsl/gsl_blas.h>
 #include <gsl/gsl_cblas.h>
+#include <src/var.h>
 enum
 {
   PSPP_LINREG_SWEEP,
@@ -62,18 +63,36 @@ enum
 
 /*
   Cache for the relevant data from the model. There are several
-  members which the caller may not use, and which could use a lot of
+  members which the caller might not use, and which could use a lot of
   storage. Therefore non-essential members of the struct will be
   allocated only when requested.
  */
+struct pspp_linreg_coeff
+{
+  double estimate; /* Estimated coefficient. */
+  const struct variable *v; /* The variable associated with this coefficient. 
+                              The calling function should supply the variable
+                              when it creates the design matrix. The estimation
+                              procedure ignores the struct variable *. It is here so
+                              the caller can match parameters with relevant 
+                              variables.
+                           */
+};
 struct pspp_linreg_cache_struct
 {
   int n_obs;                   /* Number of observations. */
   int n_indeps;                        /* Number of independent variables. */
-  gsl_vector *depvar;
-  gsl_matrix *indepvar;
+  int n_coeffs;
+
+  /* 
+     The variable struct is ignored during estimation.
+     It is here so the calling procedure can
+     find the variable used in the model.
+  */
+  const struct variable *depvar;
+
   gsl_vector *residuals;
-  gsl_vector *param_estimates;
+  struct pspp_linreg_coeff *coeff;
   int method;                  /* Method to use to estimate parameters. */
   /*
      Means and standard deviations of the variables.
@@ -81,8 +100,8 @@ struct pspp_linreg_cache_struct
      called, pspp_linreg() will compute their values.
 
      Entry i of indep_means is the mean of independent
-     variable i, whose observations are stored in column i
-     of indepvar.
+     variable i, whose observations are stored in the ith
+     column of the design matrix.
    */
   double depvar_mean;
   double depvar_std;