*! version 2.1)

help slopepower ({})

Title

slopepower -- Sample size and power calculator for
outcomes analysed using a slope (ie repeated measures across multiple timepoints).
A linear mixed model is used on data in memory to obtain estimates for slopes
and variances among people with (and possibly without) the condition of interest

Syntax

slopepower
depvar
[if] [in]
,
subject(varname)
time(varname)
schedule(numlist)
[options]

Options for data in memory
* subject(varname) variable defining each subject

* time(varname) variable defining the time of each measurement

obs the data in memory are from an observational study. One of obs and rct must be specified

nocontrols the observational data in memory contain no healthy
controls. Can only be used with the obs option

rct the data in memory are from an RCT. One of obs and rct must be specified

casecon(varname) variable defining if a person is a case or healthy control. Required if and only if observational data is used.

treat(varname) variable defining if a person received the intervention. Required if and only if RCT data is used

Options for future study
* schedule(numlist) the visit times for the proposed study.
Visit times are assumed to be in the same time units as the time variable in the dataset,
unless scale is specified

dropouts(numlist) the proportion of dropouts at each visit.
Must correspond to the schedule list

scale(#) The ratio between the time and schedule timescales

alpha(#) significance level; default is 0.05

power(#) power; default is 0.8, required to compute sample size

n(#) total sample size; required to compute power

effectiveness(#) the target effectiveness of the treatment to be trialled; default is 0.25

usetrt use the observed effectiveness of the treatment. Can only be used with the rct option.

Model options
iterate(#) the maximum number of iterations allowed in the mixed model

nocontvar omit the random slope variance and covariance for healthy controls in the mixed model

*these options are required.

Description

slopepower performs a sample size or power calculation for a proposed two-arm
parallel group randomised clinical trial (RCT) where the outcome of interest is a slope
measured over time, and the treatment is hoped to alter this slope to be more
similar to the slope of people without the condition. The calculations are based
partly upon data the user has read into Stata’s memory and partly on user input.
A linear mixed model is run (using mixed) on the data in memory to estimate
a plausible treatment effect variance, and the slope in those who are untreated;
the remaining parameters are specified by the user. The data should come from either
an observational study or a similar clinical trial and contain repeated measurements of
the outcome in long format (see reshape for more details). The data in memory
will not be altered by this command.

Options

Options for data in memory

subject(varname) is the unique identifier for participants in the
user-supplied data

time(varname) is the time variable of visits in the dataset.
This can be in any units (eg days, months, years). It is assumed to be time since
start of observation for each individual. If it is not (for instance if it is
an actual calendar date) slopepower will issue a warning and rescale it accordingly.

obs, nocontrols and rct tell Stata the nature of the data in
memory. Exactly one of obs and rct must be specified.
nocontrols should be used with obs if all the subjects in
your observational data have the condition of interest (i.e. the data contain no healthy controls).

casecontrol(varname) specifies the variable used to identify cases in observational
data; it can only be used with obs. It must be a binary 0/1 variable, with
the cases coded as 1.

treat(varname) specifies the treatment variable when you are using RCT data; it can
only be specified with rct. It must be a binary 0/1 variable, with the
experimental group coded as 1.

Options for planned trial

schedule(numlist) specifies the visit times for the proposed trial. A baseline
visit at time 0 is assumed; this list should describe subsequent visits, in
whole number units of time. The default is to use the same time unit as the
time variable in the dataset. To use a different timescale, specify how many time units make
one schedule unit in the scale option.

dropouts(numlist) specifies the estimated proportion of dropouts you
expect at each study visit. It must correspond exactly to the schedule list.
Each number in the list is a proportion between 0 and 1; this is the fraction of
subjects (of those who start the study) you estimate will fail to attend that
visit. We follow the pattern mixture method of Dawson and Lagakos.

scale(#) specifies the ratio between the time and visit timescales.
For instance, if the time variable in your dataset is in days, and you wish to have visits
annually for three years, you would specify scale(365) and schedule(1 2 3)

alpha(#) sets the significance level (also known as Type I error rate)
to be used in the planned study. The default is alpha(0.05).

power(#) sets the power for the planned study. The default is power(0.8).
This option is required to compute the sample size.

n(#) specifies the total number of participants who will be in the trial.
If an odd number is given, (n-1) will be used to allow equal numbers per arm.
Only one of power and n may be specified. This option is required to compute the power.

effectiveness(#) and usetrt specify the effect size you would like
to be able to detect in the future trial. effectiveness specifies this effect size as
a proportion of the difference between cases and healthy controls in the observational
data in memory. If RCT data, or observational data with no healthy controls, are used
effectiveness is a proportion of the difference towards a slope of 0.
This must be a number between 0 and 1; the default value is 0.25. usetrt
specifies that, when RCT data is used, the planned study is targeting
the same effect size as estimated from the previous data. You can only specify one of effectiveness and
usetrt.

Model options

iterate(#) is used as an option in the mixed command; see maximize.

nocontvar specifies that the mixed model should not estimate a random slopes
variance parameter or the covariance between random slopes and intercepts for healthy controls.
This is only applicable when you are using observational data with healthy controls.
Ignoring this variance and covariance may help the model to converge.

Examples

Load example observational data with no healthy controls (slpower1.dta, available as an ancillary file):

. use slpower1, clear

Use slopepower to give the sample size for an RCT with annual visits over two years, assuming no dropouts, with 80% power to detect a treatment effect that will eliminate one-third of the slope in the outcome sdmt. The default value of 5% Type I error rate is used.

. slopepower sdmt, schedule(1 2) subject(id) time(visit) obs nocontrol effectiveness(0.33)

Extend the trial to 5 years, with no additional interim visits, and assuming that 10% of participants will be lost to follow-up between the visit at year two and the final visit.

. slopepower sdmt, schedule(1 2 5) subject(id) time(visit) obs nocontrol eff(0.33) dropouts(0 0 0.1)

Schedule visits every six months in a two year trial, by using the scale option.

. slopepower sdmt, schedule(1 2 3 4) scale(0.5) subject(id) time(visit) obs nocontrol effectiveness(0.33)

Load example observational data with a healthy control group (slpower2.dta, available as an ancillary file):

. use slpower2, clear

Use slopepower to give the sample size for an RCT with annual visits over two years, assuming no dropouts, with 80% power to detect a treatment effect that will eliminate one-third of the slope. The scale option is used to tell Stata that the time variable is a date (recorded in days).

. slopepower sdmt, schedule(1 2) scale(365) subject(id) time(vdate) obs case(case) effectiveness(0.33)

Calculate the power for a 200 person trial, assuming a dropout rate of 5% per year of those who start the trial.

. slopepower sdmt, sched(1 2) scale(365) subject(id) time(vdate) obs case(case) eff(0.33) n(200) drop(0.05 0.05)

Load example RCT data with treated and untreated groups (slpower3.dta, available as an ancillary file):

. use slpower3, clear

Use slopepower to give the sample size for a three-year RCT with an interim visit at two years, with 80% power to detect the same treatment effect as observed in the previous RCT. Assume a dropout rate of 10% per year.

. slopepower sdmt , schedule(2 3) subject(id) time(visit) rct treat(treat) usetrt dropout(0.2 0.1)

Stored results

slopepower stores the following in r():

Scalars

r(subjects_in_model) number of subjects that were used in the mixed model

r(obs_in_model) number of observations that were used in the mixed model

r(alpha) Type I error rate (significance level) of the planned trial

r(power) power of the planned trial

r(fupvisits) specified number of follow up visits

r(sampsize) total sample size

r(effectiveness) specified target effectiveness of the proposed treatment

r(tte) target treatment effect

r(var_tte) variance of the target treatment effect for a hypothetical future two-person trial

r(slope_cases) the observed slope in the cases (if calculated)

r(slope_controls) the observed slope in the healthy controls (if calculated)

r(slope_untreated) the observed slope in the control arm of the previous RCT (if calculated)

r(slope_treated) the observed slope in the experimental arm of the previous RCT (if calculated)

Matrices

r(table) table of results

References

Chris Frost, Michael G. Kenward, Nick C. Fox. Optimizing the design of clinical
trials where the outcome is a rate. Can estimating a baseline rate in a run-in
period increase efficiency? Statist. Med. 2008; 27:3717–3731 doi: 10.1002/sim.3280

JD Dawson, SW Lagakos. Analyzing laboratory marker changes in AIDS clinical
trials. J AIDS 1991;4:667-676 PMID: 2051307

Dawson JD, Lagakos SW. Size and power of two-sample tests of repeated measures
data. Biometrics 1993;49:1022-1032

Authors

Stephen Nash, Katy Morgan, Amy Mulick
London School of Hygiene and Tropical Medicine
London, UK
katy.morgan@lshtm.ac.uk