Learn R Programming

ergm (version 2.0-5)

ergmuserterms-package: Add Statistics Terms for the 'ergm' Package

Description

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 Rformula object, of the form y ~ , 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 , 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.

Arguments

Details

The ergmuserterms package is available from the statnet website (http://statnetproject.org).

The code contains some simple examples and templates. These include: m2star{Mixed 2-stars, a.k.a. 2-paths. This option can only be specified with a directed network; for undirected graphs see kstar(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)}.$ }

testme{A clone of Edges. This is included for purposes of an example. This option adds one graph statistic equal to the number of edges in the graph. For undirected graphs, edges 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.

See Also

ergm, network, ergm-terms

Examples

Run this code
library(ergmuserterms)
data(sampson)
monk.fit <- ergm(samplike~m2star)
summary(monk.fit)

monk.fit <- ergm(samplike ~ m2star + testme)
summary(monk.fit)

Run the code above in your browser using DataLab