stan_nlmer | R Documentation |
Bayesian inference for NLMMs with group-specific coefficients that have unknown covariance matrices with flexible priors.
stan_nlmer(
formula,
data = NULL,
subset,
weights,
na.action,
offset,
contrasts = NULL,
...,
prior = normal(autoscale = TRUE),
prior_aux = exponential(autoscale = TRUE),
prior_covariance = decov(),
prior_PD = FALSE,
algorithm = c("sampling", "meanfield", "fullrank"),
adapt_delta = NULL,
QR = FALSE,
sparse = FALSE
)
formula , data |
Same as for | |||||||||||
subset , weights , offset |
Same as | |||||||||||
na.action , contrasts |
Same as | |||||||||||
... |
Further arguments passed to the function in the rstan
package ( Another useful argument that can be passed to rstan via | |||||||||||
prior |
The prior distribution for the (non-hierarchical) regression coefficients. The default priors are described in the vignette
Prior
Distributions for rstanarm Models.
If not using the default,
See the priors help page for details on the families and
how to specify the arguments for all of the functions in the table above.
To omit a prior —i.e., to use a flat (improper) uniform prior—
Note: Unless | |||||||||||
prior_aux |
The prior distribution for the "auxiliary" parameter (if
applicable). The "auxiliary" parameter refers to a different parameter
depending on the The default prior is described in the vignette
Prior
Distributions for rstanarm Models.
If not using the default, | |||||||||||
prior_covariance |
Cannot be | |||||||||||
prior_PD |
A logical scalar (defaulting to | |||||||||||
algorithm |
A string (possibly abbreviated) indicating the
estimation approach to use. Can be | |||||||||||
adapt_delta |
Only relevant if | |||||||||||
QR |
A logical scalar defaulting to | |||||||||||
sparse |
A logical scalar (defaulting to |
The stan_nlmer
function is similar in syntax to
nlmer
but rather than performing (approximate) maximum
marginal likelihood estimation, Bayesian estimation is by default performed
via MCMC. The Bayesian model adds independent priors on the "coefficients"
— which are really intercepts — in the same way as
stan_nlmer
and priors on the terms of a decomposition of the
covariance matrices of the group-specific parameters. See
priors
for more information about the priors.
The supported transformation functions are limited to the named
"self-starting" functions in the stats library:
SSasymp
, SSasympOff
,
SSasympOrig
, SSbiexp
,
SSfol
, SSfpl
,
SSgompertz
, SSlogis
,
SSmicmen
, and SSweibull
.
A stanreg object is returned
for stan_nlmer
.
stanreg-methods
and
nlmer
.
The vignette for stan_glmer
, which also discusses
stan_nlmer
models. https://mc-stan.org/rstanarm/articles/
if (.Platform$OS.type != "windows" || .Platform$r_arch !="i386") {
data("Orange", package = "datasets")
Orange$circumference <- Orange$circumference / 100
Orange$age <- Orange$age / 100
fit <- stan_nlmer(
circumference ~ SSlogis(age, Asym, xmid, scal) ~ Asym|Tree,
data = Orange,
# for speed only
chains = 1,
iter = 1000
)
print(fit)
posterior_interval(fit)
plot(fit, regex_pars = "b\\[")
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.