Fix bug 25677
[pspp-builds.git] / src / math / linreg.h
index 834b0922469c4f711bf035e5c6607c1d99c50fdd..3b19e53a260ff5aa740d69e130200b9e43ac055c 100644 (file)
 #include <gsl/gsl_math.h>
 #include <gsl/gsl_vector.h>
 #include <gsl/gsl_matrix.h>
-
-struct variable;
-struct pspp_coeff;
-union value;
+#include <src/math/coefficient.h>
 
 enum
 {
@@ -99,8 +96,7 @@ struct pspp_linreg_cache_struct
                                   coefficient here. */
 
   /*
-     The variable struct is ignored during estimation. It is here so
-     the calling procedure can find the variable used in the model.
+    Pointer to the dependent variable.
    */
   const struct variable *depvar;
 
@@ -189,8 +185,8 @@ bool pspp_linreg_cache_free (void *);
   values as indicated by opts.
  */
 int
-pspp_linreg (const gsl_vector * Y, const gsl_matrix * X,
-            const pspp_linreg_opts * opts, pspp_linreg_cache * cache);
+pspp_linreg (const gsl_vector *, const struct design_matrix *,
+            const pspp_linreg_opts *, pspp_linreg_cache *);
 
 double
 pspp_linreg_predict (const struct variable **, const union value **,
@@ -203,9 +199,20 @@ pspp_linreg_residual (const struct variable **, const union value **,
  */
 int pspp_linreg_get_vars (const void *, const struct variable **);
 
-const struct pspp_coeff *pspp_linreg_get_coeff (const pspp_linreg_cache
+struct pspp_coeff *pspp_linreg_get_coeff (const pspp_linreg_cache
                                                       *,
                                                       const struct variable
                                                       *,
                                                       const union value *);
+/*
+  Return or set the standard deviation of the independent variable.
+ */
+double pspp_linreg_get_indep_variable_sd (pspp_linreg_cache *, const struct variable *);
+void pspp_linreg_set_indep_variable_sd (pspp_linreg_cache *, const struct variable *, double);
+/*
+  Mean of the independent variable.
+ */
+double pspp_linreg_get_indep_variable_mean (pspp_linreg_cache *, const struct variable *);
+void pspp_linreg_set_indep_variable_mean (pspp_linreg_cache *, const struct variable *, double);
+double pspp_linreg_mse (const pspp_linreg_cache *);
 #endif