From: Jason Stover Date: Wed, 21 Jun 2006 09:20:52 +0000 (+0000) Subject: save coefficients in innovations estimate structure X-Git-Tag: v0.6.0~811 X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b021d5d4e83d3ac52ae1eb0490a75a561b0d7228;p=pspp-builds.git save coefficients in innovations estimate structure --- diff --git a/src/math/ts/ChangeLog b/src/math/ts/ChangeLog index e5b715fc..e2880996 100644 --- a/src/math/ts/ChangeLog +++ b/src/math/ts/ChangeLog @@ -1,6 +1,8 @@ 2006-06-21 Jason Stover * innovations.c (innovations_update_scale): New function. + * innovations.c (get_coef): Save computed coefficients in est->coeff. + * innovations.c (get_coef): Initialize and free the innovations coefficients. Call innovations_update_scale (). diff --git a/src/math/ts/innovations.c b/src/math/ts/innovations.c index 792bc6c8..a1a544a1 100644 --- a/src/math/ts/innovations.c +++ b/src/math/ts/innovations.c @@ -239,6 +239,30 @@ get_coef (size_t n_vars, const struct casefile *cf, } innovations_update_scale (est[n], theta[i], i); } + /* Copy the final row of coefficients into EST->COEFF.*/ + for (i = 0; i < max_lag; i++) + { + /* + The order of storage here means that the best predicted value + for the time series is computed as follows: + + Let X[m], X[m-1],... denote the original series. + Let X_hat[0] denote the best predicted value of X[0], + X_hat[1] denote the projection of X[1] onto the subspace + spanned by {X[0] - X_hat[0]}. Let X_hat[m] denote the + projection of X[m] onto the subspace spanned by {X[m-1] - X_hat[m-1], + X[m-2] - X_hat[m-2],...,X[0] - X_hat[0]}. + + Then X_hat[m] = est->coeff[m-1] * (X[m-1] - X_hat[m-1]) + + est->coeff[m-1] * (X[m-2] - X_hat[m-2]) + ... + + est->coeff[m-max_lag] * (X[m - max_lag] - X_hat[m - max_lag]) + + (That is what X_hat[m] SHOULD be, anyway. These routines need + to be tested.) + */ + pspp_coeff_set_estimate (est[n]->coeff[i], theta[max_lag - 1][i]); + } } for (i = 0; i < max_lag; i++) {