pspp-cvs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Pspp-cvs] pspp/src/math/linreg ChangeLog coefficient.c co...


From: Jason H Stover
Subject: [Pspp-cvs] pspp/src/math/linreg ChangeLog coefficient.c co...
Date: Wed, 05 Apr 2006 19:18:51 +0000

CVSROOT:        /sources/pspp
Module name:    pspp
Branch:         
Changes by:     Jason H Stover <address@hidden> 06/04/05 19:18:51

Modified files:
        src/math/linreg: ChangeLog coefficient.c coefficient.h linreg.h 
                         automake.mk 
Added files:
        src/math/linreg: predict.c 

Log message:
        added predict function for linear model

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/pspp/pspp/src/math/linreg/ChangeLog.diff?tr1=1.2&tr2=1.3&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/pspp/pspp/src/math/linreg/predict.c?rev=1.1
http://cvs.savannah.gnu.org/viewcvs/pspp/pspp/src/math/linreg/coefficient.c.diff?tr1=1.3&tr2=1.4&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/pspp/pspp/src/math/linreg/coefficient.h.diff?tr1=1.3&tr2=1.4&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/pspp/pspp/src/math/linreg/linreg.h.diff?tr1=1.1&tr2=1.2&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/pspp/pspp/src/math/linreg/automake.mk.diff?tr1=1.2&tr2=1.3&r1=text&r2=text

Patches:
Index: pspp/src/math/linreg/ChangeLog
diff -u pspp/src/math/linreg/ChangeLog:1.2 pspp/src/math/linreg/ChangeLog:1.3
--- pspp/src/math/linreg/ChangeLog:1.2  Tue Apr  4 00:50:39 2006
+++ pspp/src/math/linreg/ChangeLog      Wed Apr  5 19:18:51 2006
@@ -1,7 +1,16 @@
+2006-04-05  Jason Stover  <address@hidden>
+
+       * predict.c: New file. pspp_linreg_predict() uses a linear model
+       to return a predicted value of the dependent variable.
+
+       * coefficient.c: Added pspp_linreg_coeff_get_est() and
+       pspp_linreg_coeff_get_std_err() to access estimated values of
+       coefficients and standard errors.
+
 2006-04-03  Jason Stover  <address@hidden>
 
        * coefficient.c: Added pspp_linreg_get_coeff() to find a
-       coefficient corresponding to a variabl/value combination.
+       coefficient corresponding to a variable/value combination.
 
 Thu Mar  2 08:40:33 WST 2006 John Darrington <address@hidden>
        
Index: pspp/src/math/linreg/automake.mk
diff -u pspp/src/math/linreg/automake.mk:1.2 
pspp/src/math/linreg/automake.mk:1.3
--- pspp/src/math/linreg/automake.mk:1.2        Wed Mar 15 03:29:11 2006
+++ pspp/src/math/linreg/automake.mk    Wed Apr  5 19:18:51 2006
@@ -3,7 +3,9 @@
 noinst_LIBRARIES += src/math/linreg/libpspp_linreg.a
 
 src_math_linreg_libpspp_linreg_a_SOURCES = \
+       src/math/linreg/predict.c \
        src/math/linreg/coefficient.c \
        src/math/linreg/coefficient.h \
        src/math/linreg/linreg.c \
-       src/math/linreg/linreg.h
+       src/math/linreg/linreg.h 
+
Index: pspp/src/math/linreg/coefficient.c
diff -u pspp/src/math/linreg/coefficient.c:1.3 
pspp/src/math/linreg/coefficient.c:1.4
--- pspp/src/math/linreg/coefficient.c:1.3      Tue Apr  4 00:45:10 2006
+++ pspp/src/math/linreg/coefficient.c  Wed Apr  5 19:18:51 2006
@@ -22,12 +22,9 @@
 /*
   Accessor functions for matching coefficients and variables.
  */
-#include <assert.h>
 #include <math/linreg/coefficient.h>
 #include <math/linreg/linreg.h>
 #include "src/math/design-matrix.h"
-#include "src/data/variable.h"
-#include "src/data/value.h"
 
 #include <gl/xalloc.h>
 
@@ -103,6 +100,24 @@
 }
 
 /*
+  Return the estimated value of the coefficient.
+ */
+double
+pspp_linreg_coeff_get_est (const struct pspp_linreg_coeff *c)
+{
+  assert (c != NULL);
+  return c->estimate;
+}
+/*
+  Return the standard error of the estimated coefficient.
+*/
+double 
+pspp_linreg_coeff_get_std_err (const struct pspp_linreg_coeff *c)
+{
+  assert (c != NULL);
+  return c->std_err;
+}
+/*
   How many variables are associated with this coefficient?
  */
 int
Index: pspp/src/math/linreg/coefficient.h
diff -u pspp/src/math/linreg/coefficient.h:1.3 
pspp/src/math/linreg/coefficient.h:1.4
--- pspp/src/math/linreg/coefficient.h:1.3      Tue Apr  4 00:48:57 2006
+++ pspp/src/math/linreg/coefficient.h  Wed Apr  5 19:18:51 2006
@@ -23,8 +23,10 @@
 #ifndef COEFFICIENT_H
 #define COEFFICIENT_H
 
-
+#include <assert.h>
 #include <math/linreg/linreg.h>
+#include <src/data/variable.h>
+#include <src/data/value.h>
 
 struct design_matrix;
 
@@ -63,42 +65,54 @@
   Accessor functions for matching coefficients and variables.
  */
 
-void pspp_linreg_coeff_free (struct pspp_linreg_coeff *c);
+void pspp_linreg_coeff_free (struct pspp_linreg_coeff *);
 
 /*
   Initialize the variable and value pointers inside the
   coefficient structures for the linear model.
  */
 void
-pspp_linreg_coeff_init (pspp_linreg_cache *c, 
-                       struct design_matrix *X);
+pspp_linreg_coeff_init (pspp_linreg_cache *, 
+                       struct design_matrix *);
 
 
 void
-pspp_linreg_coeff_set_estimate (struct pspp_linreg_coeff *c,
+pspp_linreg_coeff_set_estimate (struct pspp_linreg_coeff *,
                                double estimate);
 
 void
-pspp_linreg_coeff_set_std_err (struct pspp_linreg_coeff *c,
+pspp_linreg_coeff_set_std_err (struct pspp_linreg_coeff *,
                               double std_err);
 /*
+  Return the estimated value of the coefficient.
+ */
+double
+pspp_linreg_coeff_get_est (const struct pspp_linreg_coeff *);
+
+/*
+  Return the standard error of the estimated coefficient.
+*/
+double 
+pspp_linreg_coeff_get_std_err (const struct pspp_linreg_coeff *);
+
+/*
   How many variables are associated with this coefficient?
  */
 int
-pspp_linreg_coeff_get_n_vars (struct pspp_linreg_coeff *c);
+pspp_linreg_coeff_get_n_vars (struct pspp_linreg_coeff *);
 
 /*
   Which variable does this coefficient match?
  */
 const struct variable *
-pspp_linreg_coeff_get_var (struct pspp_linreg_coeff *c, int i);
+pspp_linreg_coeff_get_var (struct pspp_linreg_coeff *, int );
 
 /* 
    Which value is associated with this coefficient/variable comination? 
 */
 const union value *
-pspp_linreg_coeff_get_value (struct pspp_linreg_coeff *c,
-                            const struct variable *v);
+pspp_linreg_coeff_get_value (struct pspp_linreg_coeff *,
+                            const struct variable *);
 
 const struct pspp_linreg_coeff *
 pspp_linreg_get_coeff (const pspp_linreg_cache *,
Index: pspp/src/math/linreg/linreg.h
diff -u pspp/src/math/linreg/linreg.h:1.1 pspp/src/math/linreg/linreg.h:1.2
--- pspp/src/math/linreg/linreg.h:1.1   Sat Mar  4 01:29:08 2006
+++ pspp/src/math/linreg/linreg.h       Wed Apr  5 19:18:51 2006
@@ -28,7 +28,7 @@
 
 struct variable ;
 struct pspp_linreg_coeff;
-
+union value;
 
 enum
 {
@@ -178,5 +178,7 @@
                 const pspp_linreg_opts * opts, 
                 pspp_linreg_cache * cache);
 
-
+double
+pspp_linreg_predict (const struct variable *, const union value *, 
+                    const pspp_linreg_cache *, int);
 #endif




reply via email to

[Prev in Thread] Current Thread [Next in Thread]