derive_ctmax: Derive the temperature giving a target survival at a fixed...

View source: R/predict.R

derive_ctmaxR Documentation

Derive the temperature giving a target survival at a fixed exposure

Description

derive_ctmax() inverts the fitted thermal-survival curve for temperature: it returns the assay temperature at which survival equals a target surv after exposure duration. By default surv is the relative midpoint threshold (low + up) / 2 and duration is tref, so derive_ctmax(fit) reproduces the fitted CTmax. Supplying an absolute surv gives the absolute- threshold critical temperature (the analogue of the bayesTLS extract_tdt() absolute mode), with the asymmetry correction family-specific inverse curve built in, including the exact log-logistic inverse for the default model. For a supplied absolute surv target, a temperature-varying shape uses a 201-point bounded scan and refines one crossing detected inside temp_bounds (the observed range by default). The relative default uses the analytic inverse. Crossings closer than the scan spacing may not be distinguished.

Usage

derive_ctmax(
  object,
  surv = NULL,
  duration = NULL,
  group = NULL,
  temp_bounds = NULL,
  cell = NULL
)

Arguments

object

A profile_tls fit from fit_tls().

surv

Target survival probability in ⁠(low, up)⁠. NULL (default) uses the relative midpoint (low + up) / 2, reproducing CTmax at tref.

duration

Exposure duration(s) (native time unit; strictly positive). Defaults to the fit's tref.

group

Optional single group level (grouped fits only).

temp_bounds

Optional finite increasing temperature bounds for the numerical inverse used when a fitted shape depends on temperature. The default is the fitted data's observed temperature range.

cell

Optional named list of one-row predictor values for a general formula design. Use this when CTmax cells combine predictors and a shape formula uses one of the source columns, for example cell = list(group = factor("A", levels = c("A", "B")), site = factor("north", levels = c("north", "south"))) for CTmax ~ group:site. For an absolute inversion, omit temp, temp_c, and the source column named in temp(); the inversion sets those from its candidate temperature.

Details

Let eta_curve(q) be the inverse of the selected normalized survival curve at q = (surv - low) / (up - low). Solving for temperature gives temp = CTmax - z * (log10(duration) - log10(tref) - eta_curve(q) / k). The target surv must lie strictly between low and up. For a supplied absolute surv target, a temperature-varying shape uses bounded numerical inversion and requires one crossing detected by the fixed grid inside the search interval. The relative default is evaluated analytically. For a random-effects fit this is a population-level derived quantity; it does not add a group BLUP (best linear unbiased predictor; see ranef()).

Value

A numeric vector of temperatures (degrees C), one per duration.

Examples

d <- simulate_tls(family = "binomial", times = c(30, 60, 120, 240, 480),
                  CTmax = 36, z = 4, tref = 60, seed = 1)
fit <- fit_tls(d, y = survived, n = total, time = duration, temp = temp,
               family = "binomial", tref = 60)
derive_ctmax(fit)                                  # ~ CTmax (relative, at tref)
derive_ctmax(fit, surv = 0.5, duration = c(60, 240)) # absolute 50% survival

freqTLS documentation built on Dec. 4, 2026, 5:11 p.m.