Skip to contents

Extract posterior quantiles for model components

Usage

posterior_quantiles(
  fit,
  component = c("beta", "UV", "ab"),
  probs = c(0.025, 0.5, 0.975)
)

Arguments

fit

Fitted ame model object

component

Character; which component: "beta", "UV", "ab". The additive effects "ab" come back as a list of the row (a) and column (b) quantiles; a symmetric fit has one effect per actor, so b equals a.

probs

Numeric vector of probabilities for quantiles

Value

Matrix or array of posterior quantiles

Author

Cassy Dorff, Shahryar Minhas, Tosin Salau

Examples

set.seed(1)
n <- 12
Y <- matrix(rnorm(n * n), n, n); diag(Y) <- NA
X <- array(rnorm(n * n), dim = c(n, n, 1))
# chains = 1 keeps the example short; the default runs two chains and compares them
fit <- ame(Y, Xdyad = X, R = 1, nscan = 20, burn = 5, odens = 1, verbose = FALSE, chains = 1)
posterior_quantiles(fit, component = "beta")
#>         intercept Xdyad1_dyad
#> q2.5  -0.19223670 -0.22354089
#> q50   -0.02606943 -0.08597073
#> q97.5  0.33239310 -0.02719304