[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Pspp-cvs] pspp/src math/ChangeLog math/coefficient.c math...
From: |
Jason H Stover |
Subject: |
[Pspp-cvs] pspp/src math/ChangeLog math/coefficient.c math... |
Date: |
Fri, 19 May 2006 21:08:20 +0000 |
CVSROOT: /sources/pspp
Module name: pspp
Branch:
Changes by: Jason H Stover <address@hidden> 06/05/19 21:08:20
Modified files:
src/math : ChangeLog coefficient.c coefficient.h
src/math/linreg: linreg.h linreg.c predict.c
src/language/stats: regression.q
Log message:
renamed pspp_linreg_coeff to pspp_coeff
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/pspp/pspp/src/math/ChangeLog.diff?tr1=1.6&tr2=1.7&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/pspp/pspp/src/math/coefficient.c.diff?tr1=1.1&tr2=1.2&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/pspp/pspp/src/math/coefficient.h.diff?tr1=1.1&tr2=1.2&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/pspp/pspp/src/math/linreg/linreg.h.diff?tr1=1.13&tr2=1.14&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/pspp/pspp/src/math/linreg/linreg.c.diff?tr1=1.14&tr2=1.15&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/pspp/pspp/src/math/linreg/predict.c.diff?tr1=1.9&tr2=1.10&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/pspp/pspp/src/language/stats/regression.q.diff?tr1=1.25&tr2=1.26&r1=text&r2=text
Patches:
Index: pspp/src/language/stats/regression.q
diff -u pspp/src/language/stats/regression.q:1.25
pspp/src/language/stats/regression.q:1.26
--- pspp/src/language/stats/regression.q:1.25 Fri May 19 20:06:47 2006
+++ pspp/src/language/stats/regression.q Fri May 19 21:08:20 2006
@@ -225,7 +225,7 @@
tab_float (t, 6, 1, 0, pval, 10, 2);
for (j = 1; j <= c->n_indeps; j++)
{
- v = pspp_linreg_coeff_get_var (c->coeff[j], 0);
+ v = pspp_coeff_get_var (c->coeff[j], 0);
label = var_to_string (v);
/* Do not overwrite the variable's name. */
strncpy (tmp, label, MAX_STRING);
@@ -237,7 +237,7 @@
for that value.
*/
- val = pspp_linreg_coeff_get_value (c->coeff[j], v);
+ val = pspp_coeff_get_value (c->coeff[j], v);
val_s = value_to_string (val, v);
strncat (tmp, val_s, MAX_STRING);
}
@@ -392,7 +392,7 @@
tab_text (t, 1, 1, TAB_CENTER | TAT_TITLE, _("Covariances"));
for (i = 1; i < c->n_coeffs; i++)
{
- const struct variable *v = pspp_linreg_coeff_get_var (c->coeff[i], 0);
+ const struct variable *v = pspp_coeff_get_var (c->coeff[i], 0);
label = var_to_string (v);
tab_text (t, 2, i, TAB_CENTER, label);
tab_text (t, i + 2, 0, TAB_CENTER, label);
@@ -728,7 +728,7 @@
size_t j;
int n_vars = 0;
struct variable **varlist;
- struct pspp_linreg_coeff *coeff;
+ struct pspp_coeff *coeff;
const struct variable *v;
union value *val;
@@ -738,7 +738,7 @@
for (i = 1; i < c->n_indeps; i++) /* c->coeff[0] is the intercept. */
{
coeff = c->coeff[i];
- v = pspp_linreg_coeff_get_var (coeff, 0);
+ v = pspp_coeff_get_var (coeff, 0);
if (v->type == ALPHA)
{
if (!reg_inserted (v, varlist, n_vars))
@@ -781,18 +781,18 @@
reg_print_depvars (FILE * fp, pspp_linreg_cache * c)
{
int i;
- struct pspp_linreg_coeff *coeff;
+ struct pspp_coeff *coeff;
const struct variable *v;
fprintf (fp, "char *model_depvars[%d] = {", c->n_indeps);
for (i = 1; i < c->n_indeps; i++)
{
coeff = c->coeff[i];
- v = pspp_linreg_coeff_get_var (coeff, 0);
+ v = pspp_coeff_get_var (coeff, 0);
fprintf (fp, "\"%s\",\n\t\t", v->name);
}
coeff = c->coeff[i];
- v = pspp_linreg_coeff_get_var (coeff, 0);
+ v = pspp_coeff_get_var (coeff, 0);
fprintf (fp, "\"%s\"};\n\t", v->name);
}
static void
@@ -814,7 +814,7 @@
for (i = 1; i < c->n_coeffs; i++)
{
- v = pspp_linreg_coeff_get_var (c->coeff[i], 0);
+ v = pspp_coeff_get_var (c->coeff[i], 0);
if (v->type == ALPHA)
{
return 1;
@@ -832,7 +832,7 @@
int n_quantiles = 100;
double increment;
double tmp;
- struct pspp_linreg_coeff *coeff;
+ struct pspp_coeff *coeff;
if (export)
{
@@ -1212,7 +1212,7 @@
and store pointers to the variables that correspond to the
coefficients.
*/
- pspp_linreg_coeff_init (models[k], X);
+ pspp_coeff_init (models[k], X);
/*
Find the least-squares estimates and other statistics.
Index: pspp/src/math/ChangeLog
diff -u pspp/src/math/ChangeLog:1.6 pspp/src/math/ChangeLog:1.7
--- pspp/src/math/ChangeLog:1.6 Fri May 19 20:05:59 2006
+++ pspp/src/math/ChangeLog Fri May 19 21:08:20 2006
@@ -1,5 +1,7 @@
2006-05-19 Jason Stover <address@hidden>
+ * coefficient.h: Renamed pspp_linreg_coeff to pspp_coeff.
+
* coefficient.c: Moved to src/math.
* coefficient.h: Moved to src/math.
Index: pspp/src/math/coefficient.c
diff -u pspp/src/math/coefficient.c:1.1 pspp/src/math/coefficient.c:1.2
--- pspp/src/math/coefficient.c:1.1 Fri May 19 20:00:23 2006
+++ pspp/src/math/coefficient.c Fri May 19 21:08:20 2006
@@ -1,5 +1,5 @@
/*
- lib/linreg/coefficient.c
+ src/math/coefficient.c
Copyright (C) 2005 Free Software Foundation, Inc. Written by Jason H Stover.
@@ -42,7 +42,7 @@
};
void
-pspp_linreg_coeff_free (struct pspp_linreg_coeff *c)
+pspp_coeff_free (struct pspp_coeff *c)
{
free (c->v_info);
free (c);
@@ -53,12 +53,12 @@
coefficient structures for the linear model.
*/
void
-pspp_linreg_coeff_init (pspp_linreg_cache * c, struct design_matrix *X)
+pspp_coeff_init (pspp_linreg_cache * c, struct design_matrix *X)
{
size_t i;
size_t j;
int n_vals = 1;
- struct pspp_linreg_coeff *coeff;
+ struct pspp_coeff *coeff;
c->coeff = xnmalloc (X->m->size2 + 1, sizeof (*c->coeff));
c->coeff[0] = xmalloc (sizeof (*c->coeff[0]));
@@ -90,13 +90,13 @@
}
}
void
-pspp_linreg_coeff_set_estimate (struct pspp_linreg_coeff *c, double estimate)
+pspp_coeff_set_estimate (struct pspp_coeff *c, double estimate)
{
c->estimate = estimate;
}
void
-pspp_linreg_coeff_set_std_err (struct pspp_linreg_coeff *c, double std_err)
+pspp_coeff_set_std_err (struct pspp_coeff *c, double std_err)
{
c->std_err = std_err;
}
@@ -105,7 +105,7 @@
Return the estimated value of the coefficient.
*/
double
-pspp_linreg_coeff_get_est (const struct pspp_linreg_coeff *c)
+pspp_coeff_get_est (const struct pspp_coeff *c)
{
if (c == NULL)
{
@@ -118,7 +118,7 @@
Return the standard error of the estimated coefficient.
*/
double
-pspp_linreg_coeff_get_std_err (const struct pspp_linreg_coeff *c)
+pspp_coeff_get_std_err (const struct pspp_coeff *c)
{
if (c == NULL)
{
@@ -131,7 +131,7 @@
How many variables are associated with this coefficient?
*/
int
-pspp_linreg_coeff_get_n_vars (struct pspp_linreg_coeff *c)
+pspp_coeff_get_n_vars (struct pspp_coeff *c)
{
if (c == NULL)
{
@@ -145,7 +145,7 @@
0 unless the coefficient refers to an interaction term.
*/
const struct variable *
-pspp_linreg_coeff_get_var (struct pspp_linreg_coeff *c, int i)
+pspp_coeff_get_var (struct pspp_coeff *c, int i)
{
if (c == NULL)
{
@@ -159,7 +159,7 @@
Which value is associated with this coefficient/variable combination?
*/
const union value *
-pspp_linreg_coeff_get_value (struct pspp_linreg_coeff *c,
+pspp_coeff_get_value (struct pspp_coeff *c,
const struct variable *v)
{
int i = 0;
@@ -175,7 +175,7 @@
}
while (i < c->n_vars)
{
- candidate = pspp_linreg_coeff_get_var (c, i);
+ candidate = pspp_coeff_get_var (c, i);
if (v->index == candidate->index)
{
return (c->v_info + i)->val;
@@ -189,12 +189,12 @@
Which coefficient is associated with V? The VAL argument is relevant
only to categorical variables.
*/
-const struct pspp_linreg_coeff *
+const struct pspp_coeff *
pspp_linreg_get_coeff (const pspp_linreg_cache * c,
const struct variable *v, const union value *val)
{
int i = 1;
- struct pspp_linreg_coeff *result = NULL;
+ struct pspp_coeff *result = NULL;
const struct variable *tmp = NULL;
if (c == NULL)
@@ -207,11 +207,11 @@
}
result = c->coeff[i];
- tmp = pspp_linreg_coeff_get_var (result, 0);
+ tmp = pspp_coeff_get_var (result, 0);
while (tmp->index != v->index && i < c->n_coeffs)
{
result = c->coeff[i];
- tmp = pspp_linreg_coeff_get_var (result, 0);
+ tmp = pspp_coeff_get_var (result, 0);
i++;
}
if (i > c->n_coeffs)
@@ -229,12 +229,12 @@
matches the VAL.
*/
while (tmp->index != v->index && i < c->n_coeffs
- && compare_values (pspp_linreg_coeff_get_value (result, tmp),
+ && compare_values (pspp_coeff_get_value (result, tmp),
val, v->width))
{ /* FIX THIS */
i++;
result = c->coeff[i];
- tmp = pspp_linreg_coeff_get_var (result, 0);
+ tmp = pspp_coeff_get_var (result, 0);
}
if (i == c->n_coeffs)
{
Index: pspp/src/math/coefficient.h
diff -u pspp/src/math/coefficient.h:1.1 pspp/src/math/coefficient.h:1.2
--- pspp/src/math/coefficient.h:1.1 Fri May 19 20:00:23 2006
+++ pspp/src/math/coefficient.h Fri May 19 21:08:20 2006
@@ -1,5 +1,5 @@
/*
- lib/linreg/coefficient.c
+ src/math/coefficient.c
Copyright (C) 2005 Free Software Foundation, Inc. Written by Jason H Stover.
@@ -35,7 +35,7 @@
storage. Therefore non-essential members of the struct will be
allocated only when requested.
*/
-struct pspp_linreg_coeff
+struct pspp_coeff
{
double estimate; /* Estimated coefficient. */
double std_err; /* Standard error of the estimate. */
@@ -56,20 +56,20 @@
};
-void pspp_linreg_coeff_free (struct pspp_linreg_coeff *);
+void pspp_coeff_free (struct pspp_coeff *);
/*
Initialize the variable and value pointers inside the
coefficient structures for the linear model.
*/
-void pspp_linreg_coeff_init (pspp_linreg_cache *, struct design_matrix *);
+void pspp_coeff_init (pspp_linreg_cache *, struct design_matrix *);
void
-pspp_linreg_coeff_set_estimate (struct pspp_linreg_coeff *, double estimate);
+pspp_coeff_set_estimate (struct pspp_coeff *, double estimate);
void
-pspp_linreg_coeff_set_std_err (struct pspp_linreg_coeff *, double std_err);
+pspp_coeff_set_std_err (struct pspp_coeff *, double std_err);
/*
Accessor functions for matching coefficients and variables.
@@ -78,31 +78,31 @@
/*
Return the estimated value of the coefficient.
*/
-double pspp_linreg_coeff_get_est (const struct pspp_linreg_coeff *);
+double pspp_coeff_get_est (const struct pspp_coeff *);
/*
Return the standard error of the estimated coefficient.
*/
-double pspp_linreg_coeff_get_std_err (const struct pspp_linreg_coeff *);
+double pspp_coeff_get_std_err (const struct pspp_coeff *);
/*
How many variables are associated with this coefficient?
*/
-int pspp_linreg_coeff_get_n_vars (struct pspp_linreg_coeff *);
+int pspp_coeff_get_n_vars (struct pspp_coeff *);
/*
Which variable does this coefficient match? The int argument is usually
0, unless the coefficient refers to an interaction.
*/
-const struct variable *pspp_linreg_coeff_get_var (struct pspp_linreg_coeff *,
+const struct variable *pspp_coeff_get_var (struct pspp_coeff *,
int);
/*
Which value is associated with this coefficient/variable comination?
*/
-const union value *pspp_linreg_coeff_get_value (struct pspp_linreg_coeff *,
+const union value *pspp_coeff_get_value (struct pspp_coeff *,
const struct variable *);
-const struct pspp_linreg_coeff *pspp_linreg_get_coeff (const pspp_linreg_cache
+const struct pspp_coeff *pspp_linreg_get_coeff (const pspp_linreg_cache
*,
const struct variable
*,
Index: pspp/src/math/linreg/linreg.c
diff -u pspp/src/math/linreg/linreg.c:1.14 pspp/src/math/linreg/linreg.c:1.15
--- pspp/src/math/linreg/linreg.c:1.14 Fri May 19 20:05:59 2006
+++ pspp/src/math/linreg/linreg.c Fri May 19 21:08:20 2006
@@ -97,7 +97,7 @@
pspp_linreg_get_vars (const void *c_, struct variable **v)
{
const pspp_linreg_cache *c = c_;
- struct pspp_linreg_coeff *coef = NULL;
+ struct pspp_coeff *coef = NULL;
const struct variable *tmp;
int i;
int result = 0;
@@ -113,12 +113,12 @@
/*
Start at c->coeff[1] to avoid the intercept.
*/
- v[result] = (struct variable *) pspp_linreg_coeff_get_var (c->coeff[1], 0);
+ v[result] = (struct variable *) pspp_coeff_get_var (c->coeff[1], 0);
result = (v[result] == NULL) ? 0 : 1;
for (coef = c->coeff[2]; coef < c->coeff[c->n_coeffs]; coef++)
{
- tmp = pspp_linreg_coeff_get_var (coef, 0);
+ tmp = pspp_coeff_get_var (coef, 0);
assert (tmp != NULL);
/* Repeated variables are likely to bunch together, at the end
of the array. */
@@ -187,7 +187,7 @@
gsl_matrix_free (c->cov);
for (i = 0; i < c->n_coeffs; i++)
{
- pspp_linreg_coeff_free (c->coeff[i]);
+ pspp_coeff_free (c->coeff[i]);
}
free (c);
return true;
Index: pspp/src/math/linreg/linreg.h
diff -u pspp/src/math/linreg/linreg.h:1.13 pspp/src/math/linreg/linreg.h:1.14
--- pspp/src/math/linreg/linreg.h:1.13 Fri May 12 00:29:11 2006
+++ pspp/src/math/linreg/linreg.h Fri May 19 21:08:20 2006
@@ -26,7 +26,7 @@
#include <gsl/gsl_matrix.h>
struct variable;
-struct pspp_linreg_coeff;
+struct pspp_coeff;
union value;
enum
@@ -107,7 +107,7 @@
const struct variable *depvar;
gsl_vector *residuals;
- struct pspp_linreg_coeff **coeff;
+ struct pspp_coeff **coeff;
int method; /* Method to use to estimate parameters. */
/*
Means and standard deviations of the variables.
Index: pspp/src/math/linreg/predict.c
diff -u pspp/src/math/linreg/predict.c:1.9 pspp/src/math/linreg/predict.c:1.10
--- pspp/src/math/linreg/predict.c:1.9 Fri May 19 20:05:59 2006
+++ pspp/src/math/linreg/predict.c Fri May 19 21:08:20 2006
@@ -35,8 +35,8 @@
const pspp_linreg_cache *c = c_;
int i;
int j;
- const struct pspp_linreg_coeff **found;
- const struct pspp_linreg_coeff *coe;
+ const struct pspp_coeff **found;
+ const struct pspp_coeff *coe;
double result;
double tmp;
@@ -69,7 +69,7 @@
if (i < c->n_coeffs)
{
found[i] = coe;
- tmp = pspp_linreg_coeff_get_est (coe);
+ tmp = pspp_coeff_get_est (coe);
if (predictors[j]->type == NUMERIC)
{
tmp *= vals[j]->f;
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Pspp-cvs] pspp/src math/ChangeLog math/coefficient.c math...,
Jason H Stover <=