These two functions are used to go back and forth from a pooled ergm vs a
blockdiagonal model, the latter to be fitted using ergm::ergm.

blockdiagonalize(x, attrname = "block")
splitnetwork(x, attrname)
ergm_blockdiag(formula, ...)

## Arguments

x |
In the case of `blockdiagonalize` , a list of networks or matrices.
For `splitnetwork` a single network object with a vertex attribute that can
be used to split the data. |

attrname |
Name of the attribute that holds the block ids. |

formula |
An ergm model which networks' will be wrapped with
blockdiagonalize (see details). |

... |
Further arguments passed to the method. |

## Value

An object of class ergm::ergm.

## Details

The function `ergm_blockdiag`

is a wrapper function that takes the
model's network, stacks the networks into a single block diagonal net, and
calls ergm::ergm with the option `constraints = blockdiag("block")`

.

One side effect of this function is that it loads the `ergm`

package via
requireNamespace, so after executing the function `ergm`

the package will
be loaded.

## Examples

#> Loading required package: network

#> network: Classes for Relational Data
#> Version 1.16.0 created on 2019-11-30.
#> copyright (c) 2005, Carter T. Butts, University of California-Irvine
#> Mark S. Handcock, University of California -- Los Angeles
#> David R. Hunter, Penn State University
#> Martina Morris, University of Washington
#> Skye Bender-deMoll, University of Washington
#> For citation information, type citation("network").
#> Type help("network-package") to get started.

#>
#> ergm: version 3.10.4, created on 2019-06-10
#> Copyright (c) 2019, Mark S. Handcock, University of California -- Los Angeles
#> David R. Hunter, Penn State University
#> Carter T. Butts, University of California -- Irvine
#> Steven M. Goodreau, University of Washington
#> Pavel N. Krivitsky, University of Wollongong
#> Martina Morris, University of Washington
#> with contributions from
#> Li Wang
#> Kirk Li, University of Washington
#> Skye Bender-deMoll, University of Washington
#> Chad Klumb
#> Based on "statnet" project software (statnet.org).
#> For license and citation information see statnet.org/attribution
#> or type citation("ergm").

#> NOTE: Versions before 3.6.1 had a bug in the implementation of the bd()
#> constriant which distorted the sampled distribution somewhat. In
#> addition, Sampson's Monks datasets had mislabeled vertices. See the
#> NEWS and the documentation for more details.

#> NOTE: Some common term arguments pertaining to vertex attribute and
#> level selection have changed in 3.10.0. See terms help for more
#> details. Use ‘options(ergm.term=list(version="3.9.4"))’ to use old
#> behavior.

#> Warning: `set_attrs()` is deprecated as of rlang 0.3.0
#> This warning is displayed once per session.

#> Starting maximum pseudolikelihood estimation (MPLE):

#> Evaluating the predictor and response matrix.

#> Maximizing the pseudolikelihood.

#> Finished MPLE.

#> Stopping at the initial estimate.

#> Evaluating log-likelihood at the estimate.

#>

#> Warning: The observed statistics (target.statistics) are near or at the boundary of its support, i.e. the Maximum Likelihood Estimates maynot exist or be hard to be estimated. In particular, the statistic(s) "edges", "nodematch.female".

#> Starting maximum pseudolikelihood estimation (MPLE):

#> Evaluating the predictor and response matrix.

#> Maximizing the pseudolikelihood.

#> Finished MPLE.

#> Stopping at the initial estimate.

#> Evaluating log-likelihood at the estimate.

#>