# fpe

Akaike’s Final Prediction Error for estimated model

## Syntax

``value = fpe(model)``
``value = fpe(model1,...,modeln)``

## Description

example

````value = fpe(model)` returns the Final Prediction Error (FPE) value for the estimated model.```
````value = fpe(model1,...,modeln)` returns the FPE value for multiple estimated models.```

## Examples

collapse all

Estimate a transfer function model.

```load iddata1 z1; np = 2; sys = tfest(z1,np);```

Compute the Final Prediction Error (FPE) value.

`value = fpe(sys)`
```value = 1.7252 ```

Alternatively, use the `Report` property of the model to access the value.

`sys.Report.Fit.FPE`
```ans = 1.7252 ```

Estimate multiple Output-Error (OE) models and use Akaike's Final Prediction Error (FPE) value to pick the one with optimal tradeoff between accuracy and complexity.

`load iddata2`

Specify model orders varying in 1:4 range.

```nf = 1:4; nb = 1:4; nk = 0:4;```

Estimate OE models with all possible combinations of chosen order ranges.

```NN = struc(nf,nb,nk); models = cell(size(NN,1),1); for ct = 1:size(NN,1) models{ct} = oe(z2, NN(ct,:)); end```

Compute the small sample-size corrected AIC values for the models, and return the smallest value.

```V = fpe(models{:}); [Vmin, I] = min(V);```

Return the optimal model that has the smallest AICc value.

`models{I}`
```ans = Discrete-time OE model: y(t) = [B(z)/F(z)]u(t) + e(t) B(z) = 1.067 z^-2 F(z) = 1 - 1.824 z^-1 + 1.195 z^-2 - 0.2307 z^-3 Sample time: 0.1 seconds Parameterization: Polynomial orders: nb=1 nf=3 nk=2 Number of free coefficients: 4 Use "polydata", "getpvec", "getcov" for parameters and their uncertainties. Status: Estimated using OE on time domain data "z2". Fit to estimation data: 86.53% FPE: 0.9809, MSE: 0.9615 ```

## Input Arguments

collapse all

Identified model, specified as one of the following model objects:

## Output Arguments

collapse all

Final Prediction Error (FPE) value, returned as a scalar or vector. For multiple models, `value` is a row vector where `value(k)` corresponds to the `k`th estimated model `modelk`.

collapse all

### Akaike's Final Prediction Error (FPE)

Akaike's Final Prediction Error (FPE) criterion provides a measure of model quality by simulating the situation where the model is tested on a different data set. After computing several different models, you can compare them using this criterion. According to Akaike's theory, the most accurate model has the smallest FPE.

If you use the same data set for both model estimation and validation, the fit always improves as you increase the model order and, therefore, the flexibility of the model structure.

Akaike's Final Prediction Error (FPE) is defined by the following equation:

`$FPE=\mathrm{det}\left(\frac{1}{N}\sum _{1}^{N}e\left(t,{\stackrel{^}{\theta }}_{N}\right){\left(e\left(t,{\stackrel{^}{\theta }}_{N}\right)\right)}^{T}\right)\left(\frac{1+d}{N}}{1-d}{N}}\right)$`

where:

• N is the number of values in the estimation data set.

• e(t) is a ny-by-1 vector of prediction errors.

• ${\theta }_{N}$ represents the estimated parameters.

• d is the number of estimated parameters.

If number of parameters exceeds the number of samples, FPE is not computed when model estimation is performed (`model.Report.FPE` is empty). The `fpe` command returns `NaN`.

## Tips

• The software computes and stores the FPE value during model estimation. If you want to access this value, see the `Report.Fit.FPE` property of the model.

## References

[1] Ljung, L. System Identification: Theory for the User, Upper Saddle River, NJ, Prentice-Hall PTR, 1999. See sections 7.4 and 16.4.