Skip to contents

Main algorithm for LBM estimation using binary data

Usage

fit_unsupervised_LBM(
  connectivity,
  estimOptions = list(),
  exploOptions = list()
)

Arguments

connectivity

binary connectivity

estimOptions

list of options about estimation

exploOptions

list of options about exploration

Value

List of model with different number of cluster

Examples

n1 = 100
n2 = 100
Q1=3
Q2=3
alpha1=c(.25,0.25, .5)
alpha2=c(0.10,0.4,0.5)
P <- matrix(c(0.9,0.6,0.4,0.7,0.5,0.3,0.5,0.3,0.1), Q1, Q2)
simulation1=robber::simulate_lbm(P,alpha1,alpha2,n1,n2)
M = simulation1$A
Z1 =simulation1$Z
Z2 =simulation1$W
G= 300
lambda_i =rbeta(n1,0.3,1.5)
mu_j = rbeta(n2,0.3,1.5)
lambda_i = lambda_i/max(lambda_i)
mu_j = mu_j/max(mu_j)
N0=lambda_i%*%t(mu_j)
N0 = N0*G
N=matrix(rpois(n1*n2,N0),nrow=n1)
R = M*N
obsrow = rowSums(R)>0
obscol = colSums(R)>0
R_obs = R[obsrow,obscol]
M_obs = M[obsrow,obscol]
R = M*N
models=fit_unsupervised_LBM(R,exploOptions=list(plot=F))
#> [1] "k={ 1 , 1 }"
#> [1] "k={ 2 , 1 }"
#> [1] "k={ 1 , 2 }"
#> [1] "k={ 2 , 2 }"
#> [1] "k={ 3 , 1 }"
#> [1] "k={ 3 , 2 }"
#> [1] "k={ 1 , 3 }"
#> [1] "k={ 2 , 3 }"
#> [1] "k={ 3 , 3 }"
#> [1] "k={ 4 , 1 }"
#> [1] "k={ 4 , 2 }"
#> [1] "k={ 4 , 3 }"
#> [1] "k={ 1 , 4 }"
#> [1] "k={ 2 , 4 }"
#> [1] "k={ 3 , 4 }"
#> [1] "k={ 4 , 4 }"
#> [1] "k={ 5 , 1 }"
#> [1] "k={ 5 , 2 }"
#> [1] "k={ 5 , 3 }"
#> [1] "k={ 5 , 4 }"
#> [1] "k={ 1 , 5 }"
#> [1] "k={ 2 , 5 }"
#> [1] "k={ 3 , 5 }"
#> [1] "k={ 4 , 5 }"
#> [1] "k={ 5 , 5 }"
#> [1] "k={ 6 , 1 }"
#> [1] "k={ 6 , 2 }"
#> [1] "k={ 6 , 3 }"
#> [1] "k={ 6 , 4 }"
#> [1] "k={ 6 , 5 }"
#> [1] "LBM : Best model has been fitted with 4-3 groups."