Learn R Programming

ergm (version 3.8.0)

ergm.Cprepare: Internal Function to Prepare Data for ergm's C Interface

Description

These are internal functions not intended to be called by end users. The ergm.Cprepare function builds an object called Clist that contains all the necessary ingredients to be passed to the C functions, other functions create edgelists and handle missing edge data.

Usage

ergm.Cprepare(nw, m, response = NULL)

ergm.Cprepare.el(x, attrname=NULL, prototype=NULL)

ergm.Cprepare.miss(nw)

ergm.design(nw, model, verbose = FALSE)

Arguments

nw,x

a network object

m,model

a model object, as returned by ergm.getmodel

response,attrname

character name of an edge attribute

prototype

A network whose relevant attributes (size, directedness, bipartitedness, and presence of loops) are imposed on the output edgelist if x is already an edgelist. (For example, if the prototype is undirected, ergm.Cprepare.el will ensure that \(t < h\).)

verbose

logical, whether the design matrix should be printed; default=FALSE

Value

ergm.Cprepare returns Clist: a list of parameters used by several of the fitting routines containing

  • n : the size of the network

  • dir : whether the network is directed (T or F)

  • bipartite : whether the network is bipartite (T or F)

  • ndyads : the number of dyads in the network

  • nedges : the number of edges in this network

  • tails : the vector of tail nodes; tail nodes are the 1st column of the implicit edgelist, so either the lower-numbered nodes in an undirected graph, or the out nodes of a directed graph, or the b1 nodes of a bi- partite graph

  • heads : the vector of head nodes; head nodes are the 2nd column of the implicit edgelist, so either the higher-numbered nodes in an undirected graph, or the in nodes of a directed graph, or the b2 nodes of a bi- partite graph

  • nterms : the number of model terms

  • nstats : the total number of change statistics for all model terms

  • inputs : the concatenated vector of 'input's from each model term as returned by <InitErgmTerm.X> or <InitErgm.X>

  • fnamestring : the concatenated string of model term names

  • snamestring : the concatenated string of package names that contain the C function 'd_fname'; default="ergm" for each fname in fnamestring

ergm.design returns: Clist.miss

  • if 'nw' has missing edges, see the return list, 'Clist', from the ergm.Cprepare function header

  • if 'nw' hasn't any missing edges, the list will only contain NULL values for the 'tails' and 'heads' components, a 0 for 'nedges' and 'dir' appropriately set

ergm.Cprepare.miss returns a vector of length 1+Nmissing*2. The first element is the number of missing edges, and the remainder a column-major edgelist

Details

These low-level functions are used by other ergm-related packages, but should never need to be called directly by the user.

  • ergm.Cprepare builds an object called Clist that contains all the necessary ingredients to be passed to the C functions

  • ergm.Cprepare.el constructs and serializes a very simple static edgelist, with the vertex having the lesser index the tail and sorted by tails, then by heads.

  • ergm.Cprepare.miss constructs an edgelist as ergm.Cprepare.el, but only includes 'missing' edges (marked as NA)

  • ergm.design functions as ergm.Cprepare would, but acts on the network of missing edges