## Compute Model Uncertainty

### Why Analyze Model Uncertainty?

In addition to estimating model parameters, the toolbox algorithms also estimate variability of the model parameters that result from random disturbances in the output.

Understanding model variability helps you to understand how different your model parameters would be if you repeated the estimation using a different data set (with the same input sequence as the original data set) and the same model structure.

When validating your parametric models, check the uncertainty values. Large uncertainties in the parameters might be caused by high model orders, inadequate excitation, and poor signal-to-noise ratio in the data.

### What Is Model Covariance?

Uncertainty in the model is called *model covariance*.

When you estimate a model, the covariance matrix of the estimated parameters is stored with
the model. Use `getcov`

to fetch the covariance matrix. Use
`getpvec`

to fetch the list of parameters and their individual uncertainties that
have been computed using the covariance matrix. The covariance matrix is used to compute all
uncertainties in model output, Bode plots, residual plots, and pole-zero plots.

Computing the covariance matrix is based on the assumption that the model structure gives
the correct description of the system dynamics. For models that include a disturbance model
*H*, a correct uncertainty estimate assumes that the model produces white
residuals. To determine whether you can trust the estimated model uncertainty values, perform
residual analysis tests on your model. For more details about residual analysis, see the topics
on the Residual Analysis page. If your model
passes residual analysis tests, there is a good chance that the true system lies within the
confidence interval and any parameter uncertainties results from random disturbances in the
output.

For output-error models, such as transfer function models, state-space with K=0 and
polynomial models of output-error form, with the noise model *H* fixed to
`1`

, the covariance matrix computation does not assume white residuals.
Instead, the covariance is estimated based on the estimated color of the residual correlations.
This estimation of the noise color is also performed for state-space models with
*K*=`0`

, which is equivalent to an output-error model.

### Types of Model Uncertainty Information

You can view the following uncertainty information from linear and nonlinear grey-box models:

Uncertainties of estimated parameters.

Type

`present(model)`

at the prompt, where`model`

represents the name of a linear or nonlinear model.Confidence intervals on the linear model plots, including step-response, impulse-response, Bode, Nyquist, noise spectrum and pole-zero plots.

Confidence intervals are computed based on the variability in the model parameters. For information about displaying confidence intervals, see Definition of Confidence Interval for Specific Model Plots.

Covariance matrix of the estimated parameters in linear models and nonlinear grey-box models using

`getcov`

.Estimated standard deviations of polynomial coefficients, poles/zeros, or state-space matrices using

`idssdata`

,`tfdata`

,`zpkdata`

, and`polydata`

.Simulated output values for linear models with standard deviations using

`sim`

.Call the

`sim`

command with output arguments, where the second output argument is the estimated standard deviation of each output value. For example, type`[ysim,ysimsd] = sim(model,data)`

, where`ysim`

is the simulated output,`ysimsd`

contains the standard deviations on the simulated output, and`data`

is the simulation data.Perform Monte-Carlo analysis using

`rsample`

to generate a random sampling of an identified model in a given confidence region. An array of identified systems of the same structure as the input system is returned. The parameters of the returned models are perturbed about their nominal values in a way that is consistent with the parameter covariance.Simulate the effect of parameter uncertainties on a model's response using

`simsd`

.

### Definition of Confidence Interval for Specific Model Plots

You can display the confidence interval on the following plot types:

Plot Type | Confidence Interval Corresponds to the Range of ... | More Information on Displaying Confidence Interval |
---|---|---|

Simulated and Predicted Output | Output values with a specific probability of being the actual output of the system. | Model Output Plots |

Residuals | Residual values with a specific probability of being statistically insignificant for the system. | Residuals Plots |

Impulse and Step | Response values with a specific probability of being the actual response of the system. | Impulse and Step Plots |

Frequency Response | Response values with a specific probability of being the actual response of the system. | Frequency Response Plots |

Noise Spectrum | Power-spectrum values with a specific probability of being the actual noise spectrum of the system. | Noise Spectrum Plots |

Poles and Zeros | Pole or zero values with a specific probability of being the actual pole or zero of the system. | Pole-Zero Plots |