Fit the multi-study covariate-augmented overdispersed Poisson factor model via variational inference

MSFRVI(
  XList,
  ZList,
  q = 15,
  qs = rep(2, length(XList)),
  rank_use = NULL,
  aList = NULL,
  epsELBO = 1e-05,
  maxIter = 30,
  verbose = TRUE,
  seed = 1
)

Arguments

XList

A length-M list, where each component represents a matrix and is the observed response matrix from each source/study. Ideally, each matrix should be continuous.

ZList

a length-M list with each component a matrix that is the covariate matrix from each study.

q

an optional string, specify the number of study-shared factors; default as 15.

qs

a integer vector with length M, specify the number of study-specifed factors; default as 2.

rank_use

an optional integer, specify the rank of the regression coefficient matrix; default as NULL, which means that rank is the dimension of covariates in Z.

aList

an optional length-M list with each component a vector, the normalization factors of each study; default as full-one vector.

epsELBO

an optional positive vlaue, tolerance of relative variation rate of the envidence lower bound value, defualt as '1e-5'.

maxIter

the maximum iteration of the VEM algorithm. The default is 30.

verbose

a logical value, whether output the information in iteration.

seed

an optional integer, specify the random seed for reproducibility in initialization.

Value

return a list including the following components: (1) F, a list composed by the posterior estimation of study-shared factor matrix for each study; (2) H, a list composed by the posterior estimation of study-specified factor matrix for each study; (3) Sf, a list consisting of the posterior estimation of covariance matrix of study-shared factors for each study; (4) Sh, a list consisting of the posterior estimation of covariance matrix of study-specified factors for each study; (5) A, the loading matrix corresponding to study-shared factors; (6) B, a list composed by the loading matrices corresponding to the study-specified factors; (7) bbeta, the estimated regression coefficient matrix; (8) invLambda, the inverse of the estimated variances of error; (9) ELBO: the ELBO value when algorithm stops; (7) ELBO_seq: the sequence of ELBO values. (11) qrlist, the number of factors and rank of regression coefficient matrix used in fitting; (12) time.use, the elapsed time for model fitting.

Details

None

References

None

See also

Examples

seed <- 1; nvec <- c(100,300); p<- 300;
d <- 3; q<- 3; qs <- rep(2,2)
datlist <- gendata_simu_multi2(seed=seed, nvec=nvec, p=p, d=d, q=3, qs=qs)
XList <- lapply(datlist$Xlist,  function(x) log(1+x))
fit_msfavi <- MSFRVI(XList, ZList = datlist$Zlist, q=3, qs=qs, rank_use = d)
#> iter = 2, ELBO= -21211.074547, dELBO=0.999990 
#> iter = 3, ELBO= -16799.363216, dELBO=0.207991 
#> iter = 4, ELBO= -16303.690459, dELBO=0.029505 
#> iter = 5, ELBO= -20631.652939, dELBO=0.265459 
#> iter = 6, ELBO= -20995.066595, dELBO=0.017614 
#> iter = 7, ELBO= -17430.128737, dELBO=0.169799 
#> iter = 8, ELBO= -19026.311091, dELBO=0.091576 
#> iter = 9, ELBO= -20498.695383, dELBO=0.077387 
#> iter = 10, ELBO= -20453.802235, dELBO=0.002190 
#> iter = 11, ELBO= -21472.038320, dELBO=0.049782 
#> iter = 12, ELBO= -20397.652683, dELBO=0.050036 
#> iter = 13, ELBO= -20493.516657, dELBO=0.004700 
#> iter = 14, ELBO= -20417.979648, dELBO=0.003686 
#> iter = 15, ELBO= -20447.365787, dELBO=0.001439 
#> iter = 16, ELBO= -20393.981237, dELBO=0.002611 
#> iter = 17, ELBO= -20400.621675, dELBO=0.000326 
#> iter = 18, ELBO= -20383.611194, dELBO=0.000834 
#> iter = 19, ELBO= -20379.780252, dELBO=0.000188 
#> iter = 20, ELBO= -20378.378363, dELBO=0.000069 
#> iter = 21, ELBO= -20361.646212, dELBO=0.000821 
#> iter = 22, ELBO= -20360.095826, dELBO=0.000076 
#> iter = 23, ELBO= -20348.389028, dELBO=0.000575 
#> iter = 24, ELBO= -20344.050531, dELBO=0.000213 
#> iter = 25, ELBO= -20342.906873, dELBO=0.000056 
#> iter = 26, ELBO= -20333.236366, dELBO=0.000475 
#> iter = 27, ELBO= -20339.412505, dELBO=0.000304 
#> iter = 28, ELBO= -20323.026282, dELBO=0.000806 
#> iter = 29, ELBO= -20335.098760, dELBO=0.000594 
#> iter = 30, ELBO= -20314.964150, dELBO=0.000990 
str(fit_msfavi)
#> List of 14
#>  $ F        :List of 2
#>   ..$ : num [1:100, 1:3] -0.265 -0.455 0.114 1.453 0.281 ...
#>   ..$ : num [1:300, 1:3] -2.7357 1.1631 -0.6503 -0.0827 -1.2408 ...
#>   ..- attr(*, "dim")= int [1:2] 2 1
#>  $ H        :List of 2
#>   ..$ : num [1:100, 1:2] 0.0844 0.4866 0.8423 -0.2626 -0.5206 ...
#>   ..$ : num [1:300, 1:2] 0.5452 0.0702 -1.0328 0.4039 -0.5555 ...
#>   ..- attr(*, "dim")= int [1:2] 2 1
#>  $ Sf       :List of 2
#>   ..$ : num [1:3, 1:3] 0.0664 0 0 0 0.1029 ...
#>   ..$ : num [1:3, 1:3] 0.0676 0 0 0 0.1047 ...
#>   ..- attr(*, "dim")= int [1:2] 2 1
#>  $ Sh       :List of 2
#>   ..$ : num [1:2, 1:2] 0.146 0 0 0.158
#>   ..$ : num [1:2, 1:2] 0.244 0 0 0.257
#>   ..- attr(*, "dim")= int [1:2] 2 1
#>  $ A        : num [1:300, 1:3] 0.0977 0.0193 0.0627 -0.222 -0.0262 ...
#>  $ B        :List of 2
#>   ..$ : num [1:300, 1:2] 0.262788 -0.126595 -0.000768 -0.009791 -0.196367 ...
#>   ..$ : num [1:300, 1:2] 0.056 -0.0575 -0.121 0.0942 0.0885 ...
#>   ..- attr(*, "dim")= int [1:2] 2 1
#>  $ bbeta    : num [1:300, 1:3] -0.249 -0.276 -0.268 -0.273 -0.326 ...
#>  $ invLambda: num [1:2, 1] 2.07 2.03
#>  $ ELBO     : num -20315
#>  $ dELBO    : num 20.1
#>  $ ELBO_seq : num [1:30] -2.15e+09 -2.12e+04 -1.68e+04 -1.63e+04 -2.06e+04 ...
#>  $ Lambda   : num [1:2, 1] 0.484 0.494
#>  $ qrlist   :List of 3
#>   ..$ q : num 3
#>   ..$ qs: num [1:2] 2 2
#>   ..$ r : num 3
#>  $ time.use : Named num 0.2
#>   ..- attr(*, "names")= chr "elapsed"