Reports the parameters of the concentration-response equation itself —
top, bot, beta, nec, ec50, slope,
d and f — with their credible intervals, one row per
parameter per equation.
curve_params(
object,
summary = TRUE,
xform = NULL,
x_scale = c("recorded", "fitted"),
...
)
# S3 method for class 'bayesnecfit'
curve_params(
object,
summary = TRUE,
xform = NULL,
x_scale = c("recorded", "fitted"),
...
)
# S3 method for class 'bayesmanecfit'
curve_params(
object,
summary = TRUE,
xform = NULL,
x_scale = c("recorded", "fitted"),
...
)
# S3 method for class 'bayesnechurdlefit'
curve_params(
object,
summary = TRUE,
xform = NULL,
x_scale = c("recorded", "fitted"),
...
)
# S3 method for class 'bayesnecgroupfit'
curve_params(
object,
summary = TRUE,
xform = NULL,
x_scale = c("recorded", "fitted"),
...
)An object of class bayesnecfit,
bayesmanecfit, bayesnechurdlefit or
bayesnecgroupfit.
A logical vector of length 1. Whether to
return the summary table (the default) or the underlying posterior draws.
NULL or identity leaves nec and
ec50 on x_scale. Any other function is applied to those
parameters on the fitted scale and requires x_scale = "recorded"
for an inline transformation. No other parameter is transformed; see Details.
"recorded" (the default) returns nec and
ec50 on the recorded predictor scale. "fitted" returns
them on the scale fitted by crf().
Passed to the per-component and per-level calls by the
bayesnechurdlefit and bayesnecgroupfit methods,
and unused by the other two.
With summary = TRUE, a data.frame with
columns model, wi, dpar, link, parameter,
Estimate, Q2.5 and Q97.5, ordered by decreasing
wi and then by the parameter order given above, and with the
"prior_bound_summary" attribute described in Details. A
bayesnecgroupfit adds a level column to that record.
Estimate is the posterior median and the interval is equal-tailed,
which is what fixef(robust = TRUE) reports for the same
fit. For a single-block monotone threshold fit the nec row is the
same number nec returns. For a hormesis threshold fit
nec() returns the NSEC read off the fitted curve, for a two-block
fit it returns the combined threshold rather than either block's, and for
a bayesmanecfit it returns the model-averaged estimate. None
of these is a row here.
wi is the model weight summary reports, under whichever
method the set was weighted by — pseudo-BMA unless loo_controls
asked for stacking. It is 1 for a bayesnecfit, which is the
whole of its own set.
dpar is the brms distributional parameter the row belongs to:
"mu" for every ordinary fit, and additionally "hu" or
"zi" for a joint two-block fit from
bnec(family = "hurdle_gamma") or "zero_inflated_beta". The two
blocks of such a fit need not use the same equation — see the
model_survival argument of bnec — so model
names each block's own equation, and is NA for a second block whose
equation cannot be identified from the fitted formula.
With summary = FALSE, a named list with one
element per equation, each a draws-by-parameter
matrix. A two-block fit names the second block's columns
with the distributional parameter, as hu_top; a single-block fit has
no prefixed columns. The list records the links of its fit in a link
attribute, since a matrix of draws has no column to put them in. For a
bayesmanecfit these are each
equation's own draws in full, not the weighted subset
nec(posterior = TRUE) returns, so they should not be pooled. A
bayesnecgroupfit returns a list of those lists, one per level,
because a matrix of draws has no column to keep the levels apart.
A bayesnechurdlefit returns one such object per component, as
rhat and check_sampling do, because the two
components are separate fits with separate parameters and the combined
endpoint is not a curve with parameters of its own. A
bayesnecgroupfit returns one table for the whole group, with a
leading level column and sorted by level before weight, matching
nec and ecx on that class.
summary reports the model weights, the per-equation
dispersion, the weighted no-effect estimate and the per-equation Bayesian
R-squared. It does not report the parameters of the curve, and for a
bayesmanecfit nothing else did either. Those parameters are
what a methods section states alongside the threshold estimates: top
is the control level the whole curve is referenced to, bot the
asymptote a "relative" ECx is measured against, and beta the
decay rate.
Only the parameters of the equation are reported. The family's own
dispersion parameter is dispersion's and summary's, and
a group-level term's standard deviation, its per-level deviations and the
ogl offset are not parameters of the curve. Use
fixef or as_draws_df on
pull_brmsfit(x) for those.
The estimates are per equation and are not averaged across the set.
The equations of a set do not share a parameter list: ecxexp has no
bot, the three-parameter equations have no d, and only the
equations of mod_groups$nec estimate nec. Averaging a
parameter over whichever equations happen to estimate it would average over
a different subset for each parameter, using weights that were computed for
the whole set, so the weights of the rows contributing to one number would
not sum to 1 and would sum to something different for the next number. The
model weight is reported beside each row instead, so a reader can see what
share of the model average each curve holds, and no quantity is reported
that the weights do not support. The model-averaged estimates are returned
by nec, nsec and ecx on the set.
For a hormesis threshold equation, the nec parameter is the
concentration at which the decline term starts, and the curve can continue
to rise beyond it. Its no-effect estimate is the NSEC, so the nec
row here and nec(fit) answer different questions.
show_params names the parameters of each equation without
fitting anything; this function reports their estimates from a fit.
The parameters are on the scale the model was fitted on.
bnec assigns link = "identity", so top and
bot are on the response scale for every fit that did not name a link
of its own. Where a link was named, brms applies its inverse to the
whole non-linear expression, so top and bot are on the link
scale. The link of each block is reported in the link column, and a
message names any that is not the identity.
xform applies to nec and ec50 only. Those two
are measured on the predictor axis, so where crf() transforms the
predictor inline — crf(sqrt(x), ...) — they are sampled on the
transformed scale. Without xform they are returned on the recorded
scale by the inverse of the transformation, as nec returns
the nec parameter: exactly where the inverse has a closed form, and
otherwise by interpolating on the prediction grid. A draw beyond that grid
then has no value, so it is NA, the row summarising it is
NA, and a message names the remedy. A supplied xform is
applied to them on the transformed scale. xform = identity
leaves them on the recorded scale; x_scale = "fitted" returns the
fitted scale. Every other parameter is a response level or a shape
parameter and is not on the predictor axis at all, so it is returned as
sampled.
Under the default asymptote_observed = TRUE, the nec and
ec50 priors are both bounded at the lowest and highest
concentrations tested. Where the data do not place the parameter inside
that range, a credible limit near a bound is set by the prior. For every
sampled nec and ec50 row with a bounded prior, the table's
attribute "prior_bound_summary" gives the number and share of draws
within the outer 5% of the prior range at each bounded end, with the bound
on the scale of the row and on the fitted scale. These are the columns
nec describes, and model, dpar and
parameter match the rows of the table. A message names each
parameter for which the share exceeds 7.5%, after multiplying it by the
equation's model weight, as nec does on a model set. The
ec50 parameter is not the estimate ecx returns with
ecx_val = 50. That estimate is read off the fitted curve, and its
own "censored_summary" describes draws whose curve does not cross
within the prediction range.
summary, show_params,
nec, ecx
library(bayesnec)
data(manec_example)
curve_params(manec_example)
#> model wi dpar link parameter Estimate Q2.5 Q97.5
#> 1 nec4param 0.8260613 mu identity top 2.1638790 2.0363814 2.2783254
#> 2 nec4param 0.8260613 mu identity bot -8.9237574 -13.4896079 -5.9465695
#> 3 nec4param 0.8260613 mu identity beta -0.7362906 -1.1765478 -0.2691252
#> 4 nec4param 0.8260613 mu identity nec 1.4593504 1.3880961 1.5269884
#> 5 ecx4param 0.1739387 mu identity top 2.2995332 2.1266658 2.4919187
#> 6 ecx4param 0.1739387 mu identity bot -5.4695310 -7.3197276 -4.1970524
#> 7 ecx4param 0.1739387 mu identity beta 0.9530213 0.6930029 1.2011801
#> 8 ecx4param 0.1739387 mu identity ec50 2.3444501 2.1764188 2.5658916
nec4param <- pull_out(manec_example, "nec4param")
#> Pulling out model(s): nec4param
curve_params(nec4param)
#> model wi dpar link parameter Estimate Q2.5 Q97.5
#> 1 nec4param 1 mu identity top 2.1638790 2.036381 2.2783254
#> 2 nec4param 1 mu identity bot -8.9237574 -13.489608 -5.9465695
#> 3 nec4param 1 mu identity beta -0.7362906 -1.176548 -0.2691252
#> 4 nec4param 1 mu identity nec 1.4593504 1.388096 1.5269884