OverGFMchooseFacNumber: Choose the Number of factors for Overdispersed Generalized...

View source: R/vb_gfm.R

OverGFMchooseFacNumberR Documentation

Choose the Number of factors for Overdispersed Generalized Factor Models

Description

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.

Usage

  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.

Note

nothing

Author(s)

Liu Wei

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)

GFM documentation built on Aug. 11, 2023, 9:06 a.m.