Learn R Programming

latentnet (version 0.6-0)

latentnet: Latent position and cluster models for networks

Description

The package statnet is used to fit linear exponential random network models, in which the probability of a given network, $g$, on a set of nodes is $\exp(\theta^{T}S(g))/c(\theta)$, where $S(g)$ 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. ergm can return either a maximum pseudo-likelihood estimate or an approximate MLE based on a Monte Carlo scheme.

The package latentnet adds latent variable models to the traditional exponential random network models. These latent models are fit using the ergm function that is also used by statnet. See http://www.csde.washington.edu/statnet.

The ergm specifies models via: g ~ where g is a network object For the list of possible , see the Model Terms section of the ergm function.

Arguments

...
Specific to the latent variable model terms.

Value

  • ergm returns an object of class 'ergm' that is a list.

Details

The arguments in the ergm function specific to latent variable models are latent.control. See the help page for ergm for the details.

The result of a latent variable model fit is an ergm object. Hence the summary, print, and plot functions apply to the fits. The plot.ergm function has many options specific to latent variable models. See the help page for plot.ergm for the details.

References

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.

See Also

latent, latentcluster, sna, network, terms.ergm

Examples

Run this code
#
# 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 <- ergm(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 <- ergm(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)
add.contours(samp.fit,nlevels=8,lwd=2)
points(samp.fit$Z.mkl,pch=19,col=samp.fit$class)

Run the code above in your browser using DataLab