summary_formula: Dispatching a summary function based on the class of the LHS...

View source: R/summary.statistics.network.R

summary_formulaR Documentation

Dispatching a summary function based on the class of the LHS of a formula.

Description

The generic summary_formula() (note the underscore) expects a formula argument and will attempt to identify the class of the LHS of the formula and dispatch to the appropriate summary_formula method.

Usage

summary_formula(object, ..., basis = NULL)

## S3 method for class 'ergm'
summary_formula(object, ..., basis = NULL)

## S3 method for class 'network.list'
summary_formula(object, response = NULL, ..., basis = eval_lhs.formula(object))

## S3 method for class 'network'
summary_formula(object, response = NULL, ..., basis = ergm.getnetwork(object))

## S3 method for class 'ergm_state'
summary_formula(object, ..., basis = NULL)

## S3 method for class 'matrix'
summary_formula(object, response = NULL, ..., basis = ergm.getnetwork(object))

## Default S3 method:
summary_formula(object, response = NULL, ..., basis = ergm.getnetwork(object))

Arguments

object

A two-sided formula.

...

further arguments passed to or used by methods.

basis

Optional object of the same class as the LHS of the formula, substituted in place of the LHS.

response

Either a character string, a formula, or NULL (the default), to specify the response attributes and whether the ERGM is binary or valued. Interpreted as follows:

NULL

Model simple presence or absence, via a binary ERGM.

character string

The name of the edge attribute whose value is to be modeled. Type of ERGM will be determined by whether the attribute is logical (TRUE/FALSE) for binary or numeric for valued.

a formula

must be of the form NAME~EXPR|TYPE (with | being literal). EXPR is evaluated in the formula's environment with the network's edge attributes accessible as variables. The optional NAME specifies the name of the edge attribute into which the results should be stored, with the default being a concise version of EXPR. Normally, the type of ERGM is determined by whether the result of evaluating EXPR is logical or numeric, but the optional TYPE can be used to override by specifying a scalar of the type involved (e.g., TRUE for binary and 1 for valued).

Value

A vector of statistics measured on the network.

Methods (by class)

  • summary_formula(ergm): an ergm fit method, extracting its model from the fit.

  • summary_formula(network.list): a method for a network.list on the LHS of the formula.

  • summary_formula(network): a method for a network on the LHS of the formula.

  • summary_formula(ergm_state): a method for the semi-internal ergm_state on the LHS of the formula.

  • summary_formula(matrix): a method for a matrix on the LHS of the formula.

  • summary_formula(default): a fallback method.

See Also

ergm(), network(), ergmTerm

summary.ergm_model()

Examples


#
# Lets look at the Florentine marriage data
#
data(florentine)
#
# test the summary_formula 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


ergm documentation built on May 31, 2023, 8:04 p.m.