| tulpa_ep | R Documentation |
Fits a generalized linear model with a Gaussian coefficient prior by Expectation Propagation: the posterior is approximated by a Gaussian whose per-observation sites match the moments of the tilted distribution (via Gauss-Hermite quadrature). EP is exact for a Gaussian likelihood and typically more accurate than Laplace on skewed likelihoods, since it matches marginal moments rather than the mode curvature.
tulpa_ep(
formula,
data,
family = "binomial",
phi = 1,
phi2 = NULL,
n_trials = NULL,
beta_prior = .tulpa_default_beta_prior("ep"),
control = list()
)
formula |
Model formula. |
data |
A data frame. |
family |
Character family name (see |
phi |
Dispersion passed to the family, held fixed. One convention at
every door: for Defaulted, it conditions at 1 and says so with a warning, since for a
family that reads a dispersion that is a modelling choice rather than a
neutral value. |
phi2 |
Optional second dispersion (Student-t degrees of freedom for
|
n_trials |
Binomial denominators (length |
beta_prior |
Fixed-effect prior as |
control |
List: An |
A tulpa_fit with means (posterior mean) and
cov (posterior covariance) of the EP Gaussian, which is the posterior
coef(), vcov(), summary.tulpa_fit() and confint() report; draws sampled
from that Gaussian; log_marginal (the EP approximation); converged
(the sweep tolerance was met AND every site's adaptive quadrature mode
search converged AND no site's tilted variance floored – a site that is
not well resolved by the quadrature turns this FALSE even when the
outer sweep loop itself settled); n_site_not_converged,
n_site_floored.
Minka (2001). Expectation Propagation for approximate Bayesian inference. UAI. Rasmussen & Williams (2006). Gaussian Processes for Machine Learning, Algorithm 3.5.
tulpa() (Laplace / sampler tiers), pathfinder() (VI).
set.seed(1)
d <- data.frame(x = rnorm(200))
d$y <- rbinom(200, 1, plogis(-0.3 + 0.8 * d$x))
fit <- tulpa_ep(y ~ x, data = d, family = "binomial")
coef(fit)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.