
Stereotype Logit Regression Inference for Ordinal Responses
Source:R/inference_ordinal_stereotype_logit.R
InferenceOrdinalStereotypeLogitRegr.RdFits Anderson's (1984) stereotype logit model for ordinal responses (see
fast_stereotype_logit_cpp for the full reduced-rank
multinomial-softmax formula and reparameterization): a single linear
predictor \(\eta_i = \beta_T W_i + X_i^\top \gamma\) is scaled by a
category-specific score \(\phi_k \in [0,1]\) (jointly estimated,
monotone in \(k\)) in a softmax over all \(K\) categories, rather than
assuming a single proportional/parallel effect across cuts as
InferenceOrdinalContRatioRegr/
InferenceOrdinalKKCondAdjCatLogitRegr
do. This makes the stereotype model a genuinely more flexible
(multinomial-logit-like, reduced-rank) alternative to the standard
proportional-odds/adjacent-category/continuation-ratio ordinal families,
at the cost of a less directly interpretable treatment coefficient
(\(\beta_T\) enters multiplicatively through the \(\phi_k\) scores
rather than as a single additive log-odds-ratio). likelihood_tier =
"full": likelihood-ratio, score, gradient, and Wald tests are all
available when the model converges, plus parametric-likelihood-bootstrap
calibration of the likelihood-ratio test.
Computes the randomization distribution of the treatment effect estimate under the sharp null.
Whether compute_rand_two_sided_pval() is actually
usable on this instance right now – FALSE exactly when it
would stop(): an incidence-response instance with no
custom randomization statistic and a design not eligible for
design-randomization-based incidence inference (see
private$should_use_design_randomization_for_incidence()).
TRUE for every other case, including every non-incidence
response type. Public, self-contained (only reads already-set
instance state, no side effects), so InferenceSuite can
check this before attempting the sentinel instead of relying on
the stop() being silently swallowed into a pval = NA
"ok" row – the single source of truth for both this check and
compute_rand_two_sided_pval()'s own guard, so the two can
never drift apart.
Computes a randomization-based p-value.
Value
When debug = FALSE (default), a numeric vector of length r. When
debug = TRUE, a list with: values, errors (list of character
vectors, one per iteration), warnings (list of character vectors, one per
iteration), num_errors, num_warnings,
prop_iterations_with_errors, prop_iterations_with_warnings, and
prop_illegal_values.
A single logical.
Randomization p-value.
Details
compute_lik_ratio_two_sided_pval() can be
anti-conservative at small \(n\). The stereotype model's category-score
parameters \(\phi_k\) are a Davies (1977) non-regular case, not identified
when \(\beta_T\) is at/near zero – exactly the neighborhood every null
hypothesis test sits in – so the LR statistic's null distribution need not
be the chi-square(1) this method assumes. The size of the problem depends
on the constrained refit: before 2026-09-21 the delta-constrained refit
started cold and could stall in a much worse local optimum (e.g.
neg-log-likelihood 131.3 vs the full fit's 118.9 at \(\delta\) equal to
the MLE itself), which inflated the LR statistic and produced ~18-23%
Type-I error at \(n = 100\); it also collapsed the bootstrap and
inverted-LR confidence intervals to zero width. The refit now also starts
from the full-fit parameters and keeps the better fit. Measured after that
change (400 simulated null datasets, 5 response categories, a continuous
covariate): about 6.5% Type-I error and 0.93 confidence-interval coverage
at \(n = 100\), with no zero-width intervals, and about 13% Type-I error
at \(n = 50\) with 3 categories (169 converged fits). Part of the
small-sample excess comes from the likelihood being multimodal: in a few
percent of \(n = 50\) fits the reported point estimate sits at a local
optimum whose likelihood is below that of another optimum, which makes the
LR statistic at the estimate positive rather than zero. For small samples,
prefer the better-calibrated alternatives on this class:
compute_lik_ratio_bootstrap_two_sided_pval() (parametric-bootstrap
calibration via the class's own null simulation; ~6-7% Type-I error) and
the cheaper compute_lik_ratio_bartlett_two_sided_pval()
(Monte-Carlo Bartlett correction; ~4% Type-I error); those two figures
predate the refit change and were not re-measured. Both are
roughly 20-40x slower per call than the raw chi-square test (a fresh
bootstrap/Monte-Carlo refit at every delta candidate), which is why they
are excluded from this package's own routine comprehensive test suite
(see comprehensive_slow_paths.R).
compute_lik_ratio_two_sided_pval()
itself is left unchanged (not silently recalibrated) to avoid an
undocumented behavior change to an existing method's contract.
Bayesian-bootstrap inference is temporarily unavailable because the current
non-uniform weighted hook fits a cumulative-logit surrogate rather than the
stereotype likelihood. It will remain disabled until the native weighted
stereotype-logit backend described in the package implementation plan lands.
References
Anderson, J. A. (1984). "Regression and Ordered Categorical Variables." Journal of the Royal Statistical Society, Series B, 46(1), 1-30, doi:10.1111/j.2517-6161.1984.tb01276.x , for the stereotype logit model.
See also
InferenceOrdinalContRatioRegr
for a proportional (non-reduced-rank) ordinal alternative. See also:
Ordinal
regression (Wikipedia).
Super class
Inference -> InferenceOrdinalStereotypeLogitRegr
Methods
+ inherited public methods from Inference
Inference$capabilities()Inference$compute_asymp_confidence_interval()Inference$compute_asymp_two_sided_pval()Inference$compute_estimate()Inference$compute_exact_confidence_interval()Inference$compute_exact_two_sided_pval_for_treatment_effect()Inference$duplicate()Inference$get_analysis_data()Inference$get_covariates()Inference$get_design_object()Inference$get_model_formula()Inference$get_nonestimable_reason()Inference$get_nonestimable_stage()Inference$get_optimization_alg()Inference$get_response()Inference$get_response_type()Inference$get_treatment()Inference$initialize()Inference$is_nonestimable()Inference$set_optimization_alg()Inference$set_seed()Inference$supports()
InferenceOrdinalStereotypeLogitRegr$approximate_randomization_distribution_beta_hat_T()
Usage
InferenceOrdinalStereotypeLogitRegr$approximate_randomization_distribution_beta_hat_T(
r = 501,
delta = 0,
transform_responses = "none",
show_progress = TRUE,
permutations = NULL,
debug = FALSE,
zero_one_logit_clamp = .Machine$double.eps
)Arguments
rNumber of randomization vectors. Default 501.
rNumber of randomization vectors.
deltaThe null difference. Default 0.
deltaNull difference.
transform_responsesType of transformation. Default "none".
transform_responsesTransformation.
show_progressShow progress bar. Default TRUE.
show_progressShow progress.
permutationsPre-computed permutations. Default NULL.
permutationsPre-computed permutations.
debugIf
TRUE, return a list with the distribution values and per-iteration diagnostics including error messages, warning messages, counts of each, and summary proportions for iterations with errors, warnings, and illegal (non-finite) values. Runs serially. DefaultFALSE.zero_one_logit_clampThe clamping amount for exact 0 and 1 values when logging
zero_one_logit_clampThe clamping amount for exact 0 and 1 values when logging
InferenceOrdinalStereotypeLogitRegr$compute_rand_two_sided_pval()
Usage
InferenceOrdinalStereotypeLogitRegr$compute_rand_two_sided_pval(
r = 501,
delta = 0,
transform_responses = "none",
na.rm = TRUE,
show_progress = TRUE,
permutations = NULL,
zero_one_logit_clamp = .Machine$double.eps
)Arguments
rNumber of randomization vectors. Default 501.
rNumber of randomization vectors.
deltaThe null difference. Default 0.
deltaNull difference.
transform_responsesType of transformation. Default "none".
transform_responsesTransformation.
na.rmRemove NAs.
show_progressShow progress bar. Default TRUE.
show_progressShow progress.
permutationsPre-computed permutations. Default NULL.
permutationsPre-computed permutations.
zero_one_logit_clampThe clamping amount for exact 0 and 1 values when logging
zero_one_logit_clampThe clamping amount for exact 0 and 1 values when logging