| add_model_criterion.bgmfit {bsitar} | R Documentation | 
Add model fit criteria to model
Description
The add_model_criterion() is a wrapper around the
brms::add_criterion(). Note that arguments compare and
pointwise are relevant only for brms::add_loo whereas arguments
summary, robust, and probs 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
be used in estimation. If  | 
| draw_ids | An integer indicating the specific posterior draw(s)
to be used 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 indicating whether only the estimate should be
computed ( | 
| robust | A logical to specify the summarize options. If  | 
| probs | The percentiles to be computed by the  | 
| newdata | An optional data frame to be used in estimation. If
 | 
| resp | A character string (default  | 
| cores | Number of cores to be used when running the parallel
computations (if  | 
| deriv_model | A logical to specify whether to estimate velocity curve
from the derivative function, or the differentiation of the distance curve.
The argument  | 
| verbose | An optional argument (logical, default  | 
| expose_function | An optional logical argument to indicate whether to
expose Stan functions (default  | 
| usesavedfuns | A logical (default  | 
| clearenvfuns | A logical to indicate whether to clear the exposed
function from the environment ( | 
| envir | Environment used for function evaluation. The default is
 | 
| ... | Further arguments passed to  | 
Value
An object of class class bgmfit with fit criteria added.
Author(s)
Satpal Sandhu satpal.sandhu@bristol.ac.uk
See Also
brms::add_loo brms::add_loo brms::add_ic() brms::add_waic()
brms::bayes_R2()
Examples
# Fit Bayesian SITAR model 
# To avoid mode estimation which takes 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
model <- add_model_criterion(model, criterion = c("waic"))