| Title: | Fit, Simulate and Diagnose Exponential-Family Models for Multiple or Multilayer Networks |
|---|---|
| Description: | A set of extensions for the 'ergm' package to fit multilayer/multiplex/multirelational networks and samples of multiple networks. 'ergm.multi' is a part of the Statnet suite of packages for network analysis. See Krivitsky, Koehly, and Marcum (2020) <doi:10.1007/s11336-020-09720-7> and Krivitsky, Coletti, and Hens (2023) <doi:10.1080/01621459.2023.2242627>. |
| Authors: | Pavel N. Krivitsky [aut, cre] (ORCID: <https://orcid.org/0000-0002-9101-3362>), Mark S. Handcock [ctb], David R. Hunter [ctb], Chad Klumb [ctb], Pietro Coletti [ctb], Joyce Cheng [ctb] |
| Maintainer: | Pavel N. Krivitsky <[email protected]> |
| License: | GPL-3 + file LICENSE |
| Version: | 0.3.0-4278 |
| Built: | 2026-05-21 10:55:40 UTC |
| Source: | https://github.com/statnet/ergm.multi |
A set of extensions for the 'ergm' package to fit multilayer/multiplex/multirelational networks and samples of multiple networks. 'ergm.multi' is a part of the Statnet suite of packages for network analysis. See Krivitsky, Koehly, and Marcum (2020) doi:10.1007/s11336-020-09720-7 and Krivitsky, Coletti, and Hens (2023) doi:10.1080/01621459.2023.2242627.
Also known as multiplex, multirelational, or multivariate networks, in a multilayer network a pair of actors can have multiple simultaneous relations of different types. For example, in the Lazega lawyer data set included with this package, each pair of lawyers in the firm can have an advice relationship, a coworking relationship, a friendship relationship, or any combination thereof. Application of ERGMs to multilayer networks has a long history (Pattison and Wasserman 1999; Lazega and Pattison 1999), and a number of R packages exist for analysing and estimating them.
ergm.multi implements the general approach of Krivitsky et al. (2020) for specifying multilayer ERGMs, including Layer Logic and the various cross-layer specifications. Its features include:
ergm():Multilayer
specification is contained entirely in an ergm()-style formula and can be
nested with any other ergm() terms, including dynamic and multi-network.
The number of layers in the modeled network is limited only by computing power.
Any valid binary ERGM can be specified for any layer or a logical combination of layers using simple term operators.
A network can have directed and undirected layers, which can be modeled jointly.
With some care, it is possible to specify models for unipartite and bipartie layers over different subsets of actors, which can be used to specify multimode models.
See Layer() and L() (ergmTerm?L) for
examples.
Joint modeling of independent samples of networks on disjoint sets of actors have a long history as well (Zijlstra et al. 2006, Slaughter and Koehly 2016, Stewart et al. 2019, and Vega Yon et al. 2021, for example). ergm.multi facilitates fixed-effect models for samples of networks (possibly heterogeneous in size and composition), using a multivariate linear model for each network's ERGM parameters, with network-level attributes serving as predictors, as formulated by Slaughter and Koehly (2016) and Krivitsky et al. (2023).
Its features include:
ergm():Multi-network model
specification is contained entirely in an ergm()-style formula and can be
nested with any other ergm() terms, including dynamic and multilayer.
Any valid binary or valued
ERGM can be specified for the networks, using simple term
operators and the network-level specification with an
lm()-style formula.
See Networks(), N() (ergmTerm?N) for
specification, gofN() for diagnostic facilities, and
vignette("Goeyvaerts_reproduction") for a demonstration.
Maintainer: Pavel N. Krivitsky [email protected] (ORCID)
Authors:
Pavel N. Krivitsky [email protected] (ORCID)
Other contributors:
Mark S. Handcock [email protected] [contributor]
David R. Hunter [email protected] [contributor]
Chad Klumb [email protected] [contributor]
Pietro Coletti [email protected] [contributor]
Joyce Cheng [email protected] [contributor]
Krivitsky PN, Coletti P, Hens N (2023).
“A Tale of Two Datasets: Representativeness and Generalisability of Inference for Samples of Networks.”
Journal of the American Statistical Association, 118(544), 2213-2224.
doi:10.1080/01621459.2023.2242627.
Krivitsky PN, Koehly LM, Marcum CS (2020).
“Exponential-family Random Graph Models for Multi-layer Networks.”
Psychometrika, 85(3), 630–659.
doi:10.1007/s11336-020-09720-7.
Lazega E, Pattison PE (1999).
“Multiplexity, Generalized Exchange and Cooperation in Organizations: A Case Study.”
Social Networks, 21(1), 67–90.
doi:10.1016/S0378-8733(99)00002-7.
Pattison P, Wasserman S (1999).
“Logit Models and Logistic Regressions for Social Networks: II. Multivariate Relations.”
British Journal of Mathematical and Statistical Psychology, 52(2), 169–193.
Slaughter AJ, Koehly LM (2016).
“Multilevel Models for Social Networks: Hierarchical Bayesian Approaches to Exponential Random Graph Modeling.”
Social Networks, 44, 334–345.
doi:10.1016/j.socnet.2015.11.002.
Stewart J, Schweinberger M, Bojanowski M, Morris M (2019).
“Multilevel Network Data Facilitate Statistical Inference for Curved ERGMs with Geometrically Weighted Terms.”
Social Networks, 59, 98–119.
doi:10.1016/j.socnet.2018.11.003.
Vega Yon GG, Slaughter A, de la Haye K (2021).
“Exponential Random Graph Models for Little Networks.”
Social Networks, 64, 225–238.
doi:10.1016/j.socnet.2020.07.005.
Zijlstra BJH, Van Duijn MAJ, Snijders TAB (2006).
“The Multilevel Model: A Random Effects Model for the Analysis of Multiple Social Networks.”
Methodology, 2(1), 42.
Useful links:
Report bugs at https://github.com/statnet/ergm.multi/issues
as_tibble method for combined networks.A method to obtain a network attribute table from a
combined_networks object, falling back to the
network::as_tibble.network() if vertex or edge attributes are
required.
## S3 method for class 'combined_networks' as_tibble( x, attrnames = (match.arg(unit) %in% c("vertices", "networks")), ..., unit = c("edges", "vertices", "networks") )## S3 method for class 'combined_networks' as_tibble( x, attrnames = (match.arg(unit) %in% c("vertices", "networks")), ..., unit = c("edges", "vertices", "networks") )
x |
a |
attrnames |
a list (or a selection index) for attributes to obtain; for combined networks, defaults to all. |
... |
additional arguments, currently passed to unlist()]. |
unit |
whether to obtain edge, vertex, or network attributes. |
This term adds one
network statistic to the model for each element in d; the th
such statistic equals the number of dyads in the first bipartition with exactly
d[i] shared partners. (Those shared partners, of course, must be members
of the second bipartition.) This term can only be used with bipartite networks.
# binary: b1dspL(d, Ls.path=NULL)# binary: b1dspL(d, Ls.path=NULL)
d |
a vector of distinct integers. |
Ls.path, L.in_order
|
a vector of one or two formulas |
This term does not support multilayer networks with heterogeneous bipartedness. This may change in the future.
This term takes an additional term option (see
options?ergm), cache.sp, controlling whether
the implementation will cache the number of shared partners for
each dyad in the network; this is usually enabled by default.
ergmTerm for index of model terms currently visible to the package.
None
This term adds one network statistic to the model for each element in d ; the th
such statistic equals the number of dyads in the second bipartition with exactly
d[i] shared partners. (Those shared partners, of course, must be members
of the first bipartition.) This term can only be used with bipartite networks.
# binary: b2dspL(d, Ls.path=NULL)# binary: b2dspL(d, Ls.path=NULL)
d |
a vector of distinct integers |
Ls.path, L.in_order
|
a vector of one or two formulas |
This term does not support multilayer networks with heterogeneous bipartedness. This may change in the future.
This term takes an additional term option (see
options?ergm), cache.sp, controlling whether
the implementation will cache the number of shared partners for
each dyad in the network; this is usually enabled by default.
ergmTerm for index of model terms currently visible to the package.
None
Models marginal dependence layers within each dyad by imposing a Conway–Maxwell-Binomial (CMB) distribution on the number of layers in each dyad that have a tie.
The term adds one statistic to the model, equalling the sum over
all the dyads in the network of , where
is the number of layers in Ls with an edge in that
dyad and being the total number of layers in Ls .
# binary: CMBL(Ls=~.)# binary: CMBL(Ls=~.)
Ls |
a list (constructed by |
A positive coefficient induces positive dependence and a negative one induces negative dependence.
ergmTerm for index of model terms currently visible to the package.
None
Given a list of compatible networks, combine_networks() returns a single
block-diagonal network, preserving attributes that can be
preserved.
uncombine_network() undoes combine_networks(), returning a list
of networks, optionally mapping the edges of the combined network
onto them.
combine_networks( nwl, ignore.nattr = c("mnext"), ignore.vattr = c(), ignore.eattr = c(), keep.unshared.attr = FALSE ) uncombine_network(nw, populate = TRUE) ## S3 method for class 'combined_networks' print(x, ...) ## S3 method for class 'combined_networks' summary(object, ...) ## S3 method for class 'summary.combined_networks' print(x, ...)combine_networks( nwl, ignore.nattr = c("mnext"), ignore.vattr = c(), ignore.eattr = c(), keep.unshared.attr = FALSE ) uncombine_network(nw, populate = TRUE) ## S3 method for class 'combined_networks' print(x, ...) ## S3 method for class 'combined_networks' summary(object, ...) ## S3 method for class 'summary.combined_networks' print(x, ...)
nwl |
a list of |
ignore.nattr, ignore.vattr, ignore.eattr
|
network, vertex, and edge attributes not to be processed as described below. |
keep.unshared.attr |
whether to keep those network, vertex,
and edge attributes not shared by all networks in the list; if
|
nw |
a |
populate |
logical; whether to map the edges from the combined network to the subnetworks, or whether to return them empty. |
x, object
|
a combined network. |
... |
additional arguments to methods. |
an object of class combined_networks inheriting from
network::network with a block-diagonal structure (or its
bipartite equivalent) comprising the networks passed in nwl. In
particular,
the returned network's size is the sum of the input networks';
its basic properties (directedness and bipartednes) are the same;
the input networks' sociomatrices (both edge presence and edge attributes) are the blocks in the sociomatrix of the returned network;
vertex attributes are concatenated;
edge attributes are assigned to their respective edges in the returned network;
network attributes are stored in a list network attribute ".snattr".
a new network attribute, ".snid" identifies the original networks; if combined networks are combined again, ".snid" becomes a space-separated string of IDs from outside in.
a new network attribute, ".snl", containing networks in nwl
(preserving their names, if any) but with all edges removed.
If nwl is a named list, names from the list are used.
If not 1, but the network has an attribute title, it is used.
Otherwise, a numerical index is used.
print(combined_networks): A wrapper around
network::print.network() to print constituent network
information and omit some internal variables.
summary(combined_networks): A wrapper around
network::summary.network() to print constituent network
information and omit some internal variables.
print(summary.combined_networks): A wrapper around
network::print.summary.network() to print constituent network
information and omit some internal variables.
data(samplk) o1 <- combine_networks(list(samplk1, samplk2, samplk3)) image(as.matrix(o1)) head(get.vertex.attribute(o1, ".snid")) o2 <- combine_networks(list(o1, o1)) image(as.matrix(o2)) head(get.vertex.attribute(o2, ".snid", unlist=FALSE)) data(florentine) f1 <- combine_networks(list(business=flobusiness, marriage=flomarriage)) image(as.matrix(f1)) head(get.vertex.attribute(f1, ".snid")) head(names(get.network.attribute(f1, ".snl"))) data(samplk) o1 <- combine_networks(list(samplk1, samplk2, samplk3)) image(as.matrix(o1)) ol <- uncombine_network(o1)data(samplk) o1 <- combine_networks(list(samplk1, samplk2, samplk3)) image(as.matrix(o1)) head(get.vertex.attribute(o1, ".snid")) o2 <- combine_networks(list(o1, o1)) image(as.matrix(o2)) head(get.vertex.attribute(o2, ".snid", unlist=FALSE)) data(florentine) f1 <- combine_networks(list(business=flobusiness, marriage=flomarriage)) image(as.matrix(f1)) head(get.vertex.attribute(f1, ".snid")) head(names(get.network.attribute(f1, ".snl"))) data(samplk) o1 <- combine_networks(list(samplk1, samplk2, samplk3)) image(as.matrix(o1)) ol <- uncombine_network(o1)
control.gofN.ergm (or its alias, control.gofN) is
intended to be used with gofN() specifically and will "inherit"
as many control parameters from ergm fit as possible().
control.gofN.ergm( nsim = 100, obs.twostage = nsim/2, array.max = 128, simulate = control.simulate.ergm(), obs.simulate = control.simulate.ergm(), parallel = 0, parallel.type = NULL, parallel.version.check = TRUE, parallel.inherit.MT = FALSE ) control.gofN( nsim = 100, obs.twostage = nsim/2, array.max = 128, simulate = control.simulate.ergm(), obs.simulate = control.simulate.ergm(), parallel = 0, parallel.type = NULL, parallel.version.check = TRUE, parallel.inherit.MT = FALSE )control.gofN.ergm( nsim = 100, obs.twostage = nsim/2, array.max = 128, simulate = control.simulate.ergm(), obs.simulate = control.simulate.ergm(), parallel = 0, parallel.type = NULL, parallel.version.check = TRUE, parallel.inherit.MT = FALSE ) control.gofN( nsim = 100, obs.twostage = nsim/2, array.max = 128, simulate = control.simulate.ergm(), obs.simulate = control.simulate.ergm(), parallel = 0, parallel.type = NULL, parallel.version.check = TRUE, parallel.inherit.MT = FALSE )
nsim |
Number of networks to be randomly drawn using Markov chain Monte Carlo. This sample of networks provides the basis for comparing the model to the observed network. |
obs.twostage |
Either
Then, |
array.max |
Try to avoid creating arrays larger in size (in
megabytes) than this. Is ignored if |
simulate, obs.simulate
|
Control lists produced by
|
parallel |
Number of threads in which to run the sampling. Defaults to
0 (no parallelism). See |
parallel.type |
API to use for parallel processing. Defaults
to using the parallel package with PSOCK clusters. See
|
parallel.version.check |
Logical: If TRUE, check that the version of ergm running on the slave nodes is the same as that running on the master node. |
parallel.inherit.MT |
Logical: If TRUE, slave nodes and
processes inherit the |
Auxiliary function as user interface for fine-tuning ERGM Goodness-of-Fit Evaluation.
This term adds one network statistic to the model for each element in d where the th such statistic equals the number of dyads in the network with exactly d[i] shared partners. For a directed network, multiple shared partner definitions are possible.
dspL and ddspL are aliases for consistency with ergm.
# binary: ddspL(d, type="OTP", Ls.path=NULL, L.in_order=FALSE) # binary: dspL(d, type="OTP", Ls.path=NULL, L.in_order=FALSE)# binary: ddspL(d, type="OTP", Ls.path=NULL, L.in_order=FALSE) # binary: dspL(d, type="OTP", Ls.path=NULL, L.in_order=FALSE)
Ls.path, L.in_order
|
a vector of one or two formulas |
While there is only one shared partner configuration in the undirected
case, nine distinct configurations are possible for directed graphs, selected
using the type argument. Currently, terms may be defined with respect to
five of these configurations; they are defined here as follows (using
terminology from Butts (2008) and the relevent package):
Outgoing Two-path ("OTP"): vertex is an OTP shared partner of ordered
pair iff . Also known as "transitive
shared partner".
Incoming Two-path ("ITP"): vertex is an ITP shared partner of ordered
pair iff . Also known as "cyclical shared
partner"
Reciprocated Two-path ("RTP"): vertex is an RTP shared partner of ordered
pair iff .
Outgoing Shared Partner ("OSP"): vertex is an OSP shared partner of
ordered pair iff .
Incoming Shared Partner ("ISP"): vertex is an ISP shared partner of ordered
pair iff .
By default, outgoing two-paths ("OTP") are calculated. Note that Robins et al. (2009)
define closely related statistics to several of the above, using slightly different terminology.
This term takes an additional term option (see
options?ergm), cache.sp, controlling whether
the implementation will cache the number of shared partners for
each dyad in the network; this is usually enabled by default.
ergmTerm for index of model terms currently visible to the package.
None
This term adds one network statistic to the model for each element in d where the th such statistic equals the number of edges in the network with exactly d[i] shared partners. For a directed network, multiple shared partner definitions are possible.
espL and despL are aliases for consistency with ergm.
# binary: despL(d, type="OTP", L.base=NULL, Ls.path=NULL, L.in_order=FALSE) # binary: espL(d, type="OTP", L.base=NULL, Ls.path=NULL, L.in_order=FALSE)# binary: despL(d, type="OTP", L.base=NULL, Ls.path=NULL, L.in_order=FALSE) # binary: espL(d, type="OTP", L.base=NULL, Ls.path=NULL, L.in_order=FALSE)
d |
a vector of distinct integers |
type |
A string indicating the type of shared partner or path to be considered for directed networks: |
L.base |
the Layer Logic (c.f. Layer Logic section in the
|
Ls.path, L.in_order
|
a vector of one or two formulas |
While there is only one shared partner configuration in the undirected
case, nine distinct configurations are possible for directed graphs, selected
using the type argument. Currently, terms may be defined with respect to
five of these configurations; they are defined here as follows (using
terminology from Butts (2008) and the relevent package):
Outgoing Two-path ("OTP"): vertex is an OTP shared partner of ordered
pair iff . Also known as "transitive
shared partner".
Incoming Two-path ("ITP"): vertex is an ITP shared partner of ordered
pair iff . Also known as "cyclical shared
partner"
Reciprocated Two-path ("RTP"): vertex is an RTP shared partner of ordered
pair iff .
Outgoing Shared Partner ("OSP"): vertex is an OSP shared partner of
ordered pair iff .
Incoming Shared Partner ("ISP"): vertex is an ISP shared partner of ordered
pair iff .
By default, outgoing two-paths ("OTP") are calculated. Note that Robins et al. (2009)
define closely related statistics to several of the above, using slightly different terminology.
This term takes an additional term option (see
options?ergm), cache.sp, controlling whether
the implementation will cache the number of shared partners for
each dyad in the network; this is usually enabled by default.
ergmTerm for index of model terms currently visible to the package.
None
This term adds one network statistic to the model equal to the geometrically weighted dyadwise shared partner distribution with decay parameter. Note that the GWDSP statistic is equal to the sum of GWNSP plus GWESP. For a directed network, multiple shared partner definitions are possible.
gdwdspL and dgwdspL are aliases for consistency with ergm.
# binary: dgwdspL(decay, fixed=FALSE, cutoff=30, type="OTP", # Ls.path=NULL, L.in_order=FALSE) # binary: gwdspL(decay, fixed=FALSE, cutoff=30, type="OTP", # Ls.path=NULL, L.in_order=FALSE)# binary: dgwdspL(decay, fixed=FALSE, cutoff=30, type="OTP", # Ls.path=NULL, L.in_order=FALSE) # binary: gwdspL(decay, fixed=FALSE, cutoff=30, type="OTP", # Ls.path=NULL, L.in_order=FALSE)
decay |
nonnegative decay parameter for the shared partner or selected directed analogue count; required if |
fixed |
optional argument indicating
whether the |
cutoff |
This optional argument sets the number of underlying DSP terms
to use in computing the statistics when |
type |
A string indicating the type of shared partner or path to be considered for directed networks: |
Ls.path, L.in_order
|
a vector of one or two formulas |
While there is only one shared partner configuration in the undirected
case, nine distinct configurations are possible for directed graphs, selected
using the type argument. Currently, terms may be defined with respect to
five of these configurations; they are defined here as follows (using
terminology from Butts (2008) and the relevent package):
Outgoing Two-path ("OTP"): vertex is an OTP shared partner of ordered
pair iff . Also known as "transitive
shared partner".
Incoming Two-path ("ITP"): vertex is an ITP shared partner of ordered
pair iff . Also known as "cyclical shared
partner"
Reciprocated Two-path ("RTP"): vertex is an RTP shared partner of ordered
pair iff .
Outgoing Shared Partner ("OSP"): vertex is an OSP shared partner of
ordered pair iff .
Incoming Shared Partner ("ISP"): vertex is an ISP shared partner of ordered
pair iff .
By default, outgoing two-paths ("OTP") are calculated. Note that Robins et al. (2009)
define closely related statistics to several of the above, using slightly different terminology.
This term takes an additional term option (see
options?ergm), cache.sp, controlling whether
the implementation will cache the number of shared partners for
each dyad in the network; this is usually enabled by default.
ergmTerm for index of model terms currently visible to the package.
None
This term adds a statistic equal to the geometrically weighted edgewise (not dyadwise) shared partner distribution with decay parameter. For a directed network, multiple shared partner definitions are possible.
gdwespL and dgwespL are aliases for consistency with ergm.
# binary: dgwespL(decay, fixed=FALSE, cutoff=30, type="OTP", L.base=NULL, # Ls.path=NULL, L.in_order=FALSE) # binary: gwespL(decay, fixed=FALSE, cutoff=30, type="OTP", L.base=NULL, # Ls.path=NULL, L.in_order=FALSE)# binary: dgwespL(decay, fixed=FALSE, cutoff=30, type="OTP", L.base=NULL, # Ls.path=NULL, L.in_order=FALSE) # binary: gwespL(decay, fixed=FALSE, cutoff=30, type="OTP", L.base=NULL, # Ls.path=NULL, L.in_order=FALSE)
decay |
nonnegative decay parameter for the shared partner or selected directed analogue count; required if |
fixed |
optional argument indicating
whether the |
cutoff |
This optional argument sets the number of underlying ESP terms
to use in computing the statistics when |
type |
A string indicating the type of shared partner or path to be considered for directed networks: |
L.base |
the Layer Logic (c.f. Layer Logic section in the
|
Ls.path, L.in_order
|
a vector of one or two formulas |
While there is only one shared partner configuration in the undirected
case, nine distinct configurations are possible for directed graphs, selected
using the type argument. Currently, terms may be defined with respect to
five of these configurations; they are defined here as follows (using
terminology from Butts (2008) and the relevent package):
Outgoing Two-path ("OTP"): vertex is an OTP shared partner of ordered
pair iff . Also known as "transitive
shared partner".
Incoming Two-path ("ITP"): vertex is an ITP shared partner of ordered
pair iff . Also known as "cyclical shared
partner"
Reciprocated Two-path ("RTP"): vertex is an RTP shared partner of ordered
pair iff .
Outgoing Shared Partner ("OSP"): vertex is an OSP shared partner of
ordered pair iff .
Incoming Shared Partner ("ISP"): vertex is an ISP shared partner of ordered
pair iff .
By default, outgoing two-paths ("OTP") are calculated. Note that Robins et al. (2009)
define closely related statistics to several of the above, using slightly different terminology.
This term takes an additional term option (see
options?ergm), cache.sp, controlling whether
the implementation will cache the number of shared partners for
each dyad in the network; this is usually enabled by default.
ergmTerm for index of model terms currently visible to the package.
None
This term is just like
gwespL() and
gwdspL() except it adds a statistic
equal to the geometrically weighted nonedgewise (that is, over
dyads that do not have an edge) shared partner distribution with
decay parameter. For a directed network, multiple shared partner
definitions are possible.
gdwnspL and dgwnspL are aliases for consistency with ergm.
# binary: dgwnspL(decay, fixed=FALSE, cutoff=30, type="OTP", L.base=NULL, # Ls.path=NULL, L.in_order=FALSE) # binary: gwnspL(decay, fixed=FALSE, cutoff=30, type="OTP", L.base=NULL, # Ls.path=NULL, L.in_order=FALSE)# binary: dgwnspL(decay, fixed=FALSE, cutoff=30, type="OTP", L.base=NULL, # Ls.path=NULL, L.in_order=FALSE) # binary: gwnspL(decay, fixed=FALSE, cutoff=30, type="OTP", L.base=NULL, # Ls.path=NULL, L.in_order=FALSE)
decay |
nonnegative decay parameter for the shared partner or selected directed analogue count; required if |
fixed |
optional argument indicating
whether the |
cutoff |
This optional argument sets the number of underlying NSP terms
to use in computing the statistics when |
type |
A string indicating the type of shared partner or path to be considered for directed networks: |
L.base |
the Layer Logic (c.f. Layer Logic section in the
|
Ls.path, L.in_order
|
a vector of one or two formulas |
While there is only one shared partner configuration in the undirected
case, nine distinct configurations are possible for directed graphs, selected
using the type argument. Currently, terms may be defined with respect to
five of these configurations; they are defined here as follows (using
terminology from Butts (2008) and the relevent package):
Outgoing Two-path ("OTP"): vertex is an OTP shared partner of ordered
pair iff . Also known as "transitive
shared partner".
Incoming Two-path ("ITP"): vertex is an ITP shared partner of ordered
pair iff . Also known as "cyclical shared
partner"
Reciprocated Two-path ("RTP"): vertex is an RTP shared partner of ordered
pair iff .
Outgoing Shared Partner ("OSP"): vertex is an OSP shared partner of
ordered pair iff .
Incoming Shared Partner ("ISP"): vertex is an ISP shared partner of ordered
pair iff .
By default, outgoing two-paths ("OTP") are calculated. Note that Robins et al. (2009)
define closely related statistics to several of the above, using slightly different terminology.
This term takes an additional term option (see
options?ergm), cache.sp, controlling whether
the implementation will cache the number of shared partners for
each dyad in the network; this is usually enabled by default.
ergmTerm for index of model terms currently visible to the package.
None
This term adds one network statistic to the model for each element in d where the th such statistic equals the number of non-edges in the network with exactly d[i] shared partners. For a directed network, multiple shared partner definitions are possible.
nspL and dnspL are aliases for consistency with ergm.
# binary: dnspL(d, type="OTP", L.base=NULL, Ls.path=NULL, L.in_order=FALSE) # binary: nspL(d, type="OTP", L.base=NULL, Ls.path=NULL, L.in_order=FALSE)# binary: dnspL(d, type="OTP", L.base=NULL, Ls.path=NULL, L.in_order=FALSE) # binary: nspL(d, type="OTP", L.base=NULL, Ls.path=NULL, L.in_order=FALSE)
d |
a vector of distinct integers |
type |
A string indicating the type of shared partner or path to be considered for directed networks: |
L.base |
the Layer Logic (c.f. Layer Logic section in the
|
Ls.path, L.in_order
|
a vector of one or two formulas |
While there is only one shared partner configuration in the undirected
case, nine distinct configurations are possible for directed graphs, selected
using the type argument. Currently, terms may be defined with respect to
five of these configurations; they are defined here as follows (using
terminology from Butts (2008) and the relevent package):
Outgoing Two-path ("OTP"): vertex is an OTP shared partner of ordered
pair iff . Also known as "transitive
shared partner".
Incoming Two-path ("ITP"): vertex is an ITP shared partner of ordered
pair iff . Also known as "cyclical shared
partner"
Reciprocated Two-path ("RTP"): vertex is an RTP shared partner of ordered
pair iff .
Outgoing Shared Partner ("OSP"): vertex is an OSP shared partner of
ordered pair iff .
Incoming Shared Partner ("ISP"): vertex is an ISP shared partner of ordered
pair iff .
By default, outgoing two-paths ("OTP") are calculated. Note that Robins et al. (2009)
define closely related statistics to several of the above, using slightly different terminology.
This term takes an additional term option (see
options?ergm), cache.sp, controlling whether
the implementation will cache the number of shared partners for
each dyad in the network; this is usually enabled by default.
ergmTerm for index of model terms currently visible to the package.
None
Models marginal dependence of layers within each dyad by counting edges they have in common.
The term adds one statistic to the model, equalling the sum over all distinct pairs of specified layers of their common edges.
# binary: entrainmentL(Ls=~.)# binary: entrainmentL(Ls=~.)
Ls |
a list (constructed by |
This is similar to L(~edges, c(~A & B, ~A & C, ~B & C))
but more efficient for multiple layers.
ergmTerm for index of model terms currently visible to the package.
None
This is a list of 318 network objects derived from contact
diary data collected by by Goeyvaerts et al. (2018). The
study recruited households in Flanders and Brussels-Capital region
with at least one child 12 or under. The networks are symmetrized.
data(Goeyvaerts)data(Goeyvaerts)
An object of class list of length 318.
included(logical) whether the network was included in Goeyvaerts's analysis. (Two were excluded.)
weekday(logical) whether the contact diary on which the network is based was collected on a weekday, as opposed to weekend.
age(numeric) the household member's age.
gender(character) the household member's gender ("F"/"M").
role(character) the household member's inferred role ("Father"/"Mother"/"Child"/"Grandmother").
When publishing results obtained using this data set, the original authors (Goeyvaerts et al. 2018) should be cited, along with this R package.
The data were collected and by Goeyvaerts et al. (2018) and curated by Pietro Coletti.
Goeyvaerts N, Santermans E, Potter G, Torneri A, Kerckhove KV, Willem L, Aerts M, Beutels P, Hens N (2018). “Household Members Do Not Contact Each Other at Random: Implications for Infectious Disease Modelling.” Proceedings of the Royal Society B: Biological Sciences, 285(1893), 20182201. doi:10.1098/rspb.2018.2201.
vignette("Goeyvaerts_reproduction") for a vignette reproducing the Goeyvaerts analysis and performing diagnostics
gofN() performs a simulation to obtain Pearson residuals for the
multivariate linear model for ERGM parameters, which can then be
used for a variety of diagnostics and diagnostic plots developed by
Krivitsky et al. (2023).
gofN( object, GOF = NULL, subset = TRUE, control = control.gofN.ergm(), save_stats = FALSE, ... ) ## S3 method for class 'gofN' x[i, j, ..., drop = FALSE] ## S3 method for class 'gofN' augment(x, ...) ## S3 method for class 'gofN' summary(object, by = NULL, ...)gofN( object, GOF = NULL, subset = TRUE, control = control.gofN.ergm(), save_stats = FALSE, ... ) ## S3 method for class 'gofN' x[i, j, ..., drop = FALSE] ## S3 method for class 'gofN' augment(x, ...) ## S3 method for class 'gofN' summary(object, by = NULL, ...)
object |
an |
GOF |
a one-sided |
subset |
argument for the |
control |
See |
save_stats |
If |
... |
additional arguments to functions ( |
x |
a |
i |
for the indexing operator, index of statistics to be kept in the subset. |
j |
for the indexing operator, index of networks to be kept in the subset. |
drop |
whether the indexing operator should drop attributes and return simply a list. |
by |
a numeric or character vector, or a formula whose RHS gives an expression in terms of network attributes, used as a grouping variable for summarizing the values. |
An object of class gofN: a named list containing a list
for every statistic in the specified GOF formula with the
following elements vectors of length equal to the number of
subnetworks:
observed |
For completely observed networks, their value of the statistic. For partially observed networks, the expected value of their imputations under the model. |
fitted |
Expected value of the statistic under the model. |
var |
Variance of the statistic under the model. |
var.obs |
Conditional variance under imputation statistic. |
pearson |
The Pearson residual computed from the above. |
stats, stats.obs
|
If |
In addition, the following attr-style attributes are included:
nw |
The observed multinetwork object. |
subset |
A logical vector giving the subset of networks that were used. |
control |
Control parameters passed. |
[: Extract a subset of statistics for which goodness-of-fit had been computed.
augment(gofN): a method for constructing a tibble of network attributes augmented with goodness of fit information. Columns include:
the attributes of each of the networks
.stat_namename of the simulated statistic
.stat_idindex of the simulated statistic in the gofN object
.network_idindex of the network in the networks for which gofN was run (excluding those not in the subset)
.fittedpredicted value for the statistic
.observedeither the observed (for completely observed networks) or the predicted conditional on observed (for partially observed networks) value of the statistic
.pearsonthe standardised Pearson residual
.var, .var.obs
estimated unconditional and average conditional variance of the statistic
.weightinverse of the variance of the residual
summary(gofN): A simple summary function.
Krivitsky PN, Coletti P, Hens N (2023). “A Tale of Two Datasets: Representativeness and Generalisability of Inference for Samples of Networks.” Journal of the American Statistical Association, 118(544), 2213-2224. doi:10.1080/01621459.2023.2242627.
plot.gofN() and autoplot.gofN() for plotting gofN
objects to make residual plots; ergm::gof() for single-network
goodness-of-fit simulations in ergm
data(samplk) monks <- Networks(samplk1, samplk2, samplk3,samplk1, samplk2, samplk3,samplk1, samplk2, samplk3) fit <- ergm(monks~N(~edges+nodematch("group"))) fit.gof <- gofN(fit) # GOF = original model summary(fit.gof) plot(fit.gof) fit.gof <- gofN(fit, GOF=~triangles) summary(fit.gof) plot(fit.gof) samplk1[1,]<-NA samplk2[,2]<-NA monks <- Networks(samplk1, samplk2, samplk3,samplk1, samplk2, samplk3,samplk1, samplk2, samplk3) fit <- ergm(monks~N(~edges+nodematch("group"))) fit.gof <- gofN(fit) # GOF = original model summary(fit.gof) plot(fit.gof) fit.gof <- gofN(fit, GOF=~triangles) summary(fit.gof) plot(fit.gof) plot(fit.gof, against=~log(.fitted)) # Plot against transformed fitted values. ### If 'ggplot2' and 'ggrepel' are installed, illustrate the autoplot() method. if(require("ggplot2") && requireNamespace("ggrepel")){ autoplot(fit.gof) } # Default is good enough in this case, but sometimes, we might want to set it higher. E.g., ## Not run: fit.gof <- gofN(fit, GOF=~edges, control=control.gofN.ergm(nsim=400)) ## End(Not run) ### If 'generics' is installed, illustrate the augment() method. if(require("generics")){ augment(fit.gof) }data(samplk) monks <- Networks(samplk1, samplk2, samplk3,samplk1, samplk2, samplk3,samplk1, samplk2, samplk3) fit <- ergm(monks~N(~edges+nodematch("group"))) fit.gof <- gofN(fit) # GOF = original model summary(fit.gof) plot(fit.gof) fit.gof <- gofN(fit, GOF=~triangles) summary(fit.gof) plot(fit.gof) samplk1[1,]<-NA samplk2[,2]<-NA monks <- Networks(samplk1, samplk2, samplk3,samplk1, samplk2, samplk3,samplk1, samplk2, samplk3) fit <- ergm(monks~N(~edges+nodematch("group"))) fit.gof <- gofN(fit) # GOF = original model summary(fit.gof) plot(fit.gof) fit.gof <- gofN(fit, GOF=~triangles) summary(fit.gof) plot(fit.gof) plot(fit.gof, against=~log(.fitted)) # Plot against transformed fitted values. ### If 'ggplot2' and 'ggrepel' are installed, illustrate the autoplot() method. if(require("ggplot2") && requireNamespace("ggrepel")){ autoplot(fit.gof) } # Default is good enough in this case, but sometimes, we might want to set it higher. E.g., ## Not run: fit.gof <- gofN(fit, GOF=~edges, control=control.gofN.ergm(nsim=400)) ## End(Not run) ### If 'generics' is installed, illustrate the augment() method. if(require("generics")){ augment(fit.gof) }
This term adds one network statistic to the model equal to the geometrically
weighted dyadwise shared partner distribution for dyads in the first bipartition with decay parameter
decay parameter, which should be non-negative. This term can only be used with bipartite networks.
# binary: gwb1dspL(decay=0, fixed=FALSE, cutoff=30, Ls.path=NULL)# binary: gwb1dspL(decay=0, fixed=FALSE, cutoff=30, Ls.path=NULL)
decay |
nonnegative decay parameter for the shared partner counts; required if |
fixed |
optional argument indicating
whether the |
cutoff |
This optional argument sets the number of underlying b1dsp terms
to use in computing the statistics when |
Ls.path, L.in_order
|
a vector of one or two formulas |
This term does not support multilayer networks with heterogeneous bipartedness. This may change in the future.
This term takes an additional term option (see
options?ergm), cache.sp, controlling whether
the implementation will cache the number of shared partners for
each dyad in the network; this is usually enabled by default.
ergmTerm for index of model terms currently visible to the package.
None
This term adds one network statistic to the model equal to the geometrically
weighted dyadwise shared partner distribution for dyads in the second bipartition with decay parameter
decay parameter, which should be non-negative. This term can only be used with bipartite networks.
# binary: gwb2dspL(decay=0, fixed=FALSE, cutoff=30, Ls.path=NULL)# binary: gwb2dspL(decay=0, fixed=FALSE, cutoff=30, Ls.path=NULL)
decay |
nonnegative decay parameter for the shared partner counts; required if |
fixed |
optional argument indicating
whether the |
cutoff |
This optional argument sets the number of underlying b2dsp terms
to use in computing the statistics when |
Ls.path, L.in_order
|
a vector of one or two formulas |
This term does not support multilayer networks with heterogeneous bipartedness. This may change in the future.
This term takes an additional term option (see
options?ergm), cache.sp, controlling whether
the implementation will cache the number of shared partners for
each dyad in the network; this is usually enabled by default.
ergmTerm for index of model terms currently visible to the package.
None
Models marginal dependence of layers within each dyad by counting their hamming distances.
The term adds one statistic to the model, equalling the sum over all distinct pairs of specified layers of their Hamming distances.
# binary: hammingL(Ls=~.)# binary: hammingL(Ls=~.)
Ls |
a list (constructed by |
A positive coefficient induces negative dependence and a negative one induces positive dependence.
ergmTerm for index of model terms currently visible to the package.
None
Evaluates the terms in formula on an observed or
logical layers specified in formula Ls and sums the results
elementwise.
# binary: L(formula, Ls=~.)# binary: L(formula, Ls=~.)
formula |
a one-sided |
Ls |
either a Layer Logic specification formula (c.f. Layer Logic section in the |
For the purposes of the terms in the formula, nonstandard
network and vertex attributes will be taken from the first
layer's network. The subsequent networks' attributes will be
ignored by it. If Ls is specified as a function, this
function will be able to access them, however.
ergmTerm for index of model terms currently visible to the package.
None
A function for specifying the LHS of a multilayer (a.k.a. multiplex, a.k.a. multirelational, a.k.a. multivariate) ERGM in the framework of Krivitsky et al. (2020).
unLayer() extracts the layers as a list of networks.
Layer(..., .symmetric = NULL, .bipartite = NULL, .active = NULL) unLayer(object)Layer(..., .symmetric = NULL, .bipartite = NULL, .active = NULL) unLayer(object)
... |
layer specification, in one of three formats:
|
.symmetric |
If the layer specification is via a single network with edge attributes and the network is directed, an optional logical vector to specify which of the layers should be treated as undirected. |
.bipartite |
If the layer specification is via a single network with edge attributes and the network is unipartite, an optional integer vector to specify which of the layers should be treated as bipartite and how many mode 1 vertices there are. |
.active |
An optional list with a nodal attribute specification ( |
object |
a multilayer network returned by |
A network object comprising the provided layers, with layer metadata.
Due to certain optimizations, the resulting network object's network and vertex attributes should be treated as read-only: do not modify them. If you need to change existing attributes or add new ones, do so on the input networks and call Layer(...) again.
In order to fit a model for multilayer
networks, first use Layer construct an LHS network that
ergm() will understand as multilayered.
Used in the formula directly, most, but not all, ergm terms will sum their statistics over the observed layers.
Some terms are layer-aware, however. By convention, layer-aware
terms have capital L appended to them. For example,
mutualL is a layer-aware generalization of
mutual. These terms have one or more
explicit (usually optional) layer specification arguments. By
convention, an argument that requires one layer specification is
named L= and one that requires a list of specifications
(constructed by list() or c()) is named Ls=; and a
specification of the form ~. is a placeholder for all observed
layers.
Operator L(formula, Ls = ...) can be used
to evaluate arbitrary terms in the formula on specified
layers. Note that for the purposes of the terms in the formula,
nonstandard network and vertex attributes will be taken from the
first network in the list. The subsequent networks' attributes
will be ignored by it (but not by Ls: see Alternative ways to
specify layers below).
Layer specification documentation follows.
Each formula's right-hand side describes an observed layer or some "logical" layer, whose ties are a function of corresponding ties in observed layers. (Krivitsky et al. 2020)
The observed layers can be referenced either by name or by number (i.e.,
order in which they were passed to Layer). When referencing by
number, enclose the number in quotation marks (e.g., "1") or
backticks (e.g., “1”).
Arithmetical, relational,
and logical operators can be used to combine them. All
listed operators are implemented, as well as functions abs,
round, and sign. Standard
operator precedence applies, so use of parentheses is
recommended to ensure the logical expression is what it looks like.
Important: For performance reasons, ergm.multi's
Layer Logic implementation uses integer arithmetic. This means, in
particular, that / will round down instead of returning a
fraction (as %/% does in R), and round() function without a
second argument (which can be negative to round to the nearest 10,
100, etc.) is not meaningful and will be ignored.
For example, if LHS is Layer(A=nwA, B=nwB), both ~`2` and
~B refer to nwB, while A&!B refers to a
“logical” layer that has ties that are in nwA but not in
nwB.
Transpose function t() applied to a directed layer will reverse
the direction of all relations (transposing the sociomatrix).
At this time, logical expressions that produce complete graphs from empty
graph inputs (e.g., A==B or !A) are not supported.
The following are provided for convenience:
numeric or logical vectorSelect from among the observed layers of the network; negative indices are supported.
character vectorConverted one or more formulas, prepending "~" if absent.
function (or a list of them)Call the function(s) (with
arguments lattr containing a data frame of layer attributes,
lnw containing the combined network, and namemap containing
the mapping from layer names to layer indices), then interpret
their outputs as above. It is strongly recommended that this
function take the ... arguments for future compatibility.
Some of the terms that call for a list of layers (i.e., have Ls=
arguments) will sum the statistic over the layers. For example,
Layer(nw1,nw2)~L(~edges, c(~`1`,~(`2`&!`1`))) produces the
number of edges in layer 1 plus the number of edges in layer 2 but
not in layer 1.
For these formulas, one can specify the layer's weight on its left-handside.
For example, Layer(nw1,nw2)~L(~edges, c(3~`1`,-1~(`2`&!`1`))) will
produce three times the number of edges in layer 1, minus the number of
edges in layer 2 but not in layer 1.
The resulting network will be the "least common denominator"
network: if not all layers have the same bipartedness, all layers
will appear as unipartite to the statistics, and if any are
directed, all will be. However, certain operator terms, particularly Symmetrize()
and S(), can be used to construct a bipartite
subgraph of a unipartite graph or change directedness.
Krivitsky PN, Koehly LM, Marcum CS (2020). “Exponential-family Random Graph Models for Multi-layer Networks.” Psychometrika, 85(3), 630–659. doi:10.1007/s11336-020-09720-7.
Help on model specification for specific terms.
data(florentine) # Method 1: list of networks flo <- Layer(list(m = flomarriage, b = flobusiness)) ergm(flo ~ L(~edges, ~m)+L(~edges, ~b)) # Method 2: networks as arguments flo <- Layer(m = flomarriage, b = flobusiness) ergm(flo ~ L(~edges, ~m)+L(~edges, ~b)) # Method 3: edge attributes (also illustrating renaming): flo <- flomarriage | flobusiness flo[,, names.eval="marriage"] <- as.matrix(flomarriage) flo[,, names.eval="business"] <- as.matrix(flobusiness) flo # edge attributes flo <- Layer(flo, c(m="marriage", b="business")) ergm(flo ~ L(~edges, ~m)+L(~edges, ~b)) ### Specifying modes and mixed bipartitedness # Suppose we have a two-mode network with 5 nodes on Mode 1 and 15 # on Mode 2, and suppose that we observe two layers, one only among # actors of Mode 1 and the other bipartite between Modes 1 and 2. # Construct the two layers' networks: nw1 <- network.initialize(20, dir=FALSE) nw12 <- network.initialize(20, dir=FALSE, bipartite=5) nw1 %v% "mode" <- rep(1:2,c(5,15)) # For testing: the maximal set of edges for each type of network: nw1[1:5,1:5] <- 1 nw12[1:5,6:20] <- 1 # The .active argument specifies the following: # * nw1's vertices are only active if their mode=1 (i.e., 1-2, 2-1, # and 2-2 can't have edges). # * nw12's vertices are all active, but the network is bipartite, # so constraints will be adjusted automatically. lnw <- Layer(nw1, nw12, .active=list(~mode==1, ~TRUE)) summary(lnw~ edges+ # 5*4/2+5*15 = 10+75 = 85 L(~edges,~`1`)+ # 5*4/2 = 10 L(~edges,~`2`)+ # 5*15 = 75 L(~edges,~(`1`|`2`))+ # This logical layer has contents of both, so also 85. L(~edges,~(`1`&`2`)) # There is no overlap between the two layers, so 0. ) # Layer-aware terms can be used: nw1[,] <-0 nw1[1,2:3] <- 1 nw1[2,3] <- 1 nw12[,] <- 0 nw12[1,6:7] <- 1 nw12[2,6:7] <- 1 lnw <- Layer(nw1, nw12, .active=list(~mode==1,~TRUE)) summary(lnw~L(~triangles, ~`1`)+ # 1-2-3 triangle. L(~triangles, ~`1`|`2`)+ # 1-2-3, 1-2-6, 1-2-7 triangles dgwespL(L.base=~`1`, Ls.path=list(~`2`,~`2`)) # 1-2-6 and 1-2-7 only ) # Because the layers are represented as a block-diagonal matrix, # this will only count triangles entirely contained within a single # layer, i.e., 1-2-3: summary(lnw~triangles) # If you need to evaluate bipartite-only statistics on the second # layer, you need to use the S() operator to select the bipartite # view: summary(lnw~L(~S(~b1degree(1:3)+b2degree(1:3),1:5~6:20), ~`2`))data(florentine) # Method 1: list of networks flo <- Layer(list(m = flomarriage, b = flobusiness)) ergm(flo ~ L(~edges, ~m)+L(~edges, ~b)) # Method 2: networks as arguments flo <- Layer(m = flomarriage, b = flobusiness) ergm(flo ~ L(~edges, ~m)+L(~edges, ~b)) # Method 3: edge attributes (also illustrating renaming): flo <- flomarriage | flobusiness flo[,, names.eval="marriage"] <- as.matrix(flomarriage) flo[,, names.eval="business"] <- as.matrix(flobusiness) flo # edge attributes flo <- Layer(flo, c(m="marriage", b="business")) ergm(flo ~ L(~edges, ~m)+L(~edges, ~b)) ### Specifying modes and mixed bipartitedness # Suppose we have a two-mode network with 5 nodes on Mode 1 and 15 # on Mode 2, and suppose that we observe two layers, one only among # actors of Mode 1 and the other bipartite between Modes 1 and 2. # Construct the two layers' networks: nw1 <- network.initialize(20, dir=FALSE) nw12 <- network.initialize(20, dir=FALSE, bipartite=5) nw1 %v% "mode" <- rep(1:2,c(5,15)) # For testing: the maximal set of edges for each type of network: nw1[1:5,1:5] <- 1 nw12[1:5,6:20] <- 1 # The .active argument specifies the following: # * nw1's vertices are only active if their mode=1 (i.e., 1-2, 2-1, # and 2-2 can't have edges). # * nw12's vertices are all active, but the network is bipartite, # so constraints will be adjusted automatically. lnw <- Layer(nw1, nw12, .active=list(~mode==1, ~TRUE)) summary(lnw~ edges+ # 5*4/2+5*15 = 10+75 = 85 L(~edges,~`1`)+ # 5*4/2 = 10 L(~edges,~`2`)+ # 5*15 = 75 L(~edges,~(`1`|`2`))+ # This logical layer has contents of both, so also 85. L(~edges,~(`1`&`2`)) # There is no overlap between the two layers, so 0. ) # Layer-aware terms can be used: nw1[,] <-0 nw1[1,2:3] <- 1 nw1[2,3] <- 1 nw12[,] <- 0 nw12[1,6:7] <- 1 nw12[2,6:7] <- 1 lnw <- Layer(nw1, nw12, .active=list(~mode==1,~TRUE)) summary(lnw~L(~triangles, ~`1`)+ # 1-2-3 triangle. L(~triangles, ~`1`|`2`)+ # 1-2-3, 1-2-6, 1-2-7 triangles dgwespL(L.base=~`1`, Ls.path=list(~`2`,~`2`)) # 1-2-6 and 1-2-7 only ) # Because the layers are represented as a block-diagonal matrix, # this will only count triangles entirely contained within a single # layer, i.e., 1-2-3: summary(lnw~triangles) # If you need to evaluate bipartite-only statistics on the second # layer, you need to use the S() operator to select the bipartite # view: summary(lnw~L(~S(~b1degree(1:3)+b2degree(1:3),1:5~6:20), ~`2`))
This dataset contains a network of relations of various types
among 71 lawyers (partners and associates) in a New England
(Northeastern US) corporate law firm referred to as “SG&R”
collected 1988–1991 by Lazega (2001).
data(Lazega)data(Lazega)
An object of class network of length 5.
All relations are directed.
age(numeric) the lawyer's age.
gender(character) the lawyer's gender ("man"/"woman").
office(character) in which of the firm's three offices the lawyer is based ("Boston"/"Hartford"/"Providence").
practice(character) which area of law the lawyer practices ("corporate"/"litigation").
school(character) from which law school the lawyer graduated ("Harvard/Yale"/"UConnecticut"/"other").
seniority(numeric) the lawyer's seniority rank in the firm (1 = high).
status(character) the lawyer's status in the firm ("associate"/"partner").
yrs_frm(numeric) the number of years the lawyer has been with the firm.
Each directed edge
has the following attributes:
advice(logical) whether has reported receiving advice from . (Note that as defined, advice flows from head of the directed edge to the tail.)
coworker(logical) whether has reported receiving 's assistance in preparing documents. (Note that as defined, assistance flows from head of the directed edge to the tail.)
friendship(logical) whether considers a friend outside of work.
When publishing results obtained using this data set, the original author (Lazega 2001) should be cited, along with this R package.
This version of the dataset was retrieved from the RSiena web site and was compiled by Christopher Steven Marcum and Pavel N. Krivitsky for Krivitsky et al. (2020).
Krivitsky PN, Koehly LM, Marcum CS (2020).
“Exponential-family Random Graph Models for Multi-layer Networks.”
Psychometrika, 85(3), 630–659.
doi:10.1007/s11336-020-09720-7.
Lazega E (2001).
The Collegial Phenomenon: The Social Mechanisms of Cooperation among Peers in a Corporate Law Partnership.
Oxford University Press.
ISBN 9780199242726.
data(Lazega) # Construct a multilayer network for ergm(). (See `?Layer` for syntax.) LLazega <- Layer(Lazega, c("advice", "coworker", "friendship")) # Specify a layer logic model. efit <- ergm(LLazega ~ L(~edges + mutual, ~advice) + L(~edges + mutual, ~coworker) + L(~edges + mutual, ~friendship) + L(~edges + mutual, ~advice&coworker) + L(~edges + mutual, ~advice&friendship) + L(~edges + mutual, ~coworker&friendship)) summary(efit)data(Lazega) # Construct a multilayer network for ergm(). (See `?Layer` for syntax.) LLazega <- Layer(Lazega, c("advice", "coworker", "friendship")) # Specify a layer logic model. efit <- ergm(LLazega ~ L(~edges + mutual, ~advice) + L(~edges + mutual, ~coworker) + L(~edges + mutual, ~friendship) + L(~edges + mutual, ~advice&coworker) + L(~edges + mutual, ~advice&friendship) + L(~edges + mutual, ~coworker&friendship)) summary(efit)
This non-method runs a properly weighted linear model on the raw
residuals of a gofN simulation for a multi-network ERGM fit.
lm.gofN(formula, data, ...)lm.gofN(formula, data, ...)
formula |
an |
data |
a |
... |
additional arguments to |
The formula's RHS is evaluated in an environment
comprising the network statistics used in the gofN() call
(which refer to the raw residuals for the corresponding
statistic) and the network attributes.
The LHS is handled in a nonstandard manner, designed to make it
easier to reference the usually lengthy network statistics:
first, it is evaluated in the formula's environment. If the
evaluation is successful and the result is numeric, these numbers
are used as indices of the statistics in the gofN object to
use on the RHS. If it is a character vector, it is treated as
names of these statistics.
A list of lm objects, one for each element of the
vector on the LHS.
gofN() and related methods.
data(samplk) # Add time indices: samplk1 %n% "t" <- 1 samplk2 %n% "t" <- 2 samplk3 %n% "t" <- 3 monks <- Networks(samplk1, samplk2, samplk3) fit <- ergm(monks~N(~edges+nodematch("group"))) fit.gof <- gofN(fit) # GOF = original model # Is there a time effect we should incorporate? fit.gof.lm <- lm.gofN((1:2)~t, data=fit.gof) lapply(fit.gof.lm, summary)data(samplk) # Add time indices: samplk1 %n% "t" <- 1 samplk2 %n% "t" <- 2 samplk3 %n% "t" <- 3 monks <- Networks(samplk1, samplk2, samplk3) fit <- ergm(monks~N(~edges+nodematch("group"))) fit.gof <- gofN(fit) # GOF = original model # Is there a time effect we should incorporate? fit.gof.lm <- lm.gofN((1:2)~t, data=fit.gof) lapply(fit.gof.lm, summary)
This function is to be considered experimental. Do NOT rely on
it. It may, eventually, be moved to ergm, perhaps integrated into
the simulate methods.
marg_cond_sim( object, nsim = 1, obs.twostage = nsim/2, GOF = NULL, control = control.gofN.ergm(), save_stats = FALSE, negative_info = c("error", "warning", "message", "ignore"), ... )marg_cond_sim( object, nsim = 1, obs.twostage = nsim/2, GOF = NULL, control = control.gofN.ergm(), save_stats = FALSE, negative_info = c("error", "warning", "message", "ignore"), ... )
object |
an |
nsim |
number of realizations. |
obs.twostage, GOF, save_stats
|
see |
control |
a control list returned by |
negative_info |
how to handle the situation in which the constrained variance exceeds the unconstrained: the corresponding action will be taken. |
... |
additional arguments to |
an object of similar structure as that returned by gofN().
The number of pairs of actors and for
which
and
both exist.
# binary: mutualL(same=NULL, diff=FALSE, by=NULL, keep=NULL, Ls=NULL)# binary: mutualL(same=NULL, diff=FALSE, by=NULL, keep=NULL, Ls=NULL)
same |
optional argument. If passed the name of a vertex attribute,
only mutual pairs that match on the attribute are counted. Only one of |
diff |
separate counts for each unique matching value can be obtained by using
|
by |
each node is counted separately for each mutual pair in which it
occurs and the counts are tabulated by unique values of the attribute if
passed the name of a vertex attribute. This means that the sum of the mutual statistics when |
keep |
a numerical vector to specify which statistics should be kept whenever the |
Ls |
a list (constructed by |
This term can only be used with directed networks.
ergmTerm for index of model terms currently visible to the package.
None
Evaluates the terms in formula on each of the networks joined
using Networks function, and returns either a weighted
sum or an lm-style linear model for the ERGM
coefficients (Krivitsky et al. 2023). Its syntax follows that of lm closely,
with sensible defaults.
The default formula (~1) sums the specified network
statistics. If lm refers to any network attributes for which some
networks have missing values, the term will stop with an
error. This can be avoided by pre-filtering with subset, which
controls which networks are affected by the term.
The formula may also reference .NetworkID and .NetworkName (or
the corresponding IDs set by .combiner). In particular,
~0+factor(.NetworkID) will evaluate formula on each network
individually.
# binary: N(formula, lm=~1, subset=TRUE, weights=1, contrasts=NULL, offset=0, label=NULL, # .combiner = "Networks") # valued: N(formula, lm=~1, subset=TRUE, weights=1, contrasts=NULL, offset=0, label=NULL, # .combiner = "Networks")# binary: N(formula, lm=~1, subset=TRUE, weights=1, contrasts=NULL, offset=0, label=NULL, # .combiner = "Networks") # valued: N(formula, lm=~1, subset=TRUE, weights=1, contrasts=NULL, offset=0, label=NULL, # .combiner = "Networks")
.combiner |
A character vector specifying which combiner, such
as |
formula |
a one-sided |
lm |
a one-sided |
subset, contrasts
|
see |
offset |
A constant, a vector of length equal to the number of networks, or a matrix whose number of rows is the number of networks and whose number of columns is the number of free parameters of the ERGM. It can be specified in |
weights |
reserved for future use; attempting to change it will cause an error: at this time, there is no way to assign sampling weights to networks. |
label |
An optional parameter which will add a label to model parameters to help identify the term (which may have similar predictors but, say, a different network subset) in the output or a function that wraps the names. |
By default, an N(formula, lm) term will add free
parameters, where is the number of free parameters
(possibly curved) of the ERGM specified by formula, and
is the number of parameters specified by the lm formula. That is,
there would be one parameter for each combination of an ERGM
parameter and a linear model parameter, in an ERGM-major order
(i.e., for each ERGM parameter, the linear model parameters will be
enumerated). For example, the term gwesp() has two free
parameters: its coefficient and its decay rate. We can specify a
model in which they depend on as N(~gwesp, ~log(n)), resulting in the following 4 parameters, with the
intercept for the linear model being implicit:
#> [1] "N(1)~gwesp" "N(log(n))~gwesp" "N(1)~gwesp.decay" #> [4] "N(log(n))~gwesp.decay"
If a different linear model is desired for different ERGM terms
(e.g., some are to be affected by network size while others are
not), multiple N() terms can be specified. This covers most such
cases, but not all. For example, suppose that for the above model,
we wish for its coefficient to depend on log(n) but for the decay
parameter not to. In this case, one can use the offset()
decorator with partial offsetting. Then, specifying
offset(N(~gwesp(), ~log(n)), 4), we get:
#> [1] "N(1)~gwesp" "N(log(n))~gwesp" #> [3] "N(1)~gwesp.decay" "offset(N(log(n))~gwesp.decay)"
Then, setting the corresponding offset.coef = 0 will fix the
coefficient of log(n) for the decay parameter at 0, while
allowing a constant decay parameter to be estimated.
Care should be taken to avoid multicollinearity when using
this operator. As with the lm() function, lm formulas have an
implicit intercept, which can be suppressed by specifying ~ 0 + ... or ~ -1 + ... on the formula. When lm is given a model
with intercept and a categorical predictor (including a
logical one), it will use the first level (or FALSE) as the
baseline, but if the model is without intercept, it will use all
levels of the first categorical predictor. This is typically what
is wanted in a linear regression, but for the N operator, this
can be problematic if the "intercept" effect is added by a
different term. A workaround is to convert the categorical
predictor to dummy variables before putting it into the lm
formula.
Krivitsky PN, Coletti P, Hens N (2023). “A Tale of Two Datasets: Representativeness and Generalisability of Inference for Samples of Networks.” Journal of the American Statistical Association, 118(544), 2213-2224. doi:10.1080/01621459.2023.2242627.
ergmTerm for index of model terms currently visible to the package.
None
vignette("Goeyvaerts_reproduction") for a demonstration.
Returns a network with edges optionally filtered according to a specified criterion and with edge attributes optionally computed from other edge attributes.
network_view(x, ..., .clear = FALSE, .sep = ".")network_view(x, ..., .clear = FALSE, .sep = ".")
x |
a |
... |
a list of attribute or filtering specifications. See Details. |
.clear |
whether the edge attributes not set by this call should be deleted. |
.sep |
when specifying via a character vector, use this as the separator for concatenating edge values. |
Attribute specification arguments have the form
<newattrname> = <expr>, where <newattrname> specifies the
name of the new edge attribute (or attribute to be overwritten)
and <expr> can be one of the following:
The function will be passed two arguments, the
edgelist tibble and the network, and must return a vector of
edge attribute values to be set on the edges in the order
specified.
The expression on the RHS of the formula will be
evaluated with names in it referencing the edge attributes. The
input network may be referenced as .nw. The expression's result
is expected to be a vector of edge attribute values to be set on
the edges in the order specified.
If of length one, the edge attribute with
that name will simply be copied; if greater than one, the attribute
values will be concatenated wtih the .sep argument as the
separator.
I()
The object will be used directly to set the edge attribute.
Filtering arguments are specified the same way as attribute
arguments, but they must be unnamed arguments (i.e., must be passed
without the =) and must return a logical or numeric vector
suitable for indexing the edge list. Multiple filtering arguments
may be specified, and the edge will be kept if it satisfies
all. If the conjunction of the edge's original states and the
filtering results is ambiguous (i.e., NA), it will be set as
missing.
A network object with modified edges and edge attributes.
data(florentine) flo <- flomarriage flo[,,add.edges=TRUE] <- as.matrix(flomarriage) | as.matrix(flobusiness) flo[,, names.eval="m"] <- as.matrix(flomarriage)==1 flobusiness[3,5] <- NA flo[,, names.eval="b"] <- as.matrix(flobusiness)==1 flo (flob <- network_view(flo, "b")) (flobusiness) # for comparison (flob <- network_view(flo, ~b&m)) (flobusiness & flomarriage) # for comparison as.matrix(flob <- network_view(flo, bm=~b+m), attrname="bm") (as.matrix(flobusiness) + as.matrix(flomarriage)) # for comparison as.matrix(flob <- network_view(flo, ~b, bm=~b+m), attrname="bm") as.matrix(flobusiness)*(1+as.matrix(flomarriage)) # for comparisondata(florentine) flo <- flomarriage flo[,,add.edges=TRUE] <- as.matrix(flomarriage) | as.matrix(flobusiness) flo[,, names.eval="m"] <- as.matrix(flomarriage)==1 flobusiness[3,5] <- NA flo[,, names.eval="b"] <- as.matrix(flobusiness)==1 flo (flob <- network_view(flo, "b")) (flobusiness) # for comparison (flob <- network_view(flo, ~b&m)) (flobusiness & flomarriage) # for comparison as.matrix(flob <- network_view(flo, bm=~b+m), attrname="bm") (as.matrix(flobusiness) + as.matrix(flomarriage)) # for comparison as.matrix(flob <- network_view(flo, ~b, bm=~b+m), attrname="bm") as.matrix(flobusiness)*(1+as.matrix(flomarriage)) # for comparison
A function for specifying the LHS of a multi-network
(a.k.a. multilevel) ERGM. Typically used in conjunction with the
N() term operator.
unNetworks() extracts the networks into a list.
Networks(...) unNetworks(object)Networks(...) unNetworks(object)
... |
network specification, in one of two formats:
|
object |
a multinetwork network returned by |
A network object comprising the provided networks, with multinetwork metadata.
Due to certain optimizations, the resulting network object's network and vertex attributes should be treated as read-only: do not modify them. If you need to change existing attributes or add new ones, do so on the input networks and call Networks(...) again.
ergmTerm for specific terms.
vignette("Goeyvaerts_reproduction") for a demonstration.
data(samplk) # Method 1: list of networks monks <- Networks(list(samplk1, samplk2)) ergm(monks ~ N(~edges)) # Method 2: networks as arguments monks <- Networks(samplk1, samplk2) ergm(monks ~ N(~edges))data(samplk) # Method 1: list of networks monks <- Networks(list(samplk1, samplk2)) ergm(monks ~ N(~edges)) # Method 2: networks as arguments monks <- Networks(samplk1, samplk2) ergm(monks ~ N(~edges))
gofN, making residual and scale-location plots.The plot() method uses R graphics.
The ggplot2::autoplot() method uses ggplot2 and ggrepel.
## S3 method for class 'gofN' plot( x, against = NULL, which = 1:2, col = 1, pch = 1, cex = 1, bg = 0, ..., ask = length(which) > 1 && dev.interactive(TRUE), id.n = 3, id.label = NULL, main = "{type} for {sQuote(name)}", xlab = NULL, ylim = NULL, cex.id = 0.75 ) ## S3 method for class 'gofN' autoplot( x, against = .fitted, which = 1:2, mappings = list(), geom_args = list(), id.n = 3, id.label = NULL )## S3 method for class 'gofN' plot( x, against = NULL, which = 1:2, col = 1, pch = 1, cex = 1, bg = 0, ..., ask = length(which) > 1 && dev.interactive(TRUE), id.n = 3, id.label = NULL, main = "{type} for {sQuote(name)}", xlab = NULL, ylim = NULL, cex.id = 0.75 ) ## S3 method for class 'gofN' autoplot( x, against = .fitted, which = 1:2, mappings = list(), geom_args = list(), id.n = 3, id.label = NULL )
x |
a |
against |
what the residuals should be plotted against. Note that different methods use different formats: see Details. Categorical ( |
which |
which to plot ( |
col, pch, cex, bg
|
vector of values (wrapped in |
... |
additional arguments to |
ask |
whether the user should be prompted between the plots. |
id.n |
maximum number of extreme points to label explicitly. |
id.label |
specification for how extreme points are to be labeled, defaulting to network's index in the combined network. |
main |
a template for the plots' titles; these use |
xlab |
horizontal axis label; defaults to a character representation of |
ylim |
vertical range for the plots, interpreted as in |
cex.id |
scaling factor for characters used to label extreme points; see |
mappings |
a named list of lists of mappings constructed by |
geom_args |
a named list of lists of arguments overriding the defaults for the individual geoms. See Details below. |
For the plot() method, against and id.label can be vectors of values (enclosed in I() to be used as is), a character string identifying a network attribute, or a formula whose RHS gives an expression in terms of network attributes to plot against. The against formula may also contain a .fitted variable which will be substituted with the fitted values.
For autoplot.gofN(), against and id.label are interpreted as
expressions in terms of network attributes and values generated by
augment.gofN(), included .fitted for the fitted values.
autoplot.gofN() returns a list of ggplot objects that
if printed render to diagnostic plots. If there is only one, the
object itself is returned.
autoplot.gofN()
autoplot.gofN() constructs the plots out of ggplot2::ggplot(),
ggplot2::geom_point() (for numeric against), ggplot2::geom_boxplot() for
categorical or ordinal against), and ggplot2::geom_smooth() (for numeric
or ordinal against), and ggrepel::geom_text_repel(). Mappings and
arguments passed through mappings and geom_args override the
respective defaults. They may have elements default (for
ggplot()), point (for geom_point() and geom_boxplot()),
smooth (for geom_smooth), and text (for geom_text_repel()).
gofN() for examples, plot.lm(), graphics::plot() for regression diagnostic plots and their parameters.
A utility to facilitate argument completion of control lists, reexported from statnet.common.
This list is updated as packages are loaded and unloaded.
control.ergmdrop, init, init.method, main.method, force.main, main.hessian,
checkpoint, resume, MPLE.samplesize, init.MPLE.samplesize,
MPLE.type, MPLE.maxit, MPLE.nonvar, MPLE.nonident,
MPLE.nonident.tol, MPLE.covariance.samplesize,
MPLE.covariance.method, MPLE.covariance.sim.burnin,
MPLE.covariance.sim.interval, MPLE.check,
MPLE.constraints.ignore, MCMC.prop, MCMC.prop.weights,
MCMC.prop.args, MCMC.interval, MCMC.burnin,
MCMC.samplesize, MCMC.effectiveSize,
MCMC.effectiveSize.damp, MCMC.effectiveSize.maxruns,
MCMC.effectiveSize.burnin.pval,
MCMC.effectiveSize.burnin.min,
MCMC.effectiveSize.burnin.max,
MCMC.effectiveSize.burnin.nmin,
MCMC.effectiveSize.burnin.nmax,
MCMC.effectiveSize.burnin.PC,
MCMC.effectiveSize.burnin.scl,
MCMC.effectiveSize.order.max, MCMC.return.stats,
MCMC.runtime.traceplot, MCMC.maxedges, MCMC.addto.se,
MCMC.packagenames, SAN.maxit, SAN.nsteps.times, SAN,
MCMLE.termination, MCMLE.maxit, MCMLE.conv.min.pval,
MCMLE.confidence, MCMLE.confidence.boost,
MCMLE.confidence.boost.threshold,
MCMLE.confidence.boost.lag, obs.MCMC.mul,
obs.MCMC.samplesize.mul, obs.MCMC.samplesize,
obs.MCMC.effectiveSize, obs.MCMC.interval.mul,
obs.MCMC.interval, obs.MCMC.burnin.mul, obs.MCMC.burnin,
obs.MCMC.prop, obs.MCMC.prop.weights, obs.MCMC.prop.args,
obs.MCMC.impute.min_informative,
obs.MCMC.impute.default_density, MCMLE.min.depfac,
MCMLE.sampsize.boost.pow, MCMLE.MCMC.precision,
MCMLE.MCMC.max.ESS.frac, MCMLE.metric,
MCMLE.metric.settings, MCMLE.steplength.margin,
MCMLE.steplength, MCMLE.steplength.parallel,
MCMLE.sequential, MCMLE.density.guard.min,
MCMLE.density.guard, MCMLE.effectiveSize,
obs.MCMLE.effectiveSize, MCMLE.interval, MCMLE.burnin,
MCMLE.samplesize.per_theta, MCMLE.samplesize.min,
MCMLE.samplesize, obs.MCMLE.samplesize.per_theta,
obs.MCMLE.samplesize.min, obs.MCMLE.samplesize,
obs.MCMLE.interval, obs.MCMLE.burnin,
MCMLE.steplength.solver, MCMLE.last.boost,
MCMLE.steplength.esteq, MCMLE.steplength.miss.sample,
MCMLE.steplength.min, MCMLE.effectiveSize.interval_drop,
MCMLE.save_intermediates, MCMLE.nonvar, MCMLE.nonident,
MCMLE.nonident.tol, SA.phase1_n, SA.initial_gain,
SA.nsubphases, SA.min_iterations, SA.max_iterations,
SA.phase3_n, SA.interval, SA.burnin, SA.samplesize,
CD.samplesize.per_theta, obs.CD.samplesize.per_theta,
CD.nsteps, CD.multiplicity, CD.nsteps.obs,
CD.multiplicity.obs, CD.maxit, CD.conv.min.pval,
CD.metric, CD.metric.settings, CD.steplength.margin,
CD.steplength, CD.steplength.esteq,
CD.steplength.miss.sample, CD.steplength.min,
CD.steplength.parallel, CD.steplength.solver, loglik,
term.options, seed, parallel, parallel.type,
parallel.version.check, parallel.inherit.MT, ...
control.ergm.bridgebridge.nsteps, bridge.target.se, bridge.bidirectional, drop,
MCMC.burnin, MCMC.burnin.between, MCMC.interval,
MCMC.samplesize, obs.MCMC.burnin,
obs.MCMC.burnin.between, obs.MCMC.interval,
obs.MCMC.samplesize, MCMC.prop, MCMC.prop.weights,
MCMC.prop.args, obs.MCMC.prop,
obs.MCMC.prop.weights, obs.MCMC.prop.args,
MCMC.maxedges, MCMC.packagenames, term.options,
seed, parallel, parallel.type,
parallel.version.check, parallel.inherit.MT, ...
control.ergm3drop, init, init.method, main.method, force.main, main.hessian,
checkpoint, resume, MPLE.samplesize,
init.MPLE.samplesize, MPLE.type, MPLE.maxit, MPLE.nonvar,
MPLE.nonident, MPLE.nonident.tol,
MPLE.covariance.samplesize, MPLE.covariance.method,
MPLE.covariance.sim.burnin, MPLE.covariance.sim.interval,
MPLE.check, MPLE.constraints.ignore, MCMC.prop,
MCMC.prop.weights, MCMC.prop.args, MCMC.interval,
MCMC.burnin, MCMC.samplesize, MCMC.effectiveSize,
MCMC.effectiveSize.damp, MCMC.effectiveSize.maxruns,
MCMC.effectiveSize.burnin.pval,
MCMC.effectiveSize.burnin.min,
MCMC.effectiveSize.burnin.max,
MCMC.effectiveSize.burnin.nmin,
MCMC.effectiveSize.burnin.nmax,
MCMC.effectiveSize.burnin.PC,
MCMC.effectiveSize.burnin.scl,
MCMC.effectiveSize.order.max, MCMC.return.stats,
MCMC.runtime.traceplot, MCMC.maxedges, MCMC.addto.se,
MCMC.packagenames, SAN.maxit, SAN.nsteps.times, SAN,
MCMLE.termination, MCMLE.maxit, MCMLE.conv.min.pval,
MCMLE.confidence, MCMLE.confidence.boost,
MCMLE.confidence.boost.threshold,
MCMLE.confidence.boost.lag, obs.MCMC.mul,
obs.MCMC.samplesize.mul, obs.MCMC.samplesize,
obs.MCMC.effectiveSize, obs.MCMC.interval.mul,
obs.MCMC.interval, obs.MCMC.burnin.mul, obs.MCMC.burnin,
obs.MCMC.prop, obs.MCMC.prop.weights, obs.MCMC.prop.args,
obs.MCMC.impute.min_informative,
obs.MCMC.impute.default_density, MCMLE.min.depfac,
MCMLE.sampsize.boost.pow, MCMLE.MCMC.precision,
MCMLE.MCMC.max.ESS.frac, MCMLE.metric,
MCMLE.metric.settings, MCMLE.steplength.margin,
MCMLE.steplength, MCMLE.steplength.parallel,
MCMLE.sequential, MCMLE.density.guard.min,
MCMLE.density.guard, MCMLE.effectiveSize,
obs.MCMLE.effectiveSize, MCMLE.interval, MCMLE.burnin,
MCMLE.samplesize.per_theta, MCMLE.samplesize.min,
MCMLE.samplesize, obs.MCMLE.samplesize.per_theta,
obs.MCMLE.samplesize.min, obs.MCMLE.samplesize,
obs.MCMLE.interval, obs.MCMLE.burnin,
MCMLE.steplength.solver, MCMLE.last.boost,
MCMLE.steplength.esteq, MCMLE.steplength.miss.sample,
MCMLE.steplength.min, MCMLE.effectiveSize.interval_drop,
MCMLE.save_intermediates, MCMLE.nonvar, MCMLE.nonident,
MCMLE.nonident.tol, SA.phase1_n, SA.initial_gain,
SA.nsubphases, SA.min_iterations, SA.max_iterations,
SA.phase3_n, SA.interval, SA.burnin, SA.samplesize,
CD.samplesize.per_theta, obs.CD.samplesize.per_theta,
CD.nsteps, CD.multiplicity, CD.nsteps.obs,
CD.multiplicity.obs, CD.maxit, CD.conv.min.pval,
CD.metric, CD.metric.settings, CD.steplength.margin,
CD.steplength, CD.steplength.esteq,
CD.steplength.miss.sample, CD.steplength.min,
CD.steplength.parallel, CD.steplength.solver, loglik,
term.options, seed, parallel, parallel.type,
parallel.version.check, parallel.inherit.MT, ...
control.gof.ergmnsim, MCMC.burnin, MCMC.interval, MCMC.batch, MCMC.prop,
MCMC.prop.weights, MCMC.prop.args, MCMC.maxedges,
MCMC.packagenames, MCMC.runtime.traceplot,
network.output, seed, parallel, parallel.type,
parallel.version.check, parallel.inherit.MT
control.gof.formulansim, MCMC.burnin, MCMC.interval, MCMC.batch, MCMC.prop,
MCMC.prop.weights, MCMC.prop.args, MCMC.maxedges,
MCMC.packagenames, MCMC.runtime.traceplot,
network.output, seed, parallel, parallel.type,
parallel.version.check, parallel.inherit.MT
control.logLik.ergmbridge.nsteps, bridge.target.se, bridge.bidirectional, drop,
MCMC.burnin, MCMC.interval, MCMC.samplesize,
obs.MCMC.samplesize, obs.MCMC.interval,
obs.MCMC.burnin, MCMC.prop, MCMC.prop.weights,
MCMC.prop.args, obs.MCMC.prop,
obs.MCMC.prop.weights, obs.MCMC.prop.args,
MCMC.maxedges, MCMC.packagenames, term.options,
seed, parallel, parallel.type,
parallel.version.check, parallel.inherit.MT, ...
control.sanSAN.maxit, SAN.tau, SAN.invcov, SAN.invcov.diag, SAN.nsteps.alloc,
SAN.nsteps, SAN.samplesize, SAN.prop, SAN.prop.weights,
SAN.prop.args, SAN.packagenames, SAN.ignore.finite.offsets,
term.options, seed, parallel, parallel.type,
parallel.version.check, parallel.inherit.MT
control.simulateMCMC.burnin, MCMC.interval, MCMC.prop, MCMC.prop.weights,
MCMC.prop.args, MCMC.batch, MCMC.effectiveSize,
MCMC.effectiveSize.damp, MCMC.effectiveSize.maxruns,
MCMC.effectiveSize.burnin.pval,
MCMC.effectiveSize.burnin.min,
MCMC.effectiveSize.burnin.max,
MCMC.effectiveSize.burnin.nmin,
MCMC.effectiveSize.burnin.nmax,
MCMC.effectiveSize.burnin.PC,
MCMC.effectiveSize.burnin.scl,
MCMC.effectiveSize.order.max, MCMC.maxedges,
MCMC.packagenames, MCMC.runtime.traceplot,
network.output, term.options, parallel, parallel.type,
parallel.version.check, parallel.inherit.MT, ...
control.simulate.ergmMCMC.burnin, MCMC.interval, MCMC.scale, MCMC.prop, MCMC.prop.weights,
MCMC.prop.args, MCMC.batch, MCMC.effectiveSize,
MCMC.effectiveSize.damp,
MCMC.effectiveSize.maxruns,
MCMC.effectiveSize.burnin.pval,
MCMC.effectiveSize.burnin.min,
MCMC.effectiveSize.burnin.max,
MCMC.effectiveSize.burnin.nmin,
MCMC.effectiveSize.burnin.nmax,
MCMC.effectiveSize.burnin.PC,
MCMC.effectiveSize.burnin.scl,
MCMC.effectiveSize.order.max, MCMC.maxedges,
MCMC.packagenames, MCMC.runtime.traceplot,
network.output, term.options, parallel,
parallel.type, parallel.version.check,
parallel.inherit.MT, ...
control.simulate.formulaMCMC.burnin, MCMC.interval, MCMC.prop, MCMC.prop.weights,
MCMC.prop.args, MCMC.batch,
MCMC.effectiveSize, MCMC.effectiveSize.damp,
MCMC.effectiveSize.maxruns,
MCMC.effectiveSize.burnin.pval,
MCMC.effectiveSize.burnin.min,
MCMC.effectiveSize.burnin.max,
MCMC.effectiveSize.burnin.nmin,
MCMC.effectiveSize.burnin.nmax,
MCMC.effectiveSize.burnin.PC,
MCMC.effectiveSize.burnin.scl,
MCMC.effectiveSize.order.max, MCMC.maxedges,
MCMC.packagenames, MCMC.runtime.traceplot,
network.output, term.options, parallel,
parallel.type, parallel.version.check,
parallel.inherit.MT, ...
control.simulate.formula.ergmMCMC.burnin, MCMC.interval, MCMC.prop, MCMC.prop.weights,
MCMC.prop.args, MCMC.batch,
MCMC.effectiveSize,
MCMC.effectiveSize.damp,
MCMC.effectiveSize.maxruns,
MCMC.effectiveSize.burnin.pval,
MCMC.effectiveSize.burnin.min,
MCMC.effectiveSize.burnin.max,
MCMC.effectiveSize.burnin.nmin,
MCMC.effectiveSize.burnin.nmax,
MCMC.effectiveSize.burnin.PC,
MCMC.effectiveSize.burnin.scl,
MCMC.effectiveSize.order.max,
MCMC.maxedges, MCMC.packagenames,
MCMC.runtime.traceplot, network.output,
term.options, parallel, parallel.type,
parallel.version.check,
parallel.inherit.MT, ...
split() method for network::network objects.Split a network into subnetworks on a factor.
## S3 method for class 'network' split(x, f, drop = FALSE, sep = ".", lex.order = FALSE, ...)## S3 method for class 'network' split(x, f, drop = FALSE, sep = ".", lex.order = FALSE, ...)
x |
a |
f, drop, sep, lex.order
|
see |
... |
additional arguments, currently unused. |
A network.list containing the networks. These networks
will inherit all vertex and edge attributes, as well as relevant
network attributes.
network::get.inducedSubgraph()
This term adds one statistic to the model, equal to the number of cross-layer two-stars or two-paths in the network.
# binary: twostarL(Ls, type, distinct=TRUE)# binary: twostarL(Ls, type, distinct=TRUE)
Ls |
a list (constructed by |
type |
if the network is directed, an argument to determine which configurations are counted:
This argument is ignored for undirected networks. |
distinct |
if |
ergmTerm for index of model terms currently visible to the package.
None
For a directed network, only dyads for
which may be toggled (though is usually
excluded by other constraints). Optional argument attr controls
which subgraphs are thus restricted.
# upper_tri(attr = NULL)# upper_tri(attr = NULL)
attr |
a vertex attribute specification (see Specifying Vertex attributes and Levels ( |
ergmConstraint for index of constraints and hints currently visible to the package.
None