Amends an existing bayesmanecfit object, for example, by adding or removing fitted models.

amend(
  object,
  drop,
  add,
  loo_controls,
  x_range = NA,
  resolution = 1000,
  sig_val = 0.01,
  priors
)

Arguments

object

An object of class bayesmanecfit, as returned by bnec.

drop

A character vector containing the names of model types you which to exclude for the modified fit.

add

A character vector containing the names of model types you which to include to the modified fit.

loo_controls

A named list of two elements ("fitting" and/or "weights"), each being a named list containing the desired arguments to be passed on to loo (via "fitting") or to loo_model_weights (via "weights"). If "weights" is not provided by the user, bnec will set the default method argument in loo_model_weights to "pseudobma". See ?loo_model_weights for further info.

x_range

A range of predictor values over which to consider extracting ECx.

resolution

The length of the predictor vector used for posterior predictions, and over which to extract ECx values. Large values will be slower but more precise.

sig_val

Probability value to use as the lower quantile to test significance of the predicted posterior values against the lowest observed concentration (assumed to be the control), to estimate NEC as an interpolated NOEC value from smooth ECx curves.

priors

An object of class brmsprior which specifies user-desired prior distributions of model parameters. If missing, amend will figure out a baseline prior for each parameter. It can also be specified as a named list where each name needs to correspond to the same string as model. See Details.

Value

All successfully fitted bayesmanecfit model fits.

Examples

library(bayesnec)
data(manec_example)
exmp <- amend(manec_example, drop = "nec4param")
#> Only ecx4param is fitted, no model averaging done. Perhaps try setting better priors, or check ?show_params to make sure you have the correct parameter names for your priors.
#> Returning ecx4param
#> Warning: Found 5 observations with a pareto_k > 0.5 in model 'ecx4param'. We recommend to run more iterations to get at least about 2200 posterior draws to improve LOO-CV approximation accuracy.
#> Warning: 
#> 5 (5.0%) p_waic estimates greater than 0.4. We recommend trying loo instead.