Learn R Programming

latentnet (version 0.6-0)

latentcluster: Latent cluster models for networks

Description

latentcluster() is a term to the function ergm to fit a latent postion model to a given network, $g$. ergm returns a Bayesian model fit based on a Monte Carlo scheme The default prior specifications are diffuse. An approximate MLE fit is also returned.

The ergm specifies models via: g ~ latentcluster() where g is a network object For the list of possible , see below.

Usage

latentcluster(k=2, ngroups, z.prior.mu=0, z.prior.sd=10, b.delta=0.5,
               b.prior.mu=0, b.prior.sd=10,
               Sigprior = qchisq(0.05,3),
               muSigprior = 2, dirprior=3,
               alphaprior=3,
               chisqprop = 6, thetaprop=0.1, ...)

Arguments

k
Dimension of the latent space.
ngroups
Number of clusters in the latent space.
z.prior.mu
Prior mean for each dimension of the latent positions. If a constant is passed it is used for each dimension.
z.prior.sd
Prior standard deviation for each dimension of the latent positions. If a constant is passed it is used for each dimension.
b.delta
Standard deviation of the deviance for covariate parameters. If a constant is passed it is used for each dimension.
b.prior.mu
Prior mean for the covariate parameters. If a constant is passed it is used for each dimension.
b.prior.sd
Prior standard deviation for the covariate parameters. If a constant is passed it is used for each dimension.
Sigprior
Prior standard deviations for the node positions relative to the cluster mean. If a constant is passed it is used for each dimension.
muSigprior
Prior standard deviations for the node positions relative to the cluster mean. If a constant is passed it is used for each dimension.
dirprior
Prior standard deviations for the node positions relative to the cluster mean. If a constant is passed it is used for each dimension.
alphaprior
Prior standard deviations for the node positions relative to the cluster mean. If a constant is passed it is used for each dimension.
chisqprop
Prior standard deviations for the node positions relative to the cluster mean. If a constant is passed it is used for each dimension.
thetaprop
Prior standard deviations for the node positions relative to the cluster mean. If a constant is passed it is used for each dimension.
...
Specific to the model term.

Value

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

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, plot.ergm, 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)
#
# 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