multipartiteBM: Model selection and parameter estimation of MBM

View source: R/multipartiteBM.R

multipartiteBMR Documentation

Model selection and parameter estimation of MBM

Description

Select the number of blocks and identify the blocks per functional group using a variational EM algorithm

Usage

multipartiteBM(
  list_Net,
  v_distrib = NULL,
  namesFG = NULL,
  v_Kmin = 1,
  v_Kmax = 10,
  v_Kinit = NULL,
  initBM = TRUE,
  keep = FALSE,
  verbose = TRUE,
  nbCores = NULL,
  maxiterVE = NULL,
  maxiterVEM = NULL
)

Arguments

list_Net

a list of networks (defined via the function defineNetwork) i.e. a multipartite network

v_distrib

an optional vector of characters of length the number of networks and specifying the distribution used in each network (possible values bernoulli,poisson,gaussian,laplace). If not provided, the model will be 'bernoulli' for all the interactions matrices.

namesFG

an optional vector of characters containing the names of functional groups (FG) (If Specified, must correspond to the names in list_Net).

v_Kmin

an optional vector of integers, specifying the minimal number of blocks per functional group (must be provided in the same order as in namesFG). v_Kmin may be a single value (same minimal number of blocks for all the FGs) or a vector with size equal to the number of FGs. Default value = 1.

v_Kmax

an optional vector of integers specifying the maximal number of blocks per functional group provided in the same order as in namesFG. v_Kmax may be a single value (same maximal number of blocks for all the FGs) or a vector with size equal to the number of FGs. Default value = 10.

v_Kinit

an optional vector of integers specifying initial numbers of blocks per FG provided in the same order as in namesFG. if v_Kinit is not specified, then v_Kinit = v_Kmin

initBM

an optional boolean. If initBM = TRUE an aditional initialisation is done using simple LBM or SBM on each network separatly. Default value = TRUE

keep

an optional boolean. If TRUE return the estimated parameters for intermediate visited models. Otherwise, only the better model (in ICL sense) is the ouput. Default value = FALSE.

verbose

an optional boolean. If TRUE, display the current step of the search algorithm

nbCores

an optional integer specifying the number or cores used for the estimation. Not parallelized on windows. If ncores = NULL, then half of the cores are used.

maxiterVE

an optional integer specifying the maximum number of iterations in the VE step of the VEM algorithm. If NULL then default value = 1000

maxiterVEM

an optional integer specifying the maximum number of iterations of the VEM algorithm. If NULL then default value Default value = 1000

Details

The function multipartiteBM selects the better numbers of blocks in each FG (with a penalized likelihood criterion). The model selection is performed with a forward backward strategy and the likelihood of each model is maximized with a variational EM).

Value

a list of estimated parameters for the different models ordered by decreasing ICL. If keep = FALSE, the length is of length 1 (only the better model is returned).

fittedModel

contains the results of the inference. res$fittedModel[[1]] is a list with fields

paramEstim

a MBMfit object.

ICL

the penalized likelihood criterion ICL.

vJ

the sequence of the varational bound of the likelihood through iterations of the VEM.

convergence

TRUE if the VEM reached convergence.

list_Net

contains the data.

Examples

namesFG <- c('A','B')
list_pi <- list(c(0.5,0.5),c(0.3,0.7)) # prop of blocks in each FG
E  <-  rbind(c(1,2),c(2,2)) # architecture of the multipartite net.
typeInter <- c( "inc","diradj")
v_distrib <- c('gaussian','bernoulli')
list_theta <- list()
list_theta[[1]] <- list()
list_theta[[1]]$mean  <- matrix(c(6.1, 8.9, 6.6, 3), 2, 2)
list_theta[[1]]$var  <-  matrix(c(1.6, 1.6, 1.8, 1.5),2, 2)
list_theta[[2]] <- matrix(c(0.7,1.0, 0.4, 0.6),2, 2)
list_Net <- rMBM(v_NQ = c(30,30),E , typeInter, v_distrib, list_pi,
                list_theta, namesFG = namesFG, seed = 2)$list_Net
res_MBMsimu <- multipartiteBM(list_Net, v_distrib,
                              namesFG = c('A','B'), v_Kinit = c(2,2),
                              nbCores = 2,initBM = FALSE)

Demiperimetre/GREMLIN documentation built on March 14, 2023, 12:55 p.m.