stan_gamm4(formula, random = NULL, family = gaussian(), data = list(),
weights = NULL, subset = NULL, na.action, knots = NULL,
drop.unused.levels = TRUE, ..., prior = normal(),
prior_intercept = normal(), prior_ops = prior_options(),
prior_covariance = decov(), prior_PD = FALSE, algorithm = c("sampling",
"meanfield", "fullrank"), adapt_delta = NULL, QR = FALSE)gamm4.glm,
but rarely specified.NULL to omit a prior and
see priors otherwise.NULL to omit a
prior and see priors otherwise. (Note: the prior
distribution for the intercept is set so it applies to the value when all
predictorsNULL to omit a prior on the dispersion and see
prior_options otherwise.NULL; see decov for
more information about the default arguments.FALSE) indicating
whether to draw from the prior predictive distribution instead of
conditioning on the outcome."sampling" for MCMC (the
default), "optimizing" for optimization, "meanfield" for
variational inference with independent normalgorithm="sampling". See
adapt_delta for details.FALSE) but if TRUE
applies a scaled qr decomposition to the design matrix,
$X = Q^\ast R^\ast$, where
$Q^\ast = Q \sqrt{n-1}$ and
$R^\ast = \frac{1}{\sstan_gamm4.stan_gamm4 function is similar in syntax to
gamm4, which accepts a syntax that is similar to (but
not quite as extensive as) that for gamm and converts
it internally into the syntax accepted by glmer. But
rather than performing (restricted) maximum likelihood estimation, the
stan_gamm4 function utilizes MCMC to perform Bayesian estimation.
The Bayesian model adds independent priors on the common regression
coefficients (in the same way as stan_glm) and priors on the
terms of a decomposition of the covariance matrices of the group-specific
parameters, including the smooths. Estimating these models via MCMC avoids
the optimization issues that often crop up with GAMMs and provides better
estimates for the uncertainty in the parameter estimates.
See gamm4 for more information about the model
specicification and priors for more information about the
priors.stanreg-methods and
gamm4.# see example(gamm4, package = "gamm4") but prefix gamm4() calls with stan_Run the code above in your browser using DataLab