Skip to contents

The random-intercept standard deviation \(\sigma_b\) may be estimated at the lower boundary (\(\sigma_b \to 0\), reported as a log-sigma near \(-5\)). That is a legitimate maximum-likelihood estimate when the likelihood decreases as \(\sigma_b^2\) leaves 0; the fit then equals the fixed-effects cumulative-link fit.

The random intercept is integrated with a 60-node Gauss-Hermite rule. The native fit maximizes the marginal likelihood from several starts (the default start and a few values of \(\log\sigma_b\)) on a 20-node rule, which costs a third as much, and then refits only the start that is best under the 60-node rule on that rule, from its estimates; the reported fit is the 60-node optimum. Convergence is judged by the projected gradient: its norm must be at most \(\max(10^{-4}, \epsilon_g)\) (\(\epsilon_g\) is the kernel tolerance, 1e-12 here), where at the lower variance boundary the \(\log\sigma_b\) coordinate is left out when the score in \(\sigma_b^2\) points outward (a KKT point). A fit that fails that test after L-BFGS is polished (a tight L-BFGS restart, then damped Newton steps on the remaining coordinates, aiming at \(10^{-5}\)).

A native fit is accepted only if it converged and the gradient norm is at most \(10^{-4}\). Otherwise it is retried once with Newton-Raphson from the returned parameters (from that point only, unless the fit sits at the lower variance boundary with a gradient norm above \(10^{-3}\), where the \(\log\sigma_b\) starts are rerun as well); if that also fails the gradient test, the estimate is NA with nonestimable reason "kk_clmm_rcpp_not_stationary". With the default tolerance the retry rarely runs (only when the polish cannot bring the gradient below \(10^{-4}\)).

compute_rand_two_sided_pval(type = "score") is an opt-in randomization statistic for large \(n\). The default statistic refits the CLMM on every redraw (about a second per redraw at \(n = 1000\)). The score statistic fits the CLMM once with the treatment coefficient fixed at 0 and takes, for each subject, the posterior mean over its pair's random intercept of \(\partial \log p(y_i \mid \eta_i) / \partial \eta_i\); the statistic is \(T(w) = \sum_i w_i r_i\), the score for the treatment coefficient, so each redraw is one inner product (a p-value with 501 draws takes well under a second at \(n = 1000\)). It uses the same draws, tail counting, tie rule and \((1 + b)/(1 + B)\) p-value as the default. Like any randomization test it is exact under the sharp null of no effect, but it is a different statistic, so its p-values and power differ (simulated, KK14, \(n = 50\), a 50%-power effect: rejection rate 0.43 against 0.37 for the default). It tests only \(\delta = 0\). These classes do not offer a randomization confidence interval.

The ordinal package's clmm() (used by the weighted Bayesian-bootstrap refits and by use_rcpp = FALSE) fits the log-log model when asked for link = "cloglog" and vice versa (observed in ordinal 2026.7.26; clm() is correct). EDI detects this once per session with a small probe and passes clmm() the link name that fits the complementary log-log model.

Super class

Inference -> InferenceAbstractKKOrdinalCLMM

Methods

+ inherited public methods from Inference


InferenceAbstractKKOrdinalCLMM$new()

Initialize KK cumulative-link mixed-model inference for ordinal responses, validate the matched design, and prepare the ordinal likelihood used by InferenceAbstractKKOrdinalCLMM.

Usage

InferenceAbstractKKOrdinalCLMM$new(
  des_obj,
  model_formula = NULL,
  use_rcpp = TRUE,
  verbose = FALSE,
  harden = TRUE,
  smart_cold_start_default = NULL
)

Arguments

des_obj

A completed Design object.

model_formula

Optional formula for covariate adjustment.

use_rcpp

Logical. If TRUE (default), use the internal Rcpp implementation (no external packages required). Set FALSE to fall back to ordinal::clmm.

verbose

A flag indicating whether messages should be displayed.

harden

Whether to apply robustness measures.

smart_cold_start_default

Whether to use smart cold start values.


InferenceAbstractKKOrdinalCLMM$compute_estimate()

Compute the ordinal CLMM treatment-effect estimate by fitting the cumulative-link mixed model and caching the treatment coefficient for related InferenceAsymp methods.

Usage

InferenceAbstractKKOrdinalCLMM$compute_estimate(estimate_only = FALSE)

Arguments

estimate_only

Logical. If TRUE, skip variance component calculations.


InferenceAbstractKKOrdinalCLMM$compute_estimate_with_bootstrap_weights()

Recomputes the KK ordinal CLMM treatment estimate under Bayesian-bootstrap weights.

Usage

InferenceAbstractKKOrdinalCLMM$compute_estimate_with_bootstrap_weights(
  subject_or_block_weights,
  estimate_only = FALSE
)

Arguments

subject_or_block_weights

Numeric vector. Subject- or block-level bootstrap weights (expanded internally to row weights).

estimate_only

Logical. If TRUE, skip variance component calculations.


InferenceAbstractKKOrdinalCLMM$compute_asymp_confidence_interval()

Compute the ordinal CLMM asymptotic confidence interval for the treatment coefficient using the fitted-model standard error. See InferenceAsymp.

Usage

InferenceAbstractKKOrdinalCLMM$compute_asymp_confidence_interval(alpha = 0.05)

Arguments

alpha

Numeric. Significance level (default 0.05).


InferenceAbstractKKOrdinalCLMM$compute_asymp_two_sided_pval()

Compute the ordinal CLMM asymptotic two-sided p-value for the treatment coefficient using the fitted-model standard error. See InferenceAsymp.

Usage

InferenceAbstractKKOrdinalCLMM$compute_asymp_two_sided_pval(delta = 0)

Arguments

delta

Numeric. Null treatment effect value (default 0); only 0 is supported, and a nonzero value returns NA (or errors when assertions are enabled).


InferenceAbstractKKOrdinalCLMM$compute_rand_two_sided_pval()

Randomization p-value for the treatment effect. With type = NULL (the default) it is the shared randomization test (InferenceRandCI$compute_rand_two_sided_pval()): every redraw refits the CLMM and the statistic is the treatment estimate. type = "score" uses the score statistic at the null fit instead: the CLMM is fit once with the treatment coefficient fixed at 0, and each redraw costs one inner product (see the class details). Both are exact randomization tests of the sharp null of no effect; they use different statistics, so their p-values and power differ.

Usage

InferenceAbstractKKOrdinalCLMM$compute_rand_two_sided_pval(
  r = 501,
  delta = 0,
  transform_responses = "none",
  na.rm = TRUE,
  show_progress = TRUE,
  permutations = NULL,
  type = NULL,
  args_for_type = NULL,
  zero_one_logit_clamp = .Machine$double.eps,
  alternative = "two.sided"
)

Arguments

r

Number of randomization draws (default 501).

delta

Null treatment effect (default 0). Only 0 is supported, for both the default statistic and type = "score"; any other value errors: no sharp null exists on the latent log-odds scale, and shifting the ordinal levels by delta would test a different hypothesis.

transform_responses

Response transform for the default statistic (see InferenceRand$compute_rand_two_sided_pval()); must be "none" with type = "score".

na.rm

Drop non-finite draws (they are always dropped; see InferenceRand$compute_rand_two_sided_pval()).

show_progress

Whether to show progress (default statistic only).

permutations

Optional pre-generated assignment draws: a list with element w_mat (an \(n \times r\) 0/1 matrix, one column per draw), as for InferenceRand$compute_rand_two_sided_pval(). NULL draws them from the design; both statistics then use the same draws.

type

NULL (default) or "score". "score" selects the score-at-the-null-fit statistic, offered only by the KK CLMM classes; other values are rejected. The randomization confidence interval does not use it (and is not offered by these classes).

args_for_type

Must be NULL.

zero_one_logit_clamp

Passed to the default statistic; unused with type = "score".

alternative

"two.sided" (default), "greater" or "less", with the same tail counts, tie rule and \((1 + b)/(1 + B)\) counting as the default statistic.

Returns

A p-value.


InferenceAbstractKKOrdinalCLMM$clone()

The objects of this class are cloneable with this method.

Usage

InferenceAbstractKKOrdinalCLMM$clone(deep = FALSE)

Arguments

deep

Whether to make a deep clone.