tensor_data_gen {TensorPreAve} | R Documentation |
Tensor time series data generation.
Description
Function to generate a random sample of time series tensor factor model, based on econometrics assumptions. (See Chen and Lam (2023) for more details on the assumptions.)
Usage
tensor_data_gen(K, n, d, r, re, eta, u, heavy_tailed = FALSE, t_df = 3)
Arguments
K |
The number of modes for the tensor time series. |
n |
Length of time series. |
d |
Dimensions of each mode of the tensor, written in a vector of length |
r |
Rank of the core tensors, written in a vector of length |
re |
Rank of the cross-sectional common error core tensors, written in a vector of length |
eta |
Quantities controlling factor strengths in each factor loading matrix, written in a list of |
u |
Quantities controlling range of elements in each factor loading matrix, written in a list of |
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. |
Details
Input tensor dimension and rank of core tensor, return a sample of tensor time series generated by factor model.
Value
A list containing the following:
X
: the generated tensor time series, stored in a 'Tensor' object defined in rTensor, where mode-1 is the time mode
A
: a list of K factor loading matrices
F_ts
: time series of core tensor, stored in a 'Tensor' object, where mode-1 is the time mode
E_ts
: time series of error tensor, stored in a 'Tensor' object, where mode-1 is the time mode
Examples
set.seed(10)
K = 2
n = 100
d = c(40,40)
r = c(2,2)
re = c(2,2)
eta = list(c(0,0),c(0,0))
u = list(c(-2,2),c(-2,2))
Data_test = tensor_data_gen(K,n,d,r,re,eta,u)
X = Data_test$X
A = Data_test$A
F_ts = Data_test$F_ts
E_ts = Data_test$E_ts
X@modes
F_ts@modes
E_ts@modes
dim(A[[1]])