Title: | Sample Size Computations Controlling the Type-II Generalized Family-Wise Error Rate |
---|---|
Description: | The significance of mean difference tests in clinical trials is established if at least r null hypotheses are rejected among m that are simultaneously tested. This package enables one to compute necessary sample sizes for single-step (Bonferroni) and step-wise procedures (Holm and Hochberg). These three procedures control the q-generalized family-wise error rate (probability of making at least q false rejections). Sample size is computed (for these single-step and step-wise procedures) in a such a way that the r-power (probability of rejecting at least r false null hypotheses, i.e. at least r significant endpoints among m) is above some given threshold, in the context of tests of difference of means for two groups of continuous endpoints (variables). Various types of structure of correlation are considered. It is also possible to analyse data (i.e., actually test difference in means) when these are available. The case r equals 1 is treated in separate functions that were used in Lafaye de Micheaux et al. (2014) <doi:10.1080/10543406.2013.860156>. |
Authors: | Pierre Lafaye de Micheaux, Benoit Liquet and Jeremie Riou |
Maintainer: | Pierre Lafaye de Micheaux <[email protected]> |
License: | GPL (> 2) |
Version: | 1.0.2 |
Built: | 2025-02-18 03:55:09 UTC |
Source: | https://github.com/cran/rPowerSampleSize |
The package rPowerSampleSize has been developped in order to compute the sample size, and to analyse the data, in the context of multiple primary continuous endpoints in clinical trials. Two approaches are available for the decision rule “at least one significant endpoint among m”. All the procedures which correspond to this decision rule include 1m in the name of the function. An individual procedure based on Union-Intersection Procedure, and a global method based on multivariate linear model. This package for this decision rule contains four functions: two for the sample size determination (one for individual procedure, and one for a global method), and two for data analysis in order to resolve the multiple testing problems (one for individual procedure, and one for a global method). The sample size computation for the Bonferroni Procedure is also available. A generalisation of the first case is also available with a decision rule “at least r significant endpoint among the m primary endpoint”. The procedure which corresponds to this decision rule include rm in the name of the function. We have one functions here where we study the sample size computation.
Package: | rPowerSampleSize |
Type: | Package |
Version: | 1.0 |
Date: | 2012-03-21 |
License: | GPL (>2) |
LazyLoad: | yes |
Pierre Lafaye de Micheaux, Benoit Liquet and Jeremie Riou Maintainer: Pierre Lafaye de Micheaux <[email protected]>
This function computes the sample size for an analysis of multiple test with a single step Bonferroni procedure.
bonferroni.1m.ssc(mean.diff, sd, cor, power = 0.8, alpha = 0.05, alternative = "two.sided")
bonferroni.1m.ssc(mean.diff, sd, cor, power = 0.8, alpha = 0.05, alternative = "two.sided")
mean.diff |
vector of the mean differences of the |
sd |
vector of the standard deviations of the |
cor |
correlation matrix between the endpoints. These are assumed identical for both groups. |
power |
value which corresponds to the chosen power. |
alpha |
value which correponds to the chosen Type-I error rate bound. |
alternative |
character string specifying the alternative hypothesis, must be one of "two.sided" (default), "greater" or "less". |
Sample size |
The required sample size. |
P. Lafaye de Micheaux, B. Liquet and J. Riou
Lafaye de Micheaux P., Liquet B., Marque S., Riou J. (2014). Power and Sample Size Determination in Clinical Trials With Multiple Primary Continuous Correlated Endpoints, Journal of Biopharmaceutical Statistics, 24, 378–397. Adcock, C. J. (2007). Sample size determination: a review. Journal of the Royal Statistical Society: Series D (The Statistician), 46:261-283.
global.1m.analysis
,
indiv.1m.ssc
,
indiv.1m.analysis
,
global.1m.ssc
## Not run: # Sample size computation for the global method bonferroni.1m.ssc(mean.diff = c(0.1, 0.2, 0.3), sd = c(1, 1,1 ), cor = diag(1, 3)) ## End(Not run)
## Not run: # Sample size computation for the global method bonferroni.1m.ssc(mean.diff = c(0.1, 0.2, 0.3), sd = c(1, 1,1 ), cor = diag(1, 3)) ## End(Not run)
This function computes the complexity of our formulas.
complexity(method, exchangeable, r, p, display = TRUE)
complexity(method, exchangeable, r, p, display = TRUE)
method |
"Bonferroni", "Hochberg" or "Holm". |
exchangeable |
Logical indicating if we are in the exchangeable case or not. |
r |
integer, r = 1, ..., m. Desired number of endpoints to be declared significant. |
p |
integer, p = 1, ..., m. Indicates the number of false null hypotheses. |
display |
Logical. Should we display the complexity. |
Complexity of the formulas (i.e., number of individual probabilities
computed using the function pmvt
(or pmvnorm
) in the non
exchangeable case).
P. Lafaye de Micheaux, B. Liquet and J. Riou
Delorme P., Lafaye de Micheaux P., Liquet B., Riou, J. (2015). Type-II Generalized Family-Wise Error Rate Formulas with Application to Sample Size Determination. Statistics in Medicine. Romano J. and Shaikh A. (2006) Stepup Procedures For Control of Generalizations of the Familywise Error Rate. The Annals of Statistics, 34(4), 1850–1873.
This simulated dataset contains three outcomes, and one adjustement variable, divided in two groups.
data(data.sim)
data(data.sim)
A data frame with 100 observations on the following 5 variables.
Y1
numeric vector of the first outcome
Y2
numeric vector of the second outcome
Y3
numeric vector of the third outcome
Group
binary vector of the group variable
A
numeric vector of the adjustment variable
data(data.sim)
data(data.sim)
This function computes the degrees of freedom.
df.compute(nE, nC, SigmaE = NULL, SigmaC = NULL, matrix.type = NULL, equalSigmas = NULL, m = NULL)
df.compute(nE, nC, SigmaE = NULL, SigmaC = NULL, matrix.type = NULL, equalSigmas = NULL, m = NULL)
nE |
Sample size for the experimental (test) group. |
nC |
Sample size for the control group. |
SigmaE |
NULL or a matrix indicating the covariances between the primary endpoints in the experimental (test) group. See Details. |
SigmaC |
NULL or a matrix indicating the covariances between the primary endpoints in the control group. See Details. |
matrix.type |
NULL or an integer among 1, 2, 3, 4, giving the type of the matrices 'SigmaE' and 'SigmaC'. See Details. |
equalSigmas |
NULL or a logical indicating if 'SigmaC' and 'SigmaE' are equal. See Details. |
m |
NULL or the value for |
You should provide either both SigmaE
, SigmaC
or both
matrix.type
, equalSigmas
. When you provide the former, the
latter should be set to NULL. And vice versa.
df |
The degrees of freedom. |
P. Lafaye de Micheaux, B. Liquet and J. Riou
Delorme P., Lafaye de Micheaux P., Liquet B., Riou, J. (2015). Type-II Generalized Family-Wise Error Rate Formulas with Application to Sample Size Determination. Statistics in Medicine. Romano J. and Shaikh A. (2006) Stepup Procedures For Control of Generalizations of the Familywise Error Rate. The Annals of Statistics, 34(4), 1850–1873.
global.1m.analysis
,
indiv.1m.ssc
,
indiv.1m.analysis
,
global.1m.ssc
## Not run: # standard deviation of the treatment effect var <- c(0.3520^2,0.6219^2,0.5427^2,0.6075^2,0.6277^2,0.5527^2,0.8066^2) # Correlation matrix cov <- matrix(1,ncol=7,nrow=7) cov[1,2:7] <- cov[2:7,1] <- c(0.1341692,0.1373891,0.07480123,0.1401267,0.1280336,0.1614103) cov[2,3:7] <- cov[3:7,2] <- c(0.2874531,0.18451960,0.3156895,0.2954996,0.3963837) cov[3,4:7] <- cov[4:7,3] <- c(0.19903400,0.2736123,0.2369907,0.3423579) cov[4,5:7] <- cov[5:7,4] <- c(0.1915028,0.1558958,0.2376056) cov[5,6:7] <- cov[6:7,5] <- c(0.2642217,0.3969920) cov[6,7] <- cov[7,6] <- c(0.3352029) # Covariance matrix diag(cov) <- var df.compute(SigmaE = cov, SigmaC = cov, nE = 20, nC = 30) ## End(Not run)
## Not run: # standard deviation of the treatment effect var <- c(0.3520^2,0.6219^2,0.5427^2,0.6075^2,0.6277^2,0.5527^2,0.8066^2) # Correlation matrix cov <- matrix(1,ncol=7,nrow=7) cov[1,2:7] <- cov[2:7,1] <- c(0.1341692,0.1373891,0.07480123,0.1401267,0.1280336,0.1614103) cov[2,3:7] <- cov[3:7,2] <- c(0.2874531,0.18451960,0.3156895,0.2954996,0.3963837) cov[3,4:7] <- cov[4:7,3] <- c(0.19903400,0.2736123,0.2369907,0.3423579) cov[4,5:7] <- cov[5:7,4] <- c(0.1915028,0.1558958,0.2376056) cov[5,6:7] <- cov[6:7,5] <- c(0.2642217,0.3969920) cov[6,7] <- cov[7,6] <- c(0.3352029) # Covariance matrix diag(cov) <- var df.compute(SigmaE = cov, SigmaC = cov, nE = 20, nC = 30) ## End(Not run)
This function aims at analysing multiple continuous endpoints with a global procedure. The clinical aim
is to be able to detect a mean difference between the test
and
the control
product for at least one endpoint among
. This method is based on a multivariate model taking into account
the correlations between the
endpoints and possibly some adjustment variables. The result gives only a global decision.
global.1m.analysis(XC, XT, A, alpha = 0.05, n = NULL)
global.1m.analysis(XC, XT, A, alpha = 0.05, n = NULL)
XC |
matrix of the outcome for the control group. |
XT |
matrix of the outcome for the test group. |
A |
matrix of the adjustment variables. |
n |
sample size of a group. The sample size needs to be the same for each group. |
alpha |
value which corresponds to the chosen Type-I error rate bound. |
Pvalue |
the p-value of the global test. |
P. Lafaye de Micheaux, B. Liquet and J. Riou
Lafaye de Micheaux P., Liquet B., Marque S., Riou J. (2014). Power and Sample Size Determination in Clinical Trials With Multiple Primary Continuous Correlated Endpoints, Journal of Biopharmaceutical Statistics, 24, 378–397.
global.1m.ssc
,
indiv.1m.ssc
,
indiv.1m.analysis
,
bonferroni.1m.ssc
# Calling the data data(data.sim) # Data analysis for the global method n <- nrow(data) / 2 XC <- data[1:n, 1:3] XT <- data[(n + 1):(2 * n), 1:3] global.1m.analysis(XC = XC, XT = XT, A = data[, 5])
# Calling the data data(data.sim) # Data analysis for the global method n <- nrow(data) / 2 XC <- data[1:n, 1:3] XT <- data[(n + 1):(2 * n), 1:3] global.1m.analysis(XC = XC, XT = XT, A = data[, 5])
This function computes the sample size with a global method in the
context of multiple continuous endpoints. Two groups are
considered:
for control and
for treatment. The clinical aim
is to be able to detect a mean difference between the test and the control product
for at least one endpoint among
. This method is based on a
multivariate model with co-variates taking into account
the correlations between the endpoints.
global.1m.ssc(method, mean.diff, sd, cor, v = NULL, M = NULL, power = 0.8, alpha = 0.05)
global.1m.ssc(method, mean.diff, sd, cor, v = NULL, M = NULL, power = 0.8, alpha = 0.05)
method |
either "Model" if no co-variates are involved and "Adj.Model" for a model with co-variates. |
mean.diff |
vector of the mean differences of the |
sd |
vector of the standard deviations of the |
cor |
correlation matrix between the endpoints. These are assumed identical for both groups. |
v |
|
M |
|
power |
value which corresponds to the chosen power. |
alpha |
value which correponds to the chosen Type-I error rate bound. |
Sample size |
The required sample size. |
P. Lafaye de Micheaux, B. Liquet and J. Riou
Lafaye de Micheaux P., Liquet B., Marque S., Riou J. (2014). Power and Sample Size Determination in Clinical Trials With Multiple Primary Continuous Correlated Endpoints, Journal of Biopharmaceutical Statistics, 24, 378–397.
global.1m.analysis
,
indiv.1m.ssc
,
indiv.1m.analysis
,
bonferroni.1m.ssc
# Sample size computation for the global method global.1m.ssc(method = "Adj.Model", mean.diff = c(0.1, 0.2, 0.3), sd = c(1, 1, 1), cor = diag(1, 3), v = -0.2, M = 0.46) # Table 2 in our 2014 paper: Sigma2 <- matrix(c(5.58, 2, 1.24, 2, 4.29, 1.59, 1.24, 1.59, 4.09), ncol = 3) sd2 <- sqrt(diag(Sigma2)) cor2 <- diag(1 / sd2) %*% Sigma2 %*% diag(1 / sd2) mu2 <- c(0.35, 0.28, 0.46) m <- 3 global.1m.ssc(method = "Model", mean.diff = mu2, sd = sd2, cor = cor2)
# Sample size computation for the global method global.1m.ssc(method = "Adj.Model", mean.diff = c(0.1, 0.2, 0.3), sd = c(1, 1, 1), cor = diag(1, 3), v = -0.2, M = 0.46) # Table 2 in our 2014 paper: Sigma2 <- matrix(c(5.58, 2, 1.24, 2, 4.29, 1.59, 1.24, 1.59, 4.09), ncol = 3) sd2 <- sqrt(diag(Sigma2)) cor2 <- diag(1 / sd2) %*% Sigma2 %*% diag(1 / sd2) mu2 <- c(0.35, 0.28, 0.46) m <- 3 global.1m.ssc(method = "Model", mean.diff = mu2, sd = sd2, cor = cor2)
This function aims at analysing some multiple continuous endpoints with an individual testing procedure. This method, based on Union-Intersection test procedure, allows one to take into account the correlations between the different endpoints in the analysis.
indiv.1m.analysis(method, XC, XT, varX = NULL, alpha = 0.05, alternative = "two.sided", n = NULL)
indiv.1m.analysis(method, XC, XT, varX = NULL, alpha = 0.05, alternative = "two.sided", n = NULL)
method |
description of the covariance matrix estimation. Two choices are possible: "Unknown" (normality assumption and unknown covariance matrix) and "Asympt" (asymptotic context). |
XC |
matrix of the outcomes for the control group. |
XT |
matrix of the outcomes for the test group. |
varX |
covariance matrix. Should be provided when 'method' = 'Known'. |
alpha |
value which correponds to the chosen Type-I error rate bound. |
alternative |
character string specifying the alternative hypothesis, must be one of "two.sided" (default), "greater" or "less". |
n |
NULL. Sample size of a group, computed from |
UnAdjPvalue |
unadjusted p-values. |
AdjPvalue |
corrected p-values. |
P. Lafaye de Micheaux, B. Liquet and J. Riou
Lafaye de Micheaux P., Liquet B., Marque S., Riou J. (2014). Power and Sample Size Determination in Clinical Trials With Multiple Primary Continuous Correlated Endpoints, Journal of Biopharmaceutical Statistics, 24, 378–397.
global.1m.ssc
,
indiv.1m.ssc
,
global.1m.analysis
,
bonferroni.1m.ssc
# Calling the data data(data.sim) # Data analysis for the individual method n <- nrow(data) / 2 XC <- data[1:n, 1:3] XT <- data[(n + 1):(2 * n), 1:3] indiv.1m.analysis(method = "UnKnown", XC = XC, XT = XT)
# Calling the data data(data.sim) # Data analysis for the individual method n <- nrow(data) / 2 XC <- data[1:n, 1:3] XT <- data[(n + 1):(2 * n), 1:3] indiv.1m.analysis(method = "UnKnown", XC = XC, XT = XT)
This function computes the sample size with an individual testing procedure in the context of multiple continuous endpoints. This method, based on the Union-Intersection testing procedure, allows one to take into account the correlation between the different endpoints in the computation of the sample size.
indiv.1m.ssc(method, ES, cor, power = 0.8, alpha = 0.05, alternative = "two.sided", tol = 1e-04, maxiter = 1000, tol.uniroot = 1e-04)
indiv.1m.ssc(method, ES, cor, power = 0.8, alpha = 0.05, alternative = "two.sided", tol = 1e-04, maxiter = 1000, tol.uniroot = 1e-04)
method |
description of the covariance matrix estimation. Two choices are possible: "Unknown" (normality assumption and unknown covariance matrix) and "Asympt" (asymptotic context). |
ES |
vector indicating the values of the effect size. The definition of the effect size is presented in the "Details" section. |
cor |
matrix indicating the correlation matrix between the endpoints. |
power |
value which corresponds to the chosen power. |
alpha |
value which correponds to the chosen Type-I error rate bound. |
alternative |
character string specifying the alternative hypothesis, must be one of "two.sided" (default), "greater" or "less". |
tol |
the desired accuracy (convergence tolerance) for our algorithm. |
maxiter |
maximum number of iterations. |
tol.uniroot |
desired accuracy (convergence tolerance) for the
|
ES
: The effect size definition parameter for the endpoint is defined as
, where
refers to the standard deviation
of the population from which the different treatment groups were taken
and
is the true mean difference between the test and the control group for the
group. We consider that:
.
Adjusted Type-I error rate |
adjusted Type-I error rate. |
Sample size |
the required sample size. |
P. Lafaye de Micheaux, B .Liquet and J .Riou
Lafaye de Micheaux P., Liquet B., Marque S., Riou J. (2014). Power and Sample Size Determination in Clinical Trials With Multiple Primary Continuous Correlated Endpoints, Journal of Biopharmaceutical Statistics, 24, 378–397.
global.1m.ssc
,
global.1m.analysis
,
indiv.1m.analysis
,
bonferroni.1m.ssc
# Sample size computation for the individual method indiv.1m.ssc(method = "Known", ES = c(0.1, 0.2, 0.3), cor = diag(1, 3)) # Table 2 in our 2014 paper: Sigma2 <- matrix(c(5.58, 2, 1.24, 2, 4.29, 1.59, 1.24, 1.59, 4.09), ncol = 3) sd2 <- sqrt(diag(Sigma2)) cor2 <- diag(1 / sd2) %*% Sigma2 %*% diag(1 / sd2) mu2 <- c(0.35, 0.28, 0.46) m <- 3 indiv.1m.ssc(method = "Known", ES = mu2 / sd2, cor = cor2)
# Sample size computation for the individual method indiv.1m.ssc(method = "Known", ES = c(0.1, 0.2, 0.3), cor = diag(1, 3)) # Table 2 in our 2014 paper: Sigma2 <- matrix(c(5.58, 2, 1.24, 2, 4.29, 1.59, 1.24, 1.59, 4.09), ncol = 3) sd2 <- sqrt(diag(Sigma2)) cor2 <- diag(1 / sd2) %*% Sigma2 %*% diag(1 / sd2) mu2 <- c(0.35, 0.28, 0.46) m <- 3 indiv.1m.ssc(method = "Known", ES = mu2 / sd2, cor = cor2)
multiple continuous endpoints
This function aims at analysing some multiple continuous endpoints with individual testing procedures (Bonferroni, Holm, Hochberg). These procedures, based on a Union-Intersection test procedure, allow to take into account the correlation between the different endpoints in the analysis. This function uses critical values from Romano et al. to control the q-gFWER. Different structures of the covariance matrices between endpoints are considered.
indiv.analysis(method, XE, XC, d, matrix.type, equalSigmas, alpha = 0.05, q = 1, rho = NULL, alternative = "greater", orig.Hochberg = FALSE)
indiv.analysis(method, XE, XC, d, matrix.type, equalSigmas, alpha = 0.05, q = 1, rho = NULL, alternative = "greater", orig.Hochberg = FALSE)
method |
"Bonferroni", "Holm" or "Hochberg". When |
XE |
matrix (of size |
XC |
matrix (of size |
d |
vector of length |
matrix.type |
integer value equal to 1, 2, 3, 4 or 5. A value of 1 indicates multisample sphericity. A value of 2 indicates multisample variance components. A value of 3 indicates multisample compound symmetry. A value of 4 indicates multisample compound symmetry with unequal individual (endpoints) variances. A value of 5 indicates unstructured variance components. |
equalSigmas |
logical. Indicates if |
alpha |
value which corresponds to the chosen q-gFWER type-I error rate control bound. |
q |
integer. Value of 'q' (q=1,...,m) in the q-gFWER of Romano et
al., which is the probability to make at least |
rho |
NULL or should be provided only if |
alternative |
NOT USED YET. Character string specifying the alternative hypothesis, must be one of "two.sided", "greater" or "less". |
orig.Hochberg |
logical. To use the standard Hochberg's procedure. |
list(stat = statvec, pvals = pvals, AdjPvals = pvals.adj, sig2hat = varhatvec)
stat |
individual test statistic values. |
pvals |
non corrected p-values. |
pvals.adj |
corrected p-values. |
sig2hat |
estimated variance (i.e., square of denominator of the test statistic. |
P. Lafaye de Micheaux, B. Liquet and J. Riou
Delorme P., Lafaye de Micheaux P., Liquet B., Riou, J. (2015). Type-II Generalized Family-Wise Error Rate Formulas with Application to Sample Size Determination. Submitted to Statistics in Medicine.
Romano J. and Shaikh A. (2006) Stepup Procedures For Control of Generalizations of the Familywise Error Rate. The Annals of Statistics, 34(4), 1850–1873.
This function computes the sample size for an analysis of m
multiple tests with a control of the q-gFWER.
indiv.rm.ssc(method, asympt = FALSE, r, m, p = m, nCovernE = 1, muC = NULL, muE = NULL, d = NULL, delta = NULL, SigmaC = NULL, SigmaE = NULL, power = 0.8, alpha = 0.05, interval = c(2, 2000), q = 1, maxpts = 25000, abseps = 0.001, releps = 0, nbcores = 1, LB = FALSE, orig.Hochberg = FALSE)
indiv.rm.ssc(method, asympt = FALSE, r, m, p = m, nCovernE = 1, muC = NULL, muE = NULL, d = NULL, delta = NULL, SigmaC = NULL, SigmaE = NULL, power = 0.8, alpha = 0.05, interval = c(2, 2000), q = 1, maxpts = 25000, abseps = 0.001, releps = 0, nbcores = 1, LB = FALSE, orig.Hochberg = FALSE)
method |
"Bonferroni", "Hochberg" or "Holm". When |
asympt |
logical. |
r |
integer, r = 1, ..., m. Desired number of endpoints to be declared significant. |
m |
integer. Number of endpoints. |
p |
integer, p = 1, ..., m. Indicates the number of false null hypotheses. |
nCovernE |
ratio of |
muC |
|
muE |
|
d |
|
delta |
should be |
SigmaC |
matrix giving the covariances between the |
SigmaE |
matrix giving the covariances between the |
power |
a value which correponds to the chosen r-power. |
alpha |
a value which corresponds to the chosen q-gFWER type-I control bound. |
interval |
an interval of values in which to search for the sample size. Left endpoint should be greater than or equal to 2. |
q |
integer. Value of 'q' (q=1,...,m) in the q-gFWER of Romano et
al., which is the probability to make at least |
maxpts |
convergence parameter used in the |
abseps |
convergence parameter used in the |
releps |
relative error tolerance as double used in the
|
nbcores |
integer. Number of cores to use for parallel computations. |
LB |
logical. Should we use a load balancing parallel computation. |
orig.Hochberg |
logical. To use the standard Hochberg's procedure. |
The required sample size.
Results can differ from one time to another because the results of the
function pmvt
are random. If this is the case, you should
consider increasing maxpts
and decreasing abseps
. In any
case, you should always double check using one of the functions
Psirms
, Psirmu
or Psirmd
if the sample size you
obtained gives you the intended power, with an acceptable error (or at
least compute the power a few times with various seeds to see if results
are stable).
P. Lafaye de Micheaux, B. Liquet and J. Riou
Delorme P., Lafaye de Micheaux P., Liquet B., Riou, J. (2015). Type-II Generalized Family-Wise Error Rate Formulas with Application to Sample Size Determination. Submitted to Statistics in Medicine.
Romano J. and Shaikh A. (2006) Stepup Procedures For Control of Generalizations of the Familywise Error Rate. The Annals of Statistics, 34(4), 1850–1873.
## Not run: # Pneumovacs example (takes 37 mn to compute on 1 core) # Treatment effect delta <- c(0.55, 0.34, 0.38, 0.20, 0.70, 0.38, 0.86) # Variances of the m endpoints var <- c(0.3520, 0.6219, 0.5427, 0.6075, 0.6277, 0.5527, 0.8066) ^ 2 # Covariance matrix cov <- matrix(1, ncol = 7, nrow = 7) cov[1, 2:7] <- cov[2:7, 1] <- c(0.1341692, 0.1373891, 0.07480123, 0.1401267, 0.1280336, 0.1614103) cov[2, 3:7] <- cov[3:7, 2] <- c(0.2874531, 0.18451960, 0.3156895, 0.2954996, 0.3963837) cov[3, 4:7] <- cov[4:7, 3] <- c(0.19903400, 0.2736123, 0.2369907, 0.3423579) cov[4, 5:7] <- cov[5:7, 4] <- c(0.1915028, 0.1558958, 0.2376056) cov[5, 6:7] <- cov[6:7, 5] <- c(0.2642217, 0.3969920) cov[6, 7] <- cov[7, 6] <- 0.3352029 diag(cov) <- var indiv.rm.ssc(method = "Hochberg", asympt = FALSE, r = 3, m = 7, p = 7, nCovernE = 1, muC = NULL, muE = NULL, d = NULL, delta = delta, SigmaC = cov, SigmaE = cov, power = 0.8, alpha = 0.05, interval = c(10, 2000), q = 1) # Pre-RELAX-AHF example from the paper by Teerlink et al. (2009), # Relaxin for the treatment of patients with acute heart failure # (Pre-RELAX-AHF): a multicentre, randomised, # placebo-controlled, parallel-group, dose-finding phase IIb # study, Lancet, 373: 1429--39 # Table 2 page 1432: # ------------------ # Proportion with moderately or markedly better dyspnoea at 6 h, 12 h, and 24 h (Likert): 23% 40% # Dyspnoea AUC change from baseline to day 5 (VAS [mmxh]): 1679 (2556) 2567 (2898) # Worsening heart failure through day 5: 21% 12% # Length of stay (days): 12.0 (7.3) 10.2 (6.1) # Days alive out of hospital: 44.2 (14.2) 47.9 (10.1) # KM cardiovascular death or readmission (HR, 95% CI): 17.2% 2.6% (0.13, 0.02--1.03); p=0.053 # KM cardiovascular death (HR, 95% CI): 14.3% 0.0% (0.00, 0.00--0.98); p=0.046 # Table 4 page 1436: # ------------------ # >=25% increase at day 5: 8 (13%) 9 (21%) # >=26 micro-mol/L increase at days 5 and 14: 4 (7%) 3 (7%) muC <- c(23 / 100, 1679, 1 - 21 / 100, -12.0, 44.2, 1 - 17.2 / 100, 1 - 14.3 / 100, 13 / 100, 7 / 100) muE <- c(40 / 100, 2567, 1 - 12 / 100, -10.2, 47.9, 1 - 2.60 / 100, 1, 21 / 100, 7 / 100) sdC <- c(sqrt(0.23 * (1 - 0.23)), 2556, sqrt(0.79 * (1 - 0.79)), 7.3, 14.2, sqrt(0.828 * (1 - 0.828)), sqrt(0.857 * (1 - 0.857)), sqrt(0.13 * (1 - 0.13)), sqrt(0.07 * (1 - 0.07))) sdE <- c(sqrt(0.4 * (1 - 0.4)) , 2898, sqrt(0.88 * (1 - 0.88)), 6.1, 10.1, sqrt(0.974 * (1 - 0.974)), 1e-12 , sqrt(0.21 * (1 - 0.21)), sqrt(0.07 * (1 - 0.07))) m <- 9 rho <- 0.1 cor <- matrix(rho, nrow = m, ncol = m) diag(cor) <- 1 sd.pooled <- sqrt(0.5 * sdE + 0.5 * sdC) SigmaE <- diag(sdE) %*% cor %*% diag(sdE) SigmaC <-diag(sdC) %*% cor %*% diag(sdC) indiv.rm.ssc(method = "Bonferroni", asympt = FALSE, r = 6, m = 9, p = 9, nCovernE = 1, muC = NULL, muE = NULL, d = rep(0.0, m), delta = (muE - muC) / sd.pooled, SigmaC = cor, SigmaE = cor, power = 0.8, alpha = 0.1, interval = c(2, 500), q = 1, maxpts = 25000, abseps = 0.01, nbcores = 1, LB = TRUE) ## End(Not run)
## Not run: # Pneumovacs example (takes 37 mn to compute on 1 core) # Treatment effect delta <- c(0.55, 0.34, 0.38, 0.20, 0.70, 0.38, 0.86) # Variances of the m endpoints var <- c(0.3520, 0.6219, 0.5427, 0.6075, 0.6277, 0.5527, 0.8066) ^ 2 # Covariance matrix cov <- matrix(1, ncol = 7, nrow = 7) cov[1, 2:7] <- cov[2:7, 1] <- c(0.1341692, 0.1373891, 0.07480123, 0.1401267, 0.1280336, 0.1614103) cov[2, 3:7] <- cov[3:7, 2] <- c(0.2874531, 0.18451960, 0.3156895, 0.2954996, 0.3963837) cov[3, 4:7] <- cov[4:7, 3] <- c(0.19903400, 0.2736123, 0.2369907, 0.3423579) cov[4, 5:7] <- cov[5:7, 4] <- c(0.1915028, 0.1558958, 0.2376056) cov[5, 6:7] <- cov[6:7, 5] <- c(0.2642217, 0.3969920) cov[6, 7] <- cov[7, 6] <- 0.3352029 diag(cov) <- var indiv.rm.ssc(method = "Hochberg", asympt = FALSE, r = 3, m = 7, p = 7, nCovernE = 1, muC = NULL, muE = NULL, d = NULL, delta = delta, SigmaC = cov, SigmaE = cov, power = 0.8, alpha = 0.05, interval = c(10, 2000), q = 1) # Pre-RELAX-AHF example from the paper by Teerlink et al. (2009), # Relaxin for the treatment of patients with acute heart failure # (Pre-RELAX-AHF): a multicentre, randomised, # placebo-controlled, parallel-group, dose-finding phase IIb # study, Lancet, 373: 1429--39 # Table 2 page 1432: # ------------------ # Proportion with moderately or markedly better dyspnoea at 6 h, 12 h, and 24 h (Likert): 23% 40% # Dyspnoea AUC change from baseline to day 5 (VAS [mmxh]): 1679 (2556) 2567 (2898) # Worsening heart failure through day 5: 21% 12% # Length of stay (days): 12.0 (7.3) 10.2 (6.1) # Days alive out of hospital: 44.2 (14.2) 47.9 (10.1) # KM cardiovascular death or readmission (HR, 95% CI): 17.2% 2.6% (0.13, 0.02--1.03); p=0.053 # KM cardiovascular death (HR, 95% CI): 14.3% 0.0% (0.00, 0.00--0.98); p=0.046 # Table 4 page 1436: # ------------------ # >=25% increase at day 5: 8 (13%) 9 (21%) # >=26 micro-mol/L increase at days 5 and 14: 4 (7%) 3 (7%) muC <- c(23 / 100, 1679, 1 - 21 / 100, -12.0, 44.2, 1 - 17.2 / 100, 1 - 14.3 / 100, 13 / 100, 7 / 100) muE <- c(40 / 100, 2567, 1 - 12 / 100, -10.2, 47.9, 1 - 2.60 / 100, 1, 21 / 100, 7 / 100) sdC <- c(sqrt(0.23 * (1 - 0.23)), 2556, sqrt(0.79 * (1 - 0.79)), 7.3, 14.2, sqrt(0.828 * (1 - 0.828)), sqrt(0.857 * (1 - 0.857)), sqrt(0.13 * (1 - 0.13)), sqrt(0.07 * (1 - 0.07))) sdE <- c(sqrt(0.4 * (1 - 0.4)) , 2898, sqrt(0.88 * (1 - 0.88)), 6.1, 10.1, sqrt(0.974 * (1 - 0.974)), 1e-12 , sqrt(0.21 * (1 - 0.21)), sqrt(0.07 * (1 - 0.07))) m <- 9 rho <- 0.1 cor <- matrix(rho, nrow = m, ncol = m) diag(cor) <- 1 sd.pooled <- sqrt(0.5 * sdE + 0.5 * sdC) SigmaE <- diag(sdE) %*% cor %*% diag(sdE) SigmaC <-diag(sdC) %*% cor %*% diag(sdC) indiv.rm.ssc(method = "Bonferroni", asympt = FALSE, r = 6, m = 9, p = 9, nCovernE = 1, muC = NULL, muE = NULL, d = rep(0.0, m), delta = (muE - muC) / sd.pooled, SigmaC = cor, SigmaE = cor, power = 0.8, alpha = 0.1, interval = c(2, 500), q = 1, maxpts = 25000, abseps = 0.01, nbcores = 1, LB = TRUE) ## End(Not run)
This function determines the type of matrix structure of
and
, which can be multisample
sphericity (type 1), multisample variance components (type 2), multisample compound
symmetry (type 3) or unstructured variance components (type 4).
matrix.type.compute(SigmaE, SigmaC, display.type = FALSE)
matrix.type.compute(SigmaE, SigmaC, display.type = FALSE)
SigmaE |
matrix giving the covariances between the
|
SigmaC |
matrix giving the covariances between the |
display.type |
Logical. Should we display the (name of) type of the matrices. |
Integer indicating the structure of the matrices: 1 if both are of type 1, 2 if both are of type 2, 3 if both are of type 3 or 4 if one of them is of type 4.
P. Lafaye de Micheaux, B. Liquet and J. Riou
## Not run: # Variances of the m endpoints var <- c(0.3520, 0.6219, 0.5427, 0.6075, 0.6277, 0.5527, 0.8066) ^ 2 # Covariance matrix cov <- matrix(1, ncol = 7, nrow = 7) cov[1, 2:7] <- cov[2:7, 1] <- c(0.1341692, 0.1373891, 0.07480123, 0.1401267, 0.1280336, 0.1614103) cov[2, 3:7] <- cov[3:7, 2] <- c(0.2874531, 0.18451960, 0.3156895, 0.2954996, 0.3963837) cov[3, 4:7] <- cov[4:7, 3] <- c(0.19903400, 0.2736123, 0.2369907, 0.3423579) cov[4, 5:7] <- cov[5:7, 4] <- c(0.1915028, 0.1558958, 0.2376056) cov[5, 6:7] <- cov[6:7, 5] <- c(0.2642217, 0.3969920) cov[6, 7] <- cov[7, 6] <- 0.3352029 diag(cov) <- var matrix.type.compute(SigmaE = cov, SigmaC = cov, display = TRUE) ## End(Not run)
## Not run: # Variances of the m endpoints var <- c(0.3520, 0.6219, 0.5427, 0.6075, 0.6277, 0.5527, 0.8066) ^ 2 # Covariance matrix cov <- matrix(1, ncol = 7, nrow = 7) cov[1, 2:7] <- cov[2:7, 1] <- c(0.1341692, 0.1373891, 0.07480123, 0.1401267, 0.1280336, 0.1614103) cov[2, 3:7] <- cov[3:7, 2] <- c(0.2874531, 0.18451960, 0.3156895, 0.2954996, 0.3963837) cov[3, 4:7] <- cov[4:7, 3] <- c(0.19903400, 0.2736123, 0.2369907, 0.3423579) cov[4, 5:7] <- cov[5:7, 4] <- c(0.1915028, 0.1558958, 0.2376056) cov[5, 6:7] <- cov[6:7, 5] <- c(0.2642217, 0.3969920) cov[6, 7] <- cov[7, 6] <- 0.3352029 diag(cov) <- var matrix.type.compute(SigmaE = cov, SigmaC = cov, display = TRUE) ## End(Not run)
This function approximates the power for a given sample size using a Monte Carlo simulation.
montecarlo(method, M = 100000, nE, r, m, nCovernE = 1, muC, muE, d = rep(0.0, m), SigmaE, SigmaC, alpha = 0.05, q = 1, nbcores = parallel::detectCores() - 1, alternative = "greater", orig.Hochberg = FALSE)
montecarlo(method, M = 100000, nE, r, m, nCovernE = 1, muC, muE, d = rep(0.0, m), SigmaE, SigmaC, alpha = 0.05, q = 1, nbcores = parallel::detectCores() - 1, alternative = "greater", orig.Hochberg = FALSE)
method |
"Bonferroni", "Holm" or "Hochberg". When |
M |
number of Monte Carlo repetitions. Dmitrienko et al. (2013)
suggested to take |
nE |
integer. Sample size for the experimental (test) group. |
r |
integer, r = 1, ..., m. Desired number of endpoints to be declared significant. |
m |
integer. Number of endpoints. |
nCovernE |
ratio of |
muC |
vector of length |
muE |
vector of length |
d |
vector of length |
SigmaE |
matrix indicating the covariances between the |
SigmaC |
matrix indicating the covariances between the |
alpha |
a value which corresponds to the chosen q-gFWER type-I control bound. |
q |
integer. Value of 'q' (q = 1, ..., m) in the q-gFWER of Romano et
al., which is the probability to make at least |
nbcores |
number of cores to use for the computations. |
alternative |
NOT USED YET. Character string specifying the alternative hypothesis, must be one of "two.sided", "greater" or "less". |
orig.Hochberg |
logical. To use the standard Hochberg's procedure. |
rpowBonf or rpowHoch or rpowHolm |
List with one element giving the computed power. |
P. Lafaye de Micheaux, B. Liquet and J. Riou
Delorme P., Lafaye de Micheaux P., Liquet B., Riou, J. (2015). Type-II Generalized Family-Wise Error Rate Formulas with Application to Sample Size Determination. Submitted to Statistics in Medicine.
Romano J. and Shaikh A. (2006) Stepup Procedures For Control of Generalizations of the Familywise Error Rate. The Annals of Statistics, 34(4), 1850–1873.
For an rPower
object which has been produced by montecarlo
, this function plots the distribution (estimated by Monte-Carlo) of the number of significant results (i.e, the realized values ).
## S3 method for class 'rPower' plot(x, ...)
## S3 method for class 'rPower' plot(x, ...)
x |
The name of an object of class |
... |
Some methods for this generic require additional arguments. None are used in this method. |
Returns graphs.
P. Lafaye de Micheaux, B. Liquet and J. Riou
Delorme P., Lafaye de Micheaux P., Liquet B., Riou, J. (2015). Type-II Generalized Family-Wise Error Rate Formulas with Application to Sample Size Determination. Submitted to Statistics in Medicine.
This function computes the power for an analysis of m
multiple
tests with a control of the q-gFWER with the Holm procedure.
Psirmd(r, m, p = m, nE, nCovernE = 1, delta, SigmaC, SigmaE, alpha = 0.05, q = 1, asympt = FALSE, maxpts = 25000, abseps = 0.001, releps = 0, nbcores = 1, LB = FALSE)
Psirmd(r, m, p = m, nE, nCovernE = 1, delta, SigmaC, SigmaE, alpha = 0.05, q = 1, asympt = FALSE, maxpts = 25000, abseps = 0.001, releps = 0, nbcores = 1, LB = FALSE)
r |
integer, r = 1, ..., m. Desired number of endpoints to be declared significant. |
m |
integer. Number of endpoints. |
p |
integer, p = 1, ..., m. Indicates the number of false null hypotheses. |
nE |
integer. Sample size for the experimental (test) group. |
nCovernE |
Ratio of |
delta |
vector of length |
SigmaC |
matrix giving the covariances between the |
SigmaE |
matrix giving the covariances between the |
alpha |
a value which corresponds to the chosen q-gFWER type-I control bound. |
q |
integer. Value of 'q' (q=1,...,m) in the q-gFWER of Romano et
al., which is the probability to make at least |
asympt |
logical. |
maxpts |
convergence parameter used in the |
abseps |
convergence parameter used in the |
releps |
relative error tolerance as double used in the
|
nbcores |
integer. Number of cores to use for parallel computations. |
LB |
logical. Should we use a load balancing parallel computation. |
List with two components:
pow |
The computed power. |
error |
The sum of the absolute estimated errors for each call
to the |
Results can differ from one time to another because the results of the
function pmvt
are random. If this is the case, you should
consider increasing maxpts
and decreasing abseps
.
P. Lafaye de Micheaux, B. Liquet and J. Riou
Delorme P., Lafaye de Micheaux P., Liquet B., Riou, J. (2015). Type-II Generalized Family-Wise Error Rate Formulas with Application to Sample Size Determination. Submitted to Statistics in Medicine.
Romano J. and Shaikh A. (2006) Stepup Procedures For Control of Generalizations of the Familywise Error Rate. The Annals of Statistics, 34(4), 1850–1873.
This function computes the power for an analysis of multiple
tests with a control of the q-gFWER by a Bonferroni procedure.
Psirms(r, m, p = m, nE, nCovernE = 1, delta, SigmaC, SigmaE, alpha = 0.05, q = 1, asympt = FALSE, maxpts = 25000, abseps = 0.001, releps = 0, nbcores = 1, LB = FALSE)
Psirms(r, m, p = m, nE, nCovernE = 1, delta, SigmaC, SigmaE, alpha = 0.05, q = 1, asympt = FALSE, maxpts = 25000, abseps = 0.001, releps = 0, nbcores = 1, LB = FALSE)
r |
integer, r = 1, ..., m. Desired number of endpoints to be declared significant. |
m |
integer. Number of endpoints. |
p |
integer, p = 1, ..., m. Indicates the number of false null hypotheses. |
nE |
integer. Sample size for the experimental (test) group. |
nCovernE |
Ratio of |
delta |
vector of length |
SigmaC |
matrix giving the covariances between the |
SigmaE |
matrix giving the covariances between the |
alpha |
a value which corresponds to the chosen q-gFWER type-I control bound. |
q |
integer. Value of 'q' (q=1,...,m) in the q-gFWER of Romano et
al., which is the probability to make at least |
asympt |
logical. |
maxpts |
convergence parameter used in the |
abseps |
convergence parameter used in the |
releps |
relative error tolerance as double used in the
|
nbcores |
integer. Number of cores to use for parallel computations. |
LB |
logical. Should we use a load balancing parallel computation. |
List with two components:
pow |
The computed power. |
error |
The total sum of the absolute estimated errors for each call
to the |
Results can differ from one time to another because the results of the
function pmvt
are random. If this is the case, you should
consider increasing maxpts
and decreasing abseps
.
P. Lafaye de Micheaux, B. Liquet and J. Riou
Delorme P., Lafaye de Micheaux P., Liquet B., Riou, J. (2015). Type-II Generalized Family-Wise Error Rate Formulas with Application to Sample Size Determination. Submitted to Statistics in Medicine.
Romano J. and Shaikh A. (2006) Stepup Procedures For Control of Generalizations of the Familywise Error Rate. The Annals of Statistics, 34(4), 1850–1873.
This function computes the power for an analysis of m multiple tests with a control of the q-gFWER with the Hochberg procedure.
Psirmu(r, m, p = m, nE, nCovernE = 1, delta, SigmaC, SigmaE, alpha = 0.05, q = 1, asympt = FALSE, maxpts = 25000, abseps = 0.001, releps = 0, nbcores = 1, LB = FALSE, orig.Hochberg = FALSE)
Psirmu(r, m, p = m, nE, nCovernE = 1, delta, SigmaC, SigmaE, alpha = 0.05, q = 1, asympt = FALSE, maxpts = 25000, abseps = 0.001, releps = 0, nbcores = 1, LB = FALSE, orig.Hochberg = FALSE)
r |
integer, r = 1, ..., m. Desired number of endpoints to be declared significant. |
m |
integer. Number of endpoints. |
p |
integer, p = 1, ..., m. Indicates the number of false null hypotheses. |
nE |
integer. Sample size for the experimental (test) group. |
nCovernE |
Ratio of |
delta |
vector of length |
SigmaC |
matrix giving the covariances between the |
SigmaE |
matrix giving the covariances between the |
alpha |
a value which corresponds to the chosen q-gFWER type-I control bound. |
q |
integer. Value of 'q' (q=1,...,m) in the q-gFWER of Romano et
al., which is the probability to make at least |
asympt |
logical. |
maxpts |
convergence parameter used in the |
abseps |
convergence parameter used in the |
releps |
relative error tolerance as double used in the
|
nbcores |
integer. Number of cores to use for parallel computations. |
LB |
logical. Should we use a load balancing parallel computation. |
orig.Hochberg |
logical. To use the standard Hochberg's procedure. |
List with two components:
pow |
The computed power. |
error |
The sum of the absolute estimated errors for each call
to the |
Note that we use critical values involving the D1 term in formula
(11) of Romano et al. in order to control strongly the -FWER.
If you want to use the original Hochberg's
procedure, set
orig.Hochberg
to TRUE
. Even for
, this is a bad idea except when the p-values can be assumed
independent.
Results can differ from one time to another because the results of the
function pmvt
are random. If this is the case, you should
consider increasing maxpts
and decreasing abseps
.
P. Lafaye de Micheaux, B. Liquet and J. Riou
Delorme P., Lafaye de Micheaux P., Liquet B., Riou, J. (2015). Type-II Generalized Family-Wise Error Rate Formulas with Application to Sample Size Determination. Submitted to Statistics in Medicine.
Romano J. and Shaikh A. (2006) Stepup Procedures For Control of Generalizations of the Familywise Error Rate. The Annals of Statistics, 34(4), 1850–1873.