Skip to contents

Thin wrapper around ame_parallel that forces fitter = "lame". Use this for longitudinal data; in particular, multi-chain dynamic_beta / dynamic_uv / dynamic_ab fits are reached through here. The combined fit's $BETA is a 3-D array when dynamic_beta is on, and posterior::summarise_draws(as_draws(fit), "rhat") gives R-hat across chains for every per-period coefficient.

Usage

lame_parallel(
  Y,
  n_chains = 4,
  cores = n_chains,
  combine_method = c("pool", "list"),
  ...
)

Arguments

Y

Longitudinal network: list of T relational matrices, or a 3-D array [n, n, T].

n_chains

Number of parallel chains (default 4).

cores

CPU cores to use (default n_chains; 1 = sequential).

combine_method

"pool" (default) or "list".

...

Additional arguments forwarded to lame, including dynamic_beta, dynamic_uv, dynamic_ab, family, nscan, burn, odens, etc.

Value

Same as ame_parallel: a combined lame fit (when combine_method = "pool") or a list of fits.

Examples

# \donttest{
data(YX_bin_list)
fit_pll <- lame_parallel(lapply(YX_bin_list$Y, function(y) 1 * (y > 0)), Xdyad = YX_bin_list$X,
                         family = "binary", n_chains = 2, cores = 1,
                         nscan = 50, burn = 10, odens = 5,
                         dynamic_beta = "dyad", verbose = FALSE)
dim(fit_pll$BETA)        # [iter * n_chains, p, T]
#> [1] 20  4  4
fit_pll$chain_indicator  # length iter * n_chains
#>  [1] 1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2 2
if (requireNamespace("posterior", quietly = TRUE)) {
  posterior::summarise_draws(posterior::as_draws(fit_pll))
}
#> # A tibble: 21 × 10
#>    variable       mean median     sd    mad     q5   q95  rhat ess_bulk ess_tail
#>    <chr>         <dbl>  <dbl>  <dbl>  <dbl>  <dbl> <dbl> <dbl>    <dbl>    <dbl>
#>  1 intercept[t1] 0.126  0.126 0.0232 0.0322 0.0935 0.159  1.25       10       10
#>  2 X1_dyad[t1]   0.745  0.743 0.0269 0.0258 0.710  0.780  1.18       10       10
#>  3 X2_dyad[t1]   0.891  0.898 0.0412 0.0452 0.808  0.942  1.23       10       10
#>  4 X3_dyad[t1]   1.08   1.09  0.0333 0.0290 1.03   1.12   1.04       10       10
#>  5 intercept[t2] 0.126  0.126 0.0232 0.0322 0.0935 0.159  1.25       10       10
#>  6 X1_dyad[t2]   0.733  0.737 0.0280 0.0244 0.672  0.766  1.13       10       10
#>  7 X2_dyad[t2]   0.918  0.921 0.0370 0.0337 0.845  0.964  1.11       10       10
#>  8 X3_dyad[t2]   1.11   1.13  0.0392 0.0242 1.03   1.15   1.07       10       10
#>  9 intercept[t3] 0.126  0.126 0.0232 0.0322 0.0935 0.159  1.25       10       10
#> 10 X1_dyad[t3]   0.728  0.730 0.0357 0.0348 0.657  0.771  1.03       10       10
#> # ℹ 11 more rows
# }