1 /* lib/linreg/coefficient.c
3 Copyright (C) 2005 Free Software Foundation, Inc.
4 Written by Jason H Stover.
6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2 of the License, or (at
9 your option) any later version.
11 This program is distributed in the hope that it will be useful, but
12 WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with this program; if not, write to the Free Software
18 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
27 #include <math/linreg/linreg.h>
32 Cache for the relevant data from the model. There are several
33 members which the caller might not use, and which could use a lot of
34 storage. Therefore non-essential members of the struct will be
35 allocated only when requested.
37 struct pspp_linreg_coeff
39 double estimate; /* Estimated coefficient. */
40 double std_err; /* Standard error of the estimate. */
41 struct varinfo *v_info; /* Information pertaining to the
42 variable(s) associated with this
43 coefficient. The calling function
44 should initialize this value with the
45 functions in coefficient.c. The
46 estimation procedure ignores this
47 member. It is here so the caller can
48 match parameters with relevant variables
49 and values. If the coefficient is
50 associated with an interaction, then
51 v_info contains information for multiple
54 int n_vars; /* Number of variables associated with this coefficient.
55 Coefficients corresponding to interaction terms will
56 have more than one variable.
63 Accessor functions for matching coefficients and variables.
66 void pspp_linreg_coeff_free (struct pspp_linreg_coeff *c);
69 Initialize the variable and value pointers inside the
70 coefficient structures for the linear model.
73 pspp_linreg_coeff_init (pspp_linreg_cache *c,
74 struct design_matrix *X);
78 pspp_linreg_coeff_set_estimate (struct pspp_linreg_coeff *c,
82 pspp_linreg_coeff_set_std_err (struct pspp_linreg_coeff *c,
85 How many variables are associated with this coefficient?
88 pspp_linreg_coeff_get_n_vars (struct pspp_linreg_coeff *c);
91 Which variable does this coefficient match?
93 const struct variable *
94 pspp_linreg_coeff_get_var (struct pspp_linreg_coeff *c, int i);
97 Which value is associated with this coefficient/variable comination?
100 pspp_linreg_coeff_get_value (struct pspp_linreg_coeff *c,
101 const struct variable *v);
103 const struct pspp_linreg_coeff *
104 pspp_linreg_get_coeff (const pspp_linreg_cache *,
105 const struct variable *,
106 const union value *);