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$?
Cross Validated is a question and answer site for people interested in statistics, machine learning, data analysis, data mining, and data visualization. It only takes a minute to sign up.
Sign up to join this communityHow 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$?
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)
sigma=cbind(c(Variance1,rho),c(rho,Variance2))))
? May I substitute 1 with variance of error or standard deviation of error?
$\endgroup$
– Roji
Jul 25 '12 at 11:47
d[1,]=mu+e[1,]
and then d[i,] <- phi*d[i-1,] - theta*(e[i-1,]+e[i,])
?
$\endgroup$
– Roji
Jul 25 '12 at 14:58
I will assume that the e1 and e2 terms are iid noise terms with 0 mean and constant variance. If that is the right way to interpret the model you can compute the correlation between d$_1$ and d$_2$ as a function of the correlations between e$_1$ and e$_2$. Since you now have clarified that ρ$_1$$_2$ is the correlation between e$_1$ and e$_2$ it is simpler than what I said originally. Again you haven't said whether you want to specify the entire cross correlation or just the zero lag crosscorrelation. One way to do this is to generate a bivariate normal distribution with mean vector (0,0)$^T$ and specified covariance martix having diagonal elements 1 and off diagonal elements ρ$_1$$_2$. There should be routines to do this. If you can't find one generate two independent normals a$_1$ and a$_2$ and let e$_1$=a$_1$ and e$_2$ = ρ$_1$$_2$ a$_1$ + a$_2$ where a$_2$ is chosen to have the variance that makes the variance of e$_2$ = 1 and a$_1$ has variance 1.