rar: Simulate a multivariate autoregressive time series

View source: R/rar.R

rarR Documentation

Simulate a multivariate autoregressive time series

Description

Generates a zero mean vector autoregressive process of a given order.

Usage

rar(
  n,
  d = 2,
  Psi = NULL,
  burnin = 10,
  noise = c("mnormal", "mt"),
  sigma = NULL,
  df = 4
)

Arguments

n

number of observations to generate.

d

dimension of the time series.

Psi

array of p ≥q 1 coefficient matrices. Psi[,,k] is the k-th coefficient. If no value is set then we generate a vector autoregressive process of order 1. Then, Psi[,,1] is proportional to \exp(-(i+j)\colon 1≤q i, j≤q d) and such that the spectral radius of Psi[,,1] is 1/2.

burnin

an integer ≥q 0. It specifies a number of initial observations to be trashed to achieve stationarity.

noise

mnormal for multivariate normal noise or mt for multivariate student t noise. If not specified mnormal is chosen.

sigma

covariance or scale matrix of the innovations. By default the identity matrix.

df

degrees of freedom if noise = "mt".

Details

We simulate a vector autoregressive process

X_t=∑_{k=1}^p Ψ_k X_{t-k}+\varepsilon_t,\quad 1≤q t≤q n.

The innovation process \varepsilon_t is either multivariate normal or multivariate t with a predefined covariance/scale matrix sigma and zero mean. The noise is generated with the package mvtnorm. For Gaussian noise we use rmvnorm. For Student-t noise we use rmvt. The parameters sigma and df are imported as arguments, otherwise we use default settings. To initialise the process we set [X_{1-p},…,X_{0}]=[\varepsilon_{1-p},…,\varepsilon_{0}]. When burnin is set equal to K then, n+K observations are generated and the first K will be trashed.

Value

A matrix with d columns and n rows. Each row corresponds to one time point.

See Also

rma


freqdom documentation built on Oct. 4, 2022, 5:05 p.m.