Package 'rPowerSampleSize'

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

Help Index


Sample Size Computation and Data Analysis in the context of multiple continuous endpoints in clinical trials.

Description

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.

Details

Package: rPowerSampleSize
Type: Package
Version: 1.0
Date: 2012-03-21
License: GPL (>2)
LazyLoad: yes

Author(s)

Pierre Lafaye de Micheaux, Benoit Liquet and Jeremie Riou Maintainer: Pierre Lafaye de Micheaux <[email protected]>


Sample Size Computation with Single Step Bonferroni Method in the Context of Multiple Continuous Endpoints.

Description

This function computes the sample size for an analysis of multiple test with a single step Bonferroni procedure.

Usage

bonferroni.1m.ssc(mean.diff, sd, cor, power = 0.8, alpha = 0.05,
alternative = "two.sided")

Arguments

mean.diff

vector of the mean differences of the m endpoints between both groups under the alternative hypothesis.

sd

vector of the standard deviations of the m endpoints. These are assumed identical for both groups.

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".

Value

Sample size

The required sample size.

Author(s)

P. Lafaye de Micheaux, B. Liquet and J. Riou

References

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.

See Also

global.1m.analysis, indiv.1m.ssc, indiv.1m.analysis, global.1m.ssc

Examples

## 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)

Computation of the complexity of the numerical computations.

Description

This function computes the complexity of our formulas.

Usage

complexity(method, exchangeable, r, p, display = TRUE)

Arguments

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.

Value

Complexity of the formulas (i.e., number of individual probabilities computed using the function pmvt (or pmvnorm) in the non exchangeable case).

Author(s)

P. Lafaye de Micheaux, B. Liquet and J. Riou

References

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.


Simulated data

Description

This simulated dataset contains three outcomes, and one adjustement variable, divided in two groups.

Usage

data(data.sim)

Format

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

Examples

data(data.sim)

Computation of degrees of freedom.

Description

This function computes the degrees of freedom.

Usage

df.compute(nE, nC, SigmaE = NULL, SigmaC = NULL, matrix.type = NULL,
equalSigmas = NULL, m = NULL)

Arguments

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 m. See Details.

Details

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.

Value

df

The degrees of freedom.

Author(s)

P. Lafaye de Micheaux, B. Liquet and J. Riou

References

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.

See Also

global.1m.analysis, indiv.1m.ssc, indiv.1m.analysis, global.1m.ssc

Examples

## 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)

Data analysis with a global method in the context of multiple continuous endpoints

Description

This function aims at analysing mm multiple continuous endpoints with a global procedure. The clinical aim is to be able to detect a mean difference between the test TT and the control CC product for at least one endpoint among mm. This method is based on a multivariate model taking into account the correlations between the mm endpoints and possibly some adjustment variables. The result gives only a global decision.

Usage

global.1m.analysis(XC, XT, A, alpha = 0.05, n = NULL)

Arguments

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.

Value

Pvalue

the p-value of the global test.

Author(s)

P. Lafaye de Micheaux, B. Liquet and J. Riou

References

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.

See Also

global.1m.ssc, indiv.1m.ssc, indiv.1m.analysis, bonferroni.1m.ssc

Examples

# 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])

Sample Size Computation Based on a Global Procedure in the Context of Multiple Continuous Endpoints

Description

This function computes the sample size with a global method in the context of mm multiple continuous endpoints. Two groups are considered: CC for control and TT 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 mm. This method is based on a multivariate model with co-variates taking into account the correlations between the endpoints.

Usage

global.1m.ssc(method, mean.diff, sd, cor, v = NULL, M = NULL, 
power = 0.8, alpha = 0.05)

Arguments

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 m endpoints between both groups under the alternative hypothesis.

sd

vector of the standard deviations of the m endpoints. These are assumed identical for both groups.

cor

correlation matrix between the endpoints. These are assumed identical for both groups.

v

vv is a p×1p\times1 vector whose lthl^{th} component is vl=aˉlCaˉlTv_{l}=\bar{a}_{l}^C-\bar{a}_l^T, where pp is the number of adjustment variables, and aˉli\bar{a}_{l}^{i} is the mean of the adjustment variable ala_{l} for the group ii, i=C,Ti = C, T.

M

MM is a p×pp\times p matrix with general term Ml,l=(alalCaˉlCaˉlC)+(alalTaˉlTaˉlT)M_{l,l'}=\left(\overline{a_la_{l'}}^C-\bar{a}_l^C\bar{a}_{l'}^C\right)+\left(\overline{a_{l}a_{l'}}^T-\bar{a}_l^T\bar{a}_{l'}^T\right).

power

value which corresponds to the chosen power.

alpha

value which correponds to the chosen Type-I error rate bound.

Value

Sample size

The required sample size.

Author(s)

P. Lafaye de Micheaux, B. Liquet and J. Riou

References

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.

See Also

global.1m.analysis, indiv.1m.ssc, indiv.1m.analysis, bonferroni.1m.ssc

Examples

# 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)

Data analysis with an individual testing procedure in the context of multiple continuous endpoints

Description

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.

Usage

indiv.1m.analysis(method, XC, XT, varX = NULL, alpha = 0.05,
alternative = "two.sided", n = NULL)

Arguments

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 XC.

Value

UnAdjPvalue

unadjusted p-values.

AdjPvalue

corrected p-values.

Author(s)

P. Lafaye de Micheaux, B. Liquet and J. Riou

References

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.

See Also

global.1m.ssc, indiv.1m.ssc, global.1m.analysis, bonferroni.1m.ssc

Examples

# 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)

Sample size computation with an individual testing procedure in the context of multiple continuous endpoints

Description

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.

Usage

indiv.1m.ssc(method, ES, cor, power = 0.8, alpha = 0.05, alternative =
"two.sided", tol = 1e-04, maxiter = 1000, tol.uniroot = 1e-04)

Arguments

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 uniroot.integer function.

Details

ES: The effect size definition parameter for the kthk^{th} endpoint is defined as μkTμkCσk\frac{\mu^{T}_{k}-\mu^{C}_{k}}{\sigma^{*}_{k}}, where σk\sigma^{*}_{k} refers to the standard deviation of the population from which the different treatment groups were taken and μkTμkC\mu^{T}_{k}-\mu^{C}_{k} is the true mean difference between the test and the control group for the kthk^{th} group. We consider that: σk=σk,T2+σk,C22\sigma^{*}_{k}=\frac{\sigma^{2}_{k,T}+\sigma^{2}_{k,C}}{2}.

Value

Adjusted Type-I error rate

adjusted Type-I error rate.

Sample size

the required sample size.

Author(s)

P. Lafaye de Micheaux, B .Liquet and J .Riou

References

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.

See Also

global.1m.ssc, global.1m.analysis, indiv.1m.analysis, bonferroni.1m.ssc

Examples

# 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)

Data analysis using an individual testing procedure controlling the q-gFWER in the context of mm multiple continuous endpoints

Description

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.

Usage

indiv.analysis(method, XE, XC, d, matrix.type, equalSigmas, alpha =
0.05, q = 1, rho = NULL, alternative = "greater", orig.Hochberg = FALSE)

Arguments

method

"Bonferroni", "Holm" or "Hochberg". When method = "Hochberg", we use critical values involving the D1 term in formula (11) of Romano et al. in order to control strongly the qq-FWER. If you want to use the original Hochberg's procedure, set orig.Hochberg to TRUE. Even for q=1q=1, this is a bad idea except when the p-values can be assumed independent.

XE

matrix (of size nE×mn_E \times m) of the outcome for the experimental (test) group.

XC

matrix (of size nC×mn_C \times m) of the outcome for the control group.

d

vector of length m indicating the true value of the differences in means under the null hypothesis.

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 ΣE\Sigma_E is equal to ΣC\Sigma_C.

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 q false rejections. The default value q=1 corresponds to the classical FWER control.

rho

NULL or should be provided only if matrix.type is equal to 3 or 4. This is the value of correlation for the compound symmetry case.

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.

Value

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.

Author(s)

P. Lafaye de Micheaux, B. Liquet and J. Riou

References

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.

See Also

indiv.rm.ssc,


Sample size determination in the context of multiple continuous endpoints with a control of the q-gFWER, for a given value of r-power (generalized disjunctive power).

Description

This function computes the sample size for an analysis of m multiple tests with a control of the q-gFWER.

Usage

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)

Arguments

method

"Bonferroni", "Hochberg" or "Holm". When method = "Hochberg", we use critical values involving the D1 term in formula (11) of Romano et al. in order to control strongly the qq-FWER. If you want to use the original Hochberg's procedure, set orig.Hochberg to TRUE. Even for q=1q=1, this is a bad idea except when the p-values can be assumed independent.

asympt

logical. TRUE for the use of the asymptotic approximation by a multivariate normal distribution or FALSE for the multivariate Student distribution.

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 nC over nE.

muC

NULL or a vector of length m of the true means of the control group for all endpoints under the alternative hypothesis. If muC, muE and d are NULL, then delta should be provided instead.

muE

NULL or a vector of length m of the true means of the experimental (test) group for all endpoints under the alternative hypothesis.

d

NULL or a a vector of length m indicating the true value of the differences in means under the null hypothesis.

delta

should be NULL if muC, muE and d are provided. If not, it is equal to muE - muC - d and these parameters should be set to NULL.

SigmaC

matrix giving the covariances between the m primary endpoints in the control group.

SigmaE

matrix giving the covariances between the m primary endpoints in the experimental (test) group.

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 q false rejections. The default value q=1 corresponds to the classical FWER control.

maxpts

convergence parameter used in the GenzBretz function. A good choice is min(25000 * 10 ^ true.complexity, .Machine$integer.max) where true.complexity is computed with the complexity function. But note that this might considerably increase the computation time!

abseps

convergence parameter used in the GenzBretz function. A good choice is max(0.001 / true.complexity, 1e-08) where true.complexity is computed with the complexity function. But note that this might considerably increase the computation time!

releps

relative error tolerance as double used in the GenzBretz function.

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.

Value

The required sample size.

Note

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).

Author(s)

P. Lafaye de Micheaux, B. Liquet and J. Riou

References

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.

See Also

indiv.analysis,

Examples

## 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)

Computation of matrix type

Description

This function determines the type of matrix structure of ΣE\Sigma_E and ΣC\Sigma_C, which can be multisample sphericity (type 1), multisample variance components (type 2), multisample compound symmetry (type 3) or unstructured variance components (type 4).

Usage

matrix.type.compute(SigmaE, SigmaC, display.type = FALSE)

Arguments

SigmaE

matrix giving the covariances between the m primary endpoints in the experimental (test) group.

SigmaC

matrix giving the covariances between the m primary endpoints in the control group.

display.type

Logical. Should we display the (name of) type of the matrices.

Value

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.

Author(s)

P. Lafaye de Micheaux, B. Liquet and J. Riou

See Also

indiv.analysis,

Examples

## 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)

Monte carlo computation of power.

Description

This function approximates the power for a given sample size using a Monte Carlo simulation.

Usage

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)

Arguments

method

"Bonferroni", "Holm" or "Hochberg". When method = "Hochberg", we use critical values involving the D1 term in formula (11) of Romano et al. in order to control strongly the qq-FWER. If you want to use the original Hochberg's procedure, set orig.Hochberg to TRUE. Even for q=1q=1, this is a bad idea except when the p-values can be assumed independent.

M

number of Monte Carlo repetitions. Dmitrienko et al. (2013) suggested to take M = 10 ^ 5.

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 nC over nE.

muC

vector of length m of the true means of the control group for all endpoints under the alternative hypothesis.

muE

vector of length m of the true means of the experimental (test) group for all endpoints under the alternative hypothesis.

d

vector of length m indicating the true value of the differences in means under the null hypothesis.

SigmaE

matrix indicating the covariances between the m primary endpoints in the experimental (test) group. See Details.

SigmaC

matrix indicating the covariances between the m primary endpoints in the control group. See Details.

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 q false rejections. The default value q=1 corresponds to the classical FWER control.

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.

Value

rpowBonf or rpowHoch or rpowHolm

List with one element giving the computed power.

Author(s)

P. Lafaye de Micheaux, B. Liquet and J. Riou

References

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.

See Also

indiv.analysis,


Plot of an rPower object

Description

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 rr).

Usage

## S3 method for class 'rPower'
plot(x, ...)

Arguments

x

The name of an object of class rPower.

...

Some methods for this generic require additional arguments. None are used in this method.

Value

Returns graphs.

Author(s)

P. Lafaye de Micheaux, B. Liquet and J. Riou

References

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.

See Also

montecarlo


Computation of power for step-down (Holm) procedure.

Description

This function computes the power for an analysis of m multiple tests with a control of the q-gFWER with the Holm procedure.

Usage

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)

Arguments

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 nC over nE.

delta

vector of length m equal to muE - muC - d.

SigmaC

matrix giving the covariances between the m primary endpoints in the control group.

SigmaE

matrix giving the covariances between the m primary endpoints in the experimental (test) group.

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 q false rejections. The default value q=1 corresponds to the classical FWER control.

asympt

logical. TRUE for the use of the asymptotic approximation by a multivariate normal distribution or FALSE for the multivariate Student distribution.

maxpts

convergence parameter used in the GenzBretz function. A suggested choice is min(25000 * true.complexity, .Machine$integer.max) where true.complexity is computed with the complexity function. But note that this might considerably increase the computation time!

abseps

convergence parameter used in the GenzBretz function. A suggested choice is max(0.001 / true.complexity, 1e-08) where true.complexity is computed with the complexity function. But note that this might considerably increase the computation time!

releps

relative error tolerance as double used in the GenzBretz function.

nbcores

integer. Number of cores to use for parallel computations.

LB

logical. Should we use a load balancing parallel computation.

Value

List with two components:

pow

The computed power.

error

The sum of the absolute estimated errors for each call to the pmvt (or pmvnorm) function. The number of such calls is given (in the non exchangeable case) by the function complexity. Note that in the exchangeable case, some probabilities are weighted. So an error committed on such a probability is also inflated with the same weight. Note also that this global error does not take into account the signs of the individual errors and is thus most certainly higher than the true error. In other words, you are 99 percent sure that the true power is between 'pow' - 'error' and 'pow' + 'error', but it is also probably much closer to 'pow', particularly if the complexity is large.

Note

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.

Author(s)

P. Lafaye de Micheaux, B. Liquet and J. Riou

References

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.

See Also

indiv.analysis,


Computation of power for single step (Bonferroni) procedure.

Description

This function computes the power for an analysis of mm multiple tests with a control of the q-gFWER by a Bonferroni procedure.

Usage

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)

Arguments

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 nC over nE.

delta

vector of length m equal to muE - muC - d.

SigmaC

matrix giving the covariances between the m primary endpoints in the control group.

SigmaE

matrix giving the covariances between the m primary endpoints in the experimental (test) group.

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 q false rejections. The default value q=1 corresponds to the classical FWER control.

asympt

logical. TRUE for the use of the asymptotic approximation by a multivariate normal distribution or FALSE for the multivariate Student distribution.

maxpts

convergence parameter used in the GenzBretz function. A suggested choice is min(25000 * true.complexity, .Machine$integer.max) where true.complexity is computed with the complexity function. But note that this might considerably increase the computation time!

abseps

convergence parameter used in the GenzBretz function. A suggested choice is max(0.001 / true.complexity, 1e-08) where true.complexity is computed with the complexity function. But note that this might considerably increase the computation time!

releps

relative error tolerance as double used in the GenzBretz function.

nbcores

integer. Number of cores to use for parallel computations.

LB

logical. Should we use a load balancing parallel computation.

Value

List with two components:

pow

The computed power.

error

The total sum of the absolute estimated errors for each call to the pmvt (or pmvnorm) function. The number of such calls is given (in the non exchangeable case) by the function complexity. Note that in the exchangeable case, some probabilities are weighted. So an error committed on such a probability is also inflated with the same weight. Note also that this global error does not take into account the signs of the individual errors and is thus most certainly higher than the true error. In other words, you are 99 percent sure that the true power is between 'pow' - 'error' and 'pow' + 'error', but it is also probably much closer to 'pow', particularly if the complexity is large.

Note

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.

Author(s)

P. Lafaye de Micheaux, B. Liquet and J. Riou

References

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.

See Also

indiv.analysis,


Computation of power for step-up (Hochberg) procedure.

Description

This function computes the power for an analysis of m multiple tests with a control of the q-gFWER with the Hochberg procedure.

Usage

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)

Arguments

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 nC over nE.

delta

vector of length m equal to muE - muC - d.

SigmaC

matrix giving the covariances between the m primary endpoints in the control group.

SigmaE

matrix giving the covariances between the m primary endpoints in the experimental (test) group.

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 q false rejections. The default value q=1 corresponds to the classical FWER control.

asympt

logical. TRUE for the use of the asymptotic approximation by a multivariate normal distribution or FALSE for the multivariate Student distribution.

maxpts

convergence parameter used in the GenzBretz function. A suggested choice is min(25000 * true.complexity, .Machine$integer.max) where true.complexity is computed with the complexity function. But note that this might considerably increase the computation time!

abseps

convergence parameter used in the GenzBretz function. A suggested choice is max(0.001 / true.complexity, 1e-08) where true.complexity is computed with the complexity function. But note that this might considerably increase the computation time!

releps

relative error tolerance as double used in the GenzBretz function.

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.

Value

List with two components:

pow

The computed power.

error

The sum of the absolute estimated errors for each call to the pmvt (or pmvnorm) function. The number of such calls is given (in the non exchangeable case) by the function complexity. Note that in the exchangeable case, some probabilities are weighted. So an error committed on such a probability is also inflated with the same weight. Note also that this global error does not take into account the signs of the individual errors and is thus most certainly higher than the true error. In other words, you are 99 percent sure that the true power is between 'pow' - 'error' and 'pow' + 'error', but it is also probably much closer to 'pow', particularly if the complexity is large.

Note

Note that we use critical values involving the D1 term in formula (11) of Romano et al. in order to control strongly the qq-FWER. If you want to use the original Hochberg's procedure, set orig.Hochberg to TRUE. Even for q=1q=1, 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.

Author(s)

P. Lafaye de Micheaux, B. Liquet and J. Riou

References

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.

See Also

indiv.analysis,