update.bnecfit {bayesnec}R Documentation

Update an object of class bnecfit as fitted by function bnec.


Update an object of class bnecfit as fitted by function bnec.


## S3 method for class 'bnecfit'
  newdata = NULL,
  recompile = NULL,
  x_range = NA,
  precision = 1000,
  sig_val = 0.01,
  force_fit = FALSE,



An object of class bnecfit as fitted by function bnec.


Optional data.frame to update the model with new data. Data-dependent default priors will not be updated automatically.


A logical, indicating whether the Stan model should be recompiled. If NULL (the default), update tries to figure out internally, if recompilation is necessary. Setting it to FALSE will cause all Stan code changing arguments to be ignored.


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


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.


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.


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 "fitting" is provided with argument pointwise = TRUE (due to memory issues) and family = "beta_binomial2", the bnec will fail because that is a custom family. 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.


Should model truly be updated in case either newdata of a new family is provided?


Further arguments to brm.


An object of class bnecfit. If one single model is returned, then also an object of class bayesnecfit; otherwise, if multiple models are returned, also an object of class bayesmanecfit.


# due to package size issues, `manec_example` does not contain original
# stanfit DSO, so need to recompile here
smaller_manec <- update(manec_example, chains = 1, iter = 50,
                        recompile = TRUE)
# original `manec_example` is fit with a Gaussian
# change to Beta distribution by adding newdata with original `nec_data$y`
# function will throw informative message.
beta_manec <- update(manec_example, newdata = nec_data, recompile = TRUE,
                     chains = 1, iter = 50, family = Beta(link = "identity"),
                     force_fit = TRUE)

[Package bayesnec version Index]