Accumulate Connections from a Multidimensional Array and Context Model
accumulate.RdThis function processes a context model and a multidimensional array of window/weight parameters to compute connection counts for each unit of analysis. It applies the context model to the array, using sender, receiver, and mode columns (as defined in the array attributes), and accumulates co-occurrence or adjacency matrices for each unit. The result is a set of connection counts and row-level connection matrices, suitable for network analysis (e.g., ENA/ONA).
Usage
accumulate(
context_model,
codes,
tensor = context_tensor(context_model$model$raw.input),
time_column = NULL,
ordered = FALSE,
binary = TRUE
)Arguments
- context_model
A context model object (as produced by `tma::contexts`) containing contexts for each unit of analysis.
- codes
Character vector of code names to use for constructing adjacency matrices.
- tensor
A multidimensional array (see `context_tensor`) containing window and weight values for each sender/receiver/mode combination. Defaults to an array generated from the context model's raw input.
- time_column
Character string giving the name of the time column in the context model. If NULL, uses the default context column ID.
- ordered
Logical; if TRUE (default), computes ordered adjacency matrices (ONA); if FALSE, computes unordered (ENA-style) matrices.
- binary
Logical; if TRUE (default), binarizes the connection counts (not currently implemented in this function).
Value
The input `context_model` with additional fields:
- connection.counts
A data.table of accumulated connection counts for each unit.
- model$row.connection.counts
A data.table of row-level connection matrices for each unit.
- meta.data
A data.table of metadata columns for each unit.
The class of the returned object is updated to reflect the type of accumulation (ordered or unordered).