Extracts the predicted NEC value from a bayesnechurdlefit

# S3 method for class 'bayesnechurdlefit'
nec(
  object,
  posterior = FALSE,
  xform = NULL,
  x_scale = c("recorded", "fitted"),
  prob_vals = c(0.5, 0.025, 0.975),
  extrapolate = FALSE,
  which = "combined",
  ...,
  pool = NULL
)

Arguments

object

An object of class bayesnechurdlefit.

posterior

A logical value indicating if the full posterior sample of calculated NEC values should be returned instead of just the median and 95% credible intervals.

xform

NULL or identity leaves the estimate on x_scale. Any other function is applied on the fitted scale and requires x_scale = "recorded" when the predictor is transformed inline; 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 NEC value. Defaults to 0.5 (median) and 0.025 and 0.975 (95 percent credible intervals).

extrapolate

The bound beyond which the estimate is reported as censored. FALSE, the default, censors at the prediction range the fit was built on. TRUE removes the bound at both ends. A single number is an upper limit, and a pair of numbers is a lower and an upper limit, in that order. See the Extrapolation section of nec.

which

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

...

Additional arguments passed to methods. sig_val, resolution and x_range are forwarded to nsec where an observed group level is read off its curve, and sig_val and resolution where a finite extrapolate limit requires a curve to be re-evaluated. Otherwise nec returns the estimate stored when the model was fitted, and a message names those it did not use. Any other argument is refused.

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. "mean_curve" is unavailable for a sampled NEC parameter. A joint fit defaults to "none"; other fits with spanning group terms default to "mixture".

Value

A vector containing the estimated no-effect 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

extrapolate is passed to each component and measured against that component's own prediction range. The growth component stops short of any concentration where nothing survived, so its range can end below the survival component's, and a limit between the two is an extension for one and inside the range for the other. Such a limit is refused, and the refusal names which component raised it.

The combined no-effect concentration is pmin(ne_growth, ne_survival) evaluated per posterior draw, on the scale the model was fitted on. If both components use monotone threshold equations, their product is flat below both thresholds and departs that plateau at the smaller one. With a smooth or hormesis threshold equation, the minimum is a componentwise no-effect estimate; the NSEC of the combined response curve can differ. The minimum, and the rule for censored draws below, apply on the fitted scale, and the result is then returned on the scale xform names. Under a decreasing transformation in crf(), such as crf(I(-x)), the smaller fitted-scale value is the larger of the two recorded values. An xform changes the scale the value is reported on, not which component estimate determines it.

A component draw beyond the top of its prediction range is known only to exceed that limit. Both components are predicted over the whole concentration series, so they share their limits, unless a fit made before that rule stores a growth range ending at the last concentration with survivors. Where the limits differ and one component is known only to exceed its limit while the other is estimated above that limit, the combined draw is not identified. It is reported as beyond the top of the range, at the smaller of the two components' upper limits, which is true of every such draw.

The combined estimate therefore reduces to the growth estimate whenever growth is the more sensitive endpoint – which it usually is, since a contaminant that kills has generally slowed growth at a lower concentration first. This is not a defect of the combination: the minimum selects the more sensitive component's estimate. Where the two components differ is in the magnitude of effect above that point, which is what ecx measures. Use ecx(which = "combined") rather than this function where the question is what the hurdle model adds over a survivors-only analysis.

As for nec on any fit, what is returned is a sampled NEC only where the underlying equations are monotone threshold models. A component whose model set contains smooth or hormesis threshold equations contributes NSEC draws instead. A combination of NEC and NSEC draws is labelled N(S)EC; a message is emitted and summary labels each component. A component fitted to a single smooth equation, such as ecx4param, contributes the NSEC draws stored when it was fitted, although nec() refuses that equation fitted on its own with bnec. Only the component or components that which names are computed, so which = "growth" reads nothing from the survival component. nsec with which = "combined" is the alternative that reads a single value off the combined curve itself rather than taking the minimum of two component estimates, and it does not reduce to the growth value.