artcatr calculates sample size and power for a two-arm
randomized trial with an ordered categorical outcome, analysed by a
proportional-odds model. It uses the ologit method of
White, Marley-Zagar, Morris, Parmar, Royston & Babiker (2023). This
packages implements the Stata functions (artcat, White et
al. (2023)) into R (artcatr). artcatr requires
that the most-right level probabilities need to be specified, that is,
the input vectors pc (or pe) need to sum up to
one.
The examples below reproduce the worked examples from White et al. (2023).
Outcome levels are always supplied in increasing order (level 1, 2,
…, K), but that ordering says nothing about which end of the scale
represents a good outcome. White et al (2023) therefore
introduce a favourable option:
favourable = TRUE means level 1 (the left-most level) is
the most favourable outcome and level K is the least favourable, and
vice versa.
favourable determines how a margin
(expressed as an odds ratio for the null hypothesis) is interpreted,
i.e. whether the design is a superiority, non-inferiority, or
substantial-superiority trial (that is, a superiority trial showing that
the treatment is substantially - by a margin - superior
than control). Following White et al (2023, sec. 3),
artcatr() classifies the trial as follows:
margin |
favourable |
Trial type |
|---|---|---|
= 1 |
either | superiority |
< 1 |
TRUE |
non-inferiority |
< 1 |
FALSE |
substantial-superiority |
> 1 |
TRUE |
substantial-superiority |
> 1 |
FALSE |
non-inferiority |
If favourable is left as NULL (the
default), artcatr() infers the direction from whether the
anticipated average odds ratio lies above or below margin,
and flags the result as (inferred) in the printed summary.
It is good practice, however, to set favourable explicitly
based on clinical knowledge of the outcome scale, rather than relying on
inference from the anticipated effect size:
artcatr(pc = c(.018, .036, .156, .141, .39, .259),
or = 1 / 1.77,
power = .8)
#> artcatr: sample size for an ordered categorical outcome (proportional-odds model)
#>
#> based on the Stata implementation from White et al. (2023)----------------------------------------------------------------------
#> Type of trial superiority
#> Favourable/unfavourable outcome unfavourable (inferred)
#> Null hypothesis odds ratio = 1
#> Superiority region odds ratio < 1
#> Allocation ratio C:E 1:1
#> Anticipated probabilities, control 0.018 0.036 0.156 0.141 0.390 0.259
#> experimental given by odds ratio = 0.565
#>
#> Table of anticipated probabilities
#> C E
#> 1 least favourable 0.018 0.010
#> 2 0.036 0.021
#> 3 0.156 0.099
#> 4 0.141 0.103
#> 5 0.390 0.384
#> 6 most favourable 0.259 0.382
#>
#> Alpha 0.05 (two-sided)
#> Power (designed) 0.8
#> Method ologit (variance NA)
#>
#> Total sample size (calculated) 322
#> Sample size per group (calculated) 161 161
#> ----------------------------------------------------------------------The following examples reproduces the results from White et al. (2023).
The FLU-IVIG trial (Davey et al 2019) had a six-level ordinal
outcome. Anticipated control-arm probabilities are given via
pc, one per level including the right-most, and the
anticipated treatment effect via a common odds ratio or.
Here the left-most level is the least favourable outcome, so
favourable = FALSE.
By default artcatr() uses the new ologit
method (with variance = "NA"):
artcatr(pc = c(.018, .036, .156, .141, .39, .259),
or = 1 / 1.77,
power = .8,
favourable = FALSE)
#> artcatr: sample size for an ordered categorical outcome (proportional-odds model)
#>
#> based on the Stata implementation from White et al. (2023)----------------------------------------------------------------------
#> Type of trial superiority
#> Favourable/unfavourable outcome unfavourable
#> Null hypothesis odds ratio = 1
#> Superiority region odds ratio < 1
#> Allocation ratio C:E 1:1
#> Anticipated probabilities, control 0.018 0.036 0.156 0.141 0.390 0.259
#> experimental given by odds ratio = 0.565
#>
#> Table of anticipated probabilities
#> C E
#> 1 least favourable 0.018 0.010
#> 2 0.036 0.021
#> 3 0.156 0.099
#> 4 0.141 0.103
#> 5 0.390 0.384
#> 6 most favourable 0.259 0.382
#>
#> Alpha 0.05 (two-sided)
#> Power (designed) 0.8
#> Method ologit (variance NA)
#>
#> Total sample size (calculated) 322
#> Sample size per group (calculated) 161 161
#> ----------------------------------------------------------------------This matches the sample size (n = 322, 161 per arm) reported by White et al (2023).
Whitehead’s (1993) original method is available via
method = "whitehead", for comparison with the newer
ologit method:
artcatr(pc = c(.018, .036, .156, .141, .39, .259),
or = 1 / 1.77,
power = .8,
favourable = FALSE,
method = "whitehead")
#> artcatr: sample size for an ordered categorical outcome (proportional-odds model)
#>
#> based on the Stata implementation from White et al. (2023)----------------------------------------------------------------------
#> Type of trial superiority
#> Favourable/unfavourable outcome unfavourable
#> Null hypothesis odds ratio = 1
#> Superiority region odds ratio < 1
#> Allocation ratio C:E 1:1
#> Anticipated probabilities, control 0.018 0.036 0.156 0.141 0.390 0.259
#> experimental given by odds ratio = 0.565
#>
#> Table of anticipated probabilities
#> C E
#> 1 least favourable 0.018 0.010
#> 2 0.036 0.021
#> 3 0.156 0.099
#> 4 0.141 0.103
#> 5 0.390 0.384
#> 6 most favourable 0.259 0.382
#>
#> Alpha 0.05 (two-sided)
#> Power (designed) 0.8
#> Method Whitehead
#>
#> Total sample size (calculated) 320
#> Sample size per group (calculated) 160 160
#> ----------------------------------------------------------------------Here Whitehead’s method gives a slightly smaller sample size (n =
320) than the default ologit method (n = 322).
Whitehead’s (1993) method is implemented in the psamsize
function in the ‘Hmisc’ package. The small difference to the
artcatr Whitehead option is due to ceiling of numbers.
pc <- c(.018, .036, .156, .141, .39, .259)
or <- 1 / 1.77
pe <- or * cumsum(pc) / (1 - cumsum(pc) + or * cumsum(pc))
pe <- diff(c(0, pe))
pbar <- (pc + pe) / 2
Hmisc::posamsize(p = pbar,
odds.ratio = or,
alpha = 0.05,
power = 0.8)
#> Total sample size: 319.2
#> Efficiency of design compared with continuous response: 0.905A non-inferiority trial is specified via margin,
expressed as an odds ratio defining the null hypothesis. Here the
anticipated odds ratio is or = 1 (no average treatment
effect), and the non-inferiority margin is an odds ratio of 1.33:
artcatr(pc = c(.010, .021, .099, .103, .384, .383),
or = 1,
margin = 1.33,
power = .8,
favourable = FALSE)
#> artcatr: sample size for an ordered categorical outcome (proportional-odds model)
#>
#> based on the Stata implementation from White et al. (2023)----------------------------------------------------------------------
#> Type of trial non-inferiority
#> Favourable/unfavourable outcome unfavourable
#> Null hypothesis odds ratio = 1.33
#> Non-inferiority region odds ratio < 1.33
#> Allocation ratio C:E 1:1
#> Anticipated probabilities, control 0.010 0.021 0.099 0.103 0.384 0.383
#> experimental given by odds ratio = 1
#>
#> Table of anticipated probabilities
#> C E E null
#> 1 least favourable 0.010 0.010 0.013
#> 2 0.021 0.021 0.028
#> 3 0.099 0.099 0.125
#> 4 0.103 0.103 0.122
#> 5 0.384 0.384 0.394
#> 6 most favourable 0.383 0.383 0.318
#>
#> Alpha 0.05 (two-sided)
#> Power (designed) 0.8
#> Method ologit (variance NA)
#>
#> Total sample size (calculated) 1314
#> Sample size per group (calculated) 657 657
#> ----------------------------------------------------------------------Long et al. (2025) highlights that it is not relevant that the
proportional odds assumption holds for testing the null hypothesis of no
treatment effect. artcatr also allows for non-proportional
odds by specifying pe and pc directly instead
of a common odds ratio.
artcatr(pc = c(.010, .021, .099, .103, .384, .383),
pe = c(.020, .021, .099, .103, .384, .373),
power = .9,
favourable = FALSE)
#> artcatr: sample size for an ordered categorical outcome (proportional-odds model)
#>
#> based on the Stata implementation from White et al. (2023)----------------------------------------------------------------------
#> Type of trial superiority
#> Favourable/unfavourable outcome unfavourable
#> Null hypothesis odds ratio = 1
#> Superiority region odds ratio < 1
#> Allocation ratio C:E 1:1
#> Anticipated probabilities, control 0.010 0.021 0.099 0.103 0.384 0.383
#> experimental 0.020 0.021 0.099 0.103 0.384 0.373
#> Anticipated average odds ratio 1.056
#>
#> Table of anticipated probabilities
#> C E
#> 1 least favourable 0.010 0.020
#> 2 0.021 0.021
#> 3 0.099 0.099
#> 4 0.103 0.103
#> 5 0.384 0.384
#> 6 most favourable 0.383 0.373
#>
#> Alpha 0.05 (two-sided)
#> Power (designed) 0.9
#> Method ologit (variance NA)
#>
#> Total sample size (calculated) 48130
#> Sample size per group (calculated) 24065 24065
#> ----------------------------------------------------------------------Anticipated probabilities may instead be specified as cumulative
probabilities (cumulative = TRUE), which can be more
natural when the outcome levels are thresholds on an underlying
scale.
A three-level outcome:
artcatr(pc = c(.01, .4, 1),
cumulative = TRUE,
or = .375,
power = .9,
favourable = FALSE)
#> artcatr: sample size for an ordered categorical outcome (proportional-odds model)
#>
#> based on the Stata implementation from White et al. (2023)----------------------------------------------------------------------
#> Type of trial superiority
#> Favourable/unfavourable outcome unfavourable
#> Null hypothesis odds ratio = 1
#> Superiority region odds ratio < 1
#> Allocation ratio C:E 1:1
#> Anticipated probabilities, control 0.01 0.40 1.00 (cumulative)
#> experimental given by odds ratio = 0.375
#>
#> Table of anticipated probabilities
#> C E
#> 1 least favourable 0.010 0.004
#> 2 0.390 0.196
#> 3 most favourable 0.600 0.800
#>
#> Alpha 0.05 (two-sided)
#> Power (designed) 0.9
#> Method ologit (variance NA)
#>
#> Total sample size (calculated) 216
#> Sample size per group (calculated) 108 108
#> ----------------------------------------------------------------------A four-level outcome:
artcatr(pc = c(.01, .1, .4, 1),
cumulative = TRUE,
or = .375,
power = .9,
favourable = FALSE)
#> artcatr: sample size for an ordered categorical outcome (proportional-odds model)
#>
#> based on the Stata implementation from White et al. (2023)----------------------------------------------------------------------
#> Type of trial superiority
#> Favourable/unfavourable outcome unfavourable
#> Null hypothesis odds ratio = 1
#> Superiority region odds ratio < 1
#> Allocation ratio C:E 1:1
#> Anticipated probabilities, control 0.01 0.10 0.40 1.00 (cumulative)
#> experimental given by odds ratio = 0.375
#>
#> Table of anticipated probabilities
#> C E
#> 1 least favourable 0.010 0.004
#> 2 0.090 0.036
#> 3 0.300 0.160
#> 4 most favourable 0.600 0.800
#>
#> Alpha 0.05 (two-sided)
#> Power (designed) 0.9
#> Method ologit (variance NA)
#>
#> Total sample size (calculated) 212
#> Sample size per group (calculated) 106 106
#> ----------------------------------------------------------------------A three-level outcome with a different split of probability across levels:
artcatr(pc = c(.4, .7, 1),
cumulative = TRUE,
or = .375,
power = .9,
favourable = FALSE)
#> artcatr: sample size for an ordered categorical outcome (proportional-odds model)
#>
#> based on the Stata implementation from White et al. (2023)----------------------------------------------------------------------
#> Type of trial superiority
#> Favourable/unfavourable outcome unfavourable
#> Null hypothesis odds ratio = 1
#> Superiority region odds ratio < 1
#> Allocation ratio C:E 1:1
#> Anticipated probabilities, control 0.4 0.7 1.0 (cumulative)
#> experimental given by odds ratio = 0.375
#>
#> Table of anticipated probabilities
#> C E
#> 1 least favourable 0.400 0.200
#> 2 0.300 0.267
#> 3 most favourable 0.300 0.533
#>
#> Alpha 0.05 (two-sided)
#> Power (designed) 0.9
#> Method ologit (variance NA)
#>
#> Total sample size (calculated) 154
#> Sample size per group (calculated) 77 77
#> ----------------------------------------------------------------------artcatr() returns (invisibly) a list of class
"artcatr", containing the computed sample size (or power),
the anticipated probability table, and other design parameters. Use
summary() for a tidy version of the probability table:
fit <- artcatr(pc = c(.018, .036, .156, .141, .39, .259),
or = 1 / 1.77,
power = .8,
favourable = FALSE,
quiet = TRUE)
summary(fit)
#> Design: superiority (unfavourable outcome; method = ologit, variance = NA)
#> Sample size (calculated): 322 total (C = 161, E = 161), power (designed) = 0.800
#>
#> level description control experimental
#> 1 least favourable 0.018 0.010
#> 2 0.036 0.021
#> 3 0.156 0.099
#> 4 0.141 0.103
#> 5 0.390 0.384
#> 6 most favourable 0.259 0.382White IR, Marley-Zagar E, Morris TP, Parmar MKB, Royston P, Babiker AG (2023). artcat: Sample-size calculation for an ordered categorical outcome. Stata Journal 23(1):3-23. doi:10.1177/1536867X231161934
Whitehead J (1993). Sample size calculations for ordered categorical data. Statistics in Medicine 12:2257-2271.
Davey RT Jr, Fernandez-Cruz E, Markowitz N, et al (2019). Anti-influenza hyperimmune intravenous immunoglobulin for adults with influenza A or B infection (FLU-IVIG): a double-blind, randomised, placebo-controlled trial. Lancet Respiratory Medicine 7(11):951-963.
Long Y, Wiegers EJA, Jacobs BC, Steyerberg EW, van Zwet EW (2025). Role of the proportional odds assumption for the analysis of ordinal outcomes in neurologic trials. Neurology 105(8):e214146. doi:10.1212/WNL.0000000000214146