# Walkthrough of building a time series model (on real examples)

I'm trying to find some real examples showing someone going through the full process of building a time series model (how they deal with trends and seasonalities, what features they picked, etc). Does anyone know some good ones online? (these could be either in the form of a paper, or just some example online)

I've learned a little about time series analysis a couple years ago, but I want a refresher. I've skimmed through the time series books I have, but all of their examples are limited to the particular technique that the current chapter teaches -- none shows a full analysis, like someone might do in the real world.

Reason I ask: I have something like (say) a dataset of daily ice cream sales. I want to see some examples to refresh my mind on how I would:

1. Build a predictive model of future ice cream sales.
2. Measure the effect of temperature on ice cream sales. (let's say I have another dataset of daily temperature)

In terms of practical down-to-earth examples , I might suggest reviewing some of my 583 replies to time-series model building questions. It is the only subject that I know and feel competent to comment on and thus is the only area that I do so. @gung nicely pointed to one of them in his response. Most are real data case studies where the data is delivered by the OP and procedural issues are raised.

In terms of theory/overview I can recommend a presentation that I made 8 years ago to the International Society of Forecasters ( http://www.autobox.com/stack/dpr-isf27.ppt ) . In particular on slide 41 I presented an analysis of monthly ice cream sales from Norway. As shown it is a univariate (non-causal) model whereas when temperature is incorporated (not shown) the "seasonality" vanishes as temperature is the driver and then needs to be forecasted in order to forecast ice cream sales.

• "It is the only subject that I know..." Biggest understatement by one of the most important human resources on Cross Validated ever. Dec 9 '15 at 17:53

I'd expect most tutorials to start and end with descriptive time series analysis in an ARIMA framework, but it might also be interesting to look at tutorial treatments of structural time series analysis in a Bayesian framework with a focus on causal inference.

If that's your bag, my current go-to resources are the following, all of which conveniently treat the same policy impact question.

Books and papers

Commandeur and Koopman is a gentle introduction to the model building and checking this class of models. The original paper Durbin and Harvey, 1986 is also worth a read. For a causal inference focus, the paper Brodersen et al. 2015 is good too.

Data and code

Most of the materials above make some use of the Seatbelts data that comes with R. See also the packages CausalImpact (plus vignette), bsts (sadly without vignette), and the structTS function built into R.

MATLAB has a ton of end to end examples. Here's where one batch starts, just follow it to the end. It's part I, the last one is part X, but there are other related examples on multiplicative seasonality, de-trending, filters etc.