orc_table: Ordinal c-index (ORC) with pairwise results tables

View source: R/AUC_nominal_ordinal.R

orc_tableR Documentation

Ordinal c-index (ORC) with pairwise results tables

Description

Computes the ordinal c-index (ORC) as the mean of pairwise AUCs across all outcome category pairs, closely matching the SPSS implementation discussed earlier. For each pair of categories '(i, j)', the function restricts the data to those two categories and computes the AUC using the pair-specific conditional probability

P(Y = j \mid Y \in \{i,j\}, x) = p_j / (p_i + p_j).

Usage

orc_table(outcome, probs, categories = NULL, na_rm = TRUE)

Arguments

outcome

A vector containing the observed ordinal dependent variable. May be a numeric/integer vector or an ordered/unordered factor. Its unique values define the outcome categories.

probs

A numeric matrix or data frame of predicted probabilities with one row per observation and one column per outcome category.

categories

Optional vector giving the category values in the same order as the columns of 'probs'. If 'NULL', the sorted unique values of 'outcome' are used.

na_rm

If 'TRUE', observations with missing values in 'outcome' or 'probs' are removed listwise.

Details

A weighted version is also reported using weights n_i n_j. This weighted version is a practical extension and not the original ORC definition.

This implementation is closest to the probability-based pairwise ORC definition: for each pair '(i, j)', it uses a pair-specific score derived from the model predictions. For standard proportional-odds models, this produces the same ranking-based ORC as score-based implementations using a single linear predictor or expected-value score.

Value

A list with class '"orc_result"' containing:

basic_info

Data frame with outcome variable summary information.

pairwise

Data frame with one row per category pair and columns 'category_i', 'category_j', 'n_i', 'n_j', 'auc', 'weight'.

summary

Data frame with unweighted and weighted ORC.

orc_unweighted

Numeric scalar, mean of pairwise AUCs.

orc_weighted

Numeric scalar, weighted mean of pairwise AUCs using 'n_i * n_j'.

categories

Category vector actually used.

n_valid

Number of valid cases used.

References

Van Calster, B., Van Belle, V., Vergouwe, Y., & Steyerberg, E. W. (2012). Discrimination ability of prediction models for ordinal outcomes: relationships between existing measures and a new measure. Statistics in Medicine, 31(21), 2317-2331.

Examples

# Example with artificial probabilities:
# outcome <- c(1, 1, 2, 2, 3, 3)
# probs <- rbind(
#   c(.60, .30, .10),
#   c(.50, .35, .15),
#   c(.25, .55, .20),
#   c(.20, .50, .30),
#   c(.10, .35, .55),
#   c(.05, .25, .70)
# )
# res <- orc_table(outcome, probs)
# res$pairwise
# res$summary


multiUS documentation built on April 27, 2026, 3:04 a.m.

Related to orc_table in multiUS...