A faster approximate alternative to using latentnet. Interfaces C code to fit a Variational Bayes approximation to the posterior for the Latent Position Cluster Model for networks.
This package is designed to be used as an alternative to the latentnet package when network size computationally prohibits latentnet. It uses a Variational Bayesian Expectation Maximisation algorithm to compute a closed-form approximation to the posterior that the ergmm function in latentnet samples from. It may be thought of as an intermediary approximation that is more accurate than the two-stage MLE fit provided by latentnet but a faster approximation to the MCMC sampler provided by latentnet. In fact, the VB iterations also converge quicker than the two-stage MLE.
Furthermore, VBLPCM takes advantage of the stratified sampler of Adrian Raftery, Xiaoyue Niu, Peter Hoff and Ka Yee Yeung. This approximation to the (log)likelihood allows for even larger networks to be analysed (see tech report).
library(igraph)
g<-read.graph("path_to_downloaded_graphml_file",format="graphml") ### load the network using igraph
net<-network(get.adjacency(g),directed=FALSE) ### Convert to a network:
network.vertex.names(net)<-igraph::get.vertex.attribute(g,"id") ### Add in the names
v.fit<-vblpcmfit(vblpcmstart(net,G=G,d=d)) ### Fit the model to the network, choosing G and d
plot(v.fit) ### Plot it
vblpcmgroups(v.fit) ### Show the point estimates of the groups