I have a quadratic regression model with three statistically significant coefficients: intercept, time, and time^2. The residuals of the model show significant autocorrelation. I understand that you can find an ARMA process for the residuals simply by using the ar or arima function and getting the coefficients [i.e. res.ar=ar(resid(fit),method='mle')]… but how do you refit the regression model with the autocorrelated residuals (for purposes in forecasting)? I'm thinking of terms of auto.arima
Solved – How to fit an ARMA process to residuals in R
autocorrelationautoregressiverregressiontime series
Related Question
- Solved – Ljung-Box Statistics for ARIMA residuals in R: confusing test results
- Solved – How to interpret regression coefficients with autocorrelated residuals
- Solved – Multiple ARIMA models fit data well. How to determine order? Correct approach
- Seasonal Regression Analysis – Differences Between Raw Data and Residuals
- Time-Series Forecasting ARIMA – OLS vs Regression with ARMA Errors: A Comprehensive Comparison
Best Answer
You are correct that it makes sense to estimate the "main part" of the model simultaneously allowing for the error term to have an ARMA structure (as opposed to doing this in two steps, which would be less efficient). Simply add the main regressors (
time
andtime^2
) via the argumentxreg
in the functionarima
orauto.arima
. It will estimate a regression with ARMA errors. You can read more about this and related techniques in an enlightening blog post "The ARIMAX model muddle" by Rob J. Hyndman.