Computes confidence intervals based on the profile likelihood. These are more accurate than Wald intervals when the likelihood is non-quadratic.
Details
The profile confidence interval at level 1-α is: $$CI = \{\theta_i : 2(\ell(\hat{\theta}) - pl(\theta_i)) \leq \chi^2_{1,\alpha}\}$$
This is the set of parameter values that would not be rejected by a likelihood ratio test at level α.
Examples
if (FALSE) { # \dontrun{
set.seed(42)
x <- rnorm(100, mean = 5, sd = 2)
result <- fit(
function(mu, log_sigma) loglik_normal(mu, exp(log_sigma), x),
params = c(mu = 0, log_sigma = 0)
)
# Profile-based CIs (more accurate for non-quadratic likelihoods)
confint_profile(result)
# Compare with Wald CIs
confint(result)
} # }