ts_stage2: Stage 2 of the classical two-stage TDT pipeline

View source: R/two_stage.R

ts_stage2R Documentation

Stage 2 of the classical two-stage TDT pipeline

Description

Regresses Stage-1 log10(LT50) on assay temperature by ordinary least squares and derives the classical quantities. z = -1/slope; CTmax(t_ref) = (log10(t_ref) - intercept) / slope; T_crit follows the rate-multiplier definition, ⁠CTmax(1h) + z * mean(log10(TC_rate_range/100))⁠.

Usage

ts_stage2(
  stage1,
  t_ref = 60,
  time_multiplier = 1,
  TC_rate_range = c(0.1, 1),
  rows = c("stage1_ok", "finite_ok")
)

Arguments

stage1

Output of ts_stage1().

t_ref

Reference exposure duration for CTmax (minutes). Default 60. Must be > 0.

time_multiplier

Multiplier from the Stage-1 duration unit to minutes (e.g. 60 if durations are in hours). Default 1. Must be > 0.

TC_rate_range

Length-2 HI-rate range (% per hour) for T_crit.

rows

Which Stage-1 rows to keep: "stage1_ok" (bracketing validation, the case-study default) or "finite_ok" (finite/negative slope only, the simulation's looser rule).

Details

The Stage-2 regression is unweighted ordinary least squares: it ignores the Stage-1 standard errors (se_log10_lt50) by design. This is the generated-regressor bias the manuscript demonstrates, so se_log10_lt50 is exposed for diagnostics only and is not propagated into the Stage-2 quantities.

Value

list(fit, summary); fit is NULL if fewer than 3 valid Stage-1 estimates remain. summary has intercept, slope_T, z, CTmax_1hr, T_crit, r_squared, n_stage1, n_excluded. Note that despite its name CTmax_1hr reports CTmax at t_ref (the two coincide at the default t_ref = 60); the 1 h anchor used for T_crit is computed separately and is invariant to t_ref.

Examples

d <- data.frame(
  temp = rep(c(30, 32, 34, 36, 38), each = 12),
  dur  = rep(c(1, 5, 15, 45, 135, 405), times = 10),
  surv = rbinom(60, 20, 0.4), tot = 20)
s1 <- ts_stage1(d, "temp", "dur", "surv", "tot")
ts_stage2(s1)$summary

bayesTLS documentation built on Nov. 29, 2026, 1:06 a.m.