X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Fmath%2Flinreg.h;h=f9d8c9b3f740abfc161ea7df2ecf20131985f700;hb=e9599a2f8e86d986fff1518682ba8942bd67d1c0;hp=834b0922469c4f711bf035e5c6607c1d99c50fdd;hpb=b5b474193e450bba97610065df0518c08074a7fb;p=pspp-builds.git diff --git a/src/math/linreg.h b/src/math/linreg.h index 834b0922..f9d8c9b3 100644 --- a/src/math/linreg.h +++ b/src/math/linreg.h @@ -20,10 +20,8 @@ #include #include #include - -struct variable; -struct pspp_coeff; -union value; +#include +#include enum { @@ -99,10 +97,10 @@ 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. + Pointers to the variables. */ const struct variable *depvar; + const struct variable **indep_vars; gsl_vector *residuals; struct pspp_coeff **coeff; @@ -179,7 +177,8 @@ typedef struct pspp_linreg_cache_struct pspp_linreg_cache; to it. n is the number of cases, p is the number of independent variables. */ -pspp_linreg_cache *pspp_linreg_cache_alloc (size_t n, size_t p); +pspp_linreg_cache *pspp_linreg_cache_alloc (const struct variable *, const struct variable **, + size_t, size_t); bool pspp_linreg_cache_free (void *); @@ -189,8 +188,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 +202,25 @@ 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); + +/* + Regression using only the covariance matrix. + */ +void pspp_linreg_with_cov (const struct covariance_matrix *, pspp_linreg_cache *); +double pspp_linreg_mse (const pspp_linreg_cache *); #endif