mixVAR_sim: Simulate from multivariate MixAR models

View source: R/mixVAR_sim.R

mixVAR_simR Documentation

Simulate from multivariate MixAR models

Description

Simulate data from multivariate MixAR models under the assumptions of multivariate Gaussian innovarion

Usage

mixVAR_sim(model, n, init, nskip = 100, flag = FALSE)

Arguments

model

model from which to simulate, an object inheriting from class MixVAR.

n

size of simulated multivariate series.

init

initial values, a numeric matrix. If missing, a matrix of 0 values is generated.

nskip

number of burn-in values.

flag

if TRUE returns also the regimes.

Details

mixVAR_sim simulates a series of length nskip + n and returns the last n values. init provides initial values for the algorithm. Each row is considered as a time point. The number of rows must be at least equal to the maximal AR order.

Value

a numeric matrix with n rows.

Author(s)

Davide Ravagli

See Also

mixAR_sim

Examples

AR <- list()
AR[[1]] <- array(c(0.5,-0.3,-0.6,0,0,0.5,0.4,0.5,-0.3), dim = c(3,3,1))
AR[[2]] <- array(c(-0.5,0.3,0,1,0,-0.5,-0.4,-0.2, 0.5), dim = c(3,3,1))

prob <- c(0.75, 0.25)
shift <- cbind(c(0,0,0), c(0,0,0))

Sigma1 <- cbind(c(1, 0.5, -0.4), c(0.5, 2, 0.8), c(-0.4, 0.8, 4))
Sigma2 <- cbind(c(1,0.2, 0), c(0.2, 2, -0.15), c(0, -0.15, 4))
Sigma <- array(c(Sigma1, Sigma2), dim = c(3,3,2))

m <- new("MixVARGaussian", prob=prob, vcov=Sigma, arcoef=AR, shift=shift)
mixVAR_sim(m, n=500, init=matrix(rep(0,3), ncol=3), nskip=100, flag=FALSE)

GeoBosh/mixAR documentation built on May 9, 2022, 7:36 a.m.