gendata: Generate the grouped data

View source: R/gendata.R

gendataR Documentation

Generate the grouped data

Description

Generate the grouped data for simulation studies.

Usage

gendata(
  seed = 1,
  T = 50,
  N = rep(30, 5),
  r0 = 2,
  r = rep(2, 5),
  Phi_G = 0.5,
  Phi_F = 0.5,
  Phi_e = 0.5,
  W_F = 0.5,
  beta = 0.2,
  kappa = 1,
  case = 1
)

Arguments

seed

The seed used in set.seed. Default is 1.

T

The number of time points. Default is 50.

N

A vector representing the number of variables in each group. Default is rep(30, 5).

r0

The number of global factors. Default is 2.

r

A vector representing the number of the local factors. Notice, the length of r is the same as the length of N (which implies the number of groups M). Default is rep(2, 5).

Phi_G

Hyperparameter of the global factors (AR(1) coefficient). Default is 0.5. The value should be between 0 and 1.

Phi_F

Hyperparameter of the local factors (AR(1) coefficient). Default is 0.5. The value should be between 0 and 1.

Phi_e

Hyperparameter of the errors. Default is 0.5. The value should be between 0 and 1.

W_F

Hyperparameter of the correlation of local factors. Only applicable when case = 3. The value should be between 0 and 1. Default is 0.5.

beta

Hyperparameter of the errors (spatial correlation). Default is 0.2.

kappa

Hyperparameter of signal to noise ratio. Default is 1.

case

The case of the data-generating process. Default is 1. It can also be 2 or 3.

Value

An object of class "GFD" containing:

y

A list of the generated data matrices.

G

The global factors matrix.

F

A list of the local factors.

loading_G

A list of the global factor loadings.

loading_F

A list of the local factor loadings.

T

The number of time points.

N

The vector of variables per group.

M

The number of groups.

r0

The number of global factors.

r

The vector of local factors.

case

The generation case used.

References

Aggregated Projection Method: A New Approach for Group Factor Model. Jiaqi Hu, Ting Li, Xueqin Wang (2025). Journal of the American Statistical Association, doi:10.1080/01621459.2025.2491154

Examples

dat <- gendata()
print(dat)

GrFA documentation built on Dec. 7, 2025, 1:07 a.m.

Related to gendata in GrFA...