This function is designed to chooose the number of factors for the overdispersed generalized factor model by using the singular value ratio (SVR) based method.

OverGFMchooseFacNumber(XList, types, q_max=15,offset=FALSE, epsELBO=1e-4, maxIter=30,
                            verbose = TRUE, threshold= 1e-2)

Arguments

XList

a list consisting of matrices with the same rows n, and different columns (p1,p2, ..., p_d),observational mixed data matrix list, d is the types of variables, p_j is the dimension of varibles with the j-th type.

types

a d-dimensional character vector, specify the type of variables. For example, types=c('gaussian','poisson', 'binomial'), implies the components of XList are matrices with continuous, count and binomial values, respectively.

q_max

a positive integer, specify the upper bound of the number of factors, defualt as 15.

offset

a logical value, whether add an offset term (the total counts for each row in the count component of XList) when there are Poisson variables.

epsELBO

a positive real, specify the relative tolerance of ELBO function in the algorithm. Optional parameter with default as 1e-5.

maxIter

a positive integer, specify the times of iteration. Optional parameter with default as 30.

verbose

a logical value with TRUE or FALSE, specify whether ouput the information in iteration process, (optional) default as TRUE.

threshold

a postive real, the threshold that is used to filter the small singular values in the SVR criterion.

Value

return an integer value, the estimated number of factors.

Author

Liu Wei

Note

nothing

See also

nothing

Examples


  ## mix of normal and Poisson

  dat <- gendata(seed=1, n=60, p=60, type='norm_pois', q=2, rho=2)
  ## we set maxIter=2 for example.
  hq <- OverGFMchooseFacNumber(dat$XList, dat$types, verbose = FALSE, maxIter=2)