# Time series analysis on series with static variables

Here's the scenario:

1. I have many different time series I would like to forecast
2. I've been through the process of making a seasonal ARIMA model for many of the time series just as part of exploration
3. Each of the time series also have a set of static (read: do not change over time, but vary by series) variables associated with them (could be continuous or categorical)
4. I would like to be able to build a system to forecast each time series incorporating the static variable

Oversimplified example: I have the daily sales of kool aid over the past decade and can slice the information into the five different flavors in both a sugar-free and sugar-full varieties. Is there a way to create one model that handles the different combinations above and the seasonal/AR/MA characteristics of each product?

My immediate thoughts:

• Slice the time series to generate a mutually exclusive, collectively exhaustive set of time series and forecast each one using standard methods (seems less than optimal).
• I suppose that if the impact of any static variable is roughly constant regardless of timing then I could just create a multiple regression model using all the data and ignoring date/time, so this question may be more about the interaction of the static variables and the internal components of the time series.

Any ideas? Let me know if there's a name for this and I'm just searching ineffectively.

#### Start simple; then add complexity as needed

Before you get to the construction of complicated multivariate time-series, the first step here would be to build a standard multivariate linear regression and see how this looks. You say that you have a whole bunch of explanatory variables relating to each of the time-series of interest, so start by fitting a regression and see how much of the variation in the responses this explains. The main advantage of this is that you will be able to filter out the effects of the explanatory variables and see what is left. You can apply appropriate transformations to your response variables to get them on an appropriate scale (e.g., taking logarithms of time-series that grow roughly exponentially) and use standard regression methods as a first pass. You can then look at the diagnostic plots for the regression and see if there is evidence of auto-correlation in the residuals, or seasonality, or other things that would warrant moving to the framework of time-series analysis.

Now, perhaps a linear regression will not fit your data well, but you won't know this until you try it and see what ---if any--- deficiencies this type of model has. Common deficiencies you would want to look for are evidence of auto-correlation in residuals, evidence of moving averages in the error terms, etc. If these things are present, you can indeed create larger multivariate time-series models that incorporate AR and MA effects plus explanatory variables. Start simple and then work up to what you need to explain your data well. Once you have tried some simpler models, you can come back here with your results and diagnostic plots and we will be able to give you some advice on how to generalise your model properly.

I have implemented a parent/child approach to problems like this. The "children" ... subsets can be modeled along with the composite. The composite series is used as a predictor for each of the child models. To make a forecast for the child we incorporate the future expectations for the parent. Reconciling the forecasts is then straightforward. The advantage of this approach is the input or causal series can be different for each child and for the parent.

http://autobox.com/dave/regvsbox.pdf (which I authored) discusses issues/differences/opportunities/pitfalls when dealing with time series that your possible regression solutions may be ignoring. You will want to stay very clear of regression approaches which assume independent (i.e. non-time series ) data and other things such as no pulses .. no step/level shifts .. no trends etc.

• Just to clarify--forecast the aggregate amounts and treat that forecast as an exogenous variable for each of the underlying variables? Is this one of the hierarchy methods described by Hyndman ? Do you have any other examples you could share? Dec 7, 2017 at 1:28
• Yes treat it as exogenous with possible contemporaneous and lag effects identified.I don't think that this has been described elsewhere .I could demonstrate this on data of your choice . Dec 7, 2017 at 13:16
• I should also mention/clarify that each child(subset) can have it's own distinct set of possible predictors be they just contemporaneous (static) or dynamic having lag effects. All model are formed with an eye and concern for level shifts and local time trends and seasonal effects. Dec 7, 2017 at 13:27