- formula
- An object of class - formula,- brmsformula, or- mvbrmsformula(or one that can
be coerced to that classes): A symbolic description of the model to be
fitted. The details of model specification are explained in- brmsformula.
 
- data
- An object of class - data.frame(or one that can be coerced
to that class) containing data of all variables used in the model.
 
- family
- A description of the response distribution and link function to
be used in the model. This can be a family function, a call to a family
function or a character string naming the family. Every family function has
a - linkargument allowing to specify the link function to be applied
on the response variable. If not specified, default links are used. For
details of supported families see- brmsfamily. By default, a
linear- gaussianmodel is applied. In multivariate models,- familymight also be a list of families.
 
- prior
- One or more - brmspriorobjects created by- set_prioror related functions and combined using the- cmethod or the- +operator. See also- default_priorfor more help.
 
- autocor
- (Deprecated) An optional - cor_brmsobject
describing the correlation structure within the response variable (i.e.,
the 'autocorrelation'). See the documentation of- cor_brmsfor
a description of the available correlation structures. Defaults to- NULL, corresponding to no correlations. In multivariate models,- autocormight also be a list of autocorrelation structures.
It is now recommend to specify autocorrelation terms directly
within- formula. See- brmsformulafor more details.
 
- data2
- A named - listof objects containing data, which
cannot be passed via argument- data. Required for some objects
used in autocorrelation structures to specify dependency structures
as well as for within-group covariance matrices.
 
- cov_ranef
- (Deprecated) A list of matrices that are proportional to the
(within) covariance structure of the group-level effects. The names of the
matrices should correspond to columns in - datathat are used as
grouping factors. All levels of the grouping factor should appear as
rownames of the corresponding matrix. This argument can be used, among
others to model pedigrees and phylogenetic effects.
It is now recommended to specify those matrices in the formula
interface using the- grand related functions. See- vignette("brms_phylogenetics")for more details.
 
- sample_prior
- Indicate if draws from priors should be drawn
additionally to the posterior draws. Options are - "no"(the
default),- "yes", and- "only". Among others, these draws can
be used to calculate Bayes factors for point hypotheses via- hypothesis. Please note that improper priors are not sampled,
including the default improper priors used by- brm. See- set_prioron how to set (proper) priors. Please also note
that prior draws for the overall intercept are not obtained by default
for technical reasons. See- brmsformulahow to obtain prior
draws for the intercept. If- sample_prioris set to- "only",
draws are drawn solely from the priors ignoring the likelihood, which
allows among others to generate draws from the prior predictive
distribution. In this case, all parameters must have proper priors.
 
- sparse
- (Deprecated) Logical; indicates whether the population-level
design matrices should be treated as sparse (defaults to - FALSE). For
design matrices with many zeros, this can considerably reduce required
memory. Sampling speed is currently not improved or even slightly
decreased. It is now recommended to use the- sparseargument of- brmsformulaand related functions.
 
- knots
- Optional list containing user specified knot values to be used
for basis construction of smoothing terms. See
- gammfor more details.
 
- drop_unused_levels
- Should unused factors levels in the data be
dropped? Defaults to - TRUE.
 
- stanvars
- An optional - stanvarsobject generated by function- stanvarto define additional variables for use in
Stan's program blocks.
 
- stan_funs
- (Deprecated) An optional character string containing
self-defined  Stan functions, which will be included in the functions
block of the generated Stan code. It is now recommended to use the
- stanvarsargument for this purpose instead.
 
- fit
- An instance of S3 class - brmsfitderived from a previous
fit; defaults to- NA. If- fitis of class- brmsfit, the
compiled model associated with the fitted result is re-used and all
arguments modifying the model code or data are ignored. It is not
recommended to use this argument directly, but to call the- updatemethod, instead.
 
- save_pars
- An object generated by - save_parscontrolling
which parameters should be saved in the model. The argument has no
impact on the model fitting itself.
 
- save_ranef
- (Deprecated) A flag to indicate if group-level effects for
each level of the grouping factor(s) should be saved (default is
- TRUE). Set to- FALSEto save memory. The argument has no
impact on the model fitting itself.
 
- save_mevars
- (Deprecated) A flag to indicate if draws of latent
noise-free variables obtained by using - meand- miterms should
be saved (default is- FALSE). Saving these draws allows to better
use methods such as- predictwith the latent variables but leads to
very large R objects even for models of moderate size and complexity.
 
- save_all_pars
- (Deprecated) A flag to indicate if draws from all
variables defined in Stan's - parametersblock should be saved
(default is- FALSE). Saving these draws is required in order to
apply the methods- bridge_sampler,- bayes_factor, and- post_prob. Can be set globally for the current R session via the- "brms.save_pars"option (see- options).
 
- init
- Initial values for the sampler. If - NULL(the default) or- "random", Stan will randomly generate initial values for parameters
in a reasonable range. If- 0, all parameters are initialized to zero
on the unconstrained space. This option is sometimes useful for certain
families, as it happens that default random initial values cause draws to
be essentially constant. Generally, setting- init = 0is worth a try,
if chains do not initialize or behave well. Alternatively,- initcan
be a list of lists containing the initial values, or a function (or
function name) generating initial values. The latter options are mainly
implemented for internal testing but are available to users if necessary.
If specifying initial values using a list or a function then currently the
parameter names must correspond to the names used in the generated Stan
code (not the names used in R). For more details on specifying initial
values you can consult the documentation of the selected- backend.
 
- inits
- (Deprecated) Alias of - init.
 
- chains
- Number of Markov chains (defaults to 4). 
- iter
- Number of total iterations per chain (including warmup; defaults
to 2000). 
- warmup
- A positive integer specifying number of warmup (aka burnin)
iterations. This also specifies the number of iterations used for stepsize
adaptation, so warmup draws should not be used for inference. The number
of warmup should not be larger than - iterand the default is- iter/2.
 
- thin
- Thinning rate. Must be a positive integer. Set - thin > 1to
save memory and computation time if- iteris large.
 
- cores
- Number of cores to use when executing the chains in parallel,
which defaults to 1 but we recommend setting the - mc.coresoption to
be as many processors as the hardware and RAM allow (up to the number of
chains). For non-Windows OS in non-interactive R sessions, forking is used
instead of PSOCK clusters.
 
- threads
- Number of threads to use in within-chain parallelization. For
more control over the threading process, - threadsmay also be a- brmsthreadsobject created by- threading. Within-chain
parallelization is experimental! We recommend its use only if you are
experienced with Stan's- reduce_sumfunction and have a slow running
model that cannot be sped up by any other means. Can be set globally for
the current R session via the- "brms.threads"option (see- options).
 
- opencl
- The platform and device IDs of the OpenCL device to use for
fitting using GPU support. If you don't know the IDs of your OpenCL device,
- c(0,0)is most likely what you need. For more details, see- opencl. Can be set globally for the current R session via
the- "brms.opencl"option
 
- normalize
- Logical. Indicates whether normalization constants should
be included in the Stan code (defaults to - TRUE). Setting it
to- FALSErequires Stan version >= 2.25 to work. If- FALSE,
sampling efficiency may be increased but some post processing functions
such as- bridge_samplerwill not be available. Can be
controlled globally for the current R session via the `brms.normalize`
option.
 
- control
- A named - listof parameters to control the sampler's
behavior. It defaults to- NULLso all the default values are used.
The most important control parameters are discussed in the 'Details'
section below. For a comprehensive overview see- stan.
 
- algorithm
- Character string naming the estimation approach to use.
Options are - "sampling"for MCMC (the default),- "meanfield"for
variational inference with independent normal distributions,- "fullrank"for variational inference with a multivariate normal
distribution,- "pathfinder"for the pathfinder algorithm,- "laplace"for the laplace approximation,
or- "fixed_param"for sampling from fixed parameter
values. Can be set globally for the current R session via the- "brms.algorithm"option (see- options).
 
- backend
- Character string naming the package to use as the backend for
fitting the Stan model. Options are - "rstan"(the default) or- "cmdstanr". Can be set globally for the current R session via the- "brms.backend"option (see- options). Details on the
rstan and cmdstanr packages are available at
https://mc-stan.org/rstan/ and https://mc-stan.org/cmdstanr/,
respectively. Additionally a- "mock"backend is available to make
testing brms and packages that depend on it easier.
The- "mock"backend does not actually do any fitting, it only checks
the generated Stan code for correctness and then returns whatever is passed
in an additional- mock_fitargument as the result of the fit.
 
- future
- Logical; If - TRUE, the future
package is used for parallel execution of the chains and argument- coreswill be ignored. Can be set globally for the current R
session via the- "future"option. The execution type is controlled via- plan(see the examples section below).
 
- silent
- Verbosity level between - 0and- 2.
If- 1(the default), most of the
informational messages of compiler and sampler are suppressed.
If- 2, even more messages are suppressed. The actual
sampling progress is still printed. Set- refresh = 0to turn this off
as well. If using- backend = "rstan"you can also set- open_progress = FALSEto prevent opening additional progress bars.
 
- seed
- The seed for random number generation to make results
reproducible. If - NA(the default), Stan will set the seed
randomly.
 
- save_model
- Either - NULLor a character string. In the latter
case, the model's Stan code is saved via- catin a text file
named after the string supplied in- save_model.
 
- stan_model_args
- A - listof further arguments passed to- rstan::stan_modelfor- backend =
"rstan"or to- cmdstanr::cmdstan_modelfor- backend =
"cmdstanr", which allows to change how models are compiled.
 
- file
- Either - NULLor a character string. In the latter case, the
fitted model object is saved via- saveRDSin a file named
after the string supplied in- file. The- .rdsextension is
added automatically. If the file already exists,- brmwill load and
return the saved model object instead of refitting the model.
Unless you specify the- file_refitargument as well, the existing
files won't be overwritten, you have to manually remove the file in order
to refit and save the model under an existing file name. The file name
is stored in the- brmsfitobject for later usage.
 
- file_compress
- Logical or a character string, specifying one of the
compression algorithms supported by - saveRDS. If the- fileargument is provided, this compression will be used when saving
the fitted model object.
 
- file_refit
- Modifies when the fit stored via the - fileargument
is re-used. Can be set globally for the current R session via the- "brms.file_refit"option (see- options).
For- "never"(default) the fit is always loaded if it
exists and fitting is skipped. For- "always"the model is always
refitted. If set to- "on_change", brms will
refit the model if model, data or algorithm as passed to Stan differ from
what is stored in the file. This also covers changes in priors,- sample_prior,- stanvars, covariance structure, etc. If you
believe there was a false positive, you can use- brmsfit_needs_refitto see why refit is deemed necessary.
Refit will not be triggered for changes in additional parameters of the fit
(e.g., initial values, number of iterations, control arguments, ...). A
known limitation is that a refit will be triggered if within-chain
parallelization is switched on/off.
 
- empty
- Logical. If - TRUE, the Stan model is not created
and compiled and the corresponding- 'fit'slot of the- brmsfitobject will be empty. This is useful if you have estimated a brms-created
Stan model outside of brms and want to feed it back into the package.
 
- rename
- For internal use only. 
- ...
- Further arguments passed to Stan.
For - backend = "rstan"the arguments are passed to- samplingor- vb.
For- backend = "cmdstanr"the arguments are passed to the- cmdstanr::sampleor- cmdstanr::variationalmethod.