sim.data: Multivariate time series simulation with chain graphical...

Description Usage Arguments Value Author(s) Examples

View source: R/sim.data.r

Description

Generates sparse vector autoregressive coefficients matrices and precision matrix from various network structures and using these matrices generates repeated multivariate time series dataset.

Usage

1
2
3
 sim.data(model=c("ar1","ar2"),time=time,n.obs=n.obs, n.var=n.var,seed=NULL,
          prob0=NULL, network=c("random","scale-free","hub","user_defined"),
          prec=NULL,gamma1=NULL,gamma2=NULL)

Arguments

model

Specifies the order of vector autoregressive models. Vector autoregressive model of order 1 is applied if model = "ar1" and Vector autoregressive model of order 2 is applied if method = "ar2".

time

Number of time points.

n.obs

Number of observations or replicates.

n.var

Number of variables.

seed

Random number seed.

prob0

Initial sparsity level.

network

Specifies the type of network structure. This could be random, scale-free, hub or user defined structures. Details on simultions from the various network structures can be found in the R package flare.

prec

Precision matrix.

gamma1

Autoregressive coefficients matrix at time lag 1.

gamma2

Autoregressive coefficients matrix at time lag 2.

Value

A list containing:

theta

Sparse precision matrix.

gamma

Sparse autoregressive coefficients matrix.

sigma

Covariance matrix.

data1

Repeated multivariate time series data in longitudinal format.

Author(s)

Fentaw Abegaz and Ernst Wit

Examples

1
2
3
4
5
6
seed = 321
datas <- sim.data(model="ar1", time=4,n.obs=3, n.var=5,seed=seed,prob0=0.35,
         network="random")
data.ts <-  datas$data1
prec_true <- datas$theta
autoR_true <- datas$gamma

Example output

Generating data from the multivariate normal distribution with the random graph structure...
done.
Generating data from the multivariate normal distribution with the random graph structure...
done.
Generating data from the multivariate normal distribution with the random graph structure...
done.

SparseTSCGM documentation built on Jan. 16, 2021, 5:10 p.m.