nauf contrasts.The Bayesian fixed effects regression functions nauf_stan_lm, nauf_stan_glm.nb,
and nauf_stan_glm fit linear, negative binomial, and other generalized
linear models, respectively, impelementing nauf_contrasts.
nauf_stan_glm(formula, family = gaussian(), data = NULL, weights, subset,
na.action = na.pass, offset = NULL, model = TRUE, x = TRUE,
y = TRUE, contrasts = NULL, ncs_scale = attr(formula,
"standardized.scale"), ..., prior = rstanarm::normal(),
prior_intercept = rstanarm::normal(), prior_aux = rstanarm::cauchy(0, 5),
prior_PD = FALSE, algorithm = "sampling", adapt_delta = NULL,
QR = FALSE, sparse = FALSE)nauf_stan_lm(formula, data = NULL, subset, weights, na.action = na.pass,
model = TRUE, x = TRUE, y = TRUE, singular.ok = TRUE,
contrasts = NULL, offset, ncs_scale = attr(formula, "standardized.scale"),
..., prior = rstanarm::R2(stop("'location' must be specified")),
prior_intercept = NULL, prior_PD = FALSE, algorithm = "sampling",
adapt_delta = NULL)
nauf_stan_glm.nb(formula, data = NULL, weights, subset, na.action = na.pass,
offset = NULL, model = TRUE, x = TRUE, y = TRUE, contrasts = NULL,
link = "log", ncs_scale = attr(formula, "standardized.scale"), ...,
prior = rstanarm::normal(), prior_intercept = rstanarm::normal(),
prior_aux = rstanarm::cauchy(0, 5), prior_PD = FALSE,
algorithm = "sampling", adapt_delta = NULL, QR = FALSE)
See
nauf_model.frame.
Further arguments to be passed to sampling.
See stan_glmer for details.
Changes from the default "sampling" result in an
error. Only MCMC is currently supported.
See stan_lm.
A nauf.stanreg object.
nauf_stan_lm, nauf_stan_glm, and nauf_stan_glm.nb are based on
the rstanarm functions stan_lm, stan_glm,
and stan_glm.nb, respectively, but implement
nauf_contrasts. The nauf functions have all the same
arguments as the functions they are based on, but additionally
ncs_scale, which is passed to nauf_model.frame. Other
than ncs_scale, the arguments have the same functions as they do in
the functions they are based on. The
default values for na.action, contrasts, model,
x, and y cannot be changed. For na.action and
contrasts, see nauf_model.frame. Forcing model,
x, and y to be TRUE ensures that the fitted model
retains the model frame, model matrix, and response, respectively. This is
necessary for some generic functions applied to the fitted model to work
properly.
The default priors for the nauf Bayesian fixed effects regression
functions are the defaults from rstanarm version 2.15.3; if you have
a later version of the rstanarm package, then the default priors for
the nauf regression fitting functions may be different from the
rstanarm defaults.
nauf_contrasts for a description of the treatment of
NA values, stan_glm for a description of
the priors, and the documentation for Stan and the rstan and
rstanarm packages for algorithmic details.
dat <- fricatives
dat$uvoi[!(dat$lang == "Catalan" & dat$wordpos == "Medial")] <- NA
sobj <- standardize(dur ~ lang * wordpos + uvoi, dat)
mod <- nauf_stan_lm(sobj$formula, sobj$data, prior = R2(location = 0.5))
Run the code above in your browser using DataLab