Predict the output k-step ahead.
Syntax
p = predict(z,th)
[yp,thpred] = predict(z,th,k)
Description
z is the output-input data in the usual format
z = [y u]
where y is a matrix whose r-th column is the r-th output signal and correspondingly for the input u.
The argument k indicates that the k-step ahead prediction of y according to the model th (in the theta format) is computed. In the calculation of yp(t) the model can use outputs up to time

:
,
and inputs up to the current time t. The default value of k is 1.
The output yp is a matrix of the same size as y, and its i,j element contains the predicted value of the corresponding element in y. The output argument thpred contains the k-step ahead predictor in the theta format, in the case that th corresponds to an input-output model. (The predictor is a system with
inputs and
outputs,
being the number of outputs and
the number of inputs to th.)
An important use of predict is to evaluate a model's properties in the mid-frequency range. Simulation with idsim (which conceptually corresponds to k = inf) can lead to levels that drift apart, since the low frequency behavior is emphasized. One step ahead prediction is not a powerful test of the model's properties, since the high frequency behavior is stressed. The trivial predictor
can give good predictions in case the sampling of the data is fast.
Another important use of predict is to evaluate models of time series. The natural way of studying a time series model's ability to reproduce observations is to compare its k-step ahead predictions with actual data.
Note that for output-error models, there is no difference between the k-step ahead predictions and the simulated output, since, by definition, output-error models only use past inputs to predict future outputs.
Algorithm
For a model th that is an input-output model, the formula (3.31) in Ljung (1987) is applied to compute the predictor. For state-space models, the state equations are simulated k-steps ahead with initial value
, where
is the Kalman filter state estimate.
Examples
Simulate a time series, estimate a model based on the first half of the data, and evaluate the four step ahead predictions on the second half:
th0 = poly2th([1 -0.99],[],[1 -1 0.2]);
y = idsim(randn(400,1),th0);
th = armax(y(1:200),[1 2]);
yp = predict(y,th,4);
plot([y(201:400),yp(201:400)])
Note that the last two commands also are achieved by
compare(y,th,4,201:400);
See Also
compare, idsim, pe
[ Previous | Help Desk | Next ]