tergmprepare | R Documentation |
Prepare data structure for TERGM estimation, including composition change.
tergmprepare(formula, offset = TRUE, blockdiag = FALSE, verbose = TRUE)
formula |
The original formula provided by the user, given the data structures in the workspace. |
offset |
Indicates whether absent nodes should be added where they are
missing ( |
blockdiag |
Should the time steps be arranged in a blockdiagonal matrix
for use with MCMC-MLE or Bayesian estimation ( |
verbose |
Report details about dimension adjustment? |
This is a helper function that adjusts the dimensions of networks or
covariates within a given time step to each other by removing nodes that are
not present across all objects within a time step or by adding nodes where
they are missing (and simultaneously adding entries to a list of structural
zero matrices to indicate their absence). It is not necessary to have
identical (numbers of) nodes across time steps as long as the dimensions of
the matrices, networks, and vectors match cross-sectionally within time
steps, given that temporal dependency terms like memory are interpreted as
dyadic covariates in a given time step. This helper function also creates
these dyadic covariate data structures for some of the custom temporal model
terms, such as memory
and delrecip
. Leifeld, Cranmer and
Desmarais (2018) contain additional details on composition change, dimension
adjustment of matrices, and temporal dependencies. Note that this function
should not normally be used by the end user. It is automatically called
internally by the estimation functions to make the dimensions of all objects
conformable to each other for estimation. Use this function only for
diagnostic purposes!
A list with the following slots:
A character object containing the original name of the
object on the left-hand side of the formula provided by the user. This is
saved here because the formula is manipulated such that the left-hand
side of the formula contains a new item networks[[i]]
.
The list of networks on the left-hand side of the formula
after dimension adjustment, or a blockdiagonal network representing the
left-hand side of the formula after dimension adjustment if argument
blockdiag = TRUE
was used.
The maximum number of nodes of any time point after adjustment of dimensions.
Are the networks directed?
Are the networks bipartite?
The formula after manipulation and adjustment of the data,
including networks[[i]]
on the left-hand side and an added offset
covariate on the right-hand side of the formula, in addition to added
indices for the covariate terms.
The number of time steps of the dataset.
The right-hand side of the formula after adjustment, as
a vector of character
objects representing the terms.
A character
vector containing the names of the
objects in which the networks and covariates are stored, according to the
manipulated formula. This includes "networks"
(for the left-hand
side of the formula) and all objects containing exogenous covariates on
the right-hand side of the formula after manipulation.
Each of the covariates mentioned in the slot covnames
is
stored as an element of the list, either as a list of matrices or
networks (if blockdiag = FALSE
) or as a matrix or network object
(if blockdiag = TRUE
).
Did the function have to adjust the dimensions of the networks or covariates at all?
A matrix containing the number of nodes in the rows and columns of each object at each time step, after adjustment.
A list of offset covariate matrices or a large blockdiagonal
offset covariate matrix containing structural zeros. If
offset = FALSE
, this matrix or list of matrices will contain only
zeros. If offset = TRUE
, they will contain ones where nodes were
absent in the original data.
Philip Leifeld
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.