nauf_stan_glmer: Fit a Bayesian mixed effects regression with 'nauf'...

Description Usage Arguments Details Value See Also Examples

View source: R/nauf_stan_regs.R

Description

The Bayesian mixed effects regression functions nauf_stan_lmer, nauf_stan_glmer.nb, and nauf_stan_glmer fit linear, negative binomial, and other generalized linear mixed effects models, respectively, impelementing nauf_contrasts.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
nauf_stan_glmer(formula, data = NULL, family = gaussian, subset, weights,
  na.action = na.pass, offset, contrasts = NULL, ncs_scale = attr(formula,
  "standardized.scale"), ..., prior = rstanarm::normal(),
  prior_intercept = rstanarm::normal(), prior_aux = rstanarm::cauchy(0, 5),
  prior_covariance = rstanarm::decov(), prior_PD = FALSE,
  algorithm = "sampling", adapt_delta = NULL, QR = FALSE,
  sparse = FALSE)

nauf_stan_lmer(formula, data = NULL, subset, weights, na.action = na.pass,
  offset, contrasts = NULL, ncs_scale = attr(formula, "standardized.scale"),
  ..., prior = rstanarm::normal(), prior_intercept = rstanarm::normal(),
  prior_aux = rstanarm::cauchy(0, 5), prior_covariance = rstanarm::decov(),
  prior_PD = FALSE, algorithm = "sampling", adapt_delta = NULL,
  QR = FALSE)

nauf_stan_glmer.nb(formula, data = NULL, subset, weights,
  na.action = na.pass, offset, contrasts = NULL, link = "log",
  ncs_scale = attr(formula, "standardized.scale"), ...,
  prior = rstanarm::normal(), prior_intercept = rstanarm::normal(),
  prior_aux = rstanarm::cauchy(0, 5), prior_covariance = rstanarm::decov(),
  prior_PD = FALSE, algorithm = "sampling", adapt_delta = NULL,
  QR = FALSE)

Arguments

formula, data, family, subset, weights, na.action, offset, contrasts, ncs_scale

See nauf_model.frame and nauf_glFormula.

...

Further arguments to be passed to sampling. See stan_glmer for details.

algorithm

Changes from the default "sampling" result in an error. Only MCMC is currently supported.

link, prior, prior_intercept, prior_aux, prior_covariance, prior_PD, adapt_delta, QR, sparse

See stan_glmer.

Details

nauf_stan_lmer, nauf_stan_glmer, and nauf_stan_glmer.nb are based on the rstanarm functions stan_lmer, stan_glmer, and stan_glmer.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 and contrasts cannot be changed (see nauf_model.frame). The default priors for the nauf Bayesian mixed 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.

Value

A nauf.stanreg object.

See Also

nauf_contrasts for a description of the treatment of NA values, stan_glmer for a description of the priors, and the documentation for Stan and the rstan and rstanarm packages for algorithmic details.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
## Not run: 
sobj <- standardize(vdur ~ place + stress + spont +
  (1 + place + stress + spont | speaker) + (1 | item),
  subset(plosives, dialect == "Cuzco" & voicing == "Voiceless"))

mod <- nauf_stan_lmer(sobj$formula, sobj$data,
  prior = normal(0, 1, autoscale = FALSE),
  prior_intercept = normal(0, 1, autoscale = FALSE),
  prior_aux = normal(0, 1, autoscale = FALSE),
  prior_covariance = decov(2, 1.5, 2, 0.25)
)

## End(Not run)

CDEager/nauf documentation built on May 6, 2019, 9:24 a.m.