Function to simulate compositional time series data

Simulations(N, TT, K, A, B, C, mu, D, outliers_discre, q)

Arguments

N

The number of categories in the composition

TT

The time series length

K

The state vector dimension

A

The N x K matrix of factor loadings in the observation equation

B

The K x K autoregressive matrix of the transition equation

C

The K x K matrix determining the magnitude of the persistent outliers

mu

The K-dimensional intercept vector in the transition equation

D

A K x K matrix determining the variance-covariance matrix of the error term

outliers_discre

An R x 3 matrix of discretionary outliers. R denotes the number of discretionary outliers. The first, second and third columns denote the time position, the composite position and the magnitude of the outliers

q

Probability of persistent outlier eventuating

Value

A list with the following components:

datasim

A TT x K data frame with the generated time series compositional data.

outliers_persist

A matrix indicating the time location of the persistant outliers (first column) and the factors (or states) where the outlier eventuates (second column).

outliers_discre

A matrix equivalent to the function argument provided by the user.

outliers_timeloc

A vector with the time location of all the outliers.

Examples

set.seed(2000)
N <- 30
K <- 2
TT <- 500
A <- matrix(rnorm(N*K, 0, 0.3), N, K)
B <- matrix(c(0.8,0,0,0.5), K, K)
C <- matrix(c(5,0,0,4), K, K)
mu <- c(0.3, 0.7)
D <- matrix(c(0.4,0,0,0.4), K, K)
outliers_discre <- matrix(c(117, 2, 10, 40, 8, 200), 2, 3, byrow = TRUE)
q <- 0.005
y <-  Simulations(N = N,
                 TT = TT,
                 K = K,
                 A = A,
                 B = B,
                 C = C,
                 mu = mu,
                 D = D,
                 outliers_discre = outliers_discre,
                 q = q)