Analysis Model
Summary
Analysis models define statistical methods (e.g., significance tests or descriptive statistics) that are applied to the study data in a clinical trial.
Initialization
An analysis model can be initialized using the following command:
It is highly recommended to use this command to initialize an analysis model as it will simplify the process of specifying components of the data model, including the MultAdj
, MultAdjProc
, MultAdjStrategy
, Test
, Statistic
objects.
Components of an analysis model
After an AnalysisModel
object has been initialized, components of the analysis model can be specified by adding objects to the model using the ‘+’ operator as shown below.
Test
object
Description
This object specifies a significance test that will be applied to one or more samples defined in a data model. A Test
object is defined by the following four arguments:

id
defines the test’s unique ID (label). 
method
defines the significance test. 
samples
defines the IDs of the samples (defined in the data model) that the significance test is applied to. 
par
defines the parameter(s) of the statistical test.
Several commonly used significance tests are already implemented in the Mediana package. In addition, the user can easily define custom significance tests (see Userdefined functions). The builtin tests are listed below along with the required parameters that need to be included in the par
argument:
TTest
: perform the twosample ttest between the two samples defined in thesamples
argument. Optional parameter:larger
(Larger value is expected in the second sample (TRUE
orFALSE
)).TTestNI
: perform the noninferiority twosample ttest between the two samples defined in thesamples
argument. Required parameter:margin
(positive noninferiority margin). Optional parameter:larger
(Larger value is expected in the second sample (TRUE
orFALSE
)).WilcoxTest
: perform the WilcoxonMannWhitney test between the two samples defined in thesamples
argument. Optional parameter:larger
(Larger value is expected in the second sample (TRUE
orFALSE
)).PropTest
: perform the twosample test for proportions between the two samples defined in thesamples
argument. Optional parameter:yates
(Yates’ continuity correction flag that is set toTRUE
orFALSE
) andlarger
(Larger value is expected in the second sample (TRUE
orFALSE
)).PropTestNI
: perform the noninferiority twosample test for proportions between the two samples defined in thesamples
argument. Required parameter:margin
(positive noninferiority margin). Optional parameter:yates
(Yates’ continuity correction flag that is set toTRUE
orFALSE
) andlarger
(Larger value is expected in the second sample (TRUE
orFALSE
)).FisherTest
: perform the Fisher exact test between the two samples defined in thesamples
argument. Optional parameter:larger
(Larger value is expected in the second sample (TRUE
orFALSE
)).GLMPoissonTest
: perform the Poisson regression test between the two samples defined in thesamples
argument. Optional parameter:larger
(Larger value is expected in the second sample (TRUE
orFALSE
)).GLMNegBinomTest
: perform the Negativebinomial regression test between the two samples defined in thesamples
argument. Optional parameter:larger
(Larger value is expected in the second sample (TRUE
orFALSE
)).LogrankTest
: perform the Logrank test between the two samples defined in thesamples
argument. Optional parameter:larger
(Larger value is expected in the second sample (TRUE
orFALSE
)).OrdinalLogisticRegTest
: perform an Ordinal logistic regression test between the two samples defined in thesamples
argument. Optional parameter:larger
(Larger value is expected in the second sample (TRUE
orFALSE
)).
It needs to be noted that the significance tests listed above are implemented as onesided tests and thus the sample order in the samples
argument is important. In particular, the Mediana package assumes by default that a numerically larger value of the endpoint is expected in Sample 2 compared to Sample 1. Suppose, for example, that a higher treatment response indicates a beneficial effect (e.g., higher improvement rate). In this case Sample 1 should include control patients whereas
Sample 2 should include patients allocated to the experimental treatment arm. The sample order needs to be reversed if a beneficial treatment effect is associated with a lower value of the endpoint (e.g., lower blood pressure), or alternatively (from version 1.0.6), the optional parameters larger
must be set to FALSE
to indicate that a larger value is expected on the first Sample.
Several Test
objects can be added to an AnalysisModel
object.
For more information about the Test
object, see the package’s documentation Test on the CRAN web site.
Example
Examples of Test
objects:
Carry out the twosample ttest:
# Placebo and Treatment samples were defined in the data model
Test(id = "Placebo vs treatment",
samples = samples("Placebo", "Treatment"),
method = "TTest")
Carry out the twosample ttest with larger values expected in the first sample (from v1.0.6):
# Placebo and Treatment samples were defined in the data model
Test(id = "Placebo vs treatment",
samples = samples("Treatment", "Placebo"),
method = "TTest",
par = parameters(larger = FALSE))
Example
Examples of Test
objects:
Carry out the twosample ttest:
Carry out the twosample ttest with larger values expected in the first sample (from v1.0.6):
Carry out the twosample ttest for noninferiority:
Carry out the twosample ttest with pooled samples:
Statistic
object
Description
This object specifies a descriptive statistic that will be computed based on one or more samples defined in a data model. A Statistic
object is defined by four arguments:

id
defines the descriptive statistic’s unique ID (label). 
method
defines the type of statistic/method for computing the statistic. 
samples
defines the samples (predefined in the data model) to be used for computing the statistic. 
par
defines the parameter(s) of the statistic.
Several methods for computing descriptive statistics are already implemented in the Mediana package and the user can also define custom functions for computing descriptive statistics (see Userdefined functions). These methods are shown below along with the required parameters that need to be defined in the par
argument:

MedianStat
: compute the median of the sample defined in thesamples
argument. 
MeanStat
: compute the mean of the sample defined in thesamples
argument. 
SdStat
: compute the standard deviation of the sample defined in thesamples
argument. 
MinStat
: compute the minimum value in the sample defined in thesamples
argument. 
MaxStat
: compute the maximum value in the sample defined in thesamples
argument. 
DiffMeanStat
: compute the difference of means between the two samples defined in thesamples
argument. Two samples must be defined. 
EffectSizeContStat
: compute the effect size for a continuous endpoint. Two samples must be defined. 
RatioEffectSizeContStat
: compute the ratio of two effect sizes for a continuous endpoint. Four samples must be defined. 
PropStat
: compute the proportion of the sample defined in thesamples
argument. 
DiffPropStat
: compute the difference of the proportions between the two samples defined in thesamples
argument. Two samples must be defined. 
EffectSizePropStat
: compute the effect size for a binary endpoint. Two samples must be defined. 
RatioEffectSizePropStat
: compute the ratio of two effect sizes for a binary endpoint. Four samples must be defined. 
HazardRatioStat
: compute the hazard ratio of the two samples defined in the samples argument. Two samples must be defined. By default the LogRank method is used. Optional argument:method
taking as valueLogRank
orCox
. 
EffectSizeEventStat
: compute the effect size for a survival endpoint (log of the HR. Two samples must be defined. Two samples must be defined. By default the LogRank method is used. Optional argument:method
taking as valueLogRank
orCox
. 
RatioEffectSizeEventStat
: compute the ratio of two effect sizes for a survival endpoint based on the LogRank method. Four samples must be defined. By default the LogRank method is used. Optional argument:method
taking as valueLogRank
orCox
. 
EventCountStat
: compute the number of events observed in the sample(s) defined in thesamples
argument. 
PatientCountStat
: compute the number of patients observed in the sample(s) defined in thesamples
argument
Several Statistic
objects can be added to an AnalysisModel
object.
For more information about the Statistic
object, see the R documentation Statistic.
Example
Examples of Statistic
objects:
Compute the mean of a single sample:
MultAdjProc
object
Description
This object specifies a multiplicity adjustment procedure that will be applied to the significance tests in order to protect the overall Type I error rate. A MultAdjProc
object is defined by three arguments:

proc
defines a multiplicity adjustment procedure. 
par
defines the parameter(s) of the multiplicity adjustment procedure (optional). 
tests
defines the specific tests (defined in the analysis model) to which the multiplicity adjustment procedure will be applied.
If no tests
are defined, the multiplicity adjustment procedure will be applied to all tests defined in the AnalysisModel
object.
Several commonly used multiplicity adjustment procedures are included in the Mediana package. In addition, the user can easily define custom multiplicity adjustments. The builtin multiplicity adjustments are defined below along with the required parameters that need to be included in the par
argument:

BonferroniAdj
: Bonferroni procedure. Optional parameter:weight
(vector of hypothesis weights). 
HolmAdj
: Holm procedure. Optional parameter:weight
(vector of hypothesis weights). 
HochbergAdj
: Hochberg procedure. Optional parameter:weight
(vector of hypothesis weights). 
HommelAdj
: Hommel procedure. Optional parameter:weight
(vector of hypothesis weights). 
FixedSeqAdj
: Fixedsequence procedure. 
ChainAdj
: Family of chain procedures. Required parameters:weight
(vector of hypothesis weights) andtransition
(matrix of transition parameters). 
FallbackAdj
: Fallback procedure. Required parameters:weight
(vector of hypothesis weights). 
NormalParamAdj
: Parametric multiple testing procedure derived from a multivariate normal distribution. Required parameter:corr
(correlation matrix of the multivariate normal distribution). Optional parameter:weight
(vector of hypothesis weights). 
ParallelGatekeepingAdj
: Family of parallel gatekeeping procedures. Required parameters:family
(vectors of hypotheses included in each family),proc
(vector of procedure names applied to each family),gamma
(vector of truncation parameters). 
MultipleSequenceGatekeepingAdj
: Family of multiplesequence gatekeeping procedures. Required parameters:family
(vectors of hypotheses included in each family),proc
(vector of procedure names applied to each family),gamma
(vector of truncation parameters). 
MixtureGatekeepingAdj
: Family of mixturebased gatekeeping procedures. Required parameters:family
(vectors of hypotheses included in each family),proc
(vector of procedure names applied to each family),gamma
(vector of truncation parameters),serial
(matrix of indicators),parallel
(matrix of indicators).
Several MultAdjProc
objects can be added to an AnalysisModel
object using the ‘+’ operator or by grouping them into a MultAdj object.
For more information about the MultAdjProc
object, see the package’s documentation MultAdjProc.
Example
Examples of MultAdjProc
objects:
Apply a multiplicity adjustment based on the chain procedure:
This procedure implementation is facilicated by the use of the FixedSeqAdj
method intoduced in version 1.0.4.
Apply a multiplesequence gatekeeping procedure:
MultAdjStrategy
object
Description
This object specifies a multiplicity adjustment strategy that can include several multiplicity adjustment procedures. A multiplicity adjustment strategy may be defined when the same Clinical Scenario Evaluation approach is applied to several clinical trials.
A MultAdjStrategy
object serves as a wrapper for several MultAdjProc
objects.
For more information about the MultAdjStrategy
object, see the package’s documentation MultAdjStrategy.
Example
Example of a MultAdjStrategy
object:
Perform complex multiplicity adjustments based on gatekeeping procedures in two clinical trials with three endpoints:
MultAdj
object
Description
This object can be used to combine several MultAdjProc
or MultAdjStrategy
objects and add them as a single object to an AnalysisModel
object . This object is provided mainly for convenience and its use is optional. Alternatively, MultAdjProc
or MultAdjStrategy
objects can be added to an AnalysisModel
object incrementally using the ‘+’ operator.
For more information about the MultAdj
object, see the package’s documentation MultAdj.
Example
Example of a MultAdj
object:
Perform Clinical Scenario Evaluation to compare three candidate multiplicity adjustment procedures: