mixle.analysis.developmental_risk module¶
Teratogenic / reproductive / developmental risk: benchmark-dose (BMD/BMDL) analysis (K8, work-plan §7-K).
Fits a quantal log-logistic (or Hill) dose-response curve to a developmental-toxicity cohort
(dose, n_affected out of n_total per dose group) by maximum likelihood, following the
EPA BMDS convention: the benchmark dose (BMD) is the dose giving a specified benchmark response
(default 10% extra risk over background); the BMDL is a one-sided lower confidence bound on the BMD.
rfd_exceedance divides the BMDL by an uncertainty factor to get a reference dose (RfD), then
pushes an exposure Posterior (IC-1) through the RfD threshold into an IC-8 DerivedQuantity.
- class BMDResult(bmd, bmdl, bmr, model, dof, status='ok', bmd_se=nan, _coef=<factory>)[source]
Bases:
objectA fitted benchmark-dose analysis: the BMD, its lower confidence bound (BMDL), and fit metadata.
statusis one of:"ok": the curve fit converged, the BMD was found and bracketed, and the BMDL lower bound was established.bmdandbmdlare real doses."unidentifiable": the curve fit itself did not converge, or the fitted curve never reaches the benchmark target within a bounded search (flat, wrong-signed, or requiring an implausibly large dose).bmdandbmdlarenan– never a search boundary or other placeholder dressed up as a real dose."bmdl_unavailable": the BMD itself was identified (bmdis real), but the BMDL computation did not converge to a valid bound.bmdlisnan.
bmd_seis the delta-method standard error of the BMD (nanunlessstatus == "ok");bmdl = bmd - z * bmd_seclipped at 0,zthe one-sided normal quantile for the requested confidence level.- Parameters:
- property converged: bool
Trueonly when both the BMD and the BMDL were genuinely established.
- benchmark_dose(dose, n_affected, n_total, *, bmr=0.10, model='loglogistic', risk='extra', ci_level=0.95)[source]
Fit a quantal dose-response and report the benchmark dose (BMD) and its lower bound (BMDL).
dose/n_affected/n_totalare per-dose-group arrays (n_affected <= n_total). The curve is fit by maximum likelihood (DR-ALG K8); the BMD solves for the dose givingbmrextra (or added) risk over the fitted background rate. The BMDL is the one-sidedci_levellower confidence bound on the BMD by the delta method: the gradient of the BMD with respect to the fitted coefficients is obtained by implicit differentiation of the BMD-defining equation, the coefficient covariance by inverting the observed Fisher information at the MLE, andVar(BMD)by propagating one through the other (grad @ Cov @ grad);BMDL = BMD - z * SE(BMD)withzthe one-sided normal quantile forci_level, clipped at 0 (dose cannot be negative). SeeBMDResult.statusfor what happens when any step of that chain fails to converge.
- rfd_exceedance(exposure, bmd, *, uf=100.0, n=2000, rng=None)[source]
P(exposure > RfD) as an IC-8 DerivedQuantity, where RfD = BMDL / uf (EPA convention).
exposuremay be an IC-1 Posterior (the pushforward runs through its ownderived_quantityso prior_dominated propagates), an array of exposure draws (resampled tonif its length differs), or a bare scalar (a degenerate point mass).ufmust be finite and strictly positive,na positive exact sample count, andexposuredraws finite and nonnegative – all rejected up front, before any division or resampling.bmd.bmdlmust also be finite: aBMDResultwithstatus != "ok"(seeBMDResult) has no real BMDL to divide by an uncertainty factor, and a NaN silently compared withdraws > nanwould quietly evaluate to all-False– a fabricated-looking “0% exceedance” result – rather than surfacing the underlying unidentifiability. The finite/nonnegative exposure check applies uniformly to a Posterior’s own draws too, not only to a plain array/scalar: it lives insidefnbelow (the pushforward handed toPosterior.derived_quantity), not in a separate top-level check on the rawexposure– otherwise a mis-specified exposure posterior could emit a negative or NaN draw that flowed straight through draws > rfd (silentlyFalsefor NaN) into a confident-looking “not exceeding” result with no warning.