k <- 2
n <- 300
Trunc.Series <- 50
phi <- array(c(0.5,0.4,0.1,0.5),dim=c(k,k,1))
theta <- array(c(0,0.25,0,0),dim=c(k,k,1))
intercept <- c(10,12)
sigma <- matrix(c(1,0.71,0.71,2),k,k)
p <- ifelse(is.null(phi),0,dim(phi)[3])
q <- ifelse(is.null(theta),0,dim(theta)[3])
epsilon <- t(crossprod(chol(sigma),matrix(rnorm(k*(n + q)),ncol=n + q)))
Sim.Series <- matrix(numeric(0), nrow = n, ncol = k)
r <- max(p, q)
psi <- ImpulseVMA(phi = phi, theta = theta, Trunc.Series = Trunc.Series)
epsilon <- t(crossprod(chol(sigma),matrix(rnorm(k*(Trunc.Series + r)),ncol=Trunc.Series + r)))
Sim.Series[1:r, ] <- simvma(psi = psi, a = epsilon)
Sim.Series[1:r,]
Run the code above in your browser using DataLab