Documentation Center

  • Trial Software
  • Product Updates

infer

Class: regARIMA

Infer innovations of regression models with ARIMA errors

Syntax

E = infer(Mdl,Y)
[E,U,V,logL] = infer(Mdl,Y)
[E,U,V,logL] = infer(Mdl,Y,Name,Value)

Description

E = infer(Mdl,Y) infers residuals of a univariate regression model with ARIMA time series errors fit to response data Y.

[E,U,V,logL] = infer(Mdl,Y) additionally returns the unconditional disturbances U, the innovation variances V, and the loglikelihood objective function values logL.

[E,U,V,logL] = infer(Mdl,Y,Name,Value) returns the output arguments using additional options specified by one or more Name,Value pair arguments.

Input Arguments

Mdl

Regression model with ARIMA errors, as created by regARIMA or estimate.

The parameters of Mdl cannot contain NaNs.

Y

Response data, specified as a column vector or numObs-by-numPaths matrix. infer infers the innovations and unconditional disturbances of Y. Y represents the time series characterized by Mdl, and is the continuation of the presample series Y0.

  • If Y is a column vector, then it represents one path of the underlying series.

  • If Y is a matrix, then it represents numObs observations of numPaths paths of an underlying time series.

infer assumes that observations across any row occur simultaneously. The last observation of any series is the latest.

Name-Value Pair Arguments

Specify optional comma-separated 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.

'E0'

Presample innovations that have mean 0 and provide initial values for the ARIMA error model, specified as the comma-separated pair consisting of 'E0' and a column vector or matrix.

  • If E0 is a column vector, then it is applied to each inferred path.

  • If E0 is a matrix, then it requires at least numPaths columns. If E0 contains more columns than required, then infer uses the first numPaths columns.

  • E0 must contain at least Mdl.Q rows. If E0 contains more rows than required, then infer uses the latest presample innovations. The last row contains the latest presample innovation.

Default: infer sets the necessary observations to 0.

'U0'

Presample unconditional disturbances that provide initial values for the ARIMA error model, specified as the comma-separated pair consisting of 'U0' and a column vector or matrix.

  • If U0 is a column vector, then it is applied to each inferred path.

  • If U0 is a matrix, then it requires at least numPaths columns. If U0 contains more columns than required, then infer uses the first numPaths columns.

  • U0 must contain at least Mdl.P rows. If U0 contains more rows than required, then infer uses the latest presample unconditional disturbances. The last row contains the latest presample unconditional disturbance.

Default: infer backcasts for the necessary presample unconditional disturbances.

'X'

Predictor data in the regression model, specified as the comma-separated 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 should be at least the length of Y. If the number of rows of X exceeds the number required, then infer uses the latest observations.

Default: infer does not include a regression component in the model regardless of the presence of regression coefficients in Mdl.

    Notes  

    • NaNs in Y, X, E0, and U0 indicate missing values and infer removes them. The software merges the presample data sets (E0 and U0), then uses list-wise deletion to remove any NaNs. infer similarly removes NaNs from the effective sample data (X and Y). Removing NaNs in the data reduces the sample size, and can also create irregular time series.

    • infer assumes that you synchronize presample data such that the latest observation of each presample series occurs simultaneously.

    • All predictors (i.e., columns in X) are associated with each response path in Y.

    • V is equal to the variance in Mdl.

Output Arguments

E

Inferred residuals (estimated innovations of the unconditional disturbances), returned as a numObs-by-numPaths matrix.

U

Inferred unconditional disturbances, returned as a numObs-by-numPaths matrix.

V

Inferred variances, returned as a numObs-by-numPaths matrix.

logL

Loglikelihood objective function values associated with the model specification, returned as a numPaths-element vector. Each element of logL is associated with the corresponding path of Y.

Examples

expand all

Infer Residuals from a Regression Model with ARIMA Errors

Forecast responses from the following regression model with ARMA(2,1) errors over a 30-period horizon:

where εt is Gaussian with variance 0.1.

Specify the regression model with ARIMA errors. Simulate responses from the model and two predictor series.

Mdl = regARIMA('Intercept', 0, 'AR', {0.5 -0.8}, ...
    'MA',-0.5,'Beta',[0.1 -0.2], 'Variance',0.1);
rng(1);
X =  randn(100,2);
y = simulate(Mdl,100,'X',X);

Infer, and then plot residuals. By default, infer backcasts for the necessary presample unconditional disturbances.

E = infer(Mdl,y,'X',X);

figure
plot(E)
title('Inferred Residuals')

Regress the GDP onto the CPI and Examine Residuals

Regress the log GDP onto the CPI using a regression model with ARMA(1,1) errors, and then examine the residuals.

Load the U.S. Macroeconomic data set and preprocess the data.

load Data_USEconModel;
logGDP = log(Dataset.GDP);
dlogGDP = diff(logGDP);        % For stationarity
dCPI = diff(Dataset.CPIAUCSL); % For stationarity
T = length(dlogGDP); % Effective sample size

Fit a regression model with ARMA(1,1) errors.

ToEstMdl = regARIMA(1,0,1);
EstMdl = estimate(ToEstMdl,dlogGDP,'X',dCPI);

Infer the residuals over all observations. By default, infer backcasts for the necessary unconditional disturbances.

E = infer(EstMdl,dlogGDP,'X',dCPI);

Plot the inferred residuals.

figure
plot(E)
title('{\bf Inferred Residuals}')

The residuals are centered around 0, but show signs of heteroscedasticity.

References

[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.

See Also

| | |

More About

Was this topic helpful?