Fit the 4PL thermal-load-sensitivity model by maximum likelihood (TMB)
Source:R/fit_4pl.R
fit_4pl.RdThe frequentist analogue of bayesTLS::fit_4pl(). Consumes standardize_data()
output and fits the single-stage 4PL thermal-load-sensitivity model, parameterised
directly in CTmax and thermal sensitivity (z), via the freqTLS TMB engine.
Returns a freq_tls workflow object; uncertainty (Wald / profile / bootstrap)
is computed on demand by the quantity analogues (tls(), confint()).
Arguments
- data
Output of
standardize_data().- ctmax, z, up, low, k, by
Direct-mode formula interface; see
make_4pl_formula().bygives fixed cell means for bothctmaxandz. Whenctmaxandzare both supplied, their fixed-effect right-hand sides must produce the same model-matrix columns; their optional random-intercept terms may differ.- threshold
"relative"(default; CTmax/z at the curve midpoint) or"absolute"(at thep-survival level). The fitting backbone currently accepts only"relative"; obtain absolute-threshold quantities post fit withextract_tdt()andtarget_surv = "absolute".- p
Survival level for the absolute threshold (default 0.5).
- t_ref
Positive reference exposure time at which CTmax is reported, expressed in exactly the same unit as the standardised
durationcolumn. WhenNULL(the default), it resolves to one physical hour fromduration_unit(for example,60minutes or1hour). Supply a numeric value to retain a non-hour reference such as240minutes.- bounds
Asymptote range. Only
c(0, 1)is currently accepted. Supply survival as a probability in[0, 1]and let the model estimatelowandupwithin that range; non-default bounds stop with an error.- family
"beta_binomial"(default for counts),"binomial", or"beta".NULLpicks beta for a proportion response, else beta-binomial.- method
Default interval method for downstream extraction (
"profile","wald", or"bootstrap"); stored in the object.- start, control, trace, quiet
Passed to the engine
fit_tls().
Value
A freq_tls object: a list with $fit (the engine fit), $data,
$formula, and $meta (threshold, t_ref, bounds, temp_mean, response_type,
family, grouped, moderators, method).
Experimental software
Use freqTLS at your own risk. Results and APIs may be incorrect or change. Users are responsible for checking their data, design, model specification, convergence, identifiability, diagnostics, and interpretation. Important analyses should be independently refitted and cross-checked with bayesTLS (source repository). Agreement is a cross-check, not proof of correctness; shared data or model errors can make both packages agree.
Before interpretation
Run check_tls() before interpreting the fit. It gives a concrete recovery
action for each data-adequacy warning; vignette("profile-likelihood")
explains open profiles and the bootstrap fallback.
Examples
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, method = "wald", quiet = TRUE
)
coef(fit)
#> low up k CTmax z
#> 0.01990609 0.97732873 4.89170992 35.92586046 3.99803066