average_endpoints {bayesnec} R Documentation

## average_endpoints

### Description

Extracts posterior predicted endpoint values from a list of class bayesnecfit or bayesmanecfit model fits and calculates a geometric mean.

### Usage

average_endpoints(
x,
endpoint = "nec",
ecx_val = 10,
posterior = FALSE,
type = "absolute",
hormesis_def = "control",
sig_val = 0.01,
precision = 1000,
x_range = NA,
xform = NA,
prob_vals = c(0.5, 0.025, 0.975)
)


### Arguments

 x A named list of objects of class bayesnecfit or bayesmanecfit returned by bnec. endpoint The type of endpoint 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 logical value indicating if the full posterior sample of calculated ECx values should be returned instead of just the median and 95 credible intervals. type A character vector, taking values of "relative", "absolute" (the default) or "direct". See Details. hormesis_def A character vector, taking values of "max" or "control". See Details. 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. precision 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 C-R 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 endpoints estimate values of the bayesnecfit or bayesmanecfit model fits contained in x. See Details.

bnec

### Examples

## Not run:
library(brms)
library(bayesnec)
data(manec_example)
data(nec4param)
ecx4param <- pull_out(manec_example, model = "ecx4param")
average_endpoints(list("nec" = ecx4param, "ecx" = nec4param), ecx_val = 50)

## End(Not run)



[Package bayesnec version 2.0.2.5 Index]