4 Copyright (C) 2005 Free Software Foundation, Inc. Written by Jason H Stover.
6 This program is free software; you can redistribute it and/or modify it under
7 the terms of the GNU General Public License as published by the Free
8 Software Foundation; either version 2 of the License, or (at your option)
11 This program is distributed in the hope that it will be useful, but WITHOUT
12 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
16 You should have received a copy of the GNU General Public License along with
17 this program; if not, write to the Free Software Foundation, Inc., 51
18 Franklin Street, Fifth Floor, Boston, MA 02111-1307, USA.
26 #include <math/linreg/linreg.h>
27 #include <src/data/variable.h>
28 #include <src/data/value.h>
31 This file contains definitions of data structures for storing
32 coefficients of a statistical model. The coefficients are the point
33 in the model where the theoretical aspects of the model meet the
34 data. As such, the coefficients are the interface where users need
35 to match variable names and values with any information about the
36 model itself. This file and coefficient.c provide this interface
37 between data and model structures.
43 Cache for the relevant data from the model. There are several
44 members which the caller might not use, and which could use a lot of
45 storage. Therefore non-essential members of the struct will be
46 allocated only when requested.
50 double estimate; /* Estimated coefficient. */
51 double std_err; /* Standard error of the estimate. */
52 struct varinfo *v_info; /* Information pertaining to the variable(s)
53 associated with this coefficient. The
54 calling function should initialize this
55 value with the functions in coefficient.c.
56 The estimation procedure ignores this
57 member. It is here so the caller can match
58 parameters with relevant variables and
59 values. If the coefficient is associated
60 with an interaction, then v_info contains
61 information for multiple variables. */
62 int n_vars; /* Number of variables associated with this
63 coefficient. Coefficients corresponding to
64 interaction terms will have more than one
67 typedef struct pspp_coeff coefficient;
69 void pspp_coeff_free (struct pspp_coeff *);
72 Initialize the variable and value pointers inside the
73 coefficient structures for the linear model.
75 void pspp_coeff_init (struct pspp_coeff **, const struct design_matrix *);
79 pspp_coeff_set_estimate (struct pspp_coeff *, double estimate);
82 pspp_coeff_set_std_err (struct pspp_coeff *, double std_err);
85 Accessor functions for matching coefficients and variables.
89 Return the estimated value of the coefficient.
91 double pspp_coeff_get_est (const struct pspp_coeff *);
94 Return the standard error of the estimated coefficient.
96 double pspp_coeff_get_std_err (const struct pspp_coeff *);
99 How many variables are associated with this coefficient?
101 int pspp_coeff_get_n_vars (struct pspp_coeff *);
104 Which variable does this coefficient match? The int argument is usually
105 0, unless the coefficient refers to an interaction.
107 const struct variable *pspp_coeff_get_var (struct pspp_coeff *,
110 Which value is associated with this coefficient/variable comination?
112 const union value *pspp_coeff_get_value (struct pspp_coeff *,
113 const struct variable *);
115 const struct pspp_coeff *pspp_linreg_get_coeff (const pspp_linreg_cache
117 const struct variable
119 const union value *);