average_estimates {bayesnec} | R Documentation |
average_estimates
Description
Extracts posterior predicted estimate values from a list of class
bayesnecfit
or bayesmanecfit
model fits and
calculates a geometric mean.
Usage
average_estimates(
x,
estimate = "nec",
ecx_val = 10,
posterior = FALSE,
type = "absolute",
hormesis_def = "control",
sig_val = 0.01,
resolution = 1000,
x_range = NA,
xform = identity,
prob_vals = c(0.5, 0.025, 0.975)
)
Arguments
x |
A named |
estimate |
The type of estimate to use in the mean. Takes values "nec", "ecx" or "nsec". |
ecx_val |
The desired percentage effect value. This must be a value between 1 and 99 (for type = "relative" and "absolute"), defaults to 10. |
posterior |
A |
type |
A |
hormesis_def |
A |
sig_val |
Probability value to use as the lower quantile to test significance of the predicted posterior values. |
resolution |
The number of unique x values over which to find ECx – large values will make the ECx estimate more precise. |
x_range |
A range of x values over which to consider extracting ECx. |
xform |
A function to apply to the returned estimated concentration values. |
prob_vals |
A vector indicating the probability values over which to return the estimated ECx value. Defaults to 0.5 (median) and 0.025 and 0.975 (95 percent credible intervals). |
Details
The geometric mean of values are simply the mean calculated on a
log scale and back transformed through exp
, although we
have added the capacity to accommodate zero values. Note that the function
assumes that x
has been modelled on the natural scale. Often CR
models are more stable on a log-transformed or sqrt scaling. If the input
bayesnecfit
or bayesmanecfit
model fits are
already based on a re-scaling of the x (concentration) axis, it is important
to pass an appropriate xform argument to ensure these are back transformed
before the the geometric mean calculation is applied.
Value
The geometric mean of the estimates estimate values
of the bayesnecfit
or bayesmanecfit
model fits contained in x
. See Details.
See Also
Examples
## Not run:
library(brms)
library(bayesnec)
data(manec_example)
nec4param <- pull_out(manec_example, model = "nec4param")
ecx4param <- pull_out(manec_example, model = "ecx4param")
average_estimates(list("nec" = ecx4param, "ecx" = nec4param), ecx_val = 50)
## End(Not run)