Package 'RTSA'

Title: 'Trial Sequential Analysis' for Error Control and Inference in Sequential Meta-Analyses
Description: Frequentist sequential meta-analysis based on 'Trial Sequential Analysis' (TSA) in programmed in Java by the Copenhagen Trial Unit (CTU). The primary function is the calculation of group sequential designs for meta-analysis to be used for planning and analysis of both prospective and retrospective sequential meta-analyses to preserve type-I-error control under sequential testing. 'RTSA' includes tools for sample size and trial size calculation for meta-analysis and core meta-analyses methods such as fixed-effect and random-effects models and forest plots. TSA is described in Wetterslev et. al (2008) <doi:10.1016/j.jclinepi.2007.03.013>. The methods for deriving the group sequential designs are based on Jennison and Turnbull (1999, ISBN:9780849303166).
Authors: Anne Lyngholm Soerensen [aut, cre, trl], Markus Harboe Olsen [aut, ctr], Theis Lange [ctr], Christian Gluud [ctr]
Maintainer: Anne Lyngholm Soerensen <[email protected]>
License: GPL (>= 2)
Version: 0.2.2
Built: 2025-02-03 05:41:08 UTC
Source: https://github.com/annelyng/rtsa

Help Index


Boundaries for group sequential designs

Description

Calculates alpha- and potentially beta-spending boundaries for group sequential designs for meta-analysis. Should be used for exploring how the different arguments affect the sequential design. The function is not intended to be used individually for Trial Sequential Analysis. For this purpose, we recommend RTSA().

Usage

boundaries(
  timing,
  alpha = 0.05,
  beta = 0.1,
  side = 2,
  futility = "none",
  es_alpha = "esOF",
  es_beta = NULL,
  type = "design",
  design_R = NULL,
  tol = 1e-09
)

Arguments

timing

Expected timings of interim analyses and final analysis as a vector consisting of values from 0 to 1.

alpha

The level of type I error as a percentage, the default is 0.05 corresponding to 5%.

beta

The level of type II error as a percentage, the default is 0.1 corresponding to 10%.

side

Whether a 1- or 2-sided hypothesis test is used. Defaults to 2. Options are 1 or 2.

futility

Futility boundaries added to design. Options are: none, non-binding and binding. Default is "none".

es_alpha

The error spending function for alpha-spending. Options are: "esOF" (Lan & DeMets version of O'Brien-Fleming boundaries), "esPoc" (Lan & DeMets version of Pocock boundaries), "HSDC" (Hwang Sihi and DeCani) and "rho" (rho family). Defaults to "esOF".

es_beta

The error spending function for beta-spending. For options see es_alpha. Defaults to NULL.

type

Whether the boundaries are used for design or analysis. We recommend only to use the boundaries() function with type equal to design. Defaults to design.

design_R

If type is analysis, a scalar for achieving the right amount of power is required. It is recommended not to use the boundaires() function with the setting type equal to analysis. Defaults to NULL.

tol

Tolerance level for numerical integration. Defaults to 1e-09.

Value

A boundaries object which includes:

inf_frac

Timing of interim analyses and final analysis. Potentially modified if type = "analysis".

org_inf_frac

Original timing. If type = "design".

alpha_ubound

Upper alpha-spending boundaries

alpha_lbound

Lower alpha-spending boundaries

alpha

As input

alpha_spend

List of cumulative and incremental spending

delta

Drift parameter

design_R

If type = "analysis" it is the scalar for correct power in the design. Else NULL.

info

List of the information as the squareroot of the information increments and the squareroot of the cumulative information

beta_ubound

Upper beta-spending boundaries

beta_lbound

Lower beta-spending boundaries

root

Scalar for achieving correct power

beta_spend

List of cumulative and incremental spending

pwr

List of probabilities for rejecting the null under the sample size settings being true at each analysis and the sum.

tIe

List of probabilities for type-I-error at each analysis and the sum

side

As input

beta

As input

es_alpha

As input

es_beta

As input

type

As input

futility

As input

Examples

boundaries(timing = c(0.25, 0.5, 0.75, 1), alpha = 0.05, beta = 0.1,
 side = 2, futility = "non-binding", es_alpha = "esOF", es_beta = "esOF")

Dataset of trials investigating the intensity of statin therapy on the risk of myocardial infarction or coronary death

Description

A dataset containing trials investigating myocardial infarction or coronary death among patients with acute coronary syndromes or chronic coronary artery disease of statin therapy intensity. The trials compared low intensities of statin to higher intensities.

Usage

coronary

Format

A data frame with 4 rows and 5 variables:

study

Name of first author of the trial

eI

Number of events in the intervention group

nI

Number of participants in the intervention group

eC

Number of events in the control group

nC

Number of participants in the control group


Dataset of trials investigating the effect of carer on early supported discharge services

Description

A dataset containing trials investigating on the length of hospital stay when receiving early supported discharge (ESD) service versus conventional care. The outcome is length of initial hospital stay counted in days.

Usage

eds

Format

A data frame with 9 studies and 8 variables:

Details

  • study. Name of the city of the study

  • year. Year of the trial

  • mI. Mean duration at hospital in intervention (ESD) group

  • mC. Mean duration at hospital in control group

  • sdI. Standard deviation of intervention (ESD) estimate

  • sdC. Standard deviation of control estimate

  • nI. Number of participants in the intervention (ESD) group

  • nC. Number of participants in the control group

References

Fearon P, Langhorne P. Services for reducing duration of hospital care for acute stroke patients. Cochrane Database of Systematic Reviews 2012, Issue 9. Art. No.: CD000443. DOI: 10.1002/14651858.CD000443.pub3. Accessed 17 October 2022.


Inference calculations for sequential meta-analysis

Description

Calculates point-estimates, p-values and confidence intervals. Computes naive inference and TSA-adjusted confidence intervals. If the meta-analysis crosses a alpha-spending boundary, a binding beta-spending boundary or reached the sequential RIS, stage-wise ordered inference is also calculated. This function is not supposed to be used individually for Trial Sequential Analysis (TSA). RTSA() is recommended for TSA.

Usage

inference(
  bounds,
  timing,
  ana_times,
  ma,
  fixed,
  org_timing,
  inf_type = "sw",
  conf_level = 0.95,
  final_analysis = FALSE,
  tol = 1e-15
)

Arguments

bounds

The boundaries for the analysis as calculated by the boundaries() function in RTSA.

timing

The timing of the studies relative to the sequential RIS. A vector consisting of values equal to the proportion of study participants out of the sequential RIS.

ana_times

The analysis times presented as a vector. Describes at which studies the meta-analyses were performed. If one expects that the meta-analysis was updated per study a vector from 1 to the number of studies included can be used.

ma

A metaanalysis object from the metaanalysis function.

fixed

Whether the analysis is for fixed-effect or random-effects meta-analysis. Options are TRUE (meta-analysis is fixed-effect) or FALSE (meta-analysis is random-effects).

org_timing

The timing of all included studies as a proportion of RIS and not sequential RIS.

inf_type

For now only option is "sw" (stage-wise). Type of inference used for point estimates, confidence intervals and p-values.

conf_level

The confidence interval level. Defaults to 0.95 which is 95%.

final_analysis

Whether or not the this analysis is considered the final analysis.

tol

The tolerance level. Set to 1e+09.

Value

A data.frame of cumulative meta-analysis results including stopping boundaries and a list of conditional sequential inference to be parsed to RTSA

results_df

A data.frame containing information about: Cumulative test values, cumulative outcomes, timing of trials, stopping boundaries (alpha_upper, alpha_lower, beta_upper, beta_lower), naive confidence intervals, TSA-adjusted confidence intervals, cumulative p-values and standard deviations.

seq_inf

If the meta-analysis crosses an alpha-spending boundary, a binding beta-spending boundary or reaches the required information size inference conditional on stopping is provided. A median unbiased estimate, lower and upper confidence interval, and p-value is calculated based on stage-wise ordering.

Examples

ma <- metaanalysis(data = perioOxy, outcome = "RR", mc = 0.8)
sts <- ma$ris$NR_D2$NR_D2_full
timing <- cumsum(perioOxy$nI + perioOxy$nC)/sts
bound_oxy <- boundaries(timing = timing, alpha = 0.05, beta = 0.2, side = 2,
                       futility = "none", es_alpha = "esOF")
inference(timing = bound_oxy$inf_frac, bounds = bound_oxy, ma = ma,fixed = FALSE,
ana_times = 1:length(timing), org_timing = timing)

Fixed-effect or random-effects meta-analysis

Description

Computes a fixed-effect or random-effects meta-analysis including heterogeneity statistics. If mc is specified, a retrospective sample and trial size is calculated.

Usage

metaanalysis(
  outcome,
  data,
  side = 2,
  alpha = 0.05,
  beta = 0.1,
  weights = "IV",
  re_method = "DL_HKSJ",
  tau_ci_method = "BJ",
  cont_vartype = "equal",
  mc = NULL,
  RRR = NULL,
  sd_mc = NULL,
  study = NULL,
  conf_level = 0.95,
  zero_adj = 0.5,
  ...
)

Arguments

outcome

Outcome metric for the studies. Choose between: MD (mean difference), RR (relative risk), RD (risk difference), or OR (odds ratio).

data

A data.frame containing the study results. The data set must containing a specific set of columns. These are respectively 'eI' (events in intervention group), 'eC' (events in control group), 'nC' (participants intervention group) or 'nI' (participants control group) for discrete data, or, 'mI' (mean intervention group), 'mC' (mean control group), 'sdI' (standard error intervention group), 'sdC' (standard error control group),'nC' (participants intervention group) and 'nI' (participants control group) for continuous outcomes. Preferable also a 'study' column as an indicator of study.

side

Whether a 1- or 2-sided hypothesis test is used. Options are 1 or 2. Default is 2.

alpha

The level of type I error as a percentage, the default is 0.05 corresponding to 5%.

beta

The level of type II error as a percentage, the default is 0.1 corresponding to 10%. Not used unless a sample and trial size calculation is wanted.

weights

Method for calculating weights. Options are "MH" (Mantel-Haenzel and only optional for binary data) or "IV" (Inverse variance weighting). Default is "IV".

re_method

Methods are "DL" for DerSimonian-Laird or "DL_HKSJ" for DerSimonian-Laird with Hartung-Knapp-Sidik-Jonkman adjustment. Default is "DL_HKSJ".

tau_ci_method

Methods for computation of confidence interval for heterogeneity estimate tau. Calls rma.uni from the metafor package. Options are "BJ" and "QP". Default is "BJ"

cont_vartype

Variance type for continuous outcomes. Choices are "equal" (homogeneity of treatment group variances) or "non-equal" (heterogeneity of treatment group variances). Default is "equal".

mc

Minimum clinically relevant value. Used for sample and trial size calculation.

RRR

Relative risk reduction. Used for binary outcomes with outcome metric RR. Argument mc can be used instead. Must be a value between 0 and 1.

sd_mc

The expected standard deviation. Used for sample and trial size calculation for mean differences.

study

Optional vector of study IDs. If no study indicator is provided in 'data', a vector of study indicators e.g. names.

conf_level

Confidence interval coverage

zero_adj

Zero adjustment for null events in binary data. Options for now is 0.5. Default is 0.5.

...

Additional variables.

Value

A metaanalysis object which is a list with 6 or 7 elements.

study_results

A data.frame containing study results which is information about the individual studies

meta_results

A data.frame containing the results of the meta-analysis such as the pooled estimate, its standard error, confidence interval and p-value

hete_results

A list containing statistics about hetergeneity.

metaPrepare

A list containing the elements used for calculating the study results.

synthesize

A list containing the elements used for calculating the meta-analysis results.

settings

A list containing the arguments used in the metaanalysis call.

ris

(Only when mc has been specified or meta-analysis is created as part of RTSA). List of sample size and trial size calculation. See documentation for ris.

Examples

### Basic uses
# Use perioOxy data from package and run meta-analysis with default settings
data(perioOxy)
metaanalysis(outcome = "RR", data = perioOxy, study = perioOxy$trial)

# Run same meta-analysis but with odds ratio as outcome metric, Mantel-Haenzel 
# weights and DerSimionian-Laird for the variance estimate 
metaanalysis(outcome = "OR", data = perioOxy, study = perioOxy$trial,
 weights = "MH", re_method = "DL")
 
# Run meta-analysis with mean difference as outcome metric
data(eds)
metaanalysis(outcome = "MD", data = eds)

### Retrospective sample size calculation
# minimal clinical relevant difference set to an odds ratio of 0.7.
ma <- metaanalysis(outcome = "OR", data = perioOxy, mc = 0.7)
ma$ris

Minimum number of trials needed for a specific level of power

Description

Calculates minimum number of trials needed to achieve power in a meta-analysis with heterogeneity.

Usage

minTrial(
  outcome,
  mc,
  tau2,
  alpha,
  beta,
  side,
  pC = NULL,
  p1 = NULL,
  var_mc = NULL,
  var_random = NULL,
  trials = NULL
)

Arguments

outcome

Metric of interest, options include "RR" (relative risk), "OR" (odds ratio), "RD" (risk difference) and "MD" (mean difference).

mc

Minimal clinical relevant value provided as a numeric value. Such as 0.8 for e.g. an odds ratio of 0.8.

tau2

Heterogeneity estimate. Can be extracted from the metaanalysis() function.

alpha

The level of type I error as a percentage, the default is 0.05 corresponding to 5%.

beta

The level of type II error as a percentage, the default is 0.1 corresponding to 10%.

side

Whether a 1- or 2-sided hypothesis test is used. Options are 1 or 2.

pC

Probability of event in control group. Only used for outcomes "RR", "OR" and "RD".

p1

Probability of event in treatment group. Only used for outcome "RD".

var_mc

Variance of the estimated effect when outcome is "MD". Not required for outcome types "OR", "RR" or "RD".

var_random

Estimated variance from the random-effects meta-analysis. Used then a meta-analysis have already been made previously.

trials

Optional argument. Number of trials of interest for to provide the number of participants needed for that exact number of trials.

Value

Either a number (minimum required trials) or the minimum required required trials together with a matrix of required participants per trial given different number of trials.

Examples

# Minimum number of trials for a prospective meta-analysis
minTrial(outcome = "RR", pC = 0.5, mc = 0.7, tau2 = 0.05, alpha = 0.05,
beta = 0.1, side = 2)

# Minimum number of trials still needed for a retrospective meta-analysis
# Note that retrospective sample size calculations are prone to bias
ma <- metaanalysis(outcome = "RR", data = perioOxy)
ris(outcome = "RR", mc = 0.80, ma = ma, type = "retrospective", fixed = FALSE,
 beta = 0.1, alpha = 0.05, side = 2)

Dataset of RCTs investigating the effect of 80% perioperative oxygen vs. 30 -35% perioperative oxygen on surgical site infection.

Description

A dataset containing data on seven trials which includes their number of events per treatment group, where intervention is 80% oxygen and control is 30-35% oxygen, number of participants in each treatment group and the year of the trial.

Usage

perioOxy

Format

A data frame with 7 rows and 6 variables:

study

Name of first author of the trial

eI

Number of events in the intervention group (80% oxygen)

nI

Number of perticipants in the intervention group (80% oxygen)

eC

Number of events in the control group (30-35% oxygen)

nC

Number of participants in the control group (30-35% oxygen)


Plot of boundaries for group sequential designs

Description

Plot of boundaries for group sequential designs

Usage

## S3 method for class 'boundaries'
plot(x, theme = "classic", ...)

Arguments

x

boundaries object

theme

Whether the theme is "classic" or "aussie"

...

Other arguments to plot.boundaries

Value

Plot. Either a plot for two- or one-sided testing.

Examples

bounds <- boundaries(timing = c(0.5,0.75, 1), alpha  = 0.025, beta = 0.2,
side = 1, futility = "none", es_alpha = "esOF")
plot(x = bounds)

Forestplot for metaanalysis object.

Description

Forestplot for metaanalysis object.

Usage

## S3 method for class 'metaanalysis'
plot(x, type = "both", xlims = NULL, ...)

Arguments

x

metaanalysis object from the RTSA package.

type

Define whether or not both fixed-effect and random-effects meta-analysis results should be printed on the plot. Options are: "fixed", "random" or "both". Default is "both".

xlims

Set default limits on the outcome scale. Default is NULL.

...

Additional arguments

Examples

# Example with OR 
ma <- metaanalysis(data = coronary, outcome = "OR")
plot(ma)

# Example with RR 
ma <- metaanalysis(data = perioOxy, outcome = "RR")
plot(ma)

# Example with MD
ma <- metaanalysis(data = eds, outcome = "MD")
plot(ma, type = "random")

Plot RTSA object. Returns the R version of the original TSA plot.

Description

Plot RTSA object. Returns the R version of the original TSA plot.

Usage

## S3 method for class 'RTSA'
plot(x, model = "random", type = "classic", theme = "classic", ...)

Arguments

x

RTSA object

model

Whether a fixed- or random-effects meta-analysis should be used. Defaults to random.

type

Should Z-scores (classic) or outcome values (outcome) be plotted.

theme

Whether the theme is traditional TSA (classic) or modern (modern)

...

Other arguments to plot.RTSA

Value

Plot. Either a plot for two sided testing or one-sided

Examples

data(perioOxy)
outRTSA <- RTSA(type = "analysis", data = perioOxy, outcome = "RR", mc = 0.8,
 side = 2, alpha = 0.05, beta = 0.2, fixed = FALSE, es_alpha = "esOF", design = NULL)
plot(x = outRTSA)

Calculate required sample and trials size.

Description

Calculate required sample and trials size.

Usage

ris(
  outcome,
  mc,
  side = 2,
  alpha = 0.05,
  beta = 0.1,
  fixed = TRUE,
  sd_mc = NULL,
  pC = NULL,
  p1 = NULL,
  ma = NULL,
  tau2 = NULL,
  I2 = NULL,
  D2 = NULL,
  type = "prospective",
  trials = NULL,
  RTSA = FALSE,
  ...
)

Arguments

outcome

Choose between: "MD" (mean difference), "RR" (relative risk), "OR" (odds ratio) or "RD" (risk difference).

mc

Minimum clinical relevant effect. For "OR" or "RR" set to natural scale, not log scale.

side

Test type. Set to 1 or 2 depending on the test being 1- or 2-sided.

alpha

The level of type I error as a percentage, the default is 0.05 corresponding to 5%.

beta

The level of type II error as a percentage, the default is 0.1 corresponding to 10%.

fixed

Should sample size be based on a fixed-effect (TRUE) or random-effects (FALSE) model. Defaults to TRUE.

sd_mc

Standard deviation of estimated effect. Only needed when outcome type is "MD".

pC

Probability of event in control group. Only needed when outcome type is "OR", "RR" or "RD".

p1

Probability of event in treatment group. Only needed when outcome type is "RD".

ma

An optional metaanalysis object. Required for retrospective sample size calculations.

tau2

The value of the heterogeneity. Use when estimating the sample size under a random effects model. If data is provided, the estimated heterogeneity is used instead.

I2

Optional argument. Inconsistency.

D2

Optional argument. Diversity.

type

Whehter the type of calculaiton is for "prospective" meta-analysis or "retrospective" meta-analysis. If the type is retrospective, one should add a meta-analysis object to the function. See argument ma.

trials

Optional numeric argument. If one is interested in a specific number of trials.

RTSA

Whether the ris function was called via the RTSA function. Purely operational argument.

...

additional arguments

Value

A list of up to 6 elements:

settings

A list containing the arguments provided to the ris function.

NF

The total number of required participants in a fixed-effect meta-analysis if type is prospective. Contains a list if the type is retrospective, where NF is the additional required number of participants and NF_full is the total required number of participants.

NR_tau

A list containing: minTrial the minimum number of trials. nPax a matrix containing four possible number of trials with the number of participants per trial and total number of participants. tau2 the estimate used for the calculation. Might contain NR_tau_ll and NR_tau_ul which contain the same three elements. NR_tau_ll is based on the lower value in the confidence interval of tau2. NR_tau_ul is based on the upper value in the confidence interval for tau2. If the type is prospective the numbers are the total required. If the type is retrospective the numbers are the additional required.

NR_D2

The total number of required participants in a random-effects meta-analysis adjusted by diversity (D2) if type is prospective. Contains a list if the type is retrospective, where NR_D2 is the additional required number of participants and NR_D2_full is the total required number of participants.

NR_I2

The total number of required participants in a random-effects meta-analysis adjusted by inconsistency (I2) if type is prospective. Contains a list if the type is retrospective, where NR_I2 is the additional required number of participants and NR_I2_full is the total required number of participants.

Examples

# Sample and trial size calculation for prospective meta-analysis
ris(outcome = "RR", mc = 0.8, pC = 0.12, fixed = TRUE, alpha = 0.05,
beta = 0.1, side = 2)

# Additional sample and trial size calculation for retrospective meta-analysis 
# It is calculated directly from the metaanalysis() function
data("perioOxy")
ma <- metaanalysis(outcome = "RR", data = perioOxy, mc = 0.8, beta = 0.2)
ma$ris
# Or by using the two functions in sequence
ma <- metaanalysis(outcome = "RR", data = perioOxy)
ris(outcome = "RR", mc = 0.8, ma = ma, type = "retrospective", fixed = FALSE,
 beta = 0.2, alpha = 0.05, side = 2)

R version of Trial Sequential Analysis. Used for designing and analysing sequential meta-analyses.

Description

R version of Trial Sequential Analysis. Used for designing and analysing sequential meta-analyses.

Usage

RTSA(
  type = "design",
  outcome = NULL,
  side = 2,
  alpha = 0.05,
  beta = 0.1,
  futility = "none",
  es_alpha = "esOF",
  es_beta = NULL,
  timing = NULL,
  data = NULL,
  design = NULL,
  ana_times = NULL,
  fixed = FALSE,
  mc = NULL,
  RRR = NULL,
  sd_mc = NULL,
  pC = NULL,
  weights = "MH",
  re_method = "DL_HKSJ",
  tau_ci_method = "BJ",
  gamma = NULL,
  rho = NULL,
  study = NULL,
  cont_vartype = "equal",
  zero_adj = 0.5,
  tau2 = NULL,
  I2 = NULL,
  D2 = NULL,
  trials = NULL,
  final_analysis = NULL,
  inf_type = "sw",
  conf_level = 0.95,
  random_adj = "tau2",
  power_adj = TRUE,
  ...
)

Arguments

type

Type of RTSA. Options are "design" or "analysis".

outcome

Outcome metric. Options are: RR (risk ratio/relative risk), OR (odds ratio), RD (risk difference) and MD (mean difference).

side

Whether a 1- or 2-sided hypothesis test is used. Options are 1 or 2. Default is 2.

alpha

The level of type I error as a percentage, the default is 0.05 corresponding to 5%.

beta

The level of type II error as a percentage, the default is 0.1 corresponding to 10%.

futility

Futility boundaries added to design. Options are: none, non-binding and binding. Default is "none".

es_alpha

The spending function for alpha-spending. Options are: esOF (Lan & DeMets version of O'Brien-Fleming), esPoc (Lan & DeMets version of Pocock), HSDC (Hwang Sihi and DeCani) and rho (rho family).

es_beta

The spending function for beta-spending. For options see es_alpha.

timing

Expected timings of interim analyses when type = "design". Defaults to NULL.

data

A data.frame containing the study results. The data set must containing a specific set of columns. These are respectively 'eI' (events in intervention group), 'eC' (events in control group), 'nC' (participants intervention group) or 'nI' (participants control group) for discrete data, or, 'mI' (mean intervention group), 'mC' (mean control group), 'sdI' (standard error intervention group), 'sdC' (standard error control group),'nC' (participants intervention group) and 'nI' (participants control group) for continuous outcomes. Preferable also a 'study' column as an indicator of study.

design

RTSA object where type is design.

ana_times

An optional vector of analysis times. Used if the sequential analysis is not done for all studies included in the meta-analysis.

fixed

Should only a fixed-effect meta-analysis be computed. Default is FALSE.

mc

Minimal clinical relevant outcome value

RRR

Relative risk reduction. Used for binary outcomes with outcome metric RR. Argument mc can be used instead. Must be a value between 0 and 1.

sd_mc

The expected standard deviation. Used for sample size calculation for mean differences.

pC

The expected probability of event in the control group. Used for sample size calculation for binary outcomes.

weights

Weighting method options include IV (inverse-variance) and MH (Mantel-Haenszel). Defaults to MH.

re_method

Method for calculating the estimate of heterogeneity, tau^2, and the random-effects meta-analysis variance. Options are "DL" for DerSimonian-Laird and "DL_HKSJ" for the Hartung-Knapp-Sidik-Jonkman adjustment of the DerSimonian-Laird estimator.

tau_ci_method

Method for calculating confidence intervals for the estimated heterogeneity tau^2. Options are "QP" for Q-profiling and "BJ" for Biggelstaff ....

gamma

Parameter for the HSDC error spending function.

rho

Parameter for the rho family error spending function.

study

An optional vector of study names and perhaps year of study. Defaults to NULL.

cont_vartype

For mean difference outcomes, do we expect the variance in the different groups to be "equal" or "non-equal".

zero_adj

Zero adjustment. Options for now is 0.5.

tau2

Heterogeneity estimate. Used for sample and trial size calculation. Defaults to NULL.

I2

Inconsistency estimate. Used for sample and trial size calculation. Defaults to NULL.

D2

Diversity estimate. Used for sample and trial size calculation. Defaults to NULL.

trials

Number of anticipated extra trials. Used for heterogeneity adjustment by tau2.

final_analysis

Whether or not the current analysis is the final analysis.

inf_type

Stopping time confidence interval. Options for now is sw (stage-wise).

conf_level

Confidence level on stopping time confidence interval.

random_adj

The sample size adjustment based on presence of heterogeneity. Options are "D2" (Diversity), "I2" (Inconsistency) and "tau2" (the heterogeneity estimate). Default is "tau2".

power_adj

Whether the sample size should be adjusted by the sequential design. Defaults to TRUE.

...

other arguments

Value

A RTSA object, a list of five elements:

settings

A list containing all of the settings used in the RTSA call. See Arguments.

ris

List containing sample and trial size calculations for a non-sequential meta-analysis. See documentation for ris function.

bounds

List of stopping boundaries, timing of trials and more. See documentation for boundaries function.

results

List of 3 to 7 elements. AIS Achieved information size. RIS Fixed-effect required information size for a non-sequential meta-analysis. SMA_RIS RIS adjusted for sequential analysis. HARIS Heterogeneity adjusted required information size for a non-sequential meta-analysis. SMA_HARIS HARIS adjusted for sequential analysis. results_df a data.frame of inference, see documentation for inference function. seq_inf a list of conditional inference, see documentation for inference function. metaanalysis A metaanalysis object, see documentation for metaanalysis function. design_df a data.frame containing the stopping boundaries and timings from the design.

warnings

List of warnings

Examples

## Not run: 
### Retrospective sequential meta-analysis:
# A RRR of 20% is expected which gives mc = 1 - RRR = 0.8. 
# No futility boundaries
data(perioOxy)
RTSA(type = "analysis", data = perioOxy, outcome = "RR", mc = 0.8, side = 2,
 alpha = 0.05, beta = 0.2, es_alpha = "esOF")

# Set binding futility boundaries
# And use Lan and DeMets' version of Pocock stopping boundaries 
RTSA(type = "analysis", data = perioOxy, outcome = "RR", mc = 0.8, side = 2,
 alpha = 0.05, beta = 0.2, es_alpha = "esOF", futility = "binding",
 es_beta = "esPoc", random_adj = "D2")

# Set non-binding futility boundaries
RTSA(type = "analysis", data = perioOxy, outcome = "RR", mc = 0.8, side = 2,
 alpha = 0.05, beta = 0.2, es_alpha = "esOF", futility = "non-binding",
 es_beta = "esOF")
 
### Design a prospective sequential meta-analysis
# For continuous data without expected heterogeneity
RTSA(type = "design", outcome = "MD", mc = 5, sd_mc = 10, side = 1, 
timing = c(0.33, 0.66, 1), fixed = TRUE,
alpha = 0.025, beta = 0.1, es_alpha = "esOF", futility = "non-binding", 
es_beta = "esPoc")

# For binary outcome
RTSA(type = "design", outcome = "RR", mc = 0.75, side = 1, 
timing = c(0.33, 0.66, 1), pC = 0.1, D2 = 0.1, 
alpha = 0.025, beta = 0.2, es_alpha = "esOF", futility = "non-binding", 
es_beta = "esOF")

# extract sample size calculation
out_rtsa <-  RTSA(type = "design", outcome = "RR", mc = 0.75, side = 1, 
timing = c(0.33, 0.66, 1), pC = 0.1, D2 = 0.1, 
alpha = 0.025, beta = 0.2, es_alpha = "esOF", futility = "non-binding", 
es_beta = "esOF")
out_rtsa$ris

# plot the design
plot(out_rtsa)

# update the design with data as it accumulates (here toy-data)
fake_data <- data.frame(eI = c(10,10), eC = c(13, 11), nI = c(750, 750),
nC = c(750,750))
RTSA(type = "analysis", design = out_rtsa, data = fake_data)

# plot the analysis
an_rtsa <- RTSA(type = "analysis", design = out_rtsa, data = fake_data)
plot(an_rtsa)

## End(Not run)