*! version 2.1.0 04jan2024

Title

artbin -- ART (Binary Outcomes) - Sample Size and Power

Syntax

artbin,
pr(#1 ... #K)
[
options
]

Trial type
margin(#) margin for a non-inferiority or substantial-superiority trial

favourable outcome is favourable

unfavourable outcome is unfavourable

Power and sample size
power(#) power of trial

n(#) total sample size

aratios(aratio_list) allocation ratio(s)

ltfu(#) proportion lost to follow-up

Test
alpha(#) significance level for testing treatment effect(s)

onesided the significance level given by alpha() is one-sided

trend applies a linear trend test

doses(dose_list) doses for linear trend test

condit applies a conditional test

wald applies a Wald test

ccorrect applies a continuity correction

Method
local calculates under local alternatives (only valid for small treatment effects)

noround the calculated sample size in each group should not be rounded up to the nearest integer

force overrides the program's inference of the favourable/ unfavourable outcome type

Description

artbin is part of the ART suite: Assessment of Resources for Trials.

artbin calculates the power or total sample size for various tests comparing K
anticipated probabilities. Power is calculated if n() is specified,
otherwise total sample size is estimated. artbin can be used in designing
superiority, non-inferiority and substantial-superiority trials.

pr(#1 ... #K) is required and specifies the anticipated outcome probabilities
in the groups that will be compared. #1 is the anticipated probability in the control group
(pi1^a) and #2, #3, ... are the anticipated probabilities in the treatment groups
(pi2^a, pi3^a, ...).

artbin makes comparisons on the scale of difference in
probabilities. The results on other scales such as
odds ratios will be very similar for superiority trials
but potentially very different for non-inferiority and substantial-superiority trials (Quartagno, 2020).

In a multi-group trial, artbin is based on a test of the global null
hypothesis that the probabilities are equal in all groups. The alternative
hypothesis is that there is a difference between two or more of the groups.

In a two-group superiority trial, artbin is based on a test of the null hypothesis
that the probabilities
in the two groups are equal, and the alternative hypothesis is that they take
unequal values, such that the experimental treatment is better than the control
treatment.

In a non-inferiority trial, artbin is based on a test of the null
hypothesis that the experimental treatment is worse than the control
treatment by at least a pre-specified amount, termed the margin. artbin
supports the design of more complex non-inferiority trials in which
pi1^a and pi2^a are unequal. Substantial-superiority trials are
increasingly used; here, the null hypothesis is that the experimental
treatment is better than the control treatment by at most the margin.

To minimise the risk of error in two-group trials,
the user is advised to identify whether the trial outcome is favourable or
unfavourable.
If this option is omitted, artbin infers favourability status from the
pr() and margin() options. If pi2^a > pi1^a + margin, the outcome
is assumed to be favourable, otherwise unfavourable.

Options

Trial type

margin(#) is used with two-group trials and must be specified if a non-inferiority or
substantial-superiority trial is being designed. The default margin is # = 0,
denoting a superiority trial.

If the event of interest is unfavourable, the null hypothesis
for all these designs is pi2 – pi1 >= m, where m is the
pre-specified margin. The alternative hypothesis is pi2 – pi1 < m.
m > 0 denotes a non-inferiority trial, whereas m < 0 denotes
a substantial-superiority trial.

If on the other hand the event of interest is favourable, the above
inequalities are reversed. The null hypothesis for all these designs
is then pi2 – pi1 <= m and the alternative hypothesis is
pi2 – pi1 > m. m < 0 denotes a non-inferiority trial,
while m > 0 denotes a substantial-superiority trial.

The hypothesised margin for the difference in anticipated probabilities, #, must lie
between -1 and 1.

favourable or unfavourable are used with two-group trials
to specify whether the outcome is favourable or unfavourable.
If either option is used, artbin checks the assumptions;
otherwise, it infers the favourability status. Both American and
English spellings are allowed.

Power and sample size

power(#) specifies the required power of the trial at the
alpha() significance level and computes the total sample size.
power() cannot be used with n(). Default # is 0.8.

n(#) specifies the total sample size available and computes the
corresponding power. n() cannot be used with power().
The default is to calculate the sample size for power 0.8.

aratios(aratio_list) specifies the allocation ratio(s).
The allocation ratio for group k is #k, k = 1,...,K e.g. aratios(1 2)
means two participants are randomised to the experimental group for each one randomised
to the control group. With two groups, aratios(#) is taken to mean aratios(1 #).
The default is equal allocation to all groups.

ltfu(#) assumes a proportional loss to follow-up of #, where #
is a number between 0 and 1. The total sample size is divided by 1 - # before rounding.
The default is # = 0, meaning no loss to follow-up.

Test

alpha(#) specifies that the trial will be analysed using a significance test
with level #. That is, # is the type 1 error probability. Default is # = 0.05.

onesided is used for two-group trials and for trend tests in multi-group trials.
It specifies that the significance level given by alpha() is one-sided.
Otherwise, the value of alpha() is halved to give a one-sided significance level.
Thus for example alpha(0.05) is exactly the same as alpha(0.025) onesided.

artbin always assumes that a two-group trial or a trend test in a multi-group trial will be
analysed using a one-sided alternative, regardless of whether the alpha level was specified as
one-sided or two-sided. artbin therefore uses a slightly different definition of power from
the power command: when a two-tailed test is performed, power
reports the probability of rejecting the null hypothesis in either direction, whereas artbin
only considers rejecting the null hypothesis in the direction of interest.

artbin assumes that multi-group trials will be analysed using a two-sided alternative, so
onesided is not allowed with multi-group trials unless trend/doses() is
specified (see below).

trend is used for trials with more than two groups and
specifies that the trial will be analysed using a linear trend test.
The default is a test for any difference between the groups. See also
doses().

doses(dose_list) is used for trials with more than two groups
and specifies 'doses' or other quantitative measures
for a dose-response (linear trend) test.
doses() implies trend.
doses(#1 #2...#r) assigns
doses for groups 1,...,r. If r < K (the total number of groups), the dose
is assumed equal to #r for groups r+1, r+2, ..., K.
If trend is specified without doses() then the default is doses(1 2 ... K).
doses() is not permitted for a two-group trial.

condit specifies that the trial will be analysed using Peto's conditional test.
This test conditions on the total number of events observed
and is based on Peto's local approximation to the log odds ratio.
This option is also likely to be a good approximation
with other conditional tests.
The default is the usual Pearson chisquare test.

condit is not available for non-inferiority and super-superiority trials.
condit cannot be used with wald since only one test type is allowed.
condit implies local.
The ccorrect option is not available with condit.

wald specifies that the trial will be analysed using the Wald test.
The default is the usual Pearson chisquare test.

wald cannot be used with condit since only one test type is allowed.
The Wald test inherently allows for distant alternatives so wald and local can not be used together.

ccorrect specifies that the trial will be analysed using a continuity correction. ccorrect is not
available with condit. The default is no continuity correction.

Method

local specifies that the calculation should use the variance of the difference in proportions only under the null.
This approximation is valid when the treatment effect is small ("local alternatives").
The default uses the variance of the difference in proportions both under the null and under the alternative hypothesis.
The local method is not recommended and is only included to allow comparisons with other software.

The Wald test inherently allows for distant alternatives so wald and local can not be used together.

noround prevents rounding of the calculated sample size. The default is to round the calculated sample size in each group up to the nearest integer.

force can be used with two-group studies to override the program's inference of the
favourable/ unfavourable outcome type. This may be needed for example when designing an observational
study with a harmful risk factor, the favourability types would be reversed and the force option applied.

Remarks

artbin computes sample size/power for the (global/trend) unconditional
chisquare test or the conditional test based on the hypergeometric distribution
with Peto's one-step approximation to the odds ratio (OR). Sample size/power
is calculated in the unconditional case under either local or distant
alternatives. Under local alternatives, the program uses the test statistic
covariance matrix appropriate to the null hypothesis of no difference among the
probabilities under both the null and the alternative hypotheses. This approach is
reasonable if the odds ratio(s) under the alternative hypothesis are between about
0.5 and 2. For two-group studies, the sample sizes tend to be somewhat larger with
local alternatives than with global (non-local) alternatives. The default is
non-local (distant).

The expected number of events is calculated based on the trial recruiting the sample size per group
given in the output table (which have been rounded up to the nearest integer unless noround has been specified).

All calculations in artbin are based on the approximation that the difference in proportions is Normally distributed (or with condit that the score statistic is Normally distributed).
This approximation may fail with very small sample sizes, in which case the continuity correction should be used.
We suggest using the usual rule for the Pearson chi-squared test, namely to mistrust the results when any expected
cell count is lower than about 5. Concerned users should check the power by simulation.

For a full description of the methods and formulae used in artbin, please see the accompanying Stata Journal paper.

Use for Observational Studies

artbin has been created to assist the design of clinical trials, but it can also be used
in the design of observational studies to explore a protective or harmful factor. The
trial and outcome types may need to be re-interpreted, for example for a harmful risk
factor in an observational study, the favourable/unfavourable outcome types would be
reversed. This would be an example of when the option force would be used.
An observational study design to demonstrate a protective factor could be
designed in exactly the same way as a trial, but the term superiority might be replaced
by benefit. This is further described in the newly available artcat, a Stata program to
calculate sample size or power for a 2-group trial with ordered categorical outcome.

Changes from artbin version 1.1.2 to version 2.0.1

For a detailed description of what's new in artbin, please see artbin_whatsnew.

Changes from artbin version 2.0.1 to version 2.1

An error in the ltfu() option when calculating power from sample size has been corrected.

Rounding now behaves exactly as stated in the help file, i.e. sample sizes are rounded up to the nearest integer in each group.

Examples

Find the sample size to give 80% power in a two-group superiority trial where the experimental treatment is expected to increase the proportion from 0.25 to 0.35:

. artbin, pr(0.25 0.35)

Note that artbin infers that the outcome is favourable from the fact that we want to increase the proportion.

The same, but with a local approximation in the calculation:

. artbin, pr(0.25 0.35) local

The same, but assuming a Wald test and requiring 90% power:

. artbin, pr(0.25 0.35) favourable wald power(0.9)

The same, but allowing for 20% loss to follow-up:

. artbin, pr(0.25 0.35) ltfu(0.2)

Find the sample size for a trial comparing four groups using a Pearson chisquared test,
with event probability 0.15 in the control group and 0.25 to 0.45 in the experimental groups:

. artbin, pr(0.15 0.25 0.35 0.45)

The same, but assuming the primary analysis will test for trend across the four groups:

. artbin, pr(0.15 0.25 0.35 0.45) trend

The same, but with unequal allocation:

. artbin, pr(0.15 0.25 0.35 0.45) aratios(1 2 2 2)

References

Quartagno M, Walker AS, Babiker AG et al. Handling an uncertain control group event risk
in non-inferiority trials: non-inferiority frontiers and the power-stabilising transformation.
Trials 21, 145 (2020). https://doi.org/10.1186/s13063-020-4070-4

Citation

If you find this command useful, please cite it as below:

Ella Marley-Zagar, Ian R. White, Patrick Royston, Friederike M.-S. Barthel, Mahesh K B Parmar, Abdel G. Babiker. artbin: Extended sample size for randomised trials with binary outcomes. Stata J 2023:1;24-52.
https://journals.sagepub.com/doi/pdf/10.1177/1536867X231161971

Stored results

Scalars

r(n) Sample size (total)

r(n1) Sample size in group 1

r(n2) Sample size in group 2

r(D) Events expected (total)

r(D1) Events expected in group 1

r(D2) Events expected in group 2

r(power) Power

The same quantities are returned, whether artbin has calculated power from sample size or sample size from power.
Further scalars r(n3) etc. are returned for trials with more than 2 arms.

Authors

Abdel Babiker, MRC Clinical Trials Unit at UCL

Ab Babiker

Friederike Maria-Sophie Barthel, formerly MRC Clinical Trials Unit

Sophie Barthel

Babak Choodari-Oskooei, MRC Clinical Trials Unit at UCL

Babak Oskooei

Patrick Royston, MRC Clinical Trials Unit at UCL

Patrick Royston

Ella Marley-Zagar, MRC Clinical Trials Unit at UCL

Ella Marley-Zagar

Ian White, MRC Clinical Trials Unit at UCL

Ian White

Also see

Manual: [R] sampsi
Manual: [R] power

Online: help for artmenu, artbindlg, art, artsurv