Skip to contents

For each cumulative cutpoint \(k = 1, \ldots, K-1\), fits an independent logistic regression of \(1\{Y \le k\}\) on the covariates. Optionally fits the proportional-odds baseline and returns the likelihood-ratio test of PO vs. threshold-specific.

Usage

mrm_threshold_specific_ordinal(
  data,
  outcome_col,
  covariate_cols,
  ordinal_levels = NULL,
  fit_proportional_odds_first = TRUE,
  max_iter = 200L,
  tol = 1e-06
)

Arguments

data

data.frame, one row per unit.

outcome_col

Character; name of the ordinal outcome column. Either an ordered factor / integer code or a character column (in which case ordinal_levels should be passed explicitly).

covariate_cols

Character vector of predictor columns. Categorical predictors should be one-hot dummied before passing.

ordinal_levels

Optional character vector giving the explicit ordering of the outcome categories (low-to-high). If NULL and the outcome is a factor, levels() is used; otherwise sort(unique()) (rarely what you want – pass this).

fit_proportional_odds_first

Logical; if TRUE (default) the proportional-odds baseline is fit and an LR test against the threshold-specific model is reported.

max_iter, tol

IRLS / GLM control passed to glm.fit.

Value

An object of class c("mrm_threshold_specific_ordinal", "morie_mrm_result", "list") with elements threshold_labels, covariate_names, coefficients (a (K-1) x p matrix), cutpoints, log_likelihood, n_obs, and (if requested) proportional_odds_lr_stat, proportional_odds_lr_df, proportional_odds_p.

Examples

if (FALSE) {
  df <- data.frame(
    y = sample(c("low", "med", "high"), 200, replace = TRUE),
    race = rbinom(200, 1, 0.4),
    age  = rnorm(200)
  )
  mrm_threshold_specific_ordinal(df,
    outcome_col = "y",
    covariate_cols = c("race", "age"),
    ordinal_levels = c("low", "med", "high")
  )
}