Prediction error for identified model


err = pe(sys,data,K)
err = pe(sys,data,K,opt)
[err,x0e,sys_pred] = pe(___)


err = pe(sys,data,K) returns the K-step prediction error for the output of the identified model, sys. The prediction error is determined by subtracting the K-step ahead predicted response from the measured output. The prediction error is calculated for the time span covered by data. For more information on the computation of predicted response, see predict.

err = pe(sys,data,K,opt) returns the prediction error using the option set, opt, to specify prediction error calculation behavior.

[err,x0e,sys_pred] = pe(___) also returns the estimated initial state, x0e, and a predictor system, sys_pred.

pe(___) plots the prediction error.

Input Arguments


Identified model.


Measured input-output history.

If sys is a time-series model, which has no input signals, then specify data as an iddata object with no inputs. In this case, you can also specify data as a matrix of the past time-series values.


Prediction horizon.

Specify K as a positive integer that is a multiple of the data sample time. Use K = Inf to compute the pure simulation error.

Default: 1


Prediction options.

opt is an option set, created using peOptions, that configures the computation of the predicted response. Options that you can specify include:

  • Handling of initial conditions

  • Data offsets

Output Arguments


Prediction error.

err is an iddata object.

Outputs up to the time t-K and inputs up to the time instant t are used to calculate the prediction error at the time instant t.

When K = Inf, the predicted output is a pure simulation of the system.

For multi-experiment data, err contains the prediction error data for each experiment. The time span of the prediction error matches that of the observed data.


Estimated initial states.

x0e is returned only for state-space systems.


Predictor system.

sys_pred is a dynamic system. When you simulate sys_pred, using [data.OutputData data.InputData] as the input, the output, yp, is such that err.OutputData = data.OutputData - yp. For state-space models, the software uses x0e as the initial condition when simulating sys_pred.

For discrete-time data, sys_pred is always a discrete-time model.

For multi-experiment data, sys_pred is an array of models, with one entry for each experiment.


collapse all

Compute Prediction Error for an ARIX Model

Compute the prediction error for an ARIX model.

Use the error data to compute the variance of the noise source $e$( $t$).

Obtain noisy data.

noise = [(1:150)';(151:-1:2)'];

load iddata1 z1;
z1.y = z1.y+noise;

noise is a triangular wave that is added to the output signal of z1, an iddata object.

Estimate an ARIX model for the noisy data.

sys = arx(z1,[2 2 1],'IntegrateNoise',true);

Compute the prediction error of the estimated model.

K = 1;
err = pe(z1,sys,K);

pe computes the one-step prediction error for the output of the identified model, sys.

Compute the variance of the noise source, $e$( $t$).

noise_var = err.y'*err.y/(299-nparams(sys)-order(sys));

Compare the computed value with model's noise variance.


The output of sys.NoiseVariance matches the computed variance.

See Also

| | | | | | | | | |

Introduced before R2006a

Was this topic helpful?