Preface

The Integrated Nested Laplace Approximation (INLA) is a well-known method for carrying out approximate Bayesian inference. Through the R-INLA package and its well maintained companion website, INLA has established itself as an alternative to other methods for Bayesian analysis, such as Markov chain Monte Carlo (MCMC) or Variational Bayes, primarily because of its speed and ease of use. INLA is a fast alternative to MCMC methods for Bayesian modeling in complex problems when exact, closed form solutions are not available - that is most of the data analysis in practice today!

This book has grown out of our experience over several years and is aimed at applied scientists or applied statisticians who work with time series data in various forms, sizes, and shapes, and would like to get fast and accurate, though approximate, solutions. The goal is to provide a guide for using the R-INLA package to analyze different classes of time series in a dynamic Bayesian framework.

The INLA methodology was introduced in Rue, Martino, and Chopin (2009) for models that can be expressed as latent Gaussian Markov random fields (GMRFs). Although this may seem restrictive, it is amazing how many families of models that are used in practice for large, complex data can be handled in this framework. Dynamic models for time series is one domain where R-INLA can be extremely effective.

Why read this book?

Dynamic modeling of data observed over time is increasingly important as data with temporal dependence is frequently available in various disciplines. This book describes the use of an approximate Bayesian framework using R-INLA for dynamic modeling of time series under various situations. The details provided in different chapters should be useful for practitioners who are interested in using R-INLA for modeling.

Structure of the book

Chapter 1 introduces the Bayesian framework and the dynamic Bayesian framework for time series, while Chapter 2 describes the Integrated Nested Laplace Approximation (INLA) framework for carrying out fast, approximate Bayesian modeling and forecasting. Chapter 3 sets up the R-INLA for various univariate dynamic linear models, while Chapter 4 illustrates use of these models via a univariate time series from software engineering, and explains prior specification, parameter, and hyperparameter estimation, model selection, and forecasting. A careful reading of Chapter 3 and Chapter 4 will enable a reader to learn how to set up many items in R-INLA and enhance them in later chapters. Chapter 5 shows how to fit structural time series models and include exogenous time series as predictors, both in the observation equation and in the state equation. Chapter 6 sets up hierarchical DLMs for panel time series. We describe many aspects of R-INLA which will be useful in later chapters. Chapters 7, 8, and 9 describe non-Gaussian state space models. While Chapter 7 describes models for continuous, positive-valued responses and for time series of proportions taking values in the interval \((0,1)\), Chapters 8 and 9 respectively model binary/categorical time series of counts. Chapter 10 shows how to use R-INLA for stochastic volatility modeling with application to financial returns, although these methods can be used for any nonlinear growth modeling. Chapter 11 looks at data that occur over space and time, and builds models that handle spatial and temporal effects additively, as well as through various types of interactions. In Chapter 12, we model multivariate Gaussian DLMs by using the augmented structure for representing the responses and obtaining fitted values and forecasts through the functions inla.make.lincomb() and inla.posterior.samples(). We also show an example of using rgeneric() to build MV DLM for which a template does not currently exist in R-INLA. Chapter 13 illustrates how to extend the ideas in Chapter 6 to build hierarchical DLMs for panels of vector-valued time series of counts. In this chapter, we also show how we can build level correlated models for vector-valued counts, addressing a topic that is becoming increasingly important in various application domains. Chapter 14 pulls together some often used information that can serve as a quick look-up guide for users, while the appendices in some chapters provide some useful information that is tangential to the R-INLA modeling.

Software information and conventions

This is an R book (Team 2018) and all codes are written in R version 4.1.0 (2021-05-18). The IDE used is RStudio (RStudio Team 2021). All the code in this book are developed using INLA_21.02.23. The book is compiled using the bookdown package (Xie 2016). We have used the following typographical conventions - package names are in typewriter font (e.g., ggplot2). Function names followed by parentheses are in typewriter font (e.g., inla()). Function arguments are also in typewriter font (e.g., control.compute). User specified variable or data names are in italics (e.g., y, Musa).

Plots have been constructed using plot(), ts.plot(), etc. from R or by using functions that we have created such as tsline() and multiline.plot(). In our functions we have customized ggplot(). These are available in Chapter 14 as well as in our GitHub link https://github.com/ramanbala/dynamic-time-series-models-R-INLA. Typos and other errors in the printed version are in an errata file.

Acknowledgments

We are very grateful to Håvard Rue and the R-INLA team for their expert and timely help with different aspects of the code and output. We are also thankful to Bradley Boehmke (https://GitHub.com/bradleyboehmke) for his generous help with our markdown struggles. Excellent books that describe R-INLA (by Virgilio Gomez-Rubio, Paula Moraga, and Marta Blangiardo and Michela Cameletti) have been extremely useful to us. We are grateful to the authors. Several current and past students at the University of Connecticut have been involved in our R-INLA journey. A special note of thanks to Chiranjit Dutta, Shan Hu (posthumous), and Volodymyr Serhiyenko for codes related to multivariate models. We also thank Renjie Chen and Patrick Toman for reading earlier versions and making suggestions. We thank the organizers and participants of the following workshops - Bayesian Analysis of Time Series Data using R (ISBIS 2019, Kuala Lumpur, Malaysia) and Workshop on DLM using R (YBIS 2019, Istanbul, Turkey) for their feedback which motivated us to start working on this book. We thank Kamal Sen and Venu Gorti (Cogitaas AVA, Mumbai, India) for allowing us to use their computing facilities to run our codes. We are also grateful to the ITS staff at the University of Connecticut, Storrs, U.S.A. for their help in enabling us to run R-INLA code on the HPC cluster. We appreciate all the help we received from David Grubbs at Chapman & Hall/CRC. Finally, we thank our families for their constant support and encouragement - my family (NR); my mother, Shraddha and Pinakin for letting me do my R-INLA homework peacefully (BR); Ayşegül, Deniz, and Demir (RS).

Nalini Ravishanker, Balaji Raman, and Refik Soyer

References

RStudio Team. 2021. RStudio: Integrated Development Environment for r. Boston, MA: RStudio, PBC. http://www.rstudio.com/.
Rue, Håvard, Sara Martino, and Nicholas Chopin. 2009. “Approximate Bayesian Inference for Latent Gaussian Models Using Integrated Nested Laplace Approximations (with Discussion).” Journal of the Royal Statistical Society, Series B 71: 319–92.
Team, R Core. 2018. R: A Language and Environment for Statistical Computing. Vienna, Austria: R Foundation for Statistical Computing. https://www.R-project.org/.
Xie, Yihui. 2016. Bookdown: Authoring Books and Technical Documents with R Markdown. Boca Raton, Florida: CRC Press.