| stack_stats | R Documentation |
Stack a tomstats object into long format suitable for fitting with
standard R model functions. Each row corresponds to one dyad in the risk
set at one event time point.
stack_stats(stats, reh, add_actors = TRUE)
stats |
A |
reh |
A |
add_actors |
Logical (default |
For interval timing (ordinal = FALSE), the stacked data can be
fitted with a Poisson GLM using log_interevent as an offset:
glm(obs ~ -1 + . - time - dyad - log_interevent,
offset = log_interevent, family = poisson, data = stacked$remstats_stack)
For ordinal timing (ordinal = TRUE), use conditional logistic
regression stratified by time point:
survival::clogit(obs ~ -1 + . - time - dyad +
strata(time), data = stacked$remstats_stack)
A list with elements:
Data frame in long format with columns: time
(time-point index matching attr(stats, "subset") sequence),
all statistic columns, log_interevent (log
inter-event time; interval timing only), obs (1 = observed event,
0 = non-event), dyad (active dyad index 1..D), and — when
add_actors = TRUE and the riskset is available — actor1
(sender label) and actor2 (receiver label).
Integer vector of length 2: first and last event index.
Number of dyads in the risk set.
Number of events (time points).
Logical: whether the ordinal likelihood applies.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.