expSBM (version 1.0)

expSBM_EM: expSBM_EM

Description

Runs the variational expectation maximization algorithm for a given number of latent groups.

Usage

expSBM_EM(N, edgelist, Z, lambda, mu, nu, directed = F, trunc = T, 
          tol = 0.001, n_iter_max = 100, verbose = F)

Arguments

N

Number of nodes.

edgelist

A matrix with 4 columns: on the first column the sender node, on the second the receiver, on the third either a one or zero to indicate whether it is an interaction or a non-interaction respectively, on the fourth the corresponding exponential length.

Z

A NxK matrix indicating a soft clustering of the nodes into the K latent groups. The generic entry in position [i,k] represents the posterior probability that node i belongs to group k.

lambda

Mixing proportions of the latent groups.

mu

A matrix of size KxK indicating the exponential rates for the interaction lengths, for each pair of groups. Must be a symmetric matrix if directed is false.

nu

A matrix of size KxK indicating the exponential rates for the non-interaction lengths, for each pair of groups. Must be a symmetric matrix if directed is false.

directed

TRUE or FALSE indicating whether interactions have an orientation or not.

trunc

TRUE or FALSE indicating whether the first and last interactions or non-interactions for every edge are assumed to be truncated or not.

tol

Stop the maximization if the relative increase in the objective function is not larger than this value.

n_iter_max

Stop the maximization if the number of iterations is larger than this value. This parameter can be set to zero or one for debug purposes.

verbose

TRUE or FALSE indicating whether a lengthy output should be printed out.

Value

computing_time

Number of seconds required for the evaluation.

elbo_values

Stored values of the objective function at each iteration.

Z_star

Optimal soft clustering of the nodes into the groups.

lambda_star

Optimal mixing proportions.

mu_star

Optimal group-specific parameters for the exponential rates of the interaction lengths.

nu_star

Optimal group-specific parameters for the exponential rates of the non-interaction lengths.

Examples

Run this code
# NOT RUN {
set.seed(1)
data(high_school)
K <- 4
lambda_init <- rep(1/K,K)
Z_init <- expSBM_init(high_school$edgelist, K, soft = TRUE)$Z
mu_init <- nu_init <- matrix(1,K,K)
expSBM_EM(N = 327, high_school$edgelist, Z_init, lambda_init, mu_init, nu_init)
# }

Run the code above in your browser using DataLab