profile_confint

Compute profile likelihood confidence intervals for variance parameters (the theta / relative Cholesky factor scale). Mirrors lme4::confint.merMod(method="profile").

profile_confint(result, level=0.95, scale='natural')[source]

Compute profile likelihood CIs for variance parameters.

For each theta_i, fixes all other thetas at their ML estimates and finds the CI endpoints where:

2 * (L_max - L(theta_i)) = chi2(level, df=1)

using a geometric bracket search followed by Brent’s method.

Parameters:
  • result – A fitted CrossedLMEResult.

  • level – Nominal coverage probability (default 0.95).

  • scale'natural' (default) reports SDs and correlations, matching lme4’s confint(m, method='profile') output. Row labels take the form sd_TERM|GROUP and cor_TERM_k.TERM_j|GROUP.

    'theta' reports raw relative Cholesky-factor entries.

Return type:

Any

Returns:

pd.DataFrame – Rows indexed by parameter name. Columns: ['estimate', lo_col, hi_col] where the percentage columns are named from level, e.g. '2.5 %' and '97.5 %' for level=0.95.

Parameters:
  • result (Any)

  • level (float)

  • scale (str)

Notes

For off-diagonal entries (correlation-type parameters), the profile search is unconstrained (theta can go negative), enabling negative correlation CI lower bounds. Diagonal entries are constrained to theta > 0.

If the profile never drops below the target as theta → 0 (boundary case), the lower bound is set to 0 (theta scale) or 0.0 (SD scale).

Example

import interlace
from interlace.profile_ci import profile_confint

result = interlace.fit("rt ~ condition", data=df, groups=["subject", "item"])

ci = profile_confint(result, level=0.95)
print(ci)
#                   estimate    2.5 %   97.5 %
# subject.(Int)       0.671    0.412    0.934
# item.(Int)          0.346    0.180    0.541

Notes

CIs are reported on the theta (relative Cholesky factor) scale. For intercept-only random effects, sigma_b theta * sqrt(sigma2_hat). If the profile drops below the target before theta reaches zero, the lower bound is set to 0 (boundary case).

Always uses ML (not REML) internally for the profile likelihood, regardless of how the model was originally fitted.

See also