Learn R Programming

GFM (version 1.2.1)

gendata: Generate simulated data

Description

Generate simulated data from high dimensional genelized nonlinear factor model.

Usage

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)

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.

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'.

Author

Wei Liu

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.

See Also

Factorm; gfm.

Examples

Run this code
  dat <- gendata(n=300, p = 500)
  str(dat)

Run the code above in your browser using DataLab