Learn R Programming

ergm (version 2.4-2)

ergmMPLE: ERGM Predictors and response for logistic regression calculation of MPLE

Description

Return the predictor matrix, response vector, and vector of weights that can be used to calculate the MPLE for an ERGM.

Usage

ergmMPLE (formula, fitmodel=FALSE, control=control.ergm(),
          verbose=FALSE, ...)

Arguments

formula
An ergm formula. See ergm.
fitmodel
Logical: Should the MPLE be found? If fitmodel==TRUE, then ergmMPLE simply calls the ergm function with the MPLEonly=TRUE option set. If fitmo
control
A list of control parameters for tuning the fitting of an ERGM. Most of these parameters are irrelevant in this context. See control.ergm for details about all of the control param
verbose
Logical; if TRUE, the program will print out some additional information.
...
Additional arguments, to be passed to lower-level functions.

Value

  • If fitmodel==FALSE, a list with three elements, called "response", "predictor", and "weights". If fitmodel==TRUE, an object of class ergm that gives the fitted pseudolikelihood model.

Details

The MPLE for an ERGM is calculated by first finding the matrix of change statistics. Each row of this matrix is associated with a particular pair (ordered or unordered, depending on whether the network is directed or undirected) of nodes, and the row equals the change in the vector of network statistics (as defined in formula) when that pair is toggled from a 0 (no edge) to a 1 (edge), holding all the rest of the network fixed. The MPLE results if we perform a logistic regression in which the predictor matrix is the matrix of change statistics and the response vector is the observed network (i.e., each entry is either 0 or 1, depending on whether the corresponding edge exists or not). To save space, the algorithm will automatically search for any duplicated rows in the predictor matrix (and corresponding response values). Thus, the ergmMPLE function will return three items: A response vector, a predictor matrix, and a vector of weights, which are really counts that tell how many times each corresponding response, predictor pair is repeated.

Using fitmodel=FALSE, note that the result of the fit may be obtained from the glm function, as shown in the examples below.

See Also

ergm, glm

Examples

Run this code
data(faux.mesa.high)
formula <- faux.mesa.high ~ edges + nodematch("Sex") + nodefactor("Grade")
mplesetup <- ergmMPLE(formula)

# Obtain MPLE coefficients "by hand":
glm(mplesetup$response ~ . - 1, data = data.frame(mplesetup$predictor), 
    weights = mplesetup$weights, family="binomial")$coefficients

# Check that the coefficients agree with the output of the ergm function:
ergmMPLE(formula, fitmodel=TRUE)$coef

Run the code above in your browser using DataLab