Bayesian inference
for microbial
growth curves.

BayesBiont.jl is the Bayesian companion to Kinbiont.jl. Where Kinbiont fits growth-curve models by maximum likelihood, BayesBiont samples the full posterior with NUTS via Turing.jl1, supports hierarchical pooling across replicates with a non-centered reparameterisation2, and compares competing models with PSIS-LOO3.

License
MIT · v0.1.0
Published by
Fuzue Tech
Microbial growth curve with credible-interval band Sigmoid growth from baseline to plateau, with a posterior 95% credible band widening through the exponential phase and narrowing at the asymptote. time (h) OD₆₀₀ 0.0 0.3 0.6 0.9 0 6 12 18 24
Posterior mean and 95% credible band for a single well, fit under a hierarchical aHPM model across six replicates.

A small surface area, all of it auditable.

Curve models

Gompertz, Logistic, Baranyi, Richards, and any nonlinear model from Kinbiont's NL_MODEL_REGISTRY. User-defined models drop in as a function plus a guess heuristic.

ODE models

aHPM and arbitrary multi-state ODEs from Kinbiont's MODEL_REGISTRY. Solved with OrdinaryDiffEq.jl; reverse-mode AD via SciMLSensitivity.jl for hierarchical fits.

Likelihoods

:lognormal (default; matches Kinbiont's RE loss), :normal, :proportional. Defensive error on non-positive data under lognormal — no silent epsilon shift.

Priors

Curated DEFAULT_PRIORS for canonical models calibrated to plate-reader OD; empirical fallback via model.guess(data) for user-defined models. All overridable per parameter.

Hierarchical pooling

Non-centered reparameterisation across replicates by group2. Users see LogNormal priors going in and native-scale posteriors coming out; the log-space trick is internal.

Model comparison

PSIS-LOO and WAIC via PSIS.jl3. compare(r₁, r₂) returns ELPD differences with standard errors; Pareto-k diagnostics flag misspecification.

What changes when you sample the posterior.

Calibrated uncertainty

Maximum-likelihood fits give you a point estimate and a Hessian-derived standard error. The standard error is asymptotically valid under regularity conditions that growth-curve experiments routinely violate (sparse data, non-identifiability of the lag, weak constraints on the asymptote). Posterior credible intervals make no such assumptions and degrade gracefully as the data weakens — they widen to match what the data actually says.

Hierarchical pooling, done correctly

With replicates of the same condition, neither "average then fit" nor "fit independently then average" is the right thing. Partial pooling estimates a population distribution over the per-well parameters and shares strength across replicates without forcing them to be identical. BayesBiont uses the non-centered reparameterisation2 to sidestep the funnel geometry that breaks centred hierarchical models under NUTS.

Principled model comparison

compare(result₁, result₂) returns the expected log pointwise predictive density (ELPD) difference under PSIS-LOO with its standard error, plus per-observation Pareto-k diagnostics. The latter flag observations the importance sampling can't reweight reliably — a built-in misspecification check that doesn't depend on noticing a bad fit by eye.

Same data layout, same models. Different questions.

BayesBiont depends on Kinbiont and reuses its GrowthData container and MODEL_REGISTRY. The model definitions are the same; what differs is the inference and what you do with the result.

Kinbiont.jl point estimates

  • Fast nonlinear and ODE fits by maximum likelihood
  • Plate-reader CSV ingestion, change-point detection, preprocessing
  • Batch fitting across many wells, many plates
  • Exploratory analysis when you need a curve and a number

Reach for Kinbiont when: you need throughput, you're screening, you're prototyping a new model, or uncertainty isn't the deliverable.

BayesBiont.jl posterior inference

  • NUTS sampling of the full posterior on Kinbiont models
  • Hierarchical pooling across replicates per condition
  • PSIS-LOO model comparison with diagnostics
  • Posterior contrasts: "P(WT > mutant) = 0.97"

Reach for BayesBiont when: you have replicates, you want credible intervals you can publish, you're choosing between competing kinetic models, or the inference is the deliverable.

A hierarchical fit, end to end.

Six wells from a plate reader, three replicates each for wild-type and a mutant. Fit a hierarchical Gompertz model, then ask the posterior whether the wild-type grows faster. The same script can swap the model and call compare to decide between candidates.

See the Hierarchical pooling and Model comparison chapters of the documentation for the full walkthrough, including how to interpret the Pareto-k diagnostic and how to handle non-positive data under :lognormal.

using BayesBiont

# Six wells, three replicates per condition
data  = GrowthData(curve_matrix, times, well_labels)
group = ["WT", "WT", "WT", "mut", "mut", "mut"]

# Hierarchical Bayesian fit on a non-linear Gompertz
spec = BayesianModelSpec([MODEL_REGISTRY["NL_Gompertz"]])
post = bayesfit(data, spec; group = group)

# Posterior contrast on the growth rate
Δ = contrast(post, "WT", "mut"; param = :growth_rate)
println("P(WT > mut) = ", mean(Δ .> 0))
println("Δ 95% CI    = ", quantile(Δ, [0.025, 0.975]))

In the General registry.

Both Kinbiont and BayesBiont are registered. Pkg resolves the rest of the dependency graph.

julia> ] add BayesBiont

If you use BayesBiont in a paper.

@software{bayesbiont,
  author    = {Alvarenga, Edgar Zanella},
  title     = {BayesBiont.jl: Bayesian inference
               for microbial growth curves},
  publisher = {Fuzue Tech},
  url       = {https://github.com/fuzue/BayesBiont.jl},
  year      = {2026}
}
  1. Hoffman, M. D., & Gelman, A. (2014). The No-U-Turn Sampler: Adaptively Setting Path Lengths in Hamiltonian Monte Carlo. Journal of Machine Learning Research, 15(47), 1593–1623. jmlr.org/papers/v15/hoffman14a
  2. Papaspiliopoulos, O., Roberts, G. O., & Sköld, M. (2007). A General Framework for the Parametrization of Hierarchical Models. Statistical Science, 22(1), 59–73. doi.org/10.1214/088342307000000014
  3. Vehtari, A., Gelman, A., & Gabry, J. (2017). Practical Bayesian model evaluation using leave-one-out cross-validation and WAIC. Statistics and Computing, 27(5), 1413–1432. doi.org/10.1007/s11222-016-9696-4