add_model_criterion.bgmfit {bsitar} | R Documentation |
Add Model Fit Criteria to Model
Description
The add_model_criterion() function is a wrapper around
brms::add_criterion()
that allows adding fit criteria to a model. Note
that arguments such as compare
and pointwise
are relevant
only for brms::add_loo, while summary
, robust
, and
probs
are ignored except for the brms::bayes_R2()
.
Usage
## S3 method for class 'bgmfit'
add_model_criterion(
model,
criterion = c("loo", "waic"),
ndraws = NULL,
draw_ids = NULL,
compare = TRUE,
pointwise = FALSE,
model_names = NULL,
summary = TRUE,
robust = FALSE,
probs = c(0.025, 0.975),
newdata = NULL,
resp = NULL,
cores = 1,
deriv_model = NULL,
verbose = FALSE,
expose_function = FALSE,
usesavedfuns = NULL,
clearenvfuns = NULL,
envir = NULL,
...
)
add_model_criterion(model, ...)
Arguments
model |
An object of class |
criterion |
Names of model fit criteria
to compute. Currently supported are |
ndraws |
A positive integer indicating the number of posterior draws to
use in estimation. If |
draw_ids |
An integer specifying the specific posterior draw(s) to use
in estimation (default |
compare |
A flag indicating if the information criteria
of the models should be compared to each other
via |
pointwise |
A flag indicating whether to compute the full
log-likelihood matrix at once or separately for each observation.
The latter approach is usually considerably slower but
requires much less working memory. Accordingly, if one runs
into memory issues, |
model_names |
If |
summary |
A logical value indicating whether only the estimate should be
computed ( |
robust |
A logical value to specify the summary options. If |
probs |
The percentiles to be computed by the |
newdata |
An optional data frame for estimation. If |
resp |
A character string (default |
cores |
The number of cores to be used for parallel computations if
|
deriv_model |
A logical value specifying whether to estimate the
velocity curve from the derivative function or by differentiating the
distance curve. Set |
verbose |
A logical argument (default |
expose_function |
A logical argument (default |
usesavedfuns |
A logical value (default |
clearenvfuns |
A logical value indicating whether to clear the exposed
Stan functions from the environment ( |
envir |
The environment used for function evaluation. The default is
|
... |
Additional arguments passed to the |
Value
An object of class bgmfit
with the specified fit criteria added.
Author(s)
Satpal Sandhu satpal.sandhu@bristol.ac.uk
See Also
brms::add_loo, brms::add_ic()
, brms::add_waic()
,
brms::bayes_R2()
Examples
# Fit Bayesian SITAR model
# To avoid model estimation which can take time, the Bayesian SITAR model fit
# to the 'berkeley_exdata' has been saved as an example fit ('berkeley_exfit').
# See 'bsitar' function for details on 'berkeley_exdata' and 'berkeley_exfit'.
model <- berkeley_exfit
# Add model fit criteria (e.g., WAIC)
model <- add_model_criterion(model, criterion = c("waic"))