Fast, prior-free frequentist confidence intervals: Wald, profile-likelihood, and bootstrap, for thermal-load-sensitivity (thermal death-time) models; the maximum-likelihood complement to
bayesTLS.
⚠️
freqTLSis experimental and provided without assurance. Use at your own risk. Results and APIs may be incorrect or change. You are responsible for checking your data, design, model specification, convergence, identifiability, diagnostics, and interpretation. Important analyses should be independently refitted and cross-checked with the Bayesian sister packagebayesTLS(source repository). Agreement is a cross-check, not proof of correctness: shared data or model errors can make both packages agree.
freqTLS fits a single-stage thermal-survival model by maximum
likelihood via TMB. The default is
the descending 4PL,
p = low + (up - low) / (1 + exp(k * (log10(duration) - mid))).
Optional log-normal and midpoint-centred Weibull type 1 and type 2
curves are selected with fit_tls(curve = ...); all four curves use
mid = log10(tref) - (temp - CTmax) / z. Thus CTmax (the critical
thermal maximum at reference time tref) and z (thermal sensitivity,
in degrees Celsius per order-of-magnitude change in exposure duration)
retain the same midpoint meaning, while k has a curve-specific scale.
It then returns prior-free frequentist confidence intervals: Wald,
profile-likelihood (asymmetry-respecting), and bootstrap, for binomial
and beta-binomial survival counts, and for continuous proportion
responses in (0, 1) via the beta family.
For assays with a known lower detection limit, the beta family can also use explicit left-censoring inputs. Mark censored rows and supply their detection limit; freqTLS then uses the probability below that limit. It never infers censoring from zeros. This option is distinct from the pinned Snow-gum example, which uses an ordinary beta likelihood after clamping boundary values.
Its signature display is the Confidence Eye: a pale horizontal lens spanning the selected confidence interval, with a hollow point estimate. The profile- likelihood interval is the default where it is supported; Wald and bootstrap intervals can also be shown. These are likelihood-based confidence intervals, not posterior distributions, so the visual deliberately avoids posterior-density iconography.

CTmax and z. The log-logistic 4PL is the curve-matched
bayesTLS configuration; the alternatives share its midpoint
coordinates but have curve-specific k scales. All curves support
binomial and beta-binomial survival counts and continuous
beta proportions in (0, 1) (no trials column needed). The Beta
family also accepts explicit left-censor flags and assay limits; it
does not infer censoring from zeros.fallback = FALSE to keep the open profile, which the
Confidence Eye marks with a hollow point and no lens.fit_tls()) and a
brms/drmTMB-style formula interface (tls_bf()) with
fixed-effect predictors on any sub-parameter (CTmax, log_z, low,
up, log_k), plus prediction, lethal-time derivation, and plotting
(survival curves, the survival surface, and the Confidence Eye).CTmax, log_z, low, and log_k
(<param> ~ <fixed> + (1 | group)), with profile intervals for the
fixed effects. CTmax accepts multiple additive independent grouping
terms, such as (1 | plant) + (1 | meas_day); the other coordinates
accept one grouping term each. Variances are independent, including
when terms use the same grouping factor. Correlated effects and random
slopes are not implemented. Phylogenetic covariance terms such as
gr(species, cov = tree) are also unsupported; use bayesTLS for
that model. The crossed plant/day case is an implementation example,
not evidence that the two-level Snow-gum day effect is separately
identifiable.derive_ctmax() (absolute
threshold) and derive_tcrit() (rate-multiplier), and predicts heat
injury under a temperature trace (predict_heat_injury()) with a
prior-free bootstrap confidence band (heat_injury_envelope(),
plot_heat_injury()). Point predictions evaluate fitted shape
formulas at each trace temperature; the bootstrap envelope currently
requires constant or cell-mean shapes. Trace time units can be
supplied explicitly, and common bayesTLS heat-injury argument names
are accepted as aliases. plot_tdt_curve() supports relative and
absolute target labels plus linear, log, and paired panels; its log
default preserves the existing freqTLS output, while bayesTLS defaults
to both. See vignette("frequentist-and-bayesian") for how the
likelihood and Bayesian paths compare.The classical workflow fits a curve per temperature, then regresses the
derived endpoints in a second stage. That discards the joint
uncertainty: the second-stage standard errors treat noisy first-stage
estimates as fixed, and the design’s identifiability is invisible.
freqTLS fits one model to all the counts at once and inverts the
likelihood for CTmax and z directly, so the interval reflects the
whole design and flags weakly identified parameters.
freqTLS follows the empirical workflow in the bayesTLS
supplement while using a
different inference engine. A numerical comparison is meaningful only
after the data, response family, formulas, asymptote bounds, threshold,
reference time, estimand, and grouping structure have been matched.
Under a matched log-logistic 4PL specification, the packages can
represent the same fitted curve; their APIs and uncertainty objects are
not drop-in replacements.
| | bayesTLS | freqTLS |
|----|----|----|
| Inference | Bayesian posterior (MCMC / Stan) | Maximum likelihood + profile likelihood |
| Intervals | Credible intervals (prior-informed) | Confidence intervals (prior-free) |
| Needs Stan / MCMC | Yes | No |
| Speed | Sampling (seconds to minutes) | Optimisation (~ms to ~1 s; see the timing table in vignette("comparing-to-bayesTLS")) |
| Weak identification | Priors can still yield a finite posterior interval | Open profiles are flagged; bootstrap or Wald fallback depends on the fitted model |
| Extras | Posterior propagation, fitted Bayesian heat-injury/repair workflows, priors | Explicit non-closing/identifiability flags, Confidence Eyes, profile/Wald/bootstrap intervals |
Use freqTLS when you want fast, prior-free, asymmetry-respecting
intervals and an explicit identifiability check. A non-closing
fixed-effects profile can fall back to a parametric bootstrap;
random-effects profiles fall back to Wald. If the selected method cannot
produce an interval, the result stays unavailable and the warning
explains why. Use bayesTLS when you want a full Bayesian workflow,
prior information, or the heat-injury and repair sub-models. The two are
complementary approaches to the same thermal-load-sensitivity framework,
not competitors.
To install or check the current CRAN version, run the following.
install.packages("freqTLS")
packageVersion("freqTLS")
To reproduce an analysis with version 0.2.0, download its source tarball
or install the pinned GitHub tag with
pak::pak("itchyshin/freqTLS@v0.2.0"). Source tarball and
checksum
To install from a local source checkout, run R CMD INSTALL . from its
root.
The workflow follows the same standardize → fit → quantities → plot
sequence as bayesTLS, but the packages are not drop-in replacements.
freqTLS implements the tested fixed/grouped designs and limited
random-intercept structures described below; more general Bayesian
models remain in bayesTLS. The engine is maximum likelihood (no Stan,
no MCMC, no internet); uncertainty is a frequentist trio (Wald, profile,
bootstrap) instead of a posterior. The deliberate differences are
documented in vignette("comparing-to-bayesTLS"): fitting always
targets the relative midpoint; extract_tdt() can then derive an
absolute (p-survival) threshold, including temperature-varying shapes
via a bounded scan for one crossing over the observed temperature range.
Absolute-target bootstrap intervals use only converged refits whose
fitted asymptotes bracket the target; temperature-varying shapes also
need one detected crossing. These intervals are conditional on those
usable refits, which are counted by fitted group, and require at least
20 usable refits. A fit-time absolute-threshold mode remains
unsupported. The fit also accepts custom asymptote bounds and exact
fixed_low / fixed_up values. Uncertainty comes as bootstrap
replicates rather than posterior draws; and the temperature effect
defaults to the constant-shape configuration. For a paper-matched
empirical comparison, use the case-specific formulas listed in
vignette("comparing-to-bayesTLS"); some cases allow
temperature-varying shapes.
library(freqTLS)
# 1. Standardize raw survival counts (the shared bayesTLS entry point)
dat <- simulate_tls(
family = "beta_binomial", times = c(30, 60, 120, 240, 480),
CTmax = 36, z = 4, phi = 50, tref = 60, seed = 1
)
std <- standardize_data(dat, temp = "temp", duration = "duration",
n_total = "total", n_surv = "survived",
duration_unit = "minutes")
# 2. Fit the 4PL by maximum likelihood, directly in CTmax and z.
# `standardize_data()` converts durations to minutes. The omitted t_ref is 60
# minutes (one hour); `t_ref = 1` means one minute.
fit <- fit_4pl(std)
# 3. Headline thermal-death-time quantities with profile-likelihood intervals
knitr::kable(tls(fit)$summary, digits = 2)
| quantity | median | lower | upper | |:---------|-------:|------:|------:| | CTmax | 36.0 | 35.75 | 36.27 | | z | 3.9 | 3.43 | 4.38 |
fit_4pl() prints its effective low, up, and k formulas. The
defaults are constant (~ 1) to match the benchmark configuration. For
an explicit matched comparison, pass the same shape formulas to each
package; for example, keep low = ~ 1, up = ~ 1, and k = ~ 1 in
freqTLS when the comparator uses constant asymptotes and steepness. See
the comparison vignette for complete specifications.
For follow-up 2PL comparisons, fixed_low and fixed_up hold constant
asymptotes at exact values; supplying both fixes the curve at two
parameters. bounds changes the feasible interval for asymptotes that
remain estimated; the bayesTLS-compatible lower and upper arguments
set its endpoints individually. Supply either bounds or those endpoint
aliases in one call. These opt-in settings do not change the default 4PL
fit.
For example, simulate a curve with known asymptotes and fix them during fitting:
two_pl_raw <- simulate_tls(
family = "binomial", low = 0.1, up = 0.9,
times = c(30, 60, 120, 240, 480), CTmax = 36, z = 4,
tref = 60, seed = 3
)
two_pl_data <- standardize_data(
two_pl_raw, temp = "temp", duration = "duration",
n_total = "total", n_surv = "survived", duration_unit = "minutes"
)
two_pl_fit <- fit_4pl(
two_pl_data, family = "binomial", fixed_low = 0.1, fixed_up = 0.9,
t_ref = 60, quiet = TRUE
)
tidy_parameters(two_pl_fit)[
tidy_parameters(two_pl_fit)$parameter %in% c("CTmax", "z"),
c("parameter", "estimate", "std.error")
]
The two fixed asymptotes reduce the number of estimated mean-curve parameters; this example demonstrates the interface, not recovery guarantees for every design.
For per-group CTmax and z, standardize a dataset that contains the
grouping column, then pass matching formulas exactly as in bayesTLS:
grouped_dat <- simulate_tls(
family = "binomial", times = c(30, 60, 120, 240, 480),
group = c("cool", "warm"), reps = 4, n = 40,
CTmax = c(35, 38), z = c(4, 4), tref = 60, seed = 2
)
grouped_std <- standardize_data(
grouped_dat, temp = "temp", duration = "duration",
n_total = "total", n_surv = "survived", duration_unit = "minutes"
)
grouped_fit <- fit_4pl(
grouped_std, ctmax = ~ 0 + group, z = ~ 0 + group, t_ref = 60
)
# Inspect the recovered group-specific CTmax and z estimates.
tidy_parameters(grouped_fit)[
grepl("^(CTmax|z):", tidy_parameters(grouped_fit)$parameter),
c("parameter", "estimate")
]
extract_tdt(), get_tls_est(), predict_survival_curves(), and
diagnose_tdt_fit() complete the shared-name analogue surface; the
column / formula engine interface (fit_tls(), tls_bf()) remains
available underneath. tls() accepts the legacy mode / p threshold
aliases and gives explicit errors for recognized Bayesian-only settings
that cannot affect a fitted ML model. Its params argument accepts
quantity vectors; selecting tcrit requires the explicit
lethal-endpoint setting.
# 4. Plot the fitted survival surface (the Confidence Eye is shown above)
plot_survival_curves(fit)

If you prefer a grammar, build the model with tls_bf() and pass it as
the first argument with the data in data =. The left-hand side names
the survival counts (successes | trials(total)); the right-hand side
tags the two axes with the time() and temp() markers. The formula
path feeds the same likelihood engine, so the fits are numerically
identical:
# Column form and formula form fit the same model:
fit_f <- fit_tls(
tls_bf(survived | trials(total) ~ time(duration) + temp(temp)),
data = dat,
family = "beta_binomial",
tref = 60
)
all.equal(coef(fit_f), coef(fit))
#> [1] TRUE
Add a sub-parameter formula for predictors on CTmax and log_z (for
example CTmax ~ population, log_z ~ population for a grouped fit).
These two headline coordinates must use the same fixed-effect design
columns; their supported random-intercept groupings may differ. The
shape coordinates may use independent fixed designs.
When thermal tolerance varies across colonies, clutches, or populations,
add a random intercept on CTmax with CTmax ~ 1 + (1 | group).
freqTLS fits it by maximum likelihood through TMB’s Laplace
approximation (matching the bayesTLS random-effects-on-the-midpoint
configuration), reports the between-group standard deviation as
sigma_CTmax, and returns the group BLUPs via ranef(). The
no-random-effects path stays byte-identical to the fixed-effects model.
# 15 colonies whose CTmax varies with SD = 1.5 C.
dre <- simulate_tls(family = "binomial", CTmax = 36, z = 4,
times = c(30, 60, 120, 240, 480), tref = 60,
re_sd = 1.5, n_re_groups = 15, seed = 1)
fit_re <- fit_tls(
tls_bf(survived | trials(total) ~ time(duration) + temp(temp),
CTmax ~ 1 + (1 | colony)),
data = dre, family = "binomial", tref = 60
)
# Between-colony SD of CTmax (with a Wald interval):
tp <- tidy_parameters(fit_re)
tp[tp$parameter == "sigma_CTmax", c("parameter", "estimate", "conf.low", "conf.high")]
#> # A tibble: 1 × 4
#> parameter estimate conf.low conf.high
#> <chr> <dbl> <dbl> <dbl>
#> 1 sigma_CTmax 1.48 1.03 2.12
# Colony BLUPs (deviations from the population CTmax):
head(ranef(fit_re), 3)
#> # A tibble: 3 × 4
#> group term estimate std.error
#> <chr> <chr> <dbl> <dbl>
#> 1 g1 CTmax -1.03 0.390
#> 2 g10 CTmax -0.651 0.390
#> 3 g11 CTmax 2.05 0.390
# Choose the prediction target explicitly for a random-intercept fit.
colony_1 <- as.character(ranef(fit_re)$group[1])
new_re <- data.frame(temp = 36, duration = 2, colony = colony_1)
data.frame(
target = c("population", "colony"),
survival = c(
predict(fit_re, new_re, re.form = "population"),
predict(fit_re, new_re, re.form = "conditional")
)
)
#> target survival
#> 1 population 0.9800717
#> 2 colony 0.9787471
The 2-minute prediction above is an extrapolation: this simulation used durations from 30 to 480 minutes.
Population predictions set every random intercept to zero. Conditional
predictions add the fitted BLUP and therefore require each relevant
grouping column in newdata; unseen groups stop with guidance to use
the population prediction. Calling predict() without re.form on a
random-effects fit warns and returns the population prediction.
A random intercept on thermal sensitivity works the same way, with
log_z ~ 1 + (1 | group). Because z is modelled on the log scale, the
deviation is Gaussian on log(z) and sigma_logz is a standard
deviation on log(z); read exp(sigma_logz) as the approximate
multiplicative spread of z across groups, not a z-scale SD. The two
intercepts can be combined; with the same grouping factor freqTLS
fits two independent variances (no correlation term) and warns, since
group-level CTmax and z deviations are usually correlated, reach for
bayesTLS when you need a correlated random effect. Like sigma_CTmax,
sigma_logz is a maximum-likelihood variance component, biased low with
few groups.
Two populations can differ not only in where the thermal-death curve
sits (CTmax, z) but in its shape: how steeply survival collapses
with exposure (k), or the background and maximum survival (low,
up). The formula interface lets low, up, and log_k vary by a
grouping factor, relaxing the shared-shape restriction. Here a
heat-tolerant and a heat-sensitive population differ in both CTmax and
the curve steepness k:
# The tolerant population has a higher CTmax and a steeper survival collapse.
dpop <- simulate_tls(family = "binomial", group = c("tolerant", "sensitive"),
times = c(30, 60, 120, 240, 480),
CTmax = c(38, 35), z = c(3.5, 3.5),
low = 0.02, up = 0.98, k = c(8, 3),
tref = 60, seed = 11)
fit_pop <- fit_tls(
tls_bf(survived | trials(total) ~ time(duration) + temp(temp),
CTmax ~ group, log_z ~ group,
low ~ group, up ~ group, log_k ~ group),
data = dpop, family = "binomial", tref = 60
)
# Per-group steepness k with profile-likelihood confidence intervals:
confint(fit_pop, parm = c("k:tolerant", "k:sensitive"), method = "profile")
#> # A tibble: 2 × 8
#> parameter conf.low conf.high estimate level method scale conf.status
#> <chr> <dbl> <dbl> <dbl> <dbl> <chr> <chr> <chr>
#> 1 k:tolerant 7.43 10.6 8.86 0.95 profile log ok
#> 2 k:sensitive 2.40 3.48 2.90 0.95 profile log ok
This simulated data set uses group-specific generating values of k = 8
and k = 3. The fitted curves show the estimated shape pattern:
survival collapses abruptly in the tolerant population and gradually in
the sensitive one. Separate group confidence intervals do not test the
between-group contrast:
plot_survival_curves(fit_pop)

This direct fit_tls() example keeps the duration scale supplied in the
data; here the simulated durations and tref = 60 are in minutes. The
plot labels that scale as input units because a direct engine fit does
not store unit metadata.
For exposure duration d (with logd = log10(d)) and assay temperature
T, survival follows the descending four-parameter logistic
$$ p = \mathrm{low} + \frac{\mathrm{up} - \mathrm{low}}{1 + \exp!\big(k\,(\log_{10} d - \mathrm{mid})\big)}, \qquad \mathrm{mid} = \log_{10}(t_\mathrm{ref}) - \frac{T - \mathrm{CTmax}}{z}. $$
CTmax is the critical thermal maximum at the reference time tref,
and z is the thermal sensitivity (degrees Celsius per
order-of-magnitude change in exposure duration). The In the default
constant-shape configuration, the temperature effect runs through the
midpoint only (shared low, up, k). Explicit formula terms can
instead model low, up, or log_k; these extensions change the
interpretation of an absolute-threshold curve and do not create local
z estimates. Because CTmax and z are direct model parameters, both
can be profiled directly.
See vignette("freqTLS") for the full walkthrough,
vignette("model-math") for the exact bridge to bayesTLS, and
vignette("profile-likelihood") for what the profile is doing and the
honest non-closing fallback.
The thermal-load-sensitivity modelling framework implemented here was
introduced by Daniel W. A. Noble, Pieter A. Arnold, Shinichi Nakagawa,
and Patrice Pottier in the
bayesTLS package. The
model and the mapping from the 4PL midpoint slope to z and CTmax are
theirs. freqTLS is a likelihood implementation of that framework.
Please cite the paper: Noble et al. (2026, bioRxiv,
doi:10.64898/2026.07.16.738378);
when you use freqTLS; run citation("freqTLS") for all entries.
freqTLS contributes a TMB maximum-likelihood likelihood, the direct
CTmax/z reparameterisation that makes both quantities directly
profile-able, and profile-likelihood confidence intervals, a likelihood
complement to the Bayesian path (no priors, no MCMC, no Stan).
The active teaching cases use zebrafish_o2 (oxygen-gradient
zebrafish), aphid_tdt (cereal aphids), snowgum_psii (Snow-gum PSII),
and dsuzukii (mortality and awake/coma endpoints). Their original
sources and component licences are recorded in inst/CITATION,
inst/COPYRIGHTS, and the repository licence ledger. The installed Snow-gum dataset comes from the MIT-licensed data
component of bayesTLS 1.3.0. Retain its notice in inst/COPYRIGHTS when reusing it.
Legacy compatibility/benchmark fixtures remain fully attributed in
inst/CITATION and inst/COPYRIGHTS, but are intentionally absent from
public examples and pkgdown discovery. Please cite bayesTLS and each
original data source when using any bundled data.
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.