plot_heat_injury: Plot a heat-injury survival trajectory with a bootstrap...

View source: R/heat_injury.R

plot_heat_injuryR Documentation

Plot a heat-injury survival trajectory with a bootstrap confidence band

Description

plot_heat_injury() draws the point-estimate survival trajectory from predict_heat_injury() inside the pointwise parametric-bootstrap confidence band from heat_injury_envelope(). The band is prior-free – a confidence band, never a posterior or credible band.

Usage

plot_heat_injury(
  object,
  trace,
  group = NULL,
  target_surv = NULL,
  t_c = NULL,
  repair = NULL,
  irreversible = TRUE,
  nboot = 1000L,
  conf.level = 0.95,
  seed = NULL,
  time_div = 1,
  xlab = NULL,
  ylab = "Survival",
  T_c = NULL,
  trace_unit = NULL,
  irreversible_mortality = NULL,
  repair_pars = NULL
)

Arguments

object

A profile_tls fit from fit_tls(), or a freq_tls workflow from fit_4pl().

trace

A data frame with numeric columns time (strictly increasing, at least two rows) and temp (degrees C).

group

Optional single group level (grouped fits only; required when the fit is grouped).

target_surv

Optional absolute survival threshold defining one lethal dose: a single probability strictly between the fitted lower and upper asymptotes. NULL (default) uses the project-default relative threshold (the curve midpoint (low + up) / 2), matching derive_ctmax() and derive_lt(). For a bootstrap envelope the target must also be attainable in every converged bootstrap refit; otherwise the function aborts rather than clipping an invalid refit's threshold.

t_c

Optional damage-cutoff temperature (degrees C): at or below it the damage rate is zero. NULL (default) applies no cutoff.

repair

Optional named list of Sharpe-Schoolfield repair parameters (see Details); NULL (default) or FALSE means no repair. TRUE requires repair_pars.

irreversible

Logical; if TRUE (default) survival is monotone non-increasing (mortality does not reverse even if dose is repaired).

nboot

Number of bootstrap replicates (default 1000).

conf.level

Width of the pointwise confidence band (default 0.95).

seed

Optional integer seed; when supplied the bootstrap is reproducible without disturbing the caller's random stream.

time_div

Optional positive divisor applied to returned time on the x-axis. For a fit_4pl() fit, use 60 to show hours or 1440 to show days. Default 1.

xlab, ylab

Axis labels. xlab = NULL (default) labels the known standardized scale in minutes, hours, or days according to time_div; direct profile_tls fits without unit metadata use "input units".

T_c, trace_unit, irreversible_mortality, repair_pars

Compatibility aliases for t_c, trace time units, irreversible, and repair. T_c and t_c cannot both be supplied. trace_unit accepts the same unit labels as standardize_data() and converts trace times to minutes when supplied. NULL (default) means the trace time is already in minutes. In ⁠repair = TRUE, repair_pars = ...⁠, the Bayesian r_ref is converted from doses per hour to doses per minute. irreversible_mortality sets the same behavior as irreversible. target_surv = "relative" selects the default relative midpoint and target_surv = "absolute" selects 0.5. repair_pars accepts either freqTLS parameter names or the uppercase names used by bayesTLS.

Value

A ggplot object.

See Also

heat_injury_envelope() for the band data, predict_heat_injury() for the point trajectory.

Examples

raw <- simulate_tls(family = "binomial", times = c(30, 60, 120, 240, 480),
                    CTmax = 36, z = 4, tref = 60, seed = 1)
dat <- standardize_data(raw, temp = "temp", duration = "duration",
  n_total = "total", n_surv = "survived", duration_unit = "minutes")
fit <- fit_4pl(dat, family = "binomial", t_ref = 60,
  method = "wald", quiet = TRUE)
trace <- data.frame(time = seq(0, 120, by = 5),
                    temp = 34 + 6 * sin(seq(0, 2 * pi, length.out = 25)))
plot_heat_injury(fit, trace, nboot = 50, seed = 1)

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