This is the first CRAN update since 1.0.0. Versions 1.1.0 and 1.2.0 were released on GitHub only, so their changes (listed below) are also new on CRAN.
standardize_data() gains
detection_limit for a proportion response whose instrument cannot
resolve values beyond a limit, for example a fluorometer that records 0
below the lowest value it can read, or readings capped at a ceiling. Give
one number (a lower limit), c(lower, upper), or the names of columns that
hold per-row limits. Readings below the lower limit are flagged
left-censored and readings at or above the upper limit right-censored, in a
new censored column, with the limit stored as the response. fit_4pl(),
fit_lognormal() and fit_weibull() then add brms's cens() term to the
Beta response, so each censored reading contributes the probability of
lying beyond the limit instead of a density at a clamped value.
make_4pl_formula() and make_tdt_formula() gain a matching censored
argument. The fitted curve keeps its meaning, so tls() and the prediction
helpers are unchanged.plot_survival_curves(), plot_tdt_landscape() and
summarise_observed_survival() show censored readings as recorded
(survival_recorded). print() reports the number of censored readings,
and bayes_R2_tls() warns that R^2 is only a rough guide when readings are
censored. A censored fit scores censored readings as probabilities in
log_lik(), loo() and waic(), so compare it only with fits to the same
data and the same detection_limit, never with a fit whose readings were
clamped.detection_limit nothing changes, except that
proportion_eps must now be a single number in (0, 0.5). Values outside
that range gave degenerate or invalid responses before.derive_tdt_curve() with an absolute threshold now reads each draw's LT
exactly from its fitted curve (the midpoint plus the model's closed-form
correction), the same values that tls() and derive_z() use. It used to
search a duration grid and silently drop every draw whose crossing lay
beyond it, so cool temperatures were summarised from a biased few draws. On
the snow gum fit, dark recovery at 40 degrees C came from 1 of 400 draws.
duration_grid is no longer used, and a message says so if it is given.
Draws whose curve never reaches the target (outside its asymptotes) are
dropped with a warning, as elsewhere.tls() and derive_temperature_for_duration() no longer silently drop
draws whose CTmax lies outside the temperature grid, which made intervals
too narrow. When the LT curve is a straight line in temperature, CTmax (and
the 1-hour anchor of T_crit) now come from the exact closed form at any
temperature. That covers every relative threshold, for midpoint and direct
fits alike, and absolute thresholds whose asymptotes and steepness do not
change with temperature. tls() used to invert direct fits on the grid,
dropping draws even at the default reference exposure.derive_temperature_for_duration() no longer assumes a straight relative
midpoint (one that bends is inverted instead), and its temp_grid now
defaults to 11 points over the observed temperatures. Its check for a
straight curve no longer looks only at the requested temperatures, so a
temp_grid of the centring temperature and/or one degree above it cannot
make a bent curve look straight. Such a curve used to be solved as the line
through those two temperatures, off by up to 2 degrees C per draw on a test
fit. A one-point temp_grid is searched outward at a fine step instead of
in quarters of the data's temperature range, and in a grouped call a group
with no crossing now gets an NA summary row, with the warning, instead of
an error.target_surv = 0.9 when the upper asymptote falls with
temperature. Where the target lies outside a draw's fitted asymptotes at
some temperatures, the LT there is undefined, and the inversion used to
drop every draw with such a temperature on its grid. It now treats that LT
as zero (upper asymptote at or below the target) or infinite (lower
asymptote at or above it) and locates a crossing next to it from the
survival curve, which is defined everywhere. On a test fit at
target_surv = 0.8, 1000 of 1000 draws now have a CTmax, against 2 before.target_surv = 0.9. It now takes the single
crossing where the LT shortens through the target as temperature rises. A
draw with none, or more than one, gets no CTmax and is counted in the
warning. Relative thresholds and target_surv = 0.5 were not affected on
any fit checked.tls() with ndraws now uses one posterior subsample for all four 4PL
sub-parameters. Each of the four (low, up, k, mid) used to come from its own
random subsample, so they were mismatched draws, which distorted
absolute-threshold results (relative thresholds use the midpoint only and
were unaffected). Seeded results with ndraws change, since the subsample
is drawn differently. An ndraws at least the posterior size now uses all
draws instead of erroring, and every function with an ndraws argument
(including predict_survival_curves(), derive_tdt_landscape() and
predict_heat_injury()) now requires it to be NULL or a whole number of
at least 1.tls() warns when temp_grid looks like degrees C rather than centred
temperatures, that is, when it lies entirely outside the observed (centred)
temperatures or reaches more than the data's own temperature range beyond
them. A degrees-C grid used to give nonsense silently. The check cannot tell
the two scales apart for data near 0 degrees C. Non-finite temp_grid
values are now dropped with a warning in tls(), derive_tdt_curve() and
derive_temperature_for_duration(). An Inf used to make the crossing
search fail silently.target_surv outside the fitted asymptotes now
gives the number of draws affected and on which side of the curve the
target falls. It used to round the share of evaluations (it could say "0%"
while dropping some) and print asymptote medians over all of them.derive_tdt_curve(), derive_z(), derive_temperature_for_duration(),
tdt_parameter_table(), extract_4pl_pars() and the heat-injury functions
now work on a hand-built bayes_tls object that lacks meta$bounds,
rebuilding the bounds from meta$lower and meta$upper as tls() does.
Absolute thresholds used to return nothing, with a misleading warning.tls() with by = NULL on a grouped fit (e.g. ctmax = ~ 0 + recovery)
now reports every group, as derive_z() and the other readers already did.
Previously it filled the moderator from the first data row and silently
returned that one group without a group label. A bare brmsfit whose
CTmax/z (or midpoint) vary by a moderator now asks for by. With a
user-supplied newdata grid, by = NULL still treats the grid as one
group. Single-condition fits are unaffected.?snowgum_psii now credits the data to the authors' public repository
(GitHub pieterarnold/TLS_FvFm, archived on Zenodo, MIT licence), against
which all 396 raw rows were checked, instead of giving the preprint's
CC BY-NC 4.0 licence. It also describes the split-plot design. Each heat
run heated a light and a dark array together, so the array, not the leaf
section, is the unit of replication for the light/dark contrast. The
example censors the zero readings and builds run and array labels. The MIT
copyright and permission notice that covers these data is installed as
system.file("COPYRIGHTS", package = "bayesTLS").citation("bayesTLS") and the package description now cite the bioRxiv
preprint of the accompanying paper (Noble, Arnold, Nakagawa and Pottier
2026, doi:10.64898/2026.07.16.738378).extdata/data_function_PSII_TDT_snowgum_glasshouse.csv, an
earlier snow gum dataset that no function or help page refers to, is no
longer installed.?bayes_R2_tls now says that the estimate is the posterior mean (the median
with robust = TRUE), as brms::bayes_R2() returns, not the median.?plot_tdt_curve now shows how to change the y-axis limits correctly. A
+ coord_cartesian() reaches only one panel of the two-panel default, so the
example applies it to a single panel, or to both with patchwork's & and a
lower limit above 0 for the log axis. The old example stopped with an error.fit_lognormal() (log-normal / probit curve) and
fit_weibull(type = 1 | 2) (Weibull type 1, the Gompertz-shaped curve on
log time, and Weibull type 2). Every model is written in its midpoint
form, so mid, the TDT line, the relative threshold, z and CTmax mean
the same thing whichever curve is fitted; the prior mean of logk is
shifted per model so the prior on the slope at the midpoint matches.
fit_4pl() is unchanged (it keeps meaning the log-logistic and gains no
model argument); make_tdt_formula() / make_tdt_priors() are the
model-generic builders behind make_4pl_formula() / make_4pl_priors().
Everything downstream works for every model: tls(), derive_z(),
derive_temperature_for_duration() and derive_tdt_curve() at relative
or absolute thresholds (each model's own correction from the midpoint to a
fixed survival target), predict_heat_injury() (dose and survival from
the fitted model's curve: read off it for the constant shape, followed per
individual or by cumulative exposure for the varying shape), survival curves,
landscapes and tdt_parameter_table() (which records the model in its
"model" attribute). A bare brmsfit passed to tls() is recognised from
its formula.tls()
z and CTmax (relative and absolute thresholds) and T_crit, as summaries
and as every posterior draw, the curve parameters, derive_z(),
derive_temperature_for_duration() and derive_tdt_curve() at the
absolute threshold, and predict_heat_injury() with the default constant
shape (relative and absolute dose) are bit-identical to 1.1.0, compared
on the centred temperature scale and again with a shifted centring
constant; tdt_parameter_table() gains only the "model" attribute
(scripts/package/check_case_study_outputs.R). The varying shape changes:
see Bug fixes.fit_4pl(fix_asymptotes = ) (and make_4pl_priors()) can pin one or both
asymptotes instead of estimating them: TRUE fixes low and up at the
response bounds (0 and 1 for proportions, a two-parameter log-logistic),
c("up") fixes only the upper asymptote while low stays estimated, and
c(low = 0.02) pins a named asymptote at a chosen value. Pinning is done
through a brms constant() prior on the asymptote's Intercept with its
formula forced to ~ 1, so tls(), predict_heat_injury() and the
accessors read a fixed asymptote exactly as an estimated one. Values at the
response bounds sit at the edge of the padded window (0.001 / 0.999 by
default); the effective values are recorded in meta$fix_asymptotes and
shown by print(). The default (NULL) is unchanged.predict_heat_injury(shape = "varying") used an ad hoc survival update,
present since the shape was added in 1.0.0. The default
shape = "constant", which the paper uses, gives the same numbers for
every draw that produces a prediction (draws that do not are now blanked;
see the next entry). Under the old update:target_surv, steps where the target was at or above
the curve's upper asymptote added no heat injury and no mortality, and a
draw whose first step was such a step returned NA and was dropped from
the summary without a warning;The varying shape now offers two coherent methods, chosen with the new
argument varying_method: "individual" (default), where each individual
accumulates heat injury additively against its own threshold time, and
"cumulative", cumulative exposure with survival as the state (the rule
used by Rezende et al. 2020 and Bullard et al. 2026; given the same curves
it reproduces Bullard et al.'s code up to the time step). Both reproduce the
fitted curve at any constant temperature and both equal the constant shape
exactly when low, up and k do not change with temperature and mid
is linear in it, with or without repair; they differ otherwise, because
constant-temperature data cannot say why the shape changes. Heat injury is
the same under both unless repair scales with survival (for an absolute
target, the injury of the individual of that rank; Inf, with a warning,
while injury accrued where the target is already passed is outstanding).
Both read a lower up at a temperature as individuals that die on exposure
there, permanently even with reversible mortality; under cumulative
exposure a temperature whose floor is at or above survival adds no injury. Survival starts at up of the first temperature
that accrues injury (above T_c; a trace that accrues none keeps the
constant shape's value), and repair_scales_with_survival
scales repair by survival over that up, a factor never above 1. The help
page sets
out both methods and their assumptions, and the shape is marked
experimental. Varying-shape results change for fits whose low, up or
k change with temperature, for any fit with repair and irreversible
mortality, and for absolute targets outside a draw's curve at some trace
temperature.
predict_heat_injury() now reports in meta$ndraws the posterior draws
that produced a prediction, and warns when any did not (for example, an
absolute target outside a draw's curve at the centring temperature). Such
draws are now left out of every summary column, and draws keeps them as
rows of NA: before, the count reported was the number requested, the
draws were dropped silently, and with repair_scales_with_survival = FALSE
their heat injury still entered the summary as 0. For a grouped fit,
meta$ndraws is the smallest count in any group and the new
meta$ndraws_by_group gives each group's count.
tls() now reads a workflow's own asymptote bounds (the ones it was fitted
with) when it computes absolute thresholds, as derive_z() and the other
readers already did. Before, it always used the default [0, 1] bounds, so
absolute-threshold summaries of a workflow fitted with other bounds (e.g.
lower = 0.85 for photosystem-II data) were wrong without warning;
relative thresholds were never affected. Fits with the default bounds,
including all of the paper's, give identical results. lower and upper
still override, and are still used for a bare brmsfit.
fit_4pl() now accepts
brms's gr() grouping terms, e.g.
ctmax = ~ 1 + (1 | gr(species, cov = A)) with a phylogenetic correlation
matrix supplied through the new data2 argument (ape::vcv(phy, corr =
TRUE) convention; validated for symmetry, level-covering dimnames and unit
diagonal). Internally, random-effect terms are now parsed from the formula
syntax tree instead of with text patterns, which previously broke on the
nested parentheses of gr() calls.tls() auto-includes matching random-effect terms in
posterior_linpred() when a by variable enters the model only as a
random-effect grouping factor (with a message; explicit re_formula
always wins). Previously such calls silently returned the population mean
for every group. All existing fits -- where by is a fixed-effect
moderator -- are unaffected.First release.
bayesTLS fits joint Bayesian four-parameter logistic (4PL) models to
thermal-tolerance data and derives the classical thermal death time / thermal
load sensitivity quantities from the posterior, so that every downstream
quantity carries full uncertainty and is mutually consistent within a draw.
standardize_data() maps a raw thermal-tolerance dataset (binomial counts or
continuous proportions) onto the columns the model expects, and records the
duration unit and centring used.fit_4pl() fits the joint 4PL with brms, in either the midpoint
parameterisation or the direct CTmax/z parameterisation
(ctmax = ~ ..., z = ~ ...), with moderators allowed on any sub-parameter.make_4pl_formula() and make_4pl_priors() expose the underlying brms
formula and default priors for inspection or customisation.tls() derives z, CTmax and T_crit per moderator group from any fitted
4PL — including hand-written brms models — by evaluating the sub-parameters
on a moderator x temperature grid with brms::posterior_linpred().tls_z(), tls_ctmax() and tls_tcrit() return the individual quantities;
derive_tdt_curve() and derive_tdt_landscape() give the TDT curve and
landscape.predict_heat_injury() accumulates heat injury over an arbitrary temperature
trace, with optional Sharpe-Schoolfield repair (repair_rate_schoolfield()).predict_survival_curves() propagates that injury to survival.make_temperature_scenarios() builds fluctuating-temperature scenarios.ts_stage1(), ts_stage2(), ts_curve() and ts_ci() implement the
conventional two-stage TDT workflow, for direct comparison against the joint
model.plot_tdt_curve(), plot_tdt_landscape(), plot_heat_injury(),
plot_survival_curves(), plot_temperature_scenarios() and friends, all on a
shared theme_tdt().diagnose_tdt_fit() and bayes_R2_tls() for fit checking.Four publicly available example datasets spanning lethal and sub-lethal
endpoints: aphid_tdt, dsuzukii, snowgum_psii and zebrafish_o2.
Any scripts or data that you put into this service are public.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.