tensor_gen {tensorMiss}R Documentation

Data generation of tensor time series with factor structure

Description

Generate an order-K tensor at each time t, with the first mode as the time mode and maximum allowed K is 4

Usage

tensor_gen(
  K,
  TT,
  d,
  r,
  re,
  eta,
  coef_f,
  coef_fe,
  coef_e,
  heavy_tailed = FALSE,
  t_df = 3,
  seed = 2023
)

Arguments

K

Order of the generated tensor at each time t.

TT

Length of time series.

d

Dimensions of each mode of the tensor, written in a vector of length K.

r

Rank of the core tensors, written in a vector of length K.

re

Rank of the cross-sectional common error core tensors, written in a vector of length K.

eta

Quantities controlling factor strengths in each factor loading matrix, written in a list of K vectors.

coef_f

AR(5) coefficients for the factor series, written in a vector of length 5.

coef_fe

AR(5) coefficients for the common component in error series, written in a vector of length 5.

coef_e

AR(5) coefficients for the idiosyncratic component in error series, written in a vector of length 5.

heavy_tailed

Whether to generate data from heavy-tailed distribution. If FALSE, generate from N(0,1); if TRUE, generate from t-distribution. Default is FALSE.

t_df

The degree of freedom for t-distribution if heavy_tailed = TRUE. Default is 3.

seed

Random seed required for reproducibility. Default is 2023.

Value

A list containing the following: X: the generated tensor time series, as multi-dimensional array with dimension K+1, where mode-1 is the time mode; A: a list of K factor loading matrices; C: the generated common component time series, as multi-dimensional array with dimension K+1, where mode-1 is the time mode; Ft: the generated core factor series, as multi-dimensional array with dimension K+1, where mode-1 is the time mode;

Examples

K = 3;
TT = 10;
d = c(20,20,20);
r = c(2,2,2);
re = c(2,2,2);
eta = list(c(0,0), c(0,0), c(0,0));
coef_f = c(0.7, 0.3, -0.4, 0.2, -0.1);
coef_fe = c(-0.7, -0.3, -0.4, 0.2, 0.1);
coef_e = c(0.8, 0.4, -0.4, 0.2, -0.1);
tensor_gen(K,TT,d,r,re,eta, coef_f, coef_fe, coef_e);




[Package tensorMiss version 1.1.1 Index]