| tulpa_gaussian | R Documentation |
Proof-of-concept function demonstrating the tulpa generic interface: the
Gaussian likelihood is supplied as a LikelihoodSpec and fitted by the
production NUTS sampler every other ModelData backend runs (dual-averaged
step size, adapted diagonal mass matrix, reverse-mode AD gradient checked
against finite differences before sampling). Fits
y ~ Normal(X * beta, sigma).
tulpa_gaussian(
formula,
data,
beta_prior = .tulpa_default_beta_prior("gaussian"),
control = list()
)
formula |
A formula (e.g., y ~ x1 + x2) |
data |
A data frame |
beta_prior |
Fixed-effect prior as |
control |
List of sampler knobs: |
A tulpa_fit list with draws (post-warmup draws of beta[j] and
log_sigma), means, sigma (exp() of the posterior mean of
log_sigma), accept_rate (the mean NUTS acceptance statistic over the
post-warmup iterations), the per-iteration accept_prob, divergent,
treedepth and log_prob, the adapted step size epsilon, and
formula, N, p.
set.seed(1)
d <- data.frame(x = rnorm(40))
d$y <- 1 + 2 * d$x + rnorm(40, 0, 0.6)
fit <- tulpa_gaussian(y ~ x, d, control = list(iter = 1000, warmup = 500,
seed = 1))
fit$means
fit$accept_rate
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.