Extracts the predicted ECx value from a bayesnechurdlefit

# S3 method for class 'bayesnechurdlefit'
ecx(
  object,
  ecx_val = 10,
  resolution = 500,
  posterior = FALSE,
  type = "absolute",
  x_range = NA,
  xform = NULL,
  x_scale = c("recorded", "fitted"),
  prob_vals = c(0.5, 0.025, 0.975),
  which = "combined",
  ...,
  pool = NULL,
  x_control = "own",
  extrapolate = FALSE
)

Arguments

object

An object of class bayesnechurdlefit.

ecx_val

The desired percentage effect value, defaults to 10. Any value above 0 is accepted for every type except "direct", where it is a response value rather than a percentage. Values above 100 are meaningful under "absolute" for a response that can go negative — see Details.

resolution

The number of unique x values over which to find ECx. The crossing is located by linear interpolation between the two grid values that bracket it, so precision saturates well below the grid spacing. The default is 500 grid values, matching toxval. A finer grid can change an interpolated crossing and increases prediction time. With an inline predictor transformation the grid is even on the fitted scale.

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 "absolute" (the default), "relative", "range" or "direct". See Details.

x_range

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

xform

NULL or identity leaves the estimate on x_scale. Any other function is applied to the estimate on the selected scale. With an inline predictor transformation, a function on the default recorded scale gives a warning; see Details.

x_scale

"recorded" (the default) returns the predictor on its recorded scale. "fitted" returns it on the scale fitted by crf(). The scales differ only where crf() transforms the predictor inline.

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).

which

Which component to return: "combined" (the default), "growth" or "survival".

...

Additional arguments passed to methods. A method refuses any argument it does not use.

pool

How observed group levels are combined. "none" returns per-level estimates. "mixture" gives each posterior draw to one level, in proportion to the levels' observation counts, and keeps it at its position, so that draw i of the mixture comes from posterior iteration i. Separate fits with different numbers of draws are instead each sampled over their full posterior. "mean_estimate" averages the levels' estimates at each draw, and "mean_curve" estimates from their weighted mean curve. A joint fit defaults to "none"; other fits with spanning group terms default to "mixture".

x_control

"own" reads each level's control recorded at fitting, or its lowest observed concentration for an older fit or one fitted without x_control. "shared" reads the lowest control across levels; a single finite number specifies the concentration directly. A control below a level's observations extrapolates its curve, and gives a warning unless it is the control recorded at fitting. Level controls are recorded in the result's x_control attribute.

extrapolate

FALSE, the default, uses the prediction range. A finite upper limit or a pair of finite lower and upper limits extends the search grid and marks any unresolved draw as censored at that limit. Limits are on the recorded predictor scale. TRUE and limits that narrow the current range are refused. The original grid points and their spacing are retained when extension points are appended. The search begins at the control, so a lower limit extends it only where the prediction range begins above the control. For type = "range" the lowest response is taken over the prediction range before it is extended, so a limit beyond the data does not change the estimate.

Value

A vector containing the estimated ECx value, including upper and lower credible interval bounds, or one value per draw with posterior = TRUE. Censored draws are Inf above the search range and -Inf below it.

Details

The combined curve is the product of the growth curve and the survival curve. Because both decline, the combined ECx is always reached at or below either component's own ECx. For a group term spanning concentrations, each observed level pairs its growth and survival predictions before the endpoint is read. A level observed at one concentration is excluded. pool and x_control use the same rules as for a single fit.

Without x_range, every ECx is read over the whole concentration series, the range the survival component is fitted over. The growth component is fitted to survivors only, so it has no observations above the highest concentration at which anything survived. Those concentrations were tested, so a growth ECx that falls there is reported as a value, read off the growth curve, and its credible interval reflects that the curve there is constrained by the data at lower concentrations. A supplied x_range applies to all three curves alike. summary.bayesnechurdlefit, nsec.bayesnechurdlefit, ecnsec.bayesnechurdlefit, the plots and posterior_epred.bayesnechurdlefit use the same range.