# ivx

ARX model estimation using instrumental variable method with arbitrary instruments

## Syntax

```sys = ivx(data,[na nb nk],x) sys = ivx(data,[na nb nk],x,max_size) ```

## Description

```sys = ivx(data,[na nb nk],x)``` estimates an ARX polynomial model, `sys`, using the instrumental variable method with arbitrary instruments. The model is estimated for the time series data `data`. ```[na nb nk]``` specifies the ARX structure orders of the A and B polynomials and the input to output delay, expressed in the number of samples.

An ARX model is represented as:

`$A\left(q\right)y\left(t\right)=B\left(q\right)u\left(t-nk\right)+v\left(t\right)$`

```sys = ivx(data,[na nb nk],x,max_size)``` specifies the maximum size of matrices formed during estimation.

## Input Arguments

 `data` Estimation data. The data can be: Time- or frequency-domain input-output dataTime-series dataFrequency-response data `data` must be an `iddata`, `idfrd`, or `frd` (Control System Toolbox) object. When using frequency-domain data, the number of outputs must be 1. `[na nb nk]` ARX model orders. For more details on the ARX model structure, see `arx`. `x` Instrument variable matrix. `x` is a matrix containing the arbitrary instruments for use in the instrumental variable method. `x` must be of the same size as the output data, `data.y`. For multi-experiment data, specify `x` as a cell array with one entry for each experiment. The instruments used are analogous to the regression vector, with `y` replaced by `x`. `max_size` Maximum matrix size. `max_size` specifies the maximum size of any matrix formed by the algorithm for estimation. Specify `max_size` as a reasonably large positive integer. Default: 250000

## Output Arguments

`sys`

ARX model that fits the estimation data, returned as a discrete-time `idpoly` object. This model is created using the specified model orders, delays, and estimation options. `ivx` does not return any estimated covariance information for `sys`.

Information about the estimation results and options used is stored in the `Report` property of the model. `Report` has the following fields:

Report FieldDescription
`Status`

Summary of the model status, which indicates whether the model was created by construction or obtained by estimation.

`Method`

Estimation command used.

`InitialCondition`

Handling of initial conditions during model estimation, returned as one of the following values:

• `'zero'` — The initial conditions were set to zero.

• `'estimate'` — The initial conditions were treated as independent estimation parameters.

• `'backcast'` — The initial conditions were estimated using the best least squares fit.

This field is especially useful to view how the initial conditions were handled when the `InitialCondition` option in the estimation option set is `'auto'`.

`Fit`

Quantitative assessment of the estimation, returned as a structure. See Loss Function and Model Quality Metrics for more information on these quality metrics. The structure has the following fields:

FieldDescription
`FitPercent`

Normalized root mean squared error (NRMSE) measure of how well the response of the model fits the estimation data, expressed as the percentage fitpercent = 100(1-NRMSE).

`LossFcn`

Value of the loss function when the estimation completes.

`MSE`

Mean squared error (MSE) measure of how well the response of the model fits the estimation data.

`FPE`

Final prediction error for the model.

`AIC`

Raw Akaike Information Criteria (AIC) measure of model quality.

`AICc`

Small-sample-size corrected AIC.

`nAIC`

Normalized AIC.

`BIC`

Bayesian Information Criteria (BIC).

`Parameters`

Estimated values of model parameters.

`OptionsUsed`

Option set used for estimation. If no custom options were configured, this is a set of default options. See `arxOptions` for more information.

`RandState`

State of the random number stream at the start of estimation. Empty, `[]`, if randomization was not used during estimation. For more information, see `rng`.

`DataUsed`

Attributes of the data used for estimation, returned as a structure with the following fields.

FieldDescription
`Name`

Name of the data set.

`Type`

Data type.

`Length`

Number of data samples.

`Ts`

Sample time.

`InterSample`

Input intersample behavior, returned as one of the following values:

• `'zoh'` — Zero-order hold maintains a piecewise-constant input signal between samples.

• `'foh'` — First-order hold maintains a piecewise-linear input signal between samples.

• `'bl'` — Band-limited behavior specifies that the continuous-time input signal has zero power above the Nyquist frequency.

`InputOffset`

Offset removed from time-domain input data during estimation. For nonlinear models, it is `[]`.

`OutputOffset`

Offset removed from time-domain output data during estimation. For nonlinear models, it is `[]`.

For more information on using `Report`, see Estimation Report.

## Tips

• Use `iv4` first for IV estimation to identify ARX polynomial models where the instruments `x` are chosen automatically. Use `ivx` for nonstandard situations. For example, when there is feedback present in the data, or, when other instruments need to be tried. You can also use `iv` to automatically generate instruments from certain custom defined filters.

## References

[1] Ljung, L. System Identification: Theory for the User, page 222, Upper Saddle River, NJ, Prentice-Hall PTR, 1999.