Main Content


AR model estimation using instrumental variable method



sys = ivar(data,na) estimates an AR polynomial model, sys, using the instrumental variable method and the time series data data. na specifies the order of the A polynomial.

An AR model is represented by the equation:


In the above model, e(t) is an arbitrary process, assumed to be a moving average process of order nc, and possibly time varying. The function assumes that nc is equal to na. Instruments are chosen as appropriately filtered outputs, delayed nc steps.

sys = ivar(data,na,nc) specifies the value of the moving average process order nc independently.

sys = ivar(data,na,nc,max_size) specifies the maximum size of matrices formed during estimation.


collapse all

Construct output data by combining sinusoidal signals and noise.

y = iddata(sin([1:500]'*1.2) + sin([1:500]'*1.5) + 0.2*randn(500,1),[]);

Estimate fourth-order models using the IV method (ivar) and the forward-backward least-squares method (ar).

sysiv = ivar(y,4);
sysls = ar(y,4);

Compare the spectra of the two models.


The model estimated with ivar exhibits the two distinct spectral peaks. The model estimated with ar exhibits only one peak.

Input Arguments

collapse all

Time-series data, specified as an iddata object that contains a single output channel and an empty input channel.

Order of the A polynomial, specified as a positive integer.

Order of the moving average process that represents e(t), specified as a positive integer.

Maximum matrix size for any matrix formed by the algorithm for estimation, specified as a positive integer. Specify max_size as a reasonably large value.

Output Arguments

collapse all

Identified polynomial model, returned as a discrete-time idpoly model object.

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

Report FieldDescription

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


Estimation command used


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.

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


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 these fields.

  • 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)


Estimated values of model parameters


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

  • 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' — A zero-order hold maintains a piecewise-constant input signal between samples.

    • 'foh' — A 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.


[1] Stoica, P., T. Soderstrom, and B. Friedlander. Optimal Instrumental Variable Estimates of the AR Parameters of an ARMA Process. IEEE Transactions on Automatic Control 30, no. 11 (November 1985): 1066–74,

Version History

Introduced before R2006a