## Registered S3 method overwritten by 'spatstat.geom':
## method from
## print.boxx cli
In this page, we present the code we used for our example in the presentation by Dr. Monica Taljaard. The sample size calculators we used are:
Another popular calculator ShinyCRT (https://clusterrcts.shinyapps.io/rshinyapp/) can also be used to do the calculation but no demonstration is shown in this document.
A Shiny app to assist users to view and select the most suitable sample size and power calculation software for their SW-CRTs can be found at: https://douyang.shinyapps.io/swcrtcalculator/
The last part of this document has an example to demonstrate how to use this Shiny app
Objectives: To evaluate “feasibility and effectiveness” of a brief psychosocial intervention for depressed cancer patients, tailored to patient symptoms and distress, delivered by trained front-line health professionals in routine clinical care.
Intervention: Health professionals (HPs) trained to deliver intervention. HPs participated in group supervision with a psychiatrist.
Design: Cross-sectional SW-CRT; 5 sequences, 7 periods with transition.
Primary outcome: Depression measured with the HADS
Results: Recruited 4 sites (181 patients in control, 177 intervention); adjusted mean difference: −1.23 (95% CI: −3.81 to 1.35, p = 0.35).
(Turner, Jane et al. doi:10.1007/s00520-016-3382-0)
| Parameters | Value |
|---|---|
| Number of sequences | 5 |
| Number of clusters per sequence | 1 |
| Number of patients per cluster-period | 20 |
| Mean difference | 4.2 |
| Standard deviation | 9 |
| Significance level | Two-sided, 5% |
| Correlation.structure | wpICC | CAC |
|---|---|---|
| Exchangeable | 0.013 | 1.000 |
| Nested exchangeable | 0.032 | 0.174 |
| Exponential decay | 0.031 | 0.249 |
In the first scenario, we consider a complete design, and the design matrix is as follow
swCRTdesign has a built-in function swDsn to create a design matrix. User need to specify the number of cluster at each sequence to create a design matrix. For example, we have five sequences with one cluster at each sequence:
library(swCRTdesign)
DM1 <- swDsn(c(1,1,1,1,1))
# view design matrix
DM1$swDsn
## [,1] [,2] [,3] [,4] [,5] [,6]
## [1,] 0 1 1 1 1 1
## [2,] 0 0 1 1 1 1
## [3,] 0 0 0 1 1 1
## [4,] 0 0 0 0 1 1
## [5,] 0 0 0 0 0 1
# Scenario #1
# Exchangeable correlation structures
swPwr(DM1, distn="gaussian",
# you can replace DM1 by swDsn(c(1,1,1,1,1)) if you did not define it earlier
# icc = wpICC, cac = 1 for exchangeable correlation structure
n=20, mu0=0, mu1=4.2, sigma=9, icc=0.013, cac = 1,
alpha=0.05, retDATA=FALSE)
## [1] 0.9497322
# Nested correlation structures correlation structures
swPwr(DM1, distn="gaussian",
n=20, mu0=0, mu1=4.2, sigma=9, icc=0.032, cac = 0.174,
alpha=0.05, retDATA=FALSE)
## [1] 0.8797228
In this SAS macro, users need to specify two ICC estimates: alpha1 = wpICC and alpha2 = bpICC. In case of exponential decay, users need to specify alpha0 = wpICC and r0 = decaying parameter. Please note that the exchangeable correlation structure can be achieved by setting alpha1=alpha2
%include "C:\Users\Derek Ouyang\Desktop\CRTFASTGEEPWR.v1.01.sas";
*\ Change the path to your local path;
*\ exchangeable;
*\correlation structure
%CRTFASTGEEPWR(alpha=0.05, m =%str({1,1,1,1,1}), corr_type = 1,
/* m = a vector of the number of clusters in each sequence; */
/* corr_type = 1- nested exchangeable/ 2- exponential decay /
3 - block exchangeable/ 4 - proportional decay; */
/* alpha1 = alpha2 = wp-ICC; */
alpha1 = 0.013, alpha2 = 0.013 ,
df_choice=2, intervention_effect_type=1 , delta = 0.4666666, /* standardized treatment effect is required: mean difference/SD */
period_effect_type= 1 , beta_period_effects =%str({1,1,1,1,1,1}), dist = "normal",
phi=1,
CP_size_matrix = %str({20 20 20 20 20 20,
20 20 20 20 20 20,
20 20 20 20 20 20,
20 20 20 20 20 20,
20 20 20 20 20 20}),
DesignPattern = %str({0 1 1 1 1 1,
0 0 1 1 1 1,
0 0 0 1 1 1,
0 0 0 0 1 1,
0 0 0 0 0 1}));
The output from SAS is:
Note: This calculator use the value of wpICC and bpICC
zpower refers to the power using normal approximation
tpower refers to the power using t-distribution with degree of freedom Number of cluster - 2
*\ nested exchangeable;
%CRTFASTGEEPWR(alpha=0.05, m =%str({1,1,1,1,1}), corr_type = 1,
/* m = a vector of the number of clusters in each sequence; */
/* corr_type = 1- nested exchangeable/ 2- exponential decay /
3 - block exchangeable/ 4 - proportional decay; */
/* alpha1 = wp-ICC; alpha2 = bp-ICC; */
alpha1 = 0.032, alpha2 = 0.005568 ,
/* standardized treatment effect is required: mean difference/SD; */
df_choice=2, intervention_effect_type=1 , delta = 0.4666666,
period_effect_type= 1 , beta_period_effects =%str({1,1,1,1,1,1}), dist = "normal",
phi=1,
CP_size_matrix = %str({20 20 20 20 20 20,
20 20 20 20 20 20,
20 20 20 20 20 20,
20 20 20 20 20 20,
20 20 20 20 20 20}),
DesignPattern = %str({0 1 1 1 1 1,
0 0 1 1 1 1,
0 0 0 1 1 1,
0 0 0 0 1 1,
0 0 0 0 0 1}));
The output from SAS is:
*\ Exponential decay;
%CRTFASTGEEPWR(alpha=0.05, m =%str({1,1,1,1,1}), corr_type = 2,
/* m = a vector of the number of clusters in each sequence; */
/* corr_type = 1- nested exchangeable/ 2- exponential decay /
3 - block exchangeable/ 4 - proportional decay; */
/* alpha0 = wp-ICC; r0 = decaying parameter (CAC); */
alpha0 = 0.031, r0 = 0.249 ,
/* standardized treatment effect is required: mean difference/SD; */
df_choice=2, intervention_effect_type=1 , delta = 0.4666666,
period_effect_type= 1 , beta_period_effects =%str({1,1,1,1,1,1}), dist = "normal",
phi=1,
CP_size_matrix = %str({20 20 20 20 20 20,
20 20 20 20 20 20,
20 20 20 20 20 20,
20 20 20 20 20 20,
20 20 20 20 20 20}),
DesignPattern = %str({0 1 1 1 1 1,
0 0 1 1 1 1,
0 0 0 1 1 1,
0 0 0 0 1 1,
0 0 0 0 0 1}));
The output from SAS is:
In this scenario, we consider a design with transition period. The design matrix is as follow:
The empty cell means there are no data collection
First, we need to create a design matrix for scenario two. Please note that a regular design for a SW-CRT with 5 sequences usually has 6 periods. However, in this example, we have an extra period which allows all clusters to experience at least one intervention period. Therefore, we need the parameter extra.time = 1 in swDsn function to create the design matrix
DM2 <- swDsn(c(1,1,1,1,1),extra.time = 1)
DM2$swDsn
## [,1] [,2] [,3] [,4] [,5] [,6] [,7]
## [1,] 0 1 1 1 1 1 1
## [2,] 0 0 1 1 1 1 1
## [3,] 0 0 0 1 1 1 1
## [4,] 0 0 0 0 1 1 1
## [5,] 0 0 0 0 0 1 1
To accommodate transition period in this calculator, we need additional parameter n which is a matrix (has the same dimension as the design matrix) presenting the size for each cluster period. We need to enter the size of 0 at these transition periods to achieve incomplete design
n <- matrix(c(c(20,0,20,20,20,20,20),c(20,20,0,20,20,20,20),c(20,20,20,0,20,20,20),
c(20,20,20,20,0,20,20),c(20,20,20,20,20,0,20)),5,7,byrow=TRUE)
n
## [,1] [,2] [,3] [,4] [,5] [,6] [,7]
## [1,] 20 0 20 20 20 20 20
## [2,] 20 20 0 20 20 20 20
## [3,] 20 20 20 0 20 20 20
## [4,] 20 20 20 20 0 20 20
## [5,] 20 20 20 20 20 0 20
swPwr(DM2, distn="gaussian",
# set the cluster-period size to 0 for transition periods
n=n,
mu0=0, mu1=4.2, icc=0.013, cac = 1, sigma=9,
alpha=0.05, retDATA=FALSE)
## Warning in swPwr(DM2, distn = "gaussian", n = n, mu0 = 0, mu1 = 4.2, icc =
## 0.013, : The order of variance component arguments has changed for swPwr (in
## version 2.2.0, it was tau, eta, rho, sigma); please modify existing code if
## necessary.
## Warning in swPwr(DM2, distn = "gaussian", n = n, mu0 = 0, mu1 = 4.2, icc =
## 0.013, : When sample sizes are not uniform, power depends on order of clusters
## (see documentation).
## [1] 0.8224903
swPwr(swDsn(c(1,1,1,1,1),extra.time = 1), distn="gaussian",
# set the cluster-period size to 0 for transition periods
n=matrix(c(c(20,0,20,20,20,20,20),c(20,20,0,20,20,20,20),c(20,20,20,0,20,20,20),
c(20,20,20,20,0,20,20),c(20,20,20,20,20,0,20)),5,7,byrow=TRUE),
mu0=0, mu1=4.2, icc=0.032, cac = 0.174, sigma=9,
alpha=0.05, retDATA=FALSE)
## Warning in swPwr(swDsn(c(1, 1, 1, 1, 1), extra.time = 1), distn = "gaussian", :
## The order of variance component arguments has changed for swPwr (in version
## 2.2.0, it was tau, eta, rho, sigma); please modify existing code if necessary.
## Warning in swPwr(swDsn(c(1, 1, 1, 1, 1), extra.time = 1), distn = "gaussian", :
## When sample sizes are not uniform, power depends on order of clusters (see
## documentation).
## [1] 0.7031334
CRTFASTGEEPWR has a different way to specify incomplete design. We need to specify the cluster-period size of 0 in the CP_size_matrix parameter and enter 2 for transition periods in the DesignPattern parameter
*\ exchangeable;
%CRTFASTGEEPWR(alpha=0.05, m =%str({1,1,1,1,1}), corr_type = 1,
/* m = a vector of the number of clusters in each sequence; */
/* alpha1 = alpha2 = wp-ICC; */
alpha1 = 0.013, alpha2 = 0.013 ,
/* standardized treatment effect is required: mean difference/SD; */
df_choice=2, intervention_effect_type=1 , delta = 0.4666666,
period_effect_type= 1 , beta_period_effects =%str({1,1,1,1,1,1,1}), dist = "normal",
phi=1,
CP_size_matrix = %str({20 0 20 20 20 20 20,
20 20 0 20 20 20 20,
20 20 20 0 20 20 20,
20 20 20 20 0 20 20,
20 20 20 20 20 0 20}),
DesignPattern = %str({0 2 1 1 1 1 1,
0 0 2 1 1 1 1,
0 0 0 2 1 1 1,
0 0 0 0 2 1 1,
0 0 0 0 0 2 1}));
The output from SAS is:
*\ nested exchangeable;
%CRTFASTGEEPWR(alpha=0.05, m =%str({1,1,1,1,1}), corr_type = 1,
/* m = a vector of the number of clusters in each sequence; */
/* alpha1 = wp-ICC; alpha2 = bp-ICC; */
alpha1 = 0.032, alpha2 = 0.005568 ,
/* standardized treatment effect is required: mean difference/SD; */
df_choice=2, intervention_effect_type=1 , delta = 0.4666666,
period_effect_type= 1 , beta_period_effects =%str({1,1,1,1,1,1,1}), dist = "normal",
phi=1,
CP_size_matrix = %str({20 0 20 20 20 20 20,
20 20 0 20 20 20 20,
20 20 20 0 20 20 20,
20 20 20 20 0 20 20,
20 20 20 20 20 0 20}),
DesignPattern = %str({0 2 1 1 1 1 1,
0 0 2 1 1 1 1,
0 0 0 2 1 1 1,
0 0 0 0 2 1 1,
0 0 0 0 0 2 1}));
The output from SAS is:
*\ Exponential decay;
%CRTFASTGEEPWR(alpha=0.05, m =%str({1,1,1,1,1}), corr_type = 2,
/* m = a vector of the number of clusters in each sequence; */
/* alpha1 = alpha2 = wp-ICC; alpha3 = wi-ICC; */
alpha0 = 0.031, r0 = 0.249 ,
/* standardized treatment effect is required: mean difference/SD; */
df_choice=2, intervention_effect_type=1 , delta = 0.4666666,
period_effect_type= 1 , beta_period_effects =%str({1,1,1,1,1,1,1}), dist = "normal",
phi=1,
CP_size_matrix = %str({20 0 20 20 20 20 20,
20 20 0 20 20 20 20,
20 20 20 0 20 20 20,
20 20 20 20 0 20 20,
20 20 20 20 20 0 20}),
DesignPattern = %str({0 2 1 1 1 1 1,
0 0 2 1 1 1 1,
0 0 0 2 1 1 1,
0 0 0 0 2 1 1,
0 0 0 0 0 2 1}));
The output from SAS is:
Objectives: To evaluate the effectiveness of a regional safe drinking water intervention in rural communities of Mexico
Intervention: Mesita Azul, an ultraviolet-disinfection system installed in households to treat drinking water
Design: Cohort SW-CRT; 6 sequences, 7 periods
Primary outcomes: Water contamination and diarrhea
Results: Recruited 24 communities (444 households; 1915 individuals). Reduced the percentage of households with contaminated drinking water (RD: −19% [95% CI: −27%, −14%]). No significant reduction in diarrhea (RD: −0.1% [95% CI: −1.1%, 0.9%])
(Gruber, Joshua S et al. doi:10.4269/ajtmh.13-0017)
| Parameters | Value |
|---|---|
| Number of sequences | 6 |
| Number of clusters per sequence | 4 |
| Number of patients per cluster-period | 80 |
| Baseline prevalence | 0.05 (5%) |
| Target difference | 0.0175 (35% relative reduction) |
| Secular trend | 0.05 (large) and 0.01 (samll) |
| Significance level | Two-sided, 5% |
In additional to regular parameters, we assume a null secular trend. That is, in absence of the treatment, as time goes, the proportion of household drinking contaminated water will be different from the baseline prevalence. To explore the impact of secular trend. We assumed two magnitudes of secular effects.
| Correlation.structure | wpICC | CAC | Intra.idnividual.correlation |
|---|---|---|---|
| Exchangeable | 0.10 | 1.000 | 0.600 |
| Nested exchangeable | 0.14 | 0.850 | 0.600 |
| Exponential decay | 0.14 | 0.939 | 0.939 |
The design matrix is as follow:
In presence of secular trend, methods with linear (normal) approximation (i.e., used in swCRTdesign and ShinyCRT) may not provide accurate power estimate. Here, we introduce another calculator swdpwr which is based on either maximum likelihood method (MLE) or generalized estimating equations (GEE). CRTFASTGEEPWR, which is based on GEE, can also be applied to account for secular effects
swdpwr require users to code design matrix using matrix function (a base function in R). User need to create design matrix based on above diagram. Remember, the above diagram only shows one cluster per sequence but our design has four clusters per sequence. Therefore, the dimension of design matrix is 24X7. There are different ways to create such a matrix. One example is:
dataset <- matrix(c(rep(c(0,1,1,1,1,1,1),4),rep(c(0,0,1,1,1,1,1),4),rep(c(0,0,0,1,1,1,1),4),
rep(c(0,0,0,0,1,1,1),4),rep(c(0,0,0,0,0,1,1),4),rep(c(0,0,0,0,0,0,1),4)),
24,7,byrow=TRUE)
dataset
## [,1] [,2] [,3] [,4] [,5] [,6] [,7]
## [1,] 0 1 1 1 1 1 1
## [2,] 0 1 1 1 1 1 1
## [3,] 0 1 1 1 1 1 1
## [4,] 0 1 1 1 1 1 1
## [5,] 0 0 1 1 1 1 1
## [6,] 0 0 1 1 1 1 1
## [7,] 0 0 1 1 1 1 1
## [8,] 0 0 1 1 1 1 1
## [9,] 0 0 0 1 1 1 1
## [10,] 0 0 0 1 1 1 1
## [11,] 0 0 0 1 1 1 1
## [12,] 0 0 0 1 1 1 1
## [13,] 0 0 0 0 1 1 1
## [14,] 0 0 0 0 1 1 1
## [15,] 0 0 0 0 1 1 1
## [16,] 0 0 0 0 1 1 1
## [17,] 0 0 0 0 0 1 1
## [18,] 0 0 0 0 0 1 1
## [19,] 0 0 0 0 0 1 1
## [20,] 0 0 0 0 0 1 1
## [21,] 0 0 0 0 0 0 1
## [22,] 0 0 0 0 0 0 1
## [23,] 0 0 0 0 0 0 1
## [24,] 0 0 0 0 0 0 1
In this R package, users need to specify three ICC estimates: alpha0 = wpICC, alpha1 = bpICC, and alpha2 = intra-individual ICC. Please note that the exchangeable correlation structure can be achieved by setting alpha0=alpha1
The code used for the calculation is as follow (please read the comments in the code to understand how each parameter was specified):
library(swdpwr)
# large secular trend
swdpower(K = 80, design = dataset, family = "binomial", model = "marginal", link = "identity",
# meanresponse_start is the baseline prevalence, meanresponse_end0 is the prevalence in the control
# group at the end of the control (baseline prevalence + secular trend = 0.05 + 0.05 = 0.1)
# meanresponse_end1 is the prevalence in the intervention group at the end of trial = 0.0825
# Remember, target difference = meanresponse_end1 - meanresponse_end0 = 0.0825 - 0.1 = 0.0175
type = "cohort", meanresponse_start = 0.05, meanresponse_end0 = 0.1, meanresponse_end1 = 0.0825,
# alpha0 = wpICC, alpha1 = bpICC, alpha2 = intra-individual correlation
typeIerror = 0.05, alpha0 = 0.1, alpha1 = 0.1, alpha2 = 0.6)
## This cohort study has total sample size of 1920
## Power for this scenario is 0.927 for the alternative hypothesis treatment effect beta = -0.018 (two-sided Type I error = 0.05 )
# small secular trend
swdpower(K = 80, design = dataset, family = "binomial", model = "marginal", link = "identity",
type = "cohort", meanresponse_start = 0.05, meanresponse_end0 = 0.06, meanresponse_end1 = 0.0425,
# For small secular trend, meanresponse_end0 is 0.05 + 0.01 = 0.06
# Since the time trend has been changed, to keep the same target difference
# the meanresponse_end1 has to be changed such that meanresponse_end1 - meanresponse_end0 = -0.0175
# alpha0 = wpICC, alpha1 = bpICC, alpha2 = intra-individual correlation
typeIerror = 0.05, alpha0 = 0.1, alpha1 = 0.1, alpha2 = 0.6)
## This cohort study has total sample size of 1920
## Power for this scenario is 0.958 for the alternative hypothesis treatment effect beta = -0.017 (two-sided Type I error = 0.05 )
# large secular trend
swdpower(K = 80, design = dataset, family = "binomial", model = "marginal", link = "identity",
type = "cohort", meanresponse_start = 0.05, meanresponse_end0 = 0.1, meanresponse_end1 = 0.0825,
# alpha1 = bpICC = wpICC * CAC = 0.1 * 0.8 =0.08
typeIerror = 0.05, alpha0 = 0.14, alpha1 = 0.119, alpha2 = 0.6)
## This cohort study has total sample size of 1920
## Power for this scenario is 0.369 for the alternative hypothesis treatment effect beta = -0.018 (two-sided Type I error = 0.05 )
# small secular trend
swdpower(K = 80, design = dataset, family = "binomial", model = "marginal", link = "identity",
type = "cohort", meanresponse_start = 0.05, meanresponse_end0 = 0.06, meanresponse_end1 = 0.0425,
# alpha1 = bpICC = wpICC * CAC = 0.1 * 0.8 = 0.08
typeIerror = 0.05, alpha0 = 0.14, alpha1 = 0.119, alpha2 = 0.6)
## This cohort study has total sample size of 1920
## Power for this scenario is 0.457 for the alternative hypothesis treatment effect beta = -0.017 (two-sided Type I error = 0.05 )
The code is similar as example one. However, we now need to change the parameter beta_period_effects as now the secular trend is not null. Remember, the prevalence in the control group is 0.05 at the baseline and 0.1 at the end of the trial and we have 7 periods. We assume that the prevalence at each period is equally spaced. Therefore, the beta_period_effects for large and small secular trend are:
## [1] 0.05000000 0.05833333 0.06666667 0.07500000 0.08333333 0.09166667 0.10000000
## [1] 0.05000000 0.05166667 0.05333333 0.05500000 0.05666667 0.05833333 0.06000000
In this SAS macro, users need to specify three ICC estimates: alpha1 = wpICC, alpha2 = bpICC, and alpha3 = intra-individual ICC. In case of proportional decay, users need to specify alpha0 = wpICC and r0 = decaying parameter. Please note that the exchangeable correlation structure can be achieved by setting alpha1=alpha2
The code for both large or small secular trend is similar except the the parameter beta_period_effects is different. Here, we only show the code and results for large secular trend. Users can replace the values of beta_period_effects by the second vector above to obtain the results for small secular trend
*\ exchangeable;
%CRTFASTGEEPWR(alpha=0.05, m =%str({4,4,4,4,4,4}), corr_type = 3,
/* m = a vector of the number of clusters in each sequence; */
/* alpha1 = wp-ICC; alpha2 = bp-ICC; alpha3 = intra-individual correlation; */
alpha1 = 0.1, alpha2 = 0.1, alpha3= 0.6,
/* standardized treatment effect is required: mean difference/SD; */
df_choice=2, intervention_effect_type=1 , delta = -0.0175,
period_effect_type= 1 , beta_period_effects =%str({0.05000000, 0.05833333, 0.06666667, 0.07500000, 0.08333333, 0.09166667, 0.10000000}), dist = "binary", link = "identity",
phi=1,
CP_size_matrix = %str({80 80 80 80 80 80 80,
80 80 80 80 80 80 80,
80 80 80 80 80 80 80,
80 80 80 80 80 80 80,
80 80 80 80 80 80 80,
80 80 80 80 80 80 80}),
DesignPattern = %str({0 1 1 1 1 1 1,
0 0 1 1 1 1 1,
0 0 0 1 1 1 1,
0 0 0 0 1 1 1,
0 0 0 0 0 1 1,
0 0 0 0 0 0 1}));
The output from SAS is:
*\ block exchangeable;
%CRTFASTGEEPWR(alpha=0.05, m =%str({4,4,4,4,4,4}), corr_type = 3,
/* m = a vector of the number of clusters in each sequence; */
/* alpha1 = wp-ICC; alpha2 = bp-ICC; alpha3 = intra-individual correlation; */
alpha1 = 0.1, alpha2 = 0.119, alpha3= 0.6,
/* standardized treatment effect is required: mean difference/SD; */
df_choice=2, intervention_effect_type=1 , delta = -0.0175,
period_effect_type= 1 , beta_period_effects =%str({0.05000000, 0.05833333, 0.06666667, 0.07500000, 0.08333333, 0.09166667, 0.10000000}), dist = "binary", link = "identity",
phi=1,
CP_size_matrix = %str({80 80 80 80 80 80 80,
80 80 80 80 80 80 80,
80 80 80 80 80 80 80,
80 80 80 80 80 80 80,
80 80 80 80 80 80 80,
80 80 80 80 80 80 80}),
DesignPattern = %str({0 1 1 1 1 1 1,
0 0 1 1 1 1 1,
0 0 0 1 1 1 1,
0 0 0 0 1 1 1,
0 0 0 0 0 1 1,
0 0 0 0 0 0 1}));
The output from SAS is:
*\ proportional decay exchangeable;
%CRTFASTGEEPWR(alpha=0.05, m =%str({4,4,4,4,4,4}), corr_type = 4,
/* m = a vector of the number of clusters in each sequence; */
/* alpha0 = wp-ICC; r0 = CAC = intra-indiviudal ICC; */
alpha0 = 0.1, r0= 0.939,
/* standardized treatment effect is required: mean difference/SD; */
df_choice=2, intervention_effect_type=1 , delta = -0.0175,
period_effect_type= 1 , beta_period_effects =%str({0.05000000, 0.05833333, 0.06666667, 0.07500000, 0.08333333, 0.09166667, 0.10000000}), dist = "binary", link = "identity",
phi=1,
CP_size_matrix = %str({80 80 80 80 80 80 80,
80 80 80 80 80 80 80,
80 80 80 80 80 80 80,
80 80 80 80 80 80 80,
80 80 80 80 80 80 80,
80 80 80 80 80 80 80}),
DesignPattern = %str({0 1 1 1 1 1 1,
0 0 1 1 1 1 1,
0 0 0 1 1 1 1,
0 0 0 0 1 1 1,
0 0 0 0 0 1 1,
0 0 0 0 0 0 1}));
The output from SAS is:
In order to help researchers to select the best SW-CRT calculators that may fit their SW trials, we developed a Shiny app to assist users to select the best calculators that can be used for power and sample size calculation. This calculation is available free at: https://douyang.shinyapps.io/swcrtcalculator/
A screenshot of the Shiny app is as follow. On the left column, there are common design features that people may consider when designing a SW-CRT. The users can select the feature(s) they want, and on the right panel, all calculators that may support the selected features may appear.
Suppose I am interested in a trial which has following features:
I want to find the a calculator on either SAS or R which can be used to perform power calculation for my trial. The follow screenshot shows how I click the features we want in the left panel and the calculator(s) that meets all the criteria
Note: Multiple selection under Software platform return the calculators operating on any of the selected platforms. Multiple selection under other sections returns the calculators that meet ALL selected features. Therefore, only select the features you must need to allow for maximum possibilities.