
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. Since 2026-10-08
the ordinary full-data fit screens deterministic and data-seeded local
starts and keeps the lowest converged negative log-likelihood. Since EDI
1.0.5 every fit starts only from deterministic, data-only starts (never
from a previous fit on the object), and randomization and bootstrap draws
use exactly the same estimator as the reported estimate, so all results
are functions of the data (and draws) only, not of the order in which
methods were called.
Re-measured with that change (EDI 1.0.5 null study, 400 datasets per
cell, nominal 5%): 12.9% Type-I error at \(n = 100\) with 5
categories (11.5% even with 41 starts and every fit kept, with
non-uniform null p-values), so with this many parameters the chi-square(1)
reference is anti-conservative at that \(n\); about 5-6% at
\(n = 50\) with 3 categories. In those runs 30-38% of fits were
reported non-estimable by the fit-usability check, and in roughly 10-12%
of the reported results the rank-deficiency fallback had dropped the
covariate, leaving a treatment-only model. Both came from the category
loadings: the ordered-score MLE is often on the boundary (a loading merged
with a neighboring category), where the information has a flat loading
direction, and the cold start (at \(\beta = 0\), where the loadings
carry no information) usually stopped at such a point short of the MLE.
Since EDI 1.0.5 the full-data fit also starts from the adjacent-category
fit (all loadings equally spaced, then released), and a covariate-adjusted
fit whose loadings are on the boundary is accepted, with the treatment
standard error taken from the information with the flat loading
directions held at the boundary. Covariates are then dropped only for real
rank deficiency. In a null study (\(n = 200\), 4 categories, two
covariates) this kept both covariates in 40 of 40 fits (5 before) with no
non-estimable fits, and gave 5.8% Wald Type-I error over 400 datasets.
With 3 or more response categories, a treatment-only fit (formula
~ 1, or every covariate dropped) is always reported non-estimable
(reason stereotype_treatment_only_fit_not_identified). With a single
binary regressor the model is saturated in the \(2 \times K\) table and
the loadings are not identified at \(\beta_T = 0\), so its Wald,
likelihood-ratio, score and gradient tests are not calibrated (15-21%
Type-I error even at \(n = 1000\)). Use a covariate-adjusted formula,
or a class such as InferenceOrdinalPropOddsRegr for an unadjusted
analysis.
Score test at small n. With a covariate-adjusted formula the score test rejects too often in small samples (10% to 12% at a nominal 5% with n = 50 in the first calibration campaign, 2026-11-09-8c32d060, provisional, against up to about 9% for Wald), because the loadings are weakly identified near \(\beta_T = 0\) and the null information is unreliable. The excess shrinks with n (about 6-7% at n = 200). Prefer the Wald (default) or likelihood-ratio test and intervals at small n.
The delta-constrained null refits behind the likelihood-ratio, score and
gradient tests and their confidence intervals also start only from
deterministic starts: the full fit with \(\beta_T = \delta\), a cold
start, the adjacent-category two-stage start and fixed offsets of the
loadings, keeping the lowest negative log-likelihood. Before EDI 1.0.5 they
started from the previous \(\delta\)'s refit, so a p-value could depend on
which values of \(\delta\) had been tested earlier on the same object.
Two limitations remain. At \(\delta = 0\) the loadings are not
identified, so the score statistic there depends on which of the equally
good loadings the refit returns. And the constrained optimum can switch
between branches (one per sign of \(\beta_T\)) as \(\delta\) moves, so
the score p-value can jump, the score and likelihood-ratio p-values need not
be monotone in \(\delta\), and the set of accepted \(\delta\) need not be
an interval. The likelihood-ratio confidence interval is the most reliable
interval for this class.
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). Of the two, only the
Bartlett p-value is excluded from this package's own routine comprehensive
test suite (its bartlett_pval entry in
comprehensive_slow_paths.R); the likelihood-ratio bootstrap p-value
is not listed there.
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.
Small-sample behaviour
How fast the size (and coverage) error of each procedure is expected to vanish as the
effective sample size \(n_{eff}\) grows, from EDI's convergence-rate registry
(inference_convergence_expectation()). Exact procedures are valid at every
n by construction; the others are asymptotic, so a small-sample excess is expected, and
its constant is not given by an order. The table is the expectation for a balanced
complete-randomization design; it is not a measured size. Reference keys are explained
under References.
| Procedure | Regime | Error order | Effective n | Regularity | Basis | References |
rand | finite sample | exact | subjects | regular | theory | [Fisher1935], [LehmannRomano2005] |
wald | asymptotic | unknown | subjects | other | unknown | [Davies1977] |
jackknife | asymptotic | unknown | subjects | other | unknown | [Davies1977] |
score | asymptotic | unknown | subjects | other | unknown | [Davies1977] |
lik_ratio | asymptotic | unknown | subjects | other | unknown | [Davies1977] |
gradient | asymptotic | unknown | subjects | other | unknown | [Davies1977] |
lik_ratio_bartlett_approx | asymptotic | unknown | subjects | other | unknown | [Davies1977] |
lik_ratio_bartlett_exact | asymptotic | unknown | subjects | other | unknown | [Davies1977] |
param_boot | asymptotic | unknown | subjects | other | unknown | [Davies1977] |
param_boot_direct | asymptotic | unknown | subjects | other | unknown | [Davies1977] |
bootstrap | asymptotic | unknown | subjects | other | unknown | [Davies1977] |
rand_bootstrap | asymptotic | unknown | subjects | other | unknown | [Davies1977] |
The point estimate's bias is of order \(O(n_{eff}^{-1})\) (assumed default: [CoxSnell1968]).
Rows with order unknown: no rate is known for this class and procedure, so none is claimed; the cited works describe the non-standard limit, not a rate. Expect a small-sample excess of unquantified size.
Regularity other: a non-standard limit or an estimated scale, so the regular-model rate is not established.
The procedure list is by declared capability; an object can still report a procedure
(for example a Bartlett correction) as unavailable through get_supported_testing_types().
Design-specific differences from the table:
On any design with unequal allocation (
prob_Tnot 0.5), forwald,jackknife,score,lik_ratio,gradient,lik_ratio_bartlett_approx,lik_ratio_bartlett_exact,param_boot,param_boot_direct,bootstrap,rand_bootstrap: the effective n is the size of the smaller arm.On
DesignFixedBlockedCluster,DesignFixedCluster, forwald,jackknife,score,lik_ratio,gradient,lik_ratio_bartlett_approx,lik_ratio_bartlett_exact,param_boot,param_boot_direct,bootstrap,rand_bootstrap: the effective n is the number of clusters.
Blocking designs
On a blocking design
(DesignFixedBlocking and relatives)
the regression-type inference classes do not add block fixed effects
(or block-by-treatment interactions) automatically: the model uses only the
covariate matrix. Whether the blocks enter the regression therefore depends
on how they were supplied: not at all with m=; as dummies when the
blocking column is a factor/character (or few-level integer) covariate; as a
single linear term when it is numeric. Randomization, bootstrap and
jackknife inference are block-aware regardless; only the model-based
(asymptotic, likelihood) path ignores the blocks.
When the proportion treated is the same in every block, the pooled
treatment estimate of a linear model is unbiased and its model-based SE is
conservative (it is inflated by the block variation it fails to remove), at a
cost in power. If the proportion treated differs across blocks (for example
equal_block_sizes = FALSE with very small blocks and an extreme
prob_T, where per-block rounding changes the allocation, or a
user-supplied m), the pooled treated-vs-control comparison is
confounded by block (Simpson's paradox) and can be biased; then include the
blocking covariate(s) explicitly as factor covariates. For non-linear models
(GLM, ordinal, survival) omitting blocks changes the estimand to a
block-marginal effect. See DesignFixedBlocking.
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.
[Fisher1935] Fisher, R. A. (1935). The Design of Experiments. Oliver and Boyd.
[LehmannRomano2005] Lehmann, E. L., and Romano, J. P. (2005). Testing Statistical Hypotheses (3rd ed.). Springer.
[Davies1977] Davies, R. B. (1977). "Hypothesis Testing When a Nuisance Parameter Is Present Only under the Alternative." Biometrika, 64(2), 247-254.
[CoxSnell1968] Cox, D. R., and Snell, E. J. (1968). "A General Definition of Residuals." Journal of the Royal Statistical Society: Series B, 30(2), 248-265 (discussion 265-275).
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$clear_randomization_cache()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_estimand()Inference$get_model_formula()Inference$get_nonestimable_reason()Inference$get_nonestimable_stage()Inference$get_optimization_alg()Inference$get_procedure_validity()Inference$get_response()Inference$get_response_type()Inference$get_summary()Inference$get_supported_estimands()Inference$get_treatment()Inference$initialize()Inference$is_nonestimable()Inference$set_estimand()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,
alternative = "two.sided"
)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
alternative"two.sided"(default),"greater"or"less"; use"greater"for a non-negative, one-tailed-by-construction statistic. The observed allocation counts as one of the \(B\) finite draws: two-sided is \(\min(1, 2(1 + \min(b_{\ge}, b_{\le}))/(1 + B))\) (doubled smaller tail, smallest value \(2/(B + 1)\));"greater"is \((1 + b_{\ge})/(1 + B)\) (smallest \(1/(B + 1)\)), where \(b_{\ge}\) and \(b_{\le}\) count the draws at least as large / as small as the observed statistic. This exact Monte Carlo p-value (Phipson and Smyth 2010) has size at most \(\alpha\) and is never 0; the realized allocation is never counted twice (a seeded design's replay of it is skipped, a full enumeration's copy removed); seeInferenceRand$compute_rand_two_sided_pval().