X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?p=pspp-builds.git;a=blobdiff_plain;f=src%2Fmath%2Fts%2Finnovations.c;h=a1a544a1a1a5717102dc3186389a1fe16691b3c1;hp=792bc6c8659a7d84aef55a284070e7a2b986c4e9;hb=b021d5d4e83d3ac52ae1eb0490a75a561b0d7228;hpb=d87ef24cc012a5eb67bb98fad972d29f36f18f48 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++) {