Learn R Programming

latentnet (version 2.0)

ergmm: Fit a Latent Space Random Graph Model

Description

ergmm is used to fit latent space and latent space cluster random network models, as described in Hoff, Raftery and Handcock (2002), Handcock, Raftery and Tantrum (2005), and the article we are working on. ergmm can return either a Bayesian model fit or the two-stage MLE.

Usage

ergmm(formula, response=NULL, family="Bernoulli.logit",fam.par=NULL,
      control=ergmm.control(), user.start=ergmm.par.blank(), prior=ergmm.par.blank(),
      tofit=c("pmode", "mcmc", "mkl", "mkl.mbc", "mle","procrustes",
      "klswitch"), Z.ref=NULL, Z.K.ref=NULL, seed=NULL,
      orthogonalize=FALSE,
      verbose=FALSE)

Arguments

formula
An Rformula object, of the form g ~ + ..., where g is a network object or a matrix that can be coerced to a network object, and , , etc., are each terms
response
An optional edge attribute that serves as the response variable. By default, presence (1) or absence (0) of an edge in g is used.
family
A character vector that is one of "Bernoulli" (the default), "binomial", or "Poisson", specifying the conditional distribution of each edge value. See Details for more information.
fam.par
For those families that require additional parameters, a list.
control
The MCMC parameters that do not affect the posterior distribution such as the sample size, the proposal variances, and tuning parameters, in the form of a named list. See ergmm.control for
user.start
An optional initial configuration parameters for MCMC in the form of a list. By default, posterior mode conditioned on cluster assignments is used. It is permitted to only supply some of the parameters of a configuration. If this is done, the
prior
The prior parameters for the model being fitted in the form of a named list or an ergmm.par. See terms.ergmm for the names to use. If given, will overri
tofit
A character vector listing some subset of "pmode", "mcmc", "mkl", "mkl.mbc", "mle","procrustes", and "klswitch", defaulting to all of the above, instructing ergmm what should be returned as
Z.ref
If given, used as a reference for Procrustes analysis.
Z.K.ref
If given, used as a reference for label-switching.
seed
If supplied, random number seed.
verbose
If this is TRUE (or 1), causes information to be printed out about the progress of the fitting, particularly initial value generation. Higher values lead to greater verbosity.
orthogonalize
EXPERIMENTAL. Performs Gramm-Schmidt orthogonalization on covariates passed to the model to reduce dependence. This capacity may be obsoleted in the future by the use of correlated proposals.

Value

  • ergmm returns an object of class ergmm containing the information about the posterior.

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; pp. 1090-1098. Mark S. Handcock, Adrian E. Raftery and Jeremy Tantrum. Model-Based Clustering for Social Networks. Journal of the Royal Statistical Society: Series A, 2007, Vol. 170, Iss. 2; pp. 301-354.

See Also

network, set.vertex.attributes, set.network.attributes, summary.ergmm, print.ergmm,terms.ergmm

Examples

Run this code
#
# Use 'data(package = "latentnet")' to list the data sets in a
#
data(package="latentnet")
#
# Using Sampson's Monk data, lets fit a 
# simple latent position model
#
data(sampson)
#
# Get the group labels
#

samp.fit <- ergmm(samplike ~ latent(d=2))
#
# See if we have convergence in the MCMC
mcmc.diagnostics(samp.fit)
#
# Plot the fit
#
plot(samp.fit)
#
# Using Sampson's Monk data, lets fit a latent clustering model
#
samp.fit <- ergmm(samplike ~ latent(d=2, G=3))
#
# See if we have convergence in the MCMC
mcmc.diagnostics(samp.fit)
#
# Lets look at the goodness of fit:
#
plot(samp.fit)
plot(samp.fit,pie=TRUE)
summary(samp.fit)

Run the code above in your browser using DataLab