# Boosted AR for time series forecasting?

I have time series data recorded at multiple locations, stored in a matrix $Y$. I have fit a Vector Autoregressive Model to it which forecasts the data pretty well on a test set. However, if I plot the residuals there is definitely some time series structure left; ideally the residuals would look like noise.

I have been learning about boosted trees (package 'gbm' in R) that fits a response vector $Y$ to some input features $X$, pulls the residuals $E = Y - f(X)$, and then fits $E$ to the same input features $X$ again (repeat until the process starts to overfit). It's my belief that a tree won't be able to model time series structure well, so I am wondering if the same process can be done using an AR model as the weak learner.

After fitting my VAR model, I take the residuals and fit an AR process to it, and forecast it using the 'forecast' package in R. I then take my VAR forecasts and add them to my AR forecasts to get a final prediction. The error at some locations decrease, but for most locations the error increases.

Below are the plots of the residuals having only fit the VAR model - there is definitely some structure that can still be explained using some model. Any suggestions?

Update: The time series represent energy consumption at various locations. During the night we expect energy consumption to be very low and flat, during the day there may be high volatility so the variance is definitely not constant. My first step was to remove the daily seasonal component using STL (Seasonal Trend Decomposition Using Loess). After that, I fit my VAR model, and subsequently another AR model to the residuals. The time series after removing the Seasonal Component look like this:

The error terms from the VAR look like

-

Can you show us the original time series?  It looks like there might be an increase in variability and perhaps some other nonstationary effect. But it could be some short term blip due to an intervention also.  It would help to put this into context.  What do these series represent? Is there something that you would expect would happen? – Michael Chernick Jun 10 '12 at 12:16

## 1 Answer

You probably need to include some nonlinear regressors into your AR formulation. Thus instead of regressing the vector $x_{t+1}$ against some $x_{t-i}$ ($i=0,1,...$) only (which gives standard AR), regress against $x_{t-i}$ and $x_{t-i}^2$ ($i=0,1,...$) or even $x_{t-i}x_{t-j}$ ($i\le j$). To get the most useful result you probably need to use subset selection to identify the most useful nonlinear terms. (All operations on vectors pointwise, but you may also consider products of different components.)

-

3
Without further elaboration, this is better placed as a comment. – cardinal Jun 10 '12 at 16:12
@cardinal: I added details – Arnold Neumaier Jun 11 '12 at 8:39
{"extraction_info": {"found_math": true, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 14, "mathjax_display_tex": 0, "mathjax_asciimath": 0, "img_math": 0, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0}, "config": {"markdown_headings": true, "markdown_code": true, "boilerplate_config": {"ratio_threshold": 0.18, "absolute_threshold": 20, "end_threshold": 15, "enable": true}, "remove_buttons": true, "remove_image_figures": true, "remove_link_clusters": true, "table_config": {"min_rows": 2, "min_cols": 3, "format": "plain"}, "remove_chinese": true, "remove_edit_buttons": true, "extract_latex": true}, "english_confidence": 0.9444652795791626, "perplexity_flag": "middle"}