Time Series – How to Generate Two Correlated ARMA(1,1) Processes

arimarandom-generationtime series

How can I generate two correlated ARMA(1,1) data series where

$d_{1,t}=\mu+\phi_{1}d_{1,(t-1)}-\theta_1(e_1(t-1)+e_1(t))$

$d_{2,t}=\mu+\phi_{2}d_{2,(t-1)}-\theta_2(e_2(t-1)+e_2(t))$

and $\rho_{12}$ is desired correlation between $e_1$ and $e_2$?

Best Answer

The following R code will do what you want. I have used $\rho_{12}=0.5$, $\mu=10$, $\phi_1=0.2$, $\phi_2=0.8$, $\theta_1=0.3$, $\theta_2=-0.7$ and I have assumed that the errors have mean zero and variance 1.

library(mvtnorm)
rho <- 0.5
mu <- c(10,10)
phi <- c(0.2,0.8)
theta <- c(0.3,-0.7)
d <- ts(matrix(0,ncol=2,nrow=50))
e <- ts(rmvnorm(50,sigma=cbind(c(1,rho),c(rho,1))))
for(i in 2:50)
  d[i,] <- mu + phi*d[i-1,] - theta*(e[i-1,]+e[i,])
plot(d)
Related Question