pl_est_com: Fits the stochastic block model using maximum...

Description Usage Arguments Value References Examples

View source: R/pl_est_com.R

Description

Fits the stochastic block model using maximum pseudolikelihood estimation, as proposed by Amini et. al. (2013). This function implements the conditional pseudolikelihood algorithm from Amini et al. (2013).

Usage

1
pl_est_com(X, K = NULL, max.iter = 1000, tol = 1e-08, parallel = FALSE)

Arguments

X

n x n adjacency matrix

K

number of communities; by default, chosen using the method of Le and Levina (2015)

max.iter

maximum number of iterations for the EM algorithm

tol

the EM algorithm stops when the relative tolerance is less than this value

parallel

An optional argument allowing for parallel computing using the doParallel package

Value

A list containing the following components:

eta

Estimate of eta, a K x K matrix defined in Amini et. al. (2013)

pi

Estimate of the community membership probabilities

ploglik

The maximum of the pseudolikelihood function

logphi

n x K matrix, where (i, k)th entry contains the log p.m.f. of a multinomial random variable with probability vector eta_k (the kth row of eta), evaluated at b_i, which is the ith row of the block compression matrix defined in Amini et. al. (2013)

responsibilities

n x K matrix containing the responsibilities/soft cluster memberships for the n nodes

class

A vector containing n (hard) cluster memberships for the n nodes

converged

whether the algorithm converged to the desired tolerance

References

Amini, A. A., Chen, A., Bickel, P. J., & Levina, E. (2013). Pseudo-likelihood methods for community detection in large sparse networks. The Annals of Statistics, 41(4), 2097-2122.

Le, C. M., & Levina, E. (2015). Estimating the number of communities in networks by spectral methods. arXiv preprint arXiv:1507.00827.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
# 50 draws from a stochastic block model for two network data views 
# where the communities are dependent
n <- 50
Pi <- diag(c(0.5, 0.5))
theta1 <- rbind(c(0.5, 0.1), c(0.1, 0.5))
theta2 <- cbind(c(0.1, 0.5), c(0.5, 0.1))

dat <- mv_sbm_gen(n, Pi, theta1, theta2)

# Fit SBM to view 1
results <- pl_est_com(X=dat$data$view1, K = 2)
table(results$class, dat$communities$view1)

multiviewtest documentation built on Oct. 13, 2021, 5:08 p.m.