pspp-cvs
[Top][All Lists]
Advanced

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

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


From: Jason H Stover
Subject: [Pspp-cvs] pspp/src/math/ts ChangeLog innovations.c
Date: Sun, 16 Jul 2006 12:19:24 +0000

CVSROOT:        /sources/pspp
Module name:    pspp
Changes by:     Jason H Stover <jstover>        06/07/16 12:19:24

Modified files:
        src/math/ts    : ChangeLog innovations.c 

Log message:
        fixed and tested computation of coefficients

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/pspp/src/math/ts/ChangeLog?cvsroot=pspp&r1=1.14&r2=1.15
http://cvs.savannah.gnu.org/viewcvs/pspp/src/math/ts/innovations.c?cvsroot=pspp&r1=1.14&r2=1.15

Patches:
Index: ChangeLog
===================================================================
RCS file: /sources/pspp/pspp/src/math/ts/ChangeLog,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -b -r1.14 -r1.15
--- ChangeLog   15 Jul 2006 20:24:17 -0000      1.14
+++ ChangeLog   16 Jul 2006 12:19:23 -0000      1.15
@@ -1,3 +1,8 @@
+2006-07-16  Jason Stover  <address@hidden>
+
+       * innovations.c (get_coef): Fixed diagonal elements and call to
+       innovations_convolve().
+
 2006-07-15  Jason Stover  <address@hidden>
 
        * innovations.c (get_covariance): Fixed computation of

Index: innovations.c
===================================================================
RCS file: /sources/pspp/pspp/src/math/ts/innovations.c,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -b -r1.14 -r1.15
--- innovations.c       15 Jul 2006 20:24:17 -0000      1.14
+++ innovations.c       16 Jul 2006 12:19:23 -0000      1.15
@@ -114,7 +114,7 @@
    */
   for (i = 0; i < data->size1; i++)
     {
-      for (lag = 0; lag < max_lag && lag < data->size1 - i; lag++)
+      for (lag = 0; lag <= max_lag && lag < data->size1 - i; lag++)
        {
          update_cov (est, gsl_matrix_const_row (data, i), 
                      gsl_matrix_const_row (data, i + lag), lag);
@@ -132,15 +132,19 @@
 }
 
 static double
-innovations_convolve (double **theta, struct innovations_estimate *est,
-                     int i, int j)
+innovations_convolve (double *x, double *y, struct innovations_estimate *est,
+                     int i)
 {
   int k;
   double result = 0.0;
 
-  for (k = 0; k < j; k++)
+  assert (x != NULL && y != NULL);
+  assert (est != NULL);
+  assert (est->scale != NULL);
+  assert (i > 0);
+  for (k = 0; k < i; k++)
     {
-      result += theta[i-1][i-k-1] * theta[j][j-k-1] * est->scale[k];
+      result += x[k] * y[k] * est->scale[i-k-1];
     }
   return result;
 }
@@ -187,12 +191,13 @@
 
   for (i = 0; i < max_lag; i++)
     {
-      for (j = 0; j <= i; j++)
+      theta[i][i] = est->cov[i+1] / est->scale[0];
+      for (j = 1; j <= i; j++)
        {
          k = i - j;
-         theta[i][k] = (est->cov[k] - 
-           innovations_convolve (theta, est, i, j))
-           / est->scale[k];
+         theta[i][k] = (est->cov[k+1] - 
+                        innovations_convolve (theta[i] + k + 1, theta[j - 1], 
est, j))
+           / est->scale[j];
        }
       innovations_update_scale (est, theta[i], i + 1);
     }  




reply via email to

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