| latentnet {latentnet} | R Documentation |
By way of context, the package statnet is used to fit linear exponential random network
models, in which the probability of a given network, y,
on a set of nodes is exp(theta{cdot}g(y))/c(theta),
where g(y) is a vector of network statistics, theta
is a parameter vector of the same length and c(theta)
is the normalizing constant for the distribution. The ergm
function can return either a maximum pseudo-likelihood estimate or
an approximate MLE based on a Monte Carlo scheme.
For details, see http://www.csde.washington.edu/statnet.
The package latentnet adds latent variable models
to the traditional
exponential random network models. These latent models are
fit using the ergmm function.
The ergmm specifies models via: y ~ <model terms>
where y is a network object.
For the list of possible <model terms>, see
the manual pages for terms.ergmm.
... |
Specific to the latent variable model terms. |
ergmm returns an object of class ergmm that
is a list.
Peter D. Hoff, Adrian E. Raftery and Mark S. Handcock. Latent space approaches to social network analysis. Journal of the American Statistical Association, Dec 2002, Vol.97, Iss. 460; pg. 1090-1098.
Mark S. Handcock, Adrian E. Raftery and Jeremy Tantrum. Model-Based Clustering for Social Networks. Working Paper Number 46, Center for Statistics and the Social Sciences, University of Washington, April 2005.
ergmm, latent, latentcluster, sna, network, terms.ergmm
#
# Using Sampson's Monk data, lets fit a
# simple latent position model
#
data(sampson)
#
# Get the group labels
samp.labs <- substr(get.vertex.attribute(samplike,"group"),1,1)
#
samp.fit <- ergmm(samplike ~ latent(k=2), burnin=10000,
MCMCsamplesize=2000, interval=30)
#
# See if we have convergence in the MCMC
mcmc.diagnostics(samp.fit)
#
# Plot the fit
#
plot(samp.fit,label=samp.labs, vertex.col="group")
#
# Using Sampson's Monk data, lets fit a latent clustering model
#
samp.fit <- ergmm(samplike ~ latentcluster(k=2, ngroups=3), burnin=10000,
MCMCsamplesize=2000, interval=30)
#
# See if we have convergence in the MCMC
mcmc.diagnostics(samp.fit)
#
# Lets look at the goodness of fit:
#
plot(samp.fit,label=samp.labs, vertex.col="group")
plot(samp.fit,pie=TRUE,label=samp.labs)
plot(samp.fit,density=c(2,2))
plot(samp.fit,contours=5,contour.color="red")
plot(samp.fit,density=TRUE,drawarrows=TRUE)
ergmm.add.contours(samp.fit,nlevels=8,lwd=2)
points(samp.fit$Z.mkl,pch=19,col=samp.fit$class)