
Fast Cumulative Ordinal Regression with a Logit Link, with Variance (C++)
Source:R/RcppExports.R
fast_ordinal_regression_with_var_cpp.RdIdentical to fast_ordinal_regression_cpp (see that page for the full
proportional-odds model) called with estimate_only = FALSE — this is simply
a convenience export that hardcodes that default rather than exposing the flag, so
the observed information and, when invertible, the full variance-covariance matrix
are always computed. Unlike the cauchit/probit/cloglog families' _with_var
variants, this function does not add any extra degenerate-case guarding
beyond what fast_ordinal_regression_cpp already does.
Usage
fast_ordinal_regression_with_var_cpp(
X,
y,
warm_start_params = NULL,
smart_cold_start = TRUE,
maxit = 100L,
tol = 1e-06,
fixed_idx = NULL,
fixed_values = NULL,
optimization_alg = "lbfgs",
warm_start_fisher_info = NULL
)Arguments
- X
A numeric matrix of predictors (no intercept column needed; see
fast_ordinal_regression_cpp).- y
A numeric vector of ordinal responses; only the rank order of distinct values matters, not their numeric coding.
- warm_start_params
Optional starting values for \([\alpha, \beta]\). If provided,
smart_cold_startis ignored.- smart_cold_start
Logical. If
TRUE, use an initial OLS-based guess when starting from scratch (a "cold start") with no prior knowledge. This is ignored if a warm start is provided.- maxit
Maximum number of optimizer iterations.
- tol
Convergence tolerance.
- fixed_idx
Optional 1-indexed positions (into \([\alpha,\beta]\)) of parameters to hold fixed.
- fixed_values
Optional values, parallel to
fixed_idx, of the fixed parameters.- optimization_alg
Optimization algorithm (default
"lbfgs").- warm_start_fisher_info
Optional initial curvature (Fisher/observed information) matrix.
Value
A list with components b, alpha, params, n_params,
converged, iterations, neg_loglik,
observed_information/fisher_information/information (all the same
observed-information matrix), information_type ("observed"),
ssq_b_j (the variance of b[1], i.e. the coefficient on X's first
column — conventionally the treatment effect), and vcov — the latter two are
NA/omitted if the free-parameter information matrix is not invertible.
Fixed parameters, warm starts, and optimization
fixed_idx (1-indexed into the combined \([\alpha, \beta]\) parameter
vector, thresholds first) and fixed_values optionally hold a subset of
parameters at caller-supplied constant values rather than estimating them.
warm_start_params supplies starting values for \([\alpha, \beta]\)
directly (skipping smart_cold_start); otherwise thresholds always start
evenly spaced on \((-1, 1)\) at \(-1 + 2(k+1)/K\), and \(\beta\) starts at
either zero, or (when smart_cold_start = TRUE, the default) an OLS fit of
the rank-rescaled response \((y - 1)/(K - 1)\) on X — falling back
silently to zero if that OLS solve is not well-posed. When
smart_cold_start = TRUE and no warm_start_fisher_info is supplied,
the Hessian at the starting values is additionally used to seed the optimizer's
first-iteration curvature estimate. Optimization runs via optimization_alg
(default "lbfgs") for up to maxit iterations or until the
parameter/gradient change falls below tol.
See also
fast_ordinal_regression_cpp for the estimate-only-capable variant
and the full model documentation; fast_ordinal_regression_weighted_cpp
for the observation-weighted variant.