Generate simulated data from high dimensional genelized nonlinear factor model.

gendata(seed = 1, n = 300, p = 50,
              type =  c('homonorm', 'heternorm',
              'pois', 'bino', 'norm_pois', 'pois_bino', 'npb'),
                     q = 6, rho = 1, n_bin=1)

Arguments

seed

a nonnegative integer, the random seed, default as 1.

n

a positive integer, the sample size.

p

an positive integer, the variable dimension.

type

a character, specify the variables types for generated data, default as 'homonorm', representing the homogeneous gaussian variables.

q

a positive integer, the number of factors.

rho

a positive number, controlling the magnitude of loading matrix.

n_bin

a positive integer, specify the number of trails for the binomial variables when type is set to one of 'bino', 'pois_bino' and 'npb'.

Details

This function provides a variaty of mix of different variable types, in which 'homonorm' represents the generated data with only homogenous normal variables; 'heternorm' represents the data with only heterogenous normal variables; 'pois' means the data with only poisson variables; 'bino' means the data with only binomial variables; 'norm_pois' means the mix of normal and poisson variables; 'pois_bino' represents the mix of poisson and binomial variables; and 'npb' means the most complex mix of normal, poisson and binomial variables.

Value

return a list including two components:

X

a n-by-p matrix, the observed data matrix.

XList

a list consisting of the above observed data matrices with the same rows n (observations), and different columns (p1,p2, ..., p_d) and p columns in total, where d is the types of variables, pj is the dimension of varibles with the j-th type.

H0

a n-by-q matrix, the true lantent factor matrix.

B0

a p-by-q matrix, the true loading matrix, the last pzero rows are vectors of zeros.

mu0

a p-dimensional vector, the true intercept terms.

Author

Wei Liu

Note

nothing

See also

Examples

  dat <- gendata(n=300, p = 500)
  str(dat)
#> List of 6
#>  $ X    : num [1:300, 1:500] -1.079 0.534 -0.305 -1.159 0.293 ...
#>   ..- attr(*, "dimnames")=List of 2
#>   .. ..$ : NULL
#>   .. ..$ : NULL
#>  $ XList:List of 1
#>   ..$ : num [1:300, 1:500] -1.079 0.534 -0.305 -1.159 0.293 ...
#>   .. ..- attr(*, "dimnames")=List of 2
#>   .. .. ..$ : NULL
#>   .. .. ..$ : NULL
#>  $ types: chr "gaussian"
#>  $ B0   : num [1:500, 1:6] 0.1375 -0.0403 0.1834 -0.3501 -0.0723 ...
#>  $ H0   : num [1:300, 1:6] 0.145 0.101 -1.759 -0.927 -0.597 ...
#>  $ mu0  : num [1:500] 0.296 0.155 0.519 -0.321 -0.641 ...