Multivariate time series modelling in R Multivariate time series modelling in R r r

Multivariate time series modelling in R


If you haven't done so already, have a look at the time series view on CRAN, especially the section on multivariate time series.

In finance, one traditional way of doing this is with a factor model, frequently with either a BARRA or Fama-French type model. Eric Zivot's "Modeling financial time series with S-PLUS" gives a good overview of these topics, but it isn't immediately transferable into R. Ruey Tsay's "Analysis of Financial Time Series" (available in the TSA package on CRAN) also has a nice discussion of factor models and principal component analysis in chapter 9.

R also has a number of packages that cover vector autoregression (VAR) models. In particular, I would recommend looking at Bernhard Pfaff's VAR Modelling (vars) package and the related vignette.

I strongly recommend looking at Ruey Tsay's homepage because it covers all these topics, and provides the necessary R code. In particular, look at the "Applied Multivariate Analysis", "Analysis of Financial Time Series", and "Multivariate Time Series Analysis" courses.

This is a very large subject and there are many good books that cover it, including both multivariate time series forcasting and seasonality. Here are a few more:

  1. Kleiber and Zeileis. "Applied Econometrics with R" doesn't address this specifically, but it covers the overall subject very well (see also the AER package on CRAN).
  2. Shumway and Stoffer. "Time Series Analysis and Its Applications: With R Examples" has examples of multivariate ARIMA models.
  3. Cryer. "Time Series Analysis: With Applications in R" is a classic on the subject, updated to include R code.


In the forecast package, try:

arima(df[,1:4], order=(0,0,0), xreg=df[,6:8])

for forecasting u, cci and gdp.

To predict dx from that, try the VAR model. Here's a good tutorial (PDF).


Don't Know if this functionality was available when you first asked this question but this is easily available in base R now with the arima function; just specify your external regressors with the xreg argument within the function. Try ?arima and when you read the documentation pay special attention to the xreg argument. This has been made very easy, good luck.