Documentation 
[Y,E,U]
= filter(Mdl,Z)
[Y,E,U]
= filter(Mdl,Z,Name,Value)
[Y,E,U] = filter(Mdl,Z) filters errors to produce responses, innovations, and unconditional disturbances of a univariate regression model with ARIMA time series errors.
[Y,E,U] = filter(Mdl,Z,Name,Value) filters errors using additional options specified by one or more Name,Value pair arguments.
Mdl 
Regression model with ARIMA errors, specified as a model returned by regARIMA or estimate. The parameters of Mdl cannot contain NaNs. 
Z 
Errors that drive the innovation process, specified as a numObsbynumPaths matrix. That is, ε_{t} = σz_{t} is the innovations process, where σ is the innovation standard deviation and z_{t} are the errors for t = 1,...,T. As a column vector, Z represents a path of the underlying error series. As a matrix, Z represents numObs observations of numPaths paths of the underlying errors. filter assumes that observations across any row occur simultaneously. The last row contains the latest observation. Z is a continuation of the presample errors, Z0. 
Specify optional commaseparated pairs of Name,Value arguments. Name is the argument name and Value is the corresponding value. Name must appear inside single quotes (' '). You can specify several name and value pair arguments in any order as Name1,Value1,...,NameN,ValueN.
'U0' 
Presample unconditional disturbances that provide initial values for the ARIMA error model, specified as the commaseparated pair consisting of 'U0' and a column vector or matrix.
Default: filter sets the necessary presample unconditional disturbances to 0. 
'X' 
Predictor data in the regression model, specified as the commaseparated pair consisting of 'X' and a matrix. The columns of X are separate, synchronized time series, with the last row containing the latest observations. The number of rows of X must be at least numObs. If the number of rows of X exceeds the number necessary, then filter uses the latest observations. Default: filter does not include a regression component in the model regardless of the presence of regression coefficients in Mdl. 
'Z0' 
Presample errors providing initial values for the input error series, Z, specified as the commaseparated pair consisting of 'Z0' and a vector or matrix.
Default: filter sets the necessary presample errors to 0. 
Notes

[1] Box, G. E. P., G. M. Jenkins, and G. C. Reinsel. Time Series Analysis: Forecasting and Control. 3rd ed. Englewood Cliffs, NJ: Prentice Hall, 1994.
[2] Davidson, R., and J. G. MacKinnon. Econometric Theory and Methods. Oxford, UK: Oxford University Press, 2004.
[3] Enders, W. Applied Econometric Time Series. Hoboken, NJ: John Wiley & Sons, Inc., 1995.
[4] Hamilton, J. D. Time Series Analysis. Princeton, NJ: Princeton University Press, 1994.
[5] Pankratz, A. Forecasting with Dynamic Regression Models. John Wiley & Sons, Inc., 1991.
[6] Tsay, R. S. Analysis of Financial Time Series. 2nd ed. Hoboken, NJ: John Wiley & Sons, Inc., 2005.
filter generalizes simulate. Both filter a series of errors to produce responses (Y), innovations (E), and unconditional disturbances (U). However, simulate autogenerates a series of mean zero, unit variance, independent and identically distributed (iid) errors according to the distribution in Mdl. In contrast, filter requires that you specify your own errors, which can come from any distribution.