confint.profile_tls: Confidence intervals for a fitted thermal-load-sensitivity...

View source: R/confint.R

confint.profile_tlsR Documentation

Confidence intervals for a fitted thermal-load-sensitivity model

Description

confint() returns confidence intervals for the natural-scale parameters of a fit_tls() model. Three methods are available:

Usage

## S3 method for class 'profile_tls'
confint(
  object,
  parm = NULL,
  level = 0.95,
  method = c("profile", "wald", "bootstrap"),
  npoints = 30L,
  trace = FALSE,
  fallback = TRUE,
  nboot = 1000L,
  boot_seed = NULL,
  cores = 1L,
  ...
)

Arguments

object

A profile_tls fit from fit_tls().

parm

Character vector of target names (for example "CTmax", "z", "log_z", "low", "k", "phi", grouped names such as "CTmax:A", or contrasts such as "dCTmax:A-B", which means group A minus group B). NULL (default) returns intervals for the natural-scale parameters of the fit.

level

Confidence level (default 0.95).

method

One of "profile" (default), "wald", or "bootstrap".

npoints

Number of grid points used per profile (default 30); ignored for method = "wald" and method = "bootstrap".

trace

Logical; print inner-optimisation progress (profile/bootstrap).

fallback

Logical; when method = "profile" (the default), use the parametric bootstrap for fixed-effects fits when the profile does not close or pdHess = FALSE. Random-effects fits use Wald intervals for fallback. Both routes preserve NA limits and conf.status = "invalid_center" when the profile refit fails to reproduce the likelihood at the fitted estimate. General shape-regression coefficients are reported on the link scale by Wald intervals. Default TRUE.

nboot

Number of bootstrap replicates for method = "bootstrap" or the fallback (default 1000).

boot_seed

Optional integer seed making the bootstrap reproducible without disturbing the caller's random stream (default NULL).

cores

Number of CPU cores for the bootstrap refits (default 1, maximum 2). Requests above two warn and use two. cores > 1 refits replicates in parallel by forking (Unix; sequential on Windows). Results are identical for a given boot_seed regardless of cores.

...

Reserved; must be empty.

Details

  • method = "profile" (default) computes profile-likelihood confidence intervals by inverting the likelihood-ratio test: the interval is {psi : D(psi) <= qt(1 - alpha/2, df)^2}, found by stats::uniroot() on each side of the MLE on the unconstrained internal coordinate, with the endpoints transformed to the natural scale. The cutoff is the squared profile-t quantile on df = n - p residual degrees of freedom (Bates-Watts profile-t), not qchisq(level, 1); the two coincide as df -> Inf. These intervals are prior-free and respect asymmetry. They are equivariant under monotone reparameterisation, so the z interval equals exp() of the internal log_z interval.

  • method = "wald" reuses the Phase-2 Wald path: ⁠estimate +/- t * se⁠ (with t = qt(1 - alpha/2, df) on df = n - p) on the internal (link) scale, back-transformed.

  • method = "bootstrap" returns prior-free parametric-bootstrap percentile intervals: responses are regenerated at the observed design from the fitted mean and response family, the model is refitted nboot times, and the interval is the percentile range of the replicate estimates. This is a frequentist resampling interval, not a posterior or credible interval. A finite interval requires at least 20 usable refits; otherwise limits are NA with conf.status = "bootstrap_unstable".

When a fixed-effects profile does not close on one side, or the fitted Hessian is not positive definite (pdHess = FALSE), confint() attempts a parametric bootstrap for the affected parameters (with a message). For random-effects fits, these conditions route profiled fixed effects to Wald intervals; variance components also use Wald intervals. The explicit method = "bootstrap" option performs random-effects-aware refits. Either fallback can still return NA when its interval is unavailable. Set fallback = FALSE to keep the strict profile behaviour, which returns NA on the open side (never a fabricated bound) with a warning that the parameter is weakly identified (see vignette("profile-likelihood")). The upper asymptote up has its own coordinate beta_up under disjoint bounds but is not yet profiled, so it is reported with the delta-method Wald interval under the profile/Wald methods, with a message.

For a fit with a random intercept (⁠CTmax ~ <fixed> + (1 | group)⁠), method = "profile" profiles the fixed-effect coordinates by re-running the Laplace approximation at each grid point, which is slower than a fixed-effects profile. General continuous shape coefficients are reported with their Wald intervals because they are not profile coordinates. Variance components keep their log-scale Wald intervals under the profile method, and a non-closing random-effects profile falls back to Wald. method = "bootstrap" instead redraws every active random-intercept block and refits with the Laplace approximation, returning percentile intervals when enough stable refits remain.

Value

A tibble with one row per target and columns parameter, conf.low, conf.high, estimate, level, method, scale, and conf.status.

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)
confint(fit, "CTmax", method = "profile")
confint(fit, "z", method = "profile")


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