Profile-likelihood intervals

knitr::opts_chunk$set(
  collapse = TRUE,
  comment = "#>",
  fig.width = 6,
  fig.height = 4,
  dpi = 96
)

freqTLS reports profile-likelihood confidence intervals as its default. This vignette explains what the profile is, why its intervals can be asymmetric, how it differs from the Wald interval, and — importantly — how freqTLS behaves honestly when a profile does not close. These are likelihood intervals, not posteriors; the language throughout is "confidence", never "posterior" or "credible". See vignette("model-math") for the 4PL parameterisation that the profile follows. Before interpreting an interval, run check_tls(fit); its help page maps each data-adequacy warning to a concrete design or analysis response.

library(freqTLS)

What the profile does

For a scalar target $\psi$ (say CTmax):

  1. Fit the maximum-likelihood estimate, obtaining $(\hat\theta, \hat\ell)$.
  2. Fix the internal coordinate that maps to $\psi$ at a candidate value and re-optimise all the other coordinates, giving the profile log-likelihood $\ell_p(\psi)$.
  3. Form the deviance $D(\psi) = 2\,(\hat\ell - \ell_p(\psi))$.
  4. The confidence interval is the set ${\psi : D(\psi) \le t^2_{1-\alpha/2,\,\nu}}$, found by root-finding on each side of the MLE.

At the MLE the deviance is (numerically) zero. The cutoff is the squared Student-$t$ quantile $t^2_{1-\alpha/2,\,\nu}$ on $\nu = n - p$ residual degrees of freedom (data rows minus free fixed-effect coordinates), not the $\chi^2_1$ quantile: this is the Bates–Watts profile-$t$ calibration, which is less optimistic at small $n$ and converges to $\chi^2_1$ as $\nu \to \infty$ (see vignette("frequentist-and-bayesian")). profile() returns the whole deviance curve plus the interval:

set.seed(1)
dat <- simulate_tls(
  family = "beta_binomial", CTmax = 36, z = 4, phi = 50,
  times = c(30, 60, 120, 240, 480), tref = 60, seed = 1
)
fit <- fit_tls(dat, y = survived, n = total, time = duration, temp = temp,
               family = "beta_binomial", tref = 60)

pc <- profile(fit, "CTmax")
c(estimate = pc$estimate, conf.low = pc$conf.low, conf.high = pc$conf.high,
  cutoff = pc$cutoff, min_deviance = min(pc$deviance))

The deviance minimum sits essentially at zero, at the estimate. Plotting the profile shows the deviance curve, the profile-$t$ cutoff line, and the interval where the curve dips below it:

plot(pc)

Asymmetry and equivariance

A profile interval need not be symmetric about the estimate, and freqTLS preserves the asymmetry rather than forcing a symmetric $\pm$ band. For a parameter on a log scale, such as z, the profile is taken on the internal log_z coordinate and the endpoints are exponentiated. This makes the interval equivariant: the z interval is exactly $\exp()$ of the internal log_z interval.

ci_z     <- confint(fit, "z",     method = "profile")
ci_log_z <- confint(fit, "log_z", method = "profile")

# z endpoints equal exp() of the log_z endpoints
rbind(
  z          = c(ci_z$conf.low, ci_z$conf.high),
  exp_log_z  = exp(c(ci_log_z$conf.low, ci_log_z$conf.high))
)

# the interval is asymmetric about the estimate (in general)
with(ci_z, c(lower_gap = estimate - conf.low, upper_gap = conf.high - estimate))

Profile versus Wald

The Wald interval is $\hat\psi \pm z_{\alpha/2}\,\mathrm{se}$ computed on the internal (link) scale and back-transformed. It is fast and first-order, but symmetric on the link scale and blind to the curvature of the likelihood. The profile interval inverts the likelihood-ratio test directly. On well-identified data the two agree closely; they diverge when the likelihood is skewed or the estimate approaches a boundary.

rbind(
  profile = unlist(confint(fit, "CTmax", method = "profile")[c("conf.low", "conf.high")]),
  wald    = unlist(confint(fit, "CTmax", method = "wald")[c("conf.low", "conf.high")])
)

tidy_parameters() switches between the two for the whole parameter table:

tidy_parameters(fit, method = "profile")[, c("parameter", "estimate", "conf.low", "conf.high", "interval_type")]

The upper asymptote up

Under the disjoint-bounds parameterisation up has its own coordinate beta_up, but freqTLS does not yet profile it (the profile path is wired for low but not up). freqTLS reports up with the delta-method Wald interval and labels it honestly — confint(fit, "up", method = "profile") returns interval_type = "wald" and emits an informational message rather than silently substituting a different quantity. If you need a prior-free, asymmetry-respecting interval for up, request the bootstrap: confint(fit, "up", method = "bootstrap").

Recovery when a profile does not close

freqTLS reports when the likelihood does not identify a parameter. Bayesian estimates and intervals are conditional on the specified prior and model. With the default fallback = TRUE, a non-closing fixed-effects profile or a non-positive-definite Hessian routes the affected interval to a parametric bootstrap. A weakly identified beta-binomial dispersion can route CTmax and z to Wald intervals. For random-effects fits, non-closing profiles use Wald intervals; method = "bootstrap" explicitly redraws random effects and refits. General continuous shape coefficients use Wald intervals because they are not profile coordinates. Check both the returned method and conf.status to see which route supplied each interval. An invalid_center status means the profile refit failed to reproduce the fitted likelihood, so fallback does not supply an interval. Set fallback = FALSE when you specifically need to inspect the unmodified profile geometry. In that strict mode freqTLS:

Here is a deliberately sparse design — few temperatures and little mortality contrast — that does not identify CTmax. This fixed-effects example uses the bootstrap recovery recipe below. A 1,000-refit bootstrap is intentionally not executed during package checks; run that displayed chunk interactively when you need the fallback interval.

set.seed(7)
sparse <- simulate_tls(
  temps  = c(35, 36),     # only two temperatures
  times  = c(30, 60),     # only two durations
  reps   = 2, n = 8,
  CTmax  = 36, z = 4,
  family = "binomial", tref = 60, seed = 7
)
sparse_fit <- suppressWarnings(
  fit_tls(sparse, y = survived, n = total, time = duration, temp = temp,
          family = "binomial", tref = 60)
)
ci_default <- tryCatch(
  withCallingHandlers(
    confint(sparse_fit, "CTmax", method = "profile",
            fallback = TRUE, nboot = 1000, boot_seed = 7),
    warning = function(w) {
      message("caught warning: ", conditionMessage(w))
      invokeRestart("muffleWarning")
    }
  ),
  error = function(e) e
)
ci_default[, c("parameter", "conf.low", "conf.high", "estimate", "method",
               "conf.status")]

Now disable fallback to inspect the strict profile. The open side remains NA, with an open_* status, rather than becoming a confident but unsupported bound.

ci_strict <- tryCatch(
  withCallingHandlers(
    confint(sparse_fit, "CTmax", method = "profile", fallback = FALSE),
    warning = function(w) {
      message("caught warning: ", conditionMessage(w))
      invokeRestart("muffleWarning")
    }
  ),
  error = function(e) e
)
ci_strict[, c("parameter", "conf.low", "conf.high", "estimate", "method",
              "conf.status")]

The Confidence Eye follows the same contract. With its default fallback = TRUE, a successful bootstrap recovery draws a bootstrap lens. For the strict diagnostic below, fallback = FALSE preserves the open profile and draws a hollow point with no lens.

# fallback = FALSE so the eye refuses to draw a lens when the profile does not
# close (a hollow point only), matching the honest non-closing contract above.
suppressWarnings(plot_confidence_eye(sparse_fit, parm = "CTmax", method = "profile",
                                     fallback = FALSE))

Calibration: how well do the intervals cover?

A confidence interval is only as good as its coverage. The repository-only coverage study simulated 200 datasets at a known CTmax/z under each family and requested 95% intervals with method = "profile". Its June 2026 summary is shipped with the package:

cov_path <- system.file("extdata", "coverage_results.rds", package = "freqTLS")
if (nzchar(cov_path)) {
  cov <- readRDS(cov_path)
  coverage_table <- cov$coverage[, c(
    "family", "n_converged", "CTmax_coverage", "z_coverage", "open_profiles"
  )]
  status_label <- if (identical(cov$meta$summary_schema, 2L)) {
    "Open-profile fraction"
  } else {
    "Non-ok status fraction"
  }
  knitr::kable(
    coverage_table, digits = 3,
    col.names = c("Family", "Converged", "CTmax coverage", "z coverage",
                  status_label),
    caption = sprintf("Historical routed-interval coverage (nsim = %d; nominal 0.95).",
                      cov$meta$nsim)
  )
}

The cached summary reports CTmax and z coverage of 0.945 and 0.970 for the binomial family, and 0.840 and 0.865 for the beta-binomial family. These are historical estimates for the requested profile route with its default fallback enabled. The cache does not store the realized interval method for each dataset, and its metadata does not pin a package-source SHA, so these values cannot be interpreted as pure profile-interval coverage or as calibration evidence for the current candidate. The result is a useful warning that interval behavior can vary by family and design, not a method-specific calibration claim. Reproduce and review any current coverage claim against a source-pinned run that records the returned method and status for each interval. In the June cache, open_profiles was computed as any conf.status != "ok", so the displayed 0.065 is a non-ok status fraction that can include fallback intervals, not necessarily a fraction of profiles with open endpoints. The updated generator counts only the explicit open_lower, open_upper, and open_both statuses and marks that definition with summary schema 2. Repository maintainers can reproduce the study from a source checkout with the repository-only data-raw/coverage-study.R script; that script is not installed with the package.

Ship stance

The profile gives fast, prior-free, asymmetry-respecting confidence intervals when the MLE is interior and the data identify the target. For boundary asymptotes, very sparse designs, overdispersion concentrated at zero, or weak variance components, use the interval route appropriate to the fitted model. Fixed-effect coordinates in a random-intercept fit can be profiled under the Laplace approximation; variance components use log-scale Wald intervals unless you request the random-effects-aware parametric bootstrap. freqTLS warns you when the requested route is weak or unavailable. It never claims the profile is universally superior to the Bayesian path. See vignette("comparing-to-bayesTLS") for the side-by-side comparison.



Try the freqTLS package in your browser

Any scripts or data that you put into this service are public.

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