Predict the fitted survival surface with bootstrap confidence bands
Source:R/predict_survival_curves.R
predict_survival_curves.RdThe frequentist analogue of bayesTLS::predict_survival_curves(). Evaluates the
fitted 4PL survival probability over a temperature-by-duration grid and adds
parametric-bootstrap confidence bands. For random-effects fits the curves are
population-level: random intercepts are integrated during bootstrap refits,
but no fitted group BLUP is added to the reported curve.
Usage
predict_survival_curves(
object,
temps = NULL,
durations = NULL,
nboot = 500L,
level = 0.95,
seed = NULL,
by = NULL
)Arguments
- object
A
freq_tlsfit fromfit_4pl()(or aprofile_tlsfit).- temps
Temperatures to predict at (default: the observed assay temps).
- durations
Exposure durations (default: 100 points log-spaced over the observed range, in the data's duration unit).
- nboot
Number of bootstrap replicates for the bands (default 500). Bootstrap bands currently require shared fixed-effect shape formulas (
low = up = log_k = ~ 1). For varying shapes, usepredict()for the fitted surface; a design-aware bootstrap surface is not yet available.- level
Confidence level (default 0.95).
- seed
Optional RNG seed.
- by
Optional name for the grouping column.
Value
A freq_surv_curves object: $summary (a tibble of
[<group>,] temp, duration, survival_lower, survival_median, survival_upper)
and $meta.
Examples
# \donttest{
raw <- simulate_tls(family = "binomial", CTmax = 36, z = 4, seed = 1)
dat <- standardize_data(
raw, temp = "temp", duration = "duration",
n_total = "total", n_surv = "survived"
)
fit <- fit_4pl(dat, family = "binomial", t_ref = 1, quiet = TRUE)
curves <- predict_survival_curves(
fit, temps = c(34, 36), durations = c(1, 4), nboot = 10, seed = 1
)
curves$summary
#> # A tibble: 4 × 5
#> temp duration survival_lower survival_median survival_upper
#> <dbl> <dbl> <dbl> <dbl> <dbl>
#> 1 34 1 0.868 0.888 0.919
#> 2 36 1 0.433 0.470 0.518
#> 3 34 4 0.331 0.363 0.399
#> 4 36 4 0.0452 0.0641 0.0773
# }