Extracts posterior predicted values from a list of class
bayesnecfit
or bayesmanecfit
model fits and
compares these via bootstrap re sampling.
compare_posterior(
x,
comparison = "n(s)ec",
ecx_val = 10,
type = "absolute",
hormesis_def = "control",
sig_val = 0.01,
resolution,
x_range = NA,
make_newdata = TRUE,
...
)
A named list
of objects of class
bayesnecfit
or bayesmanecfit
returned by
bnec
.
The posterior predictions to compare, takes values of "nec", "n(s)ec", "nsec", "ecx" or "fitted".
The desired percentage effect value. This must be a value between 1 and 99 (for type = "relative" and "absolute"), defaults to 10.
A character
vector, taking values of
"relative", "absolute" (the default) or "direct". See Details.
A character
vector, taking values
of "max" or "control". See Details.
Probability value to use as the lower quantile to test significance of the predicted posterior values.
The number of unique x values over which to find ECx – large values will make the ECx estimate more precise.
A range of x values over which to consider extracting ECx.
Only used if comparison = "fitted"
. Should the
user allow the package to create newdata
for predictions?
If so, arguments resolution
and x_range
will be used. Defaults
to TRUE. See details.
Further arguments that control posterior predictions via
posterior_epred
.
A named list
containing bootstrapped differences
in posterior predictions of the bayesnecfit
or
bayesnecfit
model fits contained in x
. See Details.
type
"relative" is calculated as the percentage decrease
from the maximum predicted value of the response (top) to the minimum
predicted value of the response. Type "absolute" (the default) is
calculated as the percentage decrease from the maximum value of the
response (top) to 0 (or bot for a 4 parameter model fit). Type "direct"
provides a direct estimate of the x value for a given y.
Note that for the current version, ECx for an "nechorme" (NEC Hormesis)
model is estimated at a percent decline from the control.
For hormesis_def
, if "max", then ECx or NSEC values – i.e.,
depending on argument comparison
– are calculated
as a decline from the maximum estimates (i.e. the peak at NEC);
if "control", then ECx or NSEC values are calculated relative to the
control, which is assumed to be the lowest observed concentration.
The argument make_newdata
is only used if
comparison = "fitted"
. It is relevant to those who want the package
to create a data.frame from which to make predictions. This is done via
bnec_newdata
and uses arguments resolution
and
x_range
. If make_newdata = FALSE
and no additional
newdata
argument is provided (via ...
), then the predictions
are made for the raw data. Else, to generate predictions for a specific
user-specific data.frame, set make_newdata = FALSE
and provide
an additional data.frame via the newdata
argument. For guidance
on how to structure newdata
, see for example
posterior_epred
.