blockdiagonalize {ergmito} | R Documentation |
Block-diagonal models using ergm
Description
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.
Usage
blockdiagonalize(x, attrname = "block")
splitnetwork(x, attrname)
ergm_blockdiag(formula, ...)
Arguments
x |
In the case of |
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. |
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.
Value
An object of class ergm::ergm.
Examples
library(ergm)
data(fivenets)
fivenets2 <- blockdiagonalize(fivenets, attrname = "block") # A network with
ans0 <- ergm(
fivenets2 ~ edges + nodematch("female"),
constraints = ~blockdiag("block")
)
ans1 <- ergmito(fivenets ~ edges + nodematch("female"))
# This is equivalent
ans2 <- ergm_blockdiag(fivenets ~ edges + nodematch("female"))