View source: R/fit_laplace_beta.R
| tulpa_laplace_beta | R Documentation |
Thin wrapper around tulpa_laplace() for family = "beta". The
Laplace engine treats phi as fixed per fit (same contract as gamma
and neg_binomial_2); this wrapper does an outer 1-D optimisation of
the Laplace-approximated log-marginal over phi, then refits at the
optimum to return betas and Hessian.
The mean-precision parameterisation is y ~ Beta(mu * phi, (1 - mu) * phi)
with default logit link; y must be strictly in (0, 1).
tulpa_laplace_beta(
y,
X,
re_list = list(),
spatial = NULL,
weights = NULL,
offset = NULL,
max_iter = 100L,
tol = 1e-06,
n_threads = 1L,
beta_prior = NULL,
phi_init = NULL,
phi_bounds = c(0.1, 10000),
outer_tol = 1e-04,
mode = c("laplace", "nuts"),
control = list()
)
y |
Response in |
X |
Fixed-effects design matrix. |
re_list, spatial, weights, offset, max_iter, tol, n_threads, beta_prior |
Passed to |
phi_init |
Optional starting value for the precision. If |
phi_bounds |
Numeric length-2 vector with lower/upper bounds on
|
outer_tol |
Tolerance for the outer optimisation. Default 1e-4. |
mode |
Inference method (the method is an argument, not a parallel
verb): |
control |
Passed to |
For mode = "laplace", the list returned by tulpa_laplace() at the
optimum, augmented with phi (the optimised precision), phi_trace (the
optimisation trace: a matrix with one row per objective evaluation and
columns phi and log_marginal) and phi_converged (TRUE when the
Brent search reported convergence). For mode = "nuts", the draws object
returned by tulpa_nuts_beta().
set.seed(1)
n <- 200L
X <- cbind(1, rnorm(n))
mu <- plogis(X %*% c(0.2, 0.7)); phi <- 8
y <- rbeta(n, mu * phi, (1 - mu) * phi)
fit <- tulpa_laplace_beta(y, X)
fit$mode
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.