testVAR: Function to generate a VAR process

Description Usage Arguments Value Examples

View source: R/LSVAR.R

Description

A function to generate synthetic time series process based on the given structure

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
testVAR(
  n,
  p,
  struct = c("sparse", "low rank", "LS")[1],
  sp_density = 0.1,
  signal = NULL,
  rank = NULL,
  singular_vals,
  spectral_radius = 0.9,
  sigma = NULL,
  skip = 50,
  seed = 1
)

Arguments

n

the length of time series

p

the number of multivariate time series

struct

a character string indicating the structure of the transition matrix, here are three options: sparse, low rank and LS (low rank plus sparse)

sp_density

a numeric value, indicating the sparsity density of sparse components, default is 0.1

signal

a numeric value, indicating the magnitude of transition matrix

rank

a positive integer, the rank for low rank component

singular_vals

a numeric vector, indicating the singular values for the low rank component, the length of singular value must equal to the rank

spectral_radius

a numeric value, controlling the stability of the process, default is 0.9

sigma

a numeric matrix, indicating the covariance matrix of noise term

skip

a numeric value, indicating the number of skipped time points in the beginning of the process

seed

an integer, indicating the seed for random seed.

Value

A list object, including

series

the generated time series

noise

the noise term

model_param

true transition matrix

Examples

1
2
3
4
5
6
7
n <- 300; p <- 15
signal <- 0.75
rank <- 3
singular_vals <- c(1, 0.75, 0.5)
try <- testVAR(n, p, struct = "LS", signal = signal, rank = rank,
               singular_vals = singular_vals)
data <- as.matrix(try$series)

LSVAR documentation built on May 26, 2021, 5:07 p.m.