Learn R Programming

ksm (version 1.0)

rVAR: Random generation from first-order vector autoregressive model

Description

Given a matrix of coefficients M and a covariance matrix Sigma, simulate K vectors from a first-order autoregressive process.

Usage

rVAR(n, M, Sigma, K = 1L, order = 1L, burnin = 25L)

Value

a list of length n containing matrices of size K by d

Arguments

n

sample size

M

matrix of autoregressive coefficients

Sigma

covariance matrix

K

integer, degrees of freedom

order

order of autoregressive process, only 1 is supported at current.

burnin

number of iterations discarded

Examples

Run this code
M <- matrix(c(0.3, -0.3, -0.3, 0.3), nrow = 2)
Sigma <- matrix(c(1, 0.5, 0.5, 1), nrow = 2)
rVAR(n = 100, M = M, Sigma = Sigma, K = 10)

Run the code above in your browser using DataLab