Learn R Programming

ergm (version 3.8.0)

summary.statistics: Calculation of network or graph statistics

Description

Used to calculate the specified statistics for an observed network if its argument is a formula for an ergm. See ergm-terms for more information on the statistics that may be specified.

Usage

# S3 method for default
summary.statistics(object, response=NULL, …, basis=NULL)
# S3 method for matrix
summary.statistics(object, response=NULL, …, basis=NULL)
# S3 method for network
summary.statistics(object, response=NULL, …, basis=NULL)
# S3 method for network.list
summary.statistics(object, response=NULL, …, basis=NULL)
# S3 method for formula
summary.statistics(object, …, basis=NULL)
# S3 method for ergm
summary.statistics(object, …, basis=NULL)

Arguments

object

Either an R formula object (see above) or an ergm model object. In the latter case, summary.statistics is called for the object$formula object. In the former case, object is of the form y ~ <model terms>, where y is a network object or a matrix that can be coerced to a network object. For the details on the possible <model terms>, see ergm-terms. To create a network object in R, use the network() function, then add nodal attributes to it using the %v% operator if necessary.

response

Name of the edge attribute whose value is to be modeled. Defaults to NULL for simple presence or absence, modeled via binary ERGM terms. Passing anything but NULL uses valued ERGM terms.

basis

An optional network object relative to which the global statistics should be calculated.

further arguments passed to or used by methods.

Value

A vector of statistics measured on the network.

Details

If object is of class formula, then summary may be used in lieu of summary.statistics because summary.formula calls the summary.statistics function. The function actually cumulates the change statistics when removing edges from the observed network one by one until the empty network results. Since each model term has a prespecified value (zero by default) for the corresponding statistic(s) on an empty network, these change statistics give the absolute statistics on the original network.

summary.formula for networks understands the lasttoggle "API".

See Also

ergm, network, ergm-terms

Examples

Run this code
# NOT RUN {
#
# Lets look at the Florentine marriage data
#
data(florentine)
#
# test the summary.statistics function
#
summary(flomarriage ~ edges + kstar(2))
m <- as.matrix(flomarriage)
summary(m ~ edges)  # twice as large as it should be
summary(m ~ edges, directed=FALSE) # Now it's correct
# }

Run the code above in your browser using DataLab