Skip to contents

Summarize posterior snap indices

Usage

snap_index_summary(
  fit,
  actors = NULL,
  years = NULL,
  side = c("u", "v"),
  probs = c(0.025, 0.1, 0.5, 0.9, 0.975)
)

Arguments

fit

a lame fit with snap-shift MCMC output, run with retained snap draws for posterior uncertainty.

actors

optional actor names or indices. Default uses every actor on the selected side.

years

optional year/period names or indices. Default uses every period.

side

"u" for sender/row-side snap indicators or "v" for receiver/column-side indicators.

probs

numeric quantiles to report.

Value

A data frame with one row per selected year.

Examples

set.seed(1)
n <- 12; Tt <- 3
Y <- lapply(seq_len(Tt), function(t) {
  m <- matrix(rnorm(n * n), n, n); diag(m) <- NA; m
})
# chains = 1 keeps the example short; the default runs two chains and compares them
fit <- lame(Y, R = 1, dynamic_uv = TRUE, dynamic_uv_kind = "snap",
            keep_snap_draws = "draws",
            nscan = 20, burn = 5, odens = 1, verbose = FALSE, plot = FALSE, chains = 1)
snap_index_summary(fit, side = "u")
#>   year side n_actors      mean        sd q2_5 q10        q50       q90
#> 1   t1    u       12        NA        NA   NA  NA         NA        NA
#> 2   t2    u       12 0.1083333 0.1241933    0   0 0.08333333 0.3333333
#> 3   t3    u       12 0.1333333 0.1389181    0   0 0.08333333 0.3333333
#>       q97_5
#> 1        NA
#> 2 0.3333333
#> 3 0.3770833