| ergmuserterms-package {ergm} | R Documentation |
The ergm package is capable of fitting a wide range of
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 fits these models when they are expressed
via an R formula object, of the form
y ~ <model terms>,
where y is a network object or a matrix that can be
coerced to a network object.
To create a
network object in R, use the network() function,
then add nodal attributes to it using the %v%
operator if necessary.
The ergm package contains a wide range of terms.
For the details on the possible
<model terms>, see ergm-terms.
This package can be modified by users to add user-defined terms to ergm
models.
The terms can be used throughout the ergm package
and behave identically to the supplied terms.
The ergmuserterms package is available from the statnet
website (http://statnetproject.org).
The code contains some simple examples and templates. These include:
m2starkstar(2). This
option adds one statistic to the model, equal to the
number of mixed-2-stars in the network, defined as a
pair of edges {(i{rightarrow}j), (j{rightarrow}k)}.
testmeedges is isomorphic to kstar(1); for
directed networks, edges is isomorphic to both ostar(1)
and istar(1).
In the implementation of ergm, the model is initialized in R,
then all the model information is passed to a C program that generates
the sample of graph statistics using MCMC. This sample is then returned
to R, which then approximates the MLE.
ergm, network, ergm-terms
## Not run: library(ergmuserterms) data(sampson) monk.fit <- ergm(samplike~m2star) summary(monk.fit) monk.fit <- ergm(samplike ~ m2star + testme) summary(monk.fit) ## End(Not run)