coef.choicer_hb: Extract posterior means from a hierarchical Bayes fit

View source: R/methods.R

coef.choicer_hbR Documentation

Extract posterior means from a hierarchical Bayes fit

Description

Extract posterior means from a hierarchical Bayes fit

Usage

## S3 method for class 'choicer_hb'
coef(object, component = c("beta", "theta", "delta", "xi"), ...)

Arguments

object

A choicer_hmnl or choicer_hmnp object.

component

Which block to return: "beta" (population means b, default), "theta" (delta mean function), "delta" (alternative effects), or "xi" (unobserved quality, delta - z'theta).

...

Additional arguments (ignored).

Value

Named numeric vector of posterior means.

Examples


sim <- simulate_hmnl_data(N = 50, T = 2, J = 3, seed = 42)
fit <- suppressWarnings(run_hmnlogit(sim$data, "task", "alt", "choice", c("x1", "x2"),
                    person_col = "pid",
                    mcmc = list(R = 300, burn = 100)))
coef(fit)
coef(fit, component = "delta")


choicer documentation built on Sept. 5, 2026, 1:07 a.m.