CMGFM {CMGFM} | R Documentation |
Fit the CMGFM model
Description
Fit the covariate-augumented generalized factor model
Usage
CMGFM(
XList,
Z,
types,
numvarmat,
q = 15,
Alist = NULL,
init = c("LFM", "GFM", "random"),
maxIter = 30,
epsELBO = 1e-08,
verbose = TRUE,
add_IC_iter = FALSE,
seed = 1
)
Arguments
XList |
a list consisting of multiple matrices in which each matrix has the same type of values, i.e., continuous, or count, or binomial/binary values. |
Z |
a matrix, the fixed-dimensional covariate matrix with control variables. |
types |
a string vector, specify the variable type in each matrix in |
numvarmat |
a |
q |
an optional string, specify the number of factors; default as 15. |
Alist |
an optional vector, the offset for each unit; default as full-zero vector. |
init |
an optional character, specify the method in initialization. |
maxIter |
the maximum iteration of the VEM algorithm. The default is 30. |
epsELBO |
an optional positive value, tolerance of relative variation rate of the evidence lower bound value, default as '1e-8'. |
verbose |
a logical value, whether output the information in iteration. |
add_IC_iter |
a logical value, add the identifiability condition in iterative algorithm or add it after algorithm converges; default as FALSE. |
seed |
an integer, set the random seed in initialization, default as 1; |
Details
None
Value
return a list including the following components:
-
betaf
- the estimated regression coefficient vector for each modality; -
Bf
- the estimated loading matrix for each modality; -
M
- the estimated modality-shared factor matrix; -
Xif
- the estimated modality-specified factor vector; -
S
- the estimated covariance matrix of modality-shared latent factors; -
Om
- the posterior variance of modality-specified latent factors; -
muf
- the estimated intercept vector for each modality; -
Sigmam
- the variance of modality-specified factors; -
invLambdaf
- the inverse of the estimated variances of error for each modality. -
ELBO
- the ELBO value when algorithm stops; -
ELBO_seq
- the sequence of ELBO values. -
time_use
- the running time in model fitting;
References
None
See Also
None
Examples
pveclist <- list('gaussian'=c(50, 150),'poisson'=c(50, 150),
'binomial'=c(100,60))
q <- 6
sigmavec <- rep(1,3)
pvec <- unlist(pveclist)
datlist <- gendata_cmgfm(pveclist = pveclist, seed = 1, n = 300,d = 3,
q = q, rho = rep(1,length(pveclist)), rho_z=0.2,
sigmavec=sigmavec, sigma_eps=1)
XList <- datlist$XList
Z <- datlist$Z
numvarmat <- datlist$numvarmat
types <- datlist$types
rlist <- CMGFM(XList, Z, types=types, numvarmat, q=q)
str(rlist)