Learn R Programming

dnc (version 1.2)

dnc: Dynamic Network Clustering

Description

Perform dynamic network clustering. Either variational Bayes or a Gibbs sampler may be implemented. Setting M=0 performs variational Bayes with no clustering. Returns posterior parameters (if method="VB") or approximate posterior samples (if method="Gibbs"), as well as the MAP estimates, which may be extracted through dncObj$pm.

Usage

dnc(Y,M,p=3,method="VB",init=NULL,hyperparms=NULL,Missing=NULL,
    controls=list(MaxIt=500,epsilon=1e-5,MaxItStg2=100,
                  epsilonStg2=1e-15,nDraws=10000,burnin=1000))

Arguments

Y
Dynamic network data. This should be in the form of a n x n x T array of 1's and 0's. Each slice corresponds to a single time point.
M
Number of communities (may be zero).
p
Dimension of the latent space.
method
Method of estimation, either "VB" for variational Bayes, or "Gibbs" for a Gibbs sampler.
init
(Use of this argument is not recommended) Initial values of the parameters. A named list containing EOm, mu, Sig, Bi0g, Bitbar, Bithk
hyperparms
Hyperparameters. A named list with cc, a0Star, b0Star, a2Star, b2Star, b3Star, GamStar.
Missing
A matrix whose rows correspond to missing dyads. Missing should have three columns: row, column, and time (i.e., the indices for the NA's in Y). May be left as NULL if the missing dyads in
controls
A list of values to control the algorithm. [object Object],[object Object],[object Object],[object Object],[object Object],[object Object]

Value

  • An object of class dnc, for which other methods exist (e.g., methods(class="dnc")). If method="VB" and M=0, [object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object] If method="Gibbs", [object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object] Additionally, each dnc class object comes with a $pm value, which is a list of the MAP estimates for alpha, X, s, tau, r, u, Z, and beta.

Details

This function performs community detection according to the model $$logit(P(Y_{ijt} =1)) = \alpha + s_j X_{it}'X_{jt}$$, $$\pi(X_{it}|Z_{it}=m) = N(r_i {\bf u}_m,\tau^{-1} I_p)$$ While the latent positions, $X_{it}$'s, live in a p-dim Euclidean space, it is more natural to conceptualize these as living on a (hyper-) sphere with the magnitude of the $X_{it}$'s as attached attributes that reflect the actors' individual tendency to send and receive edges. If M=0, then the prior on $X_{it}$ is given by $$\pi(X_{i1}) = N(0,\sigma^2 I_p)$$ $$\pi(X_{it}|X_{i(t-1)}) = N(X_{i(t-1)},\tau_i^{-1} I_p)$$ The variational Bayes approach is typically faster than the Gibbs sampler, but tends to underestimate the spread of the posterior. Currently, only VB is implemented when M=0 (no clustering), hence method will be ignored if M=0. Ignorable missing data can be estimated within the Gibbs sampler (not using the VB algorithm) by adding the extra step of drawing the missing edges given the latent positions and the model parameters at each iteration. Using the init is, in general, strongly discouraged, as this may have a non-negligible negative affect on the performance of the VB or the length of the chain needed to reach convergence. Unless otherwise specified, both the initialization scheme and the hyperparameters are chosen according to Sewell and Chen (2016).

References

Sewell, D. K., and Chen, Y. (2016). Latent Space Approaches to Community Detection in Dynamic Networks. Bayesian Analysis. doi: 10.1214/16-BA1000. http://projecteuclid.org/euclid.ba/1461603847

Examples

Run this code
data(friendship)
  set.seed(123)
  dncObj <- dnc(friendship,M=4,p=3,method="Gibbs",
                controls=list(nDraws=250,burnin=50,
                              MaxItStg2=25,epsilonStg2=1e-15))
  print(dncObj)
  BIC(dncObj)
  par(mar=rep(0,4)+0.05)
  plot(dncObj,plotRGL=FALSE,pch=16,phi=60,lwd=2,cex=1.5)

Run the code above in your browser using DataLab