[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Pspp-cvs] pspp/src/math/ts innovations.c ChangeLog
From: |
Jason H Stover |
Subject: |
[Pspp-cvs] pspp/src/math/ts innovations.c ChangeLog |
Date: |
Fri, 16 Jun 2006 09:18:34 +0000 |
CVSROOT: /cvsroot/pspp
Module name: pspp
Changes by: Jason H Stover <jstover> 06/06/16 09:18:34
Modified files:
src/math/ts : innovations.c ChangeLog
Log message:
added initial innovations functions
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/pspp/src/math/ts/innovations.c?cvsroot=pspp&r1=1.3&r2=1.4
http://cvs.savannah.gnu.org/viewcvs/pspp/src/math/ts/ChangeLog?cvsroot=pspp&r1=1.2&r2=1.3
Patches:
Index: innovations.c
===================================================================
RCS file: /cvsroot/pspp/pspp/src/math/ts/innovations.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -b -r1.3 -r1.4
--- innovations.c 7 Jun 2006 22:32:30 -0000 1.3
+++ innovations.c 16 Jun 2006 09:18:34 -0000 1.4
@@ -1,5 +1,5 @@
/*
- src/math/time-series/arma/innovations.c
+ src/math/ts/innovations.c
Copyright (C) 2006 Free Software Foundation, Inc. Written by Jason H. Stover.
@@ -170,9 +170,50 @@
}
free (c);
}
+static double
+innovations_convolve (double **theta, struct innovations_estimate *est,
+ int i, int j)
+{
+ int k;
+ double result = 0.0;
-struct innovations_estimate ** pspp_innovations (const struct variable **vars,
size_t *n_vars,
- size_t lag, const struct
casefile *cf)
+ for (k = 0; k < i; k++)
+ {
+ result += theta[i][i-k] * theta[j][i-j] * est->cov[k];
+ }
+ return result;
+}
+static void
+get_coef (size_t n_vars, const struct casefile *cf,
+ struct innovations_estimate **est, size_t max_lag)
+{
+ int j;
+ int i;
+ int k;
+ size_t n;
+ double v;
+ double **theta;
+
+ for (n = 0; n < n_vars; n++)
+ {
+ for (i = 0; i < max_lag; i++)
+ {
+ v = est[n]->cov[i];
+ for (j = 0; j < i; j++)
+ {
+ k = i - j;
+ theta[i][k] = est[n]->cov[k] -
+ innovations_convolve (theta, est, i, j);
+ }
+ }
+ }
+}
+
+struct innovations_estimate **
+pspp_innovations (const struct variable **vars,
+ size_t *n_vars,
+ size_t lag,
+ const struct casefile *cf)
{
struct innovations_estimate **est;
size_t i;
@@ -202,11 +243,9 @@
}
}
- /*
- First data pass to get the mean and variance.
- */
get_mean_variance (*n_vars, cf, est);
get_covariance (*n_vars, cf, est, lag);
+ get_coef (*n_vars, cf, est, lag);
return est;
}
Index: ChangeLog
===================================================================
RCS file: /cvsroot/pspp/pspp/src/math/ts/ChangeLog,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -b -r1.2 -r1.3
--- ChangeLog 7 Jun 2006 01:20:04 -0000 1.2
+++ ChangeLog 16 Jun 2006 09:18:34 -0000 1.3
@@ -1,3 +1,8 @@
+2006-06-16 Jason Stover <address@hidden>
+
+ * innovations.c (innovations_convolve): New function.
+ * innovations.c (get_coef): New function.
+
2006-06-04 Jason Stover <address@hidden>
* innovations.c (get_covariance): Initial version
- [Pspp-cvs] pspp/src/math/ts innovations.c ChangeLog,
Jason H Stover <=