pspp-cvs
[Top][All Lists]
Advanced

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

[Pspp-cvs] pspp/src/math/ts innovations.c innovations.h


From: Jason H Stover
Subject: [Pspp-cvs] pspp/src/math/ts innovations.c innovations.h
Date: Wed, 07 Jun 2006 01:52:48 +0000

CVSROOT:        /cvsroot/pspp
Module name:    pspp
Changes by:     Jason H Stover <jstover>        06/06/07 01:52:48

Modified files:
        src/math/ts    : innovations.c 
Added files:
        src/math/ts    : innovations.h 

Log message:
        fixed mistakes

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/pspp/src/math/ts/innovations.c?cvsroot=pspp&r1=1.1&r2=1.2
http://cvs.savannah.gnu.org/viewcvs/pspp/src/math/ts/innovations.h?cvsroot=pspp&rev=1.1

Patches:
Index: innovations.c
===================================================================
RCS file: /cvsroot/pspp/pspp/src/math/ts/innovations.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -b -r1.1 -r1.2
--- innovations.c       7 Jun 2006 01:12:37 -0000       1.1
+++ innovations.c       7 Jun 2006 01:52:48 -0000       1.2
@@ -38,9 +38,7 @@
 #include <libpspp/compiler.h>
 #include <libpspp/message.h>
 #include <math/coefficient.h>
-#include <math/innovations.h>
-#include <gettext.h>
-#define _(msgid) gettext (msgid)
+#include <math/ts/innovations.h>
 
 static void
 get_mean_variance (size_t n_vars, const struct casefile *cf,
@@ -48,13 +46,10 @@
                   
 {
   struct casereader *r;
-  struct ccase *c;
-  struct ccase *c2;
+  struct ccase c;
   size_t n;
-  double *x;
   double d;
-  double tmp;
-  double variance;
+  const union value *tmp;
 
   for (n = 0; n < n_vars; n++)
     {
@@ -67,10 +62,10 @@
     {
       for (n = 0; n < n_vars; n++)
        {
-         if (!mv_is_value_missing (&v->miss, val))
-           {
              tmp = case_data (&c, est[n]->variable->fv);
-             d = (tmp - est[n]->mean) / est[n]->n_obs;
+         if (!mv_is_value_missing (&(est[n]->variable->miss), tmp))
+           {
+             d = (tmp->f - est[n]->mean) / est[n]->n_obs;
              est[n]->mean += d;
              est[n]->variance += est[n]->n_obs * est[n]->n_obs * d * d;
              est[n]->n_obs += 1.0;
@@ -182,6 +177,7 @@
   struct casereader *r;
   struct ccase *c;
   size_t i;
+  size_t j;
 
   est = xnmalloc (*n_vars, sizeof *est);
   for (i = 0; i < *n_vars; i++)
@@ -202,8 +198,8 @@
       else
        {
          *n_vars--;
-         msg (MW, _("Cannot compute autocovariance for a non-numeric variable 
%s"),
-                    var_to_string (vars[i]));
+/*       msg (MW, _("Cannot compute autocovariance for a non-numeric variable 
%s"), */
+/*                  var_to_string (vars[i])); */
        }
     }
 

Index: innovations.h
===================================================================
RCS file: innovations.h
diff -N innovations.h
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ innovations.h       7 Jun 2006 01:52:48 -0000       1.1
@@ -0,0 +1,43 @@
+/*
+  src/math/time-series/arma/innovations.h
+  
+  Copyright (C) 2006 Free Software Foundation, Inc. Written by Jason H. Stover.
+  
+  This program is free software; you can redistribute it and/or modify it under
+  the terms of the GNU General Public License as published by the Free
+  Software Foundation; either version 2 of the License, or (at your option)
+  any later version.
+  
+  This program is distributed in the hope that it will be useful, but WITHOUT
+  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+  FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
+  more details.
+  
+  You should have received a copy of the GNU General Public License along with
+  this program; if not, write to the Free Software Foundation, Inc., 51
+  Franklin Street, Fifth Floor, Boston, MA 02111-1307, USA.
+ */
+/*
+  Find preliminary ARMA coefficients via the innovations algorithm.
+  Also compute the sample mean and covariance matrix for each series.
+
+  Reference:
+
+  P. J. Brockwell and R. A. Davis. Time Series: Theory and
+  Methods. Second edition. Springer. New York. 1991. ISBN
+  0-387-97429-6. Sections 5.2, 8.3 and 8.4.
+ */
+#ifndef INNOVATIONS_H
+#define INNOVATIONS_H
+#include <math/coefficient.h>
+struct innovations_estimate
+{
+  struct variable *variable;
+  double mean;
+  double variance;
+  double *cov;
+  double n_obs;
+  double max_lag;
+  coefficient *coeff;
+};
+#endif




reply via email to

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