Learn R Programming

freqdom (version 1.0.4)

rar: Simulate a multivariate autoregressive time series

Description

Simulate n observarions multivariate autoregressive time series, i.e. $$ X_t = \sum_{k=0}^p A_k X_{t-k} + \varepsilon_t,$$ where \(\varepsilon_t\) is a d-dimensional white noise and \(A_k\) are \(d \times d\) matrices and \(X_t = 0\) for \(t \leq 0\).

Usage

rar(n, d = NULL, Psi = NULL, first = NULL, noise = NULL, sd = 1)

Arguments

n

number of observations to generate

d

dimension of the process

Psi

serie of regression operators (if one matrix is given it is treated as regressor with lag 1)

first

the first element of a series

noise

the noise we want to add

sd

standard deviation of the gaussian noise if the noise wasn't provided

Value

an AR series of vectors

Examples

Run this code
# NOT RUN {
nbase = 10
Psi = t((1:nbase) %*% t(sin(1:nbase * 2*pi/nbase)) / (nbase*nbase))
process = rar(30, Psi=Psi, sd=0.2)
pdf(file='simulated.arh1.pdf')
plot(process)
title("Simulated ARH(1)")
dev.off()
# }

Run the code above in your browser using DataLab