Title: | Unified Multiple Testing Procedures |
---|---|
Description: | Designed to ease the application and comparison of multiple hypothesis testing procedures for FWER, gFWER, FDR and FDX. Methods are standardized and usable by the accompanying 'mutossGUI'. |
Authors: | MuToss Coding Team (Berlin 2010), Gilles Blanchard, Thorsten Dickhaus, Niklas Hack, Frank Konietschke, Kornelius Rohmeyer, Jonathan Rosenblatt, Marsel Scheer, Wiebke Werft |
Maintainer: | Kornelius Rohmeyer <[email protected]> |
License: | GPL |
Version: | 0.1-13 |
Built: | 2025-02-17 05:31:36 UTC |
Source: | https://github.com/kornl/mutoss |
The Lowest Slope Line (LSL) method of Hochberg and Benjamini for estimating pi0 is applied to pValues. This method for estimating pi0 is motivated by the graphical approach proposed by Schweder and Spjotvoll (1982), as developed and presented in Hochberg and Benjamini (1990).
ABH_pi0_est(pValues)
ABH_pi0_est(pValues)
pValues |
The raw p-values for the marginal test problems |
pi0.ABH |
The estimated proportion of true null hypotheses. |
WerftWiebke
Hochberg, Y. and Benjamini, Y. (1990). More powerful procedures for multiple significance testing. Statistics in Medicine 9, 811-818.
Schweder, T. and Spjotvoll, E. (1982). Plots of P-values to evaluate many tests simultaneously. Biometrika 69, 3, 493-502.
my.pvals <- c(runif(50), runif(50, 0, 0.01)) result <- ABH_pi0_est(my.pvals)
my.pvals <- c(runif(50), runif(50, 0, 0.01)) result <- ABH_pi0_est(my.pvals)
The adaptive Benjamini-Hochberg step-up procedure is applied to pValues. It controls the FDR at level alpha for independent or positive regression dependent test statistics.
adaptiveBH(pValues, alpha, silent=FALSE)
adaptiveBH(pValues, alpha, silent=FALSE)
pValues |
The used raw pValues. |
alpha |
The level at which the FDR shall be controlled. |
silent |
If true any output on the console will be suppressed. |
In the adaptive Benjamini-Hochberg step-up procedure the number of true null hypotheses is estimated first as in Hochberg and Benjamini (1990), and this estimate is used in the procedure of Benjamini and Hochberg (1995) with alpha'=alpha*m/m0. Please note that this method is not equivalent to multcomp's ABH. They revised the formular of the original paper.
A list containing:
adjPValues |
A numeric vector containing the adjusted pValues |
criticalValues |
A numeric vector containing critical values used in the step-up-down test |
rejected |
A logical vector indicating which hypotheses are rejected |
pi0 |
An estimate of the proportion of true null hypotheses among all hypotheses (pi0=m0/m). |
errorControl |
A Mutoss S4 class of type |
WerftWiebke
Benjamini, Y. and Hochberg, Y. (2000). On the Adaptive Control of the False Discovery Rate
in Multiple Testing With Independent Statistics.
Journal of Educational and Behavioral Statistics, 25(1): 60-83.
Hochberg, Y. and Benjamini, Y. (1990). More powerful procedures for multiple significance testing.
Statistics in Medicine 9, 811-818.
Benjamini, Y. and Hochberg, Y. (1995). Controlling the false discovery rate: A practical and powerful approach to mulitple testing. Journal of the Royal Statistical Society, Series B, 57:289-300.
alpha <- 0.05 p <-c(runif(10, min=0, max=0.01), runif(10, min=0.9, max=1)) result <- adaptiveBH(p, alpha) result <- adaptiveBH(p, alpha, silent=TRUE)
alpha <- 0.05 p <-c(runif(10, min=0, max=0.01), runif(10, min=0.9, max=1)) result <- adaptiveBH(p, alpha) result <- adaptiveBH(p, alpha, silent=TRUE)
Storey-Taylor-Siegmund's (2004) adaptive step-up procedure
adaptiveSTS(pValues, alpha, lambda=0.5, silent=FALSE)
adaptiveSTS(pValues, alpha, lambda=0.5, silent=FALSE)
pValues |
The used raw pValues. |
alpha |
The level at which the FDR shall be controlled. |
lambda |
The tuning parameter for the estimation procedure (defaults to 0.5) |
silent |
If true any output on the console will be suppressed. |
The adaptive STS procedure uses a conservative estimate of pi0 which is plugged in a linear step-up procedure. The estimation of pi0 requires a parameter (lambda) which is set to 0.5 by default. Note that the estimated pi0 is truncated at 1 as suggested by the author, so the implemetation of the procedure is not entirely supported by the proof in the reference.
A list containing:
adjPValues |
A numeric vector containing the adjusted pValues |
rejected |
A logical vector indicating which hypotheses are rejected |
criticalValues |
A numeric vector containing critical values used in the step-up-down test |
errorControl |
A Mutoss S4 class of type |
Werft Wiebke
Storey, J.D., Taylor, J.E. and Siegmund, D. (2004). Strong control, conservative point estimation and simultaneous conservative consistency of false discovery rates: a unified approach. Journal of the Royal Statistical Society, B 66(1):187-205.
alpha <- 0.05 p <-c(runif(10, min=0, max=0.01), runif(10, min=0.9,max=1)) result <- adaptiveSTS(p, alpha, lambda=0.5) result <- adaptiveSTS(p, alpha, lambda=0.5, silent=TRUE)
alpha <- 0.05 p <-c(runif(10, min=0, max=0.01), runif(10, min=0.9,max=1)) result <- adaptiveSTS(p, alpha, lambda=0.5) result <- adaptiveSTS(p, alpha, lambda=0.5, silent=TRUE)
A function plotting adjusted p-values
adjPValuesPlot(adjPValues, alpha)
adjPValuesPlot(adjPValues, alpha)
adjPValues |
A numeric containing the adjusted pValues to plot. |
alpha |
A numeric containing the overall type I error rate alpha.. |
MuToss-Coding Team
Performs a step-up-down test on pValues. The critical values are based on the asymptotically optimal rejection curve. To have finite FDR control, an automatic adjustment of the critical values is done (see details for more).
aorc(pValues, alpha, startIDX_SUD=length(pValues), betaAdjustment, silent=FALSE)
aorc(pValues, alpha, startIDX_SUD=length(pValues), betaAdjustment, silent=FALSE)
pValues |
pValues to be used. They are assumed to be stochastically independent. |
alpha |
The level at which the FDR shall be controlled. |
startIDX_SUD |
The index at which critical value the step-up-down test starts. Default is length(pValues) and thus the function aorc() by default behaves like an step-up test. |
betaAdjustment |
A numeric value to adjust the asymptotically optimal rejection curve for the finite sample case. If betaAdjustment is not set an algorithm will calculate it, but this can be time-consuming. |
silent |
If true any output on the console will be suppressed. |
The graph of the function f(t) = t / (t * (1 - alpha) + alpha) is called the asymptotically optimal rejection curve. Denote by finv(t) the inverse of f(t). Using the critical values finv(i/n) for i = 1, ..., n yields asymptotic FDR control. To ensure finite control it is possible to adjust f(t) by a factor. The function calculateBetaAdjustment() calculates a beta such that (1 + beta / n) * f(t) can be used to control the FDR for a given finite sample size. If the parameter betaAdjustment is not provided, calculateBetaAdjustment() will be called automatically.
A list containing:
adjPValues |
A numeric vector containing the adjusted pValues |
rejected |
A logical vector indicating which hypotheses are rejected |
criticalValues |
A numeric vector containing critical values used in the step-up-down test |
errorControl |
A Mutoss S4 class of type |
MarselScheer
Finner, H., Dickhaus, T. & Roters, M. (2009). On the false discovery rate and an asymptotically optimal rejection curve. The Annals of Statistics 37, 596-618.
## Not run: # Takes more than 6 seconds therefor CRAN should not check it: r <- c(runif(10), runif(10, 0, 0.01)) result <- aorc(r, 0.05) result <- aorc(r, 0.05, startIDX_SUD = 1) ## step-down result <- aorc(r, 0.05, startIDX_SUD = length(r)) ## step-up ## End(Not run)
## Not run: # Takes more than 6 seconds therefor CRAN should not check it: r <- c(runif(10), runif(10, 0, 0.01)) result <- aorc(r, 0.05) result <- aorc(r, 0.05, startIDX_SUD = 1) ## step-down result <- aorc(r, 0.05, startIDX_SUD = length(r)) ## step-up ## End(Not run)
Wrapper function to the augmentation methods of the multtest package.
augmentation(adjPValues, newErrorControl, newK, newQ, silent=FALSE)
augmentation(adjPValues, newErrorControl, newK, newQ, silent=FALSE)
adjPValues |
a vector of p-values that are *already* adjusted for FWER |
newErrorControl |
new error control type to adjust for. One of ("gFWER", "FDX", "FDR") |
newK |
k-parameter if newErrorControl is "gFWER" |
newQ |
q-parameter if newErrorControl is "FDX" |
silent |
if true any output on the console will be suppressed. |
The augmentation method turns a vector of p-values which are already adjusted for FWER control into p-values that are adjusted for gFWER, FDX or FDR. The underlying idea (for gFWER and FDX) is that the set of hypotheses rejected at a given level alpha under FWER can be "augmented" by rejecting some additional hypotheses while still ensuring (strong) control of the desired weaker type I criterion. For FDR, it uses the fact that FDX control for q=alpha=1-sqrt(1-beta) entails FDR control at level beta.
Use of these augmentation methods is recommended only in the situation where FWER-controlled p-values are directly available from the data (using some specific method). When only marginal p-values are available, it is generally prerefable to use other adjustment methods directly aimed at the intended criterion (as opposed to first adjust for FWER, then augment)
Note: in the multtest package, two methods ("restricted" and "conservative") are available for FDR augmentation. Here the 'restricted' method is forced for FDR augmentation since it is in fact always valid and better than "conservative" (M. van der Laan, personal communication) with respect to power.
A list containing:
adjPValues |
A numeric vector containing the new adjusted pValues |
rejected |
A logical vector indicating which hypotheses are rejected. Currently always NULL. |
errorControl |
A Mutoss S4 class of type |
KornRohm, GillesBlanchard
Dudoit, S. and van der Laan, M.J. (2008) Multiple Testing Procedures with Applications to Genomics, Springer. (chapter 6)
## Not run: TODO NH (MS) EXAMPLE PROBLEM p <- c(runif(50), runif(50, 0, 0.01)) fwer_adj <- bonferroni(p) # adjust for FWER using Bonferroni correction fdx_adj <- augmentation(fwer_adj$adjPValues , "FDX", q=0.1, silent = TRUE) #augment to FDX (q=0.1) ## End(Not run)
## Not run: TODO NH (MS) EXAMPLE PROBLEM p <- c(runif(50), runif(50, 0, 0.01)) fwer_adj <- bonferroni(p) # adjust for FWER using Bonferroni correction fdx_adj <- augmentation(fwer_adj$adjPValues , "FDX", q=0.1, silent = TRUE) #augment to FDX (q=0.1) ## End(Not run)
Benjamini-Hochbergs Linear Step-Up Procedure. The procedure controls the FDR when the test statistics are stochastically independent or satisfy positive regression dependency (PRDS) (see Benjamini and Yekutieli 2001 for details). The Benjamini-Hochberg (BH) step-up procedure considers ordered pValues P_(i). It defines k as the largest i for which P_(i) <= i*alpha/m and then rejects all associated hypotheses H_(i) for i=1,...,k. In their seminal paper, Benjamini and Hochberg (1995) show that for 0 <= m_0 <= m independent pValues corresponding to true null hypotheses and for any joint distribution of the m_1 = m-m_0 p-values corresponding to the non null hypotheses, the FDR is controlled at level (m_0/m)*alpha. Under the assumption of the PRDS property, (for details see Benjamini and Yekutieli 2001). In Benjamini et al. (2006) the BH procedure is improved by adaptive procedures which use an estimate of m_0 and apply the BH method al level alpha'=alpha*m/m_0, to fully exhaust the desired level alpha (see Adaptive Benjamini Hochberg and Two Stage Banjamini Yekutieli).
BH(pValues, alpha, silent=FALSE)
BH(pValues, alpha, silent=FALSE)
pValues |
The used unadjusted pValues. |
alpha |
The level at which the FDR shall be controlled. |
silent |
If true any output on the console will be suppressed. |
A list containing:
adjPValues |
A numeric vector containing the adjusted pValues |
criticalValues |
A numeric vector containing critical values used in the step-up test |
rejected |
A logical vector indicating which hypotheses are rejected |
errorControl |
A Mutoss S4 class of type |
Werft Wiebke
Benjamini, Y. and Hochberg, Y. (1995). Controlling the false discovery rate: A practical and powerful approach to mulitple testing.
Journal of the Royal Statistical Society, Series B, 57:289-300.
Benjamini, Y. and Yekutieli, D. (2001). The control of the false discovery rate in multiple testing under dependency.
Annals of Statistics, 29(4):1165-1188.
Benjamini, Y., Krieger, A. and Yekutieli, D. (2006). Adaptive linear step-up procedures that control the false discovery rate. Biometrika, 93(3):491-507.
alpha <- 0.05 p <-c(runif(10, min=0, max=0.01), runif(10, min=0.9, max=1)) result <- BH(p, alpha) result <- BH(p, alpha, silent=TRUE)
alpha <- 0.05 p <-c(runif(10, min=0, max=0.01), runif(10, min=0.9, max=1)) result <- BH(p, alpha) result <- BH(p, alpha, silent=TRUE)
Benjamini-Liu's step-down procedure is applied to pValues. The procedure controls the FDR if the corresponding test statistics are stochastically independent.
BL(pValues, alpha, silent=FALSE)
BL(pValues, alpha, silent=FALSE)
pValues |
Numeric vector of p-values |
alpha |
The level at which the FDR is to be controlled. |
silent |
If true any output on the console will be suppressed. |
The Benjamini-Liu (BL) step-down procedure neither dominates nor is dominated by the Benjamini-Hochberg (BH) step-up procedure. However, in Benjamini and Liu (1999) a large simulation study concerning the power of the two procedures reveals that the BL step-down procedure is more suitable when the number of hypotheses is small. Moreover, if most hypotheses are far from the null then the BL step-down procedure is more powerful than the BH step-up method. The BL step-down method calculates critical values according to Benjamin and Liu (1999), i.e., c_i = 1 - (1 - min(1, (m*alpha)/(m-i+1)))^(1/(m-i+1)) for i = 1,...,m, where m is the number of hypotheses tested. Then, let k be the smallest i for which P_(i) > c_i and reject the associated hypotheses H_(1),...,H_(k-1).
A list containing:
adjPValues |
A numeric vector containing the adjusted pValues. |
criticalValues |
A numeric vector containing critical values used in the step-up-down test. |
rejected |
A logical vector indicating which hypotheses are rejected. |
errorControl |
A Mutoss S4 class of type |
Werft Wiebke
Bejamini, Y. and Liu, W. (1999). A step-down multiple hypotheses testing procedure that controls the false discovery rate under independence. Journal of Statistical Planning and Inference Vol. 82(1-2): 163-170.
alpha <- 0.05 p <-c(runif(10, min=0, max=0.01), runif(10, min=0.9, max=1)) result <- BL(p, alpha) result <- BL(p, alpha, silent=TRUE)
alpha <- 0.05 p <-c(runif(10, min=0, max=0.01), runif(10, min=0.9, max=1)) result <- BL(p, alpha) result <- BL(p, alpha, silent=TRUE)
Blanchard-Roquain (2008) step-up Procedure for arbitrary dependent p-Values Also proposed independently by Sarkar (2008)
BlaRoq(pValues, alpha, pii, silent=FALSE)
BlaRoq(pValues, alpha, pii, silent=FALSE)
pValues |
pValues to be used. They can have arbitrary dependence. |
alpha |
the level at which the FDR should be controlled |
pii |
Prior for the proportion of true null hypotheses, same size as pValues |
silent |
if true any output on the console will be suppressed. |
A generalization of the Benjamini-Yekutieli procedure, taking as an additional parameter a distribution pii on [1..k] (k is the number of hypotheses) representing prior belief on the number of hypotheses that will be rejected.
It is a step-up Procedure with critical values C_i defined as alpha/k times the sum for j in [1..i] of j*pii[j]. For any fixed prior pii, the FDR is controlled at level alpha for arbitrary dependence structure of the p-Values. The particular case of the Benjamini-Yekutieli step-up is recovered by taking pii[i] proportional to 1/i.
If pii is missing, a default prior distribution proportional to exp( -i/(0.15*k) ) is taken. It should perform better than the BY procedure if more than about 0.05 to 0.1 of hypotheses are rejected, and worse otherwise.
Note: the procedure automatically normalizes the prior pii to sum to one if this is not the case.
A list containing:
adjPValues |
A numeric vector containing the adjusted pValues |
rejected |
A logical vector indicating which hypotheses are rejected |
criticalValues |
A numeric vector containing critical values used in the step-up test |
errorControl |
A Mutoss S4 class of type |
GillesBlanchard,HackNiklas
Blanchard, G. and Roquain, E. (2008). Two simple sufficient conditions for FDR control. Electronic Journal of Statistics, 2:963-992. Sarkar, S.K. (2008) On methods controlling the false discovery rate. Sankhya, Series A, 70:135-168.
Bonferroni correction
bonferroni(pValues, alpha, silent=FALSE)
bonferroni(pValues, alpha, silent=FALSE)
pValues |
A numeric vector containing the unadjusted pValues. No assumption is made on the dependence structure. |
alpha |
The overall type I error at which the FWER shall be controlled (optional). |
silent |
logical scalar. If |
The classical Bonferroni correction outputs adjusted p-values, ensuring strong FWER control under arbitrary dependence of the input p-values. It simply multiplies each input p-value by the total number of hypotheses (and ceils at value 1).
It is recommended to use Holm's step-down instead, which is valid under the exact same assumptions and more powerful.
A list containing:
adjPValues |
A numeric vector containing the new adjusted pValues |
rejected |
(if alpha is given) A logical vector indicating which hypotheses are rejected |
errorControl |
A Mutoss S4 class of type |
MuToss-Coding Team
Bonferroni, C. E. (1935) Il calcolo delle assicurazioni su gruppi di teste. 'In Studi in Onore del Professore Salvatore Ortu Carboni. Rome: Italy, pp. 13-60.
Bonferroni, C. E. (1936) Teoria statistica delle classi e calcolo delle probabilita. Pubblicazioni del R Istituto Superiore di Scienze Economiche e Commerciali di Firenze 8, 3-62, 1936.
The proportion of true nulls is estimated using the Blanchard-Roquain 1-stage procedure with parameter (alpha,lambda) via the formula
BR_pi0_est(pValues, alpha, lambda=1, truncate=TRUE)
BR_pi0_est(pValues, alpha, lambda=1, truncate=TRUE)
pValues |
The raw p-values for the marginal test problems (assumed to be independent) |
alpha |
The FDR significance level for the BR procedure |
lambda |
(default 1) The parameter for the BR procedure, shoud belong to (0, 1/alpha) |
truncate |
(logical, default TRUE) if TRUE, output estimated is truncated to 1 |
estimated pi_0 = ( m - R(alpha,lambda) + 1) / ( m*( 1 - lambda * alpha ) )
where R(alpha,lambda) is the number of hypotheses rejected by the BR 1-stage procedure, alpha is the FDR level for this procedure and lambda a parameter belonging to (0, 1/alpha) with default value 1. Independence of p-values is assumed. This estimate may in some cases be larger than 1; it is truncated to 1 if the parameter truncated=TRUE. The estimate is used in the Blanchard-Roquain 2-stage step-up (using the non-truncated version)
pi0 |
The estimated proportion of true null hypotheses. |
GillesBlanchard
Blanchard
The Benjamini-Yekutieli step-up procedure is applied to pValues. The procedure ensures FDR control for any dependency structure.
BY(pValues, alpha, silent=FALSE)
BY(pValues, alpha, silent=FALSE)
pValues |
The used unadjusted pValues. |
alpha |
The level at which the FDR shall be controlled. |
silent |
If true any output on the console will be suppressed. |
The critical values of the Benjamini-Yekutieli (BY) procedure are calculated by replacing the alpha of the Benjamini-Hochberg procedure by alpha/sum(1/1:m)), i.e., c(i)=i*alpha/(m*(sum(1/1:m))) for i=1,...,m. For large number m of hypotheses the critical values of the BY procedure and the BH procedure differ by a factor log(m). Benjamini and Yekutieli (2001) showed that this step-up procedure controls the FDR at level alpha*m/m0 for any dependency structure among the test statistics.
A list containing:
adjPValues |
A numeric vector containing the adjusted pValues |
criticalValues |
A numeric vector containing critical values used in the step-up-down test |
rejected |
A logical vector indicating which hypotheses are rejected |
errorControl |
A Mutoss S4 class of type |
WerftWiebke
Benjamini, Y. and Yekutieli, D. (2001). The control of the false discovery rate in multiple testing under dependency. Annals of Statistics, 29(4):1165-1188.
alpha <- 0.05 p <-c(runif(10, min=0, max=0.01), runif(10, min=0.9, max=1)) result <- BY(p, alpha) result <- BY(p, alpha, silent=TRUE)
alpha <- 0.05 p <-c(runif(10, min=0, max=0.01), runif(10, min=0.9, max=1)) result <- BY(p, alpha) result <- BY(p, alpha, silent=TRUE)
Calculates the beta to adjust the asymptotically optimal rejection curve used by the function aorc() for a finite sample size. Then aorc(..., betaAdjustment = beta) controls the FDR also in the finite sample situation.
calculateBetaAdjustment(n, startIDX_SUD, alpha, silent=FALSE, initialBeta=1, maxBinarySteps=50, tolerance=1e-04)
calculateBetaAdjustment(n, startIDX_SUD, alpha, silent=FALSE, initialBeta=1, maxBinarySteps=50, tolerance=1e-04)
n |
Number of tests for which the adjusted beta should be calculated. |
startIDX_SUD |
Starting index of the step-up-down procedure |
alpha |
The level at which the FDR shall be controlled. |
silent |
If true any output on the console will be suppressed. |
initialBeta |
Initial beta. |
maxBinarySteps |
Maximum number of steps that will be performed. |
tolerance |
The tolerance to search for an upper FDR bound element in [alpha - tolerance, alpha] |
The asymptotically optimal rejection curve, denoted by f(t), does not provide finite control of the FDR. calculateBetaAdjustment() calculates a factor, denoted by beta, such that (1 + beta/n) * f(t) provides finite control of the FDR.
The beta is calculated with the bisection approach. Assume there are beta1 and beta2 such that the choosing beta1 controls the FDR and beta2 not, then the optimal beta lies in [beta2, beta1]. If the choice (beta2 + beta1)/2 controls the FDR, the optimal FDR lies in [(beta2 + beta1)/2, beta1] and so on.
The adjustment factor that is needed to ensure control of the FDR with the adjusted asymptotically optimal rejection curve at the specified level and sample size.
MarselScheer
Functions for comparing outputs of different procedures.
compareMutoss(...) mu.compare.adjusted(comparison.list, identify.check=F) mu.compare.critical(comparison.list, identify.check=F) mu.compare.summary(comparison.list)
compareMutoss(...) mu.compare.adjusted(comparison.list, identify.check=F) mu.compare.critical(comparison.list, identify.check=F) mu.compare.summary(comparison.list)
... |
An arbitrary number of Motoss class objects. |
comparison.list |
The output of the |
identify.check |
Logical parameter specifying if hypotheses should be identified on the output plots. |
These functions are used to compare the results of different multiple comparisons procedures stored as Mutoss class objects.
compareMutoss
takes as input an arbitrary number of Mutoss objects and arranges them in a simple list objects (non S4).
mu.compare.adjuted
, mu.compare.critical
and mu.compare.summary
take the output of the compareMutoss
and plots or summerize the results textually or graphically.
compareMutoss |
Returns a list with the following components: |
mu.compare.adjusted |
Creates a plot with the adjusted p-values for each procedure. |
mu.compare.critical |
Creates a plot with the critical values for each procedure and error rate. |
mu.compare.summary |
Creates a short textual summary for comparing results of different procedures. |
Jonathan Rosenblatt
# TODO: EXAMPLE PROBLEMS ## Not run: \dontrun{Creating several Mutoss class objects} mu.test.obj.1 <- mutoss.apply(new(Class="Mutoss", pValues=runif(10)), f=bonferroni, label="Bonferroni Correction", alpha=0.05, silent=T) mu.test.obj.2 <- mutoss.apply(new(Class="Mutoss", pValues=runif(10)), f=holm, label="Holm's step-down-procedure", alpha=0.05, silent=T) mu.test.obj.3 <- mutoss.apply(new(Class="Mutoss", pValues=runif(10)), f=aorc, label="Asymtotically optimal rejection curve", alpha=0.05, startIDX_SUD = 1, silent=T) \dontrun{Trying to coercing a non-Mutoss object} compareMutoss(1) \dontrun{ Coercing several objects into a list} compare.1<- compareMutoss(mu.test.obj.1, mu.test.obj.2) compare.2<- compareMutoss(mu.test.obj.1, mu.test.obj.2, mu.test.obj.3) \dontrun{Plotting the adjusted pvalues. Identification available.} mu.compare.adjusted(compare.1, T) mu.compare.adjusted(compare.2, T) \dontrun{Plotting the critical values. Identification available.} mu.compare.critical(compare.1, T) mu.compare.critical(compare.2, T) \dontrun{Showing a textual sumary} mu.compare.summary(compare.1) mu.compare.summary(compare.2) ## End(Not run)
# TODO: EXAMPLE PROBLEMS ## Not run: \dontrun{Creating several Mutoss class objects} mu.test.obj.1 <- mutoss.apply(new(Class="Mutoss", pValues=runif(10)), f=bonferroni, label="Bonferroni Correction", alpha=0.05, silent=T) mu.test.obj.2 <- mutoss.apply(new(Class="Mutoss", pValues=runif(10)), f=holm, label="Holm's step-down-procedure", alpha=0.05, silent=T) mu.test.obj.3 <- mutoss.apply(new(Class="Mutoss", pValues=runif(10)), f=aorc, label="Asymtotically optimal rejection curve", alpha=0.05, startIDX_SUD = 1, silent=T) \dontrun{Trying to coercing a non-Mutoss object} compareMutoss(1) \dontrun{ Coercing several objects into a list} compare.1<- compareMutoss(mu.test.obj.1, mu.test.obj.2) compare.2<- compareMutoss(mu.test.obj.1, mu.test.obj.2, mu.test.obj.3) \dontrun{Plotting the adjusted pvalues. Identification available.} mu.compare.adjusted(compare.1, T) mu.compare.adjusted(compare.2, T) \dontrun{Plotting the critical values. Identification available.} mu.compare.critical(compare.1, T) mu.compare.critical(compare.2, T) \dontrun{Showing a textual sumary} mu.compare.summary(compare.1) mu.compare.summary(compare.2) ## End(Not run)
This class holds the information related to the error rate
type
:a character specifying the error rate. For example FWER, FDR, ...
alpha
:the level at which the error rate shall be controlled
k
:an additional parameter for generalised FWER
q
:an additional parameter for FDX (false discovery exceedance)
MuToss-Coding Team
Fisher (2x2) table association analysis for calculating one (marginal) p-value
fisher22_fast(obs, epsilon)
fisher22_fast(obs, epsilon)
obs |
The observed (2x2) table |
epsilon |
A threshold for comparing real numbers to zero |
A list containing:
nonrand_p |
The non-randomized (conservative) p-value |
rand_p |
The randomized (non-conservative) p-value |
prob_table |
The conditional probability of the observed table (given the merginals) |
ThorstenDickhaus
Fisher (2x2) table association analysis for calculating all marginal p-values
fisher22.marginal(data, model)
fisher22.marginal(data, model)
data |
A tensor of dimension (2x2xm) where m is the number of endpoints (genes, etc.) |
model |
A model object indicating that this type of analysis shall be performed |
A list containing the m marginal p-values
ThorstenDickhaus
Fisher-type (2x3) table association analysis for calculating one (marginal) p-value
fisher23_fast(obs, epsilon)
fisher23_fast(obs, epsilon)
obs |
The observed (2x3) table |
epsilon |
A threshold for comparing real numbers to zero |
A list containing:
nonrand_p |
The non-randomized (conservative) p-value |
rand_p |
The randomized (non-conservative) p-value |
prob_table |
The conditional probability of the observed table (given the merginals) |
ThorstenDickhaus
Fisher-type (2x3) table association analysis for calculating all marginal p-values
fisher23.marginal(data, model)
fisher23.marginal(data, model)
data |
A tensor of dimension (2x3xm) where m is the number of endpoints (genes, etc.) |
model |
A model object indicating that this type of analysis shall be performed |
A list containing the m marginal p-values
ThorstenDickhaus
The robust version uses the Kruskal-Wallis test, otherwise a F-test will be performed.
ftest.marginal(data, model, robust)
ftest.marginal(data, model, robust)
data |
the data set |
model |
the result of a call to |
robust |
a logical variable indicating whether a F-test or a Kruskal-Wallis test should be used. |
A classlabel needs to be provided to distinguish k sample groups.
pValues |
A numeric vector containing the unadjusted pValues |
MuToss-Coding Team
Kruskal, W.H. und Wallis, W.A. (1952). Use of ranks in one-criterion variance analysis. JASA, 47:583-621
Xin Gao's non-parametric multiple test procedure is applied to Data. The procedure controls the FWER in the strong sense. Here, only the Many-To-One comparisons are computed.
gao(formula, data, alpha=0.05, control=NULL, silent=FALSE) gao.wrapper(model, data, alpha, control)
gao(formula, data, alpha=0.05, control=NULL, silent=FALSE) gao.wrapper(model, data, alpha, control)
formula |
Formula defining the statistical model, containing the response and the factors |
model |
Model with formula, containing the response and the factors |
data |
Dataset containing the response and the grouping factor |
alpha |
The level at which the FWER shall be controlled. By default it is alpha=0.05. |
silent |
If true any output on the console will be suppressed. |
control |
The control group for the Many-To-One comparisons. By default it is the first group in lexicographical order. |
This function computes Xin Gao's nonparametric multiple test procedures in an unbalanced one way layout.
It is based upon the following purely nonparametric effects:
Let denote the distribution function of sample
and let
denote the mean distribution function
of all distribution functions
. The effects
are called unweighted relative effects. If
, the random
variables from sample
tend (stochastically) to larger values than any randomly chosen number
from the whole experiment. If
, there is no tendency to smaller nor larger values. However,
this approach tests the hypothesis
formulated in terms of the
distribution functions, simultaneously.
A list containing:
adjPValues |
A numeric vector containing the adjusted pValues |
rejected |
A logical vector indicating which hypotheses are rejected |
confIntervals |
A matrix containing the estimates and the lower and upper confidence bound |
errorControl |
A Mutoss S4 class of type |
Frank Konietschke
Gao, X. et al. (2008). Nonparametric multiple comparison procedures for unbalanced
one-way factorial designs.
Journal of Statistical Planning and Inference 77, 2574-2591.
The FWER is controlled by using the Hochberg adjustment
(Hochberg, Y. (1988). A sharper Bonferroni procedure for multiple tests of significance. Biometrika 75, 800-802.)
x=c(rnorm(40)) f1=c(rep(1,10),rep(2,10),rep(3,10),rep(4,10)) my.data <- data.frame(x,f1) result <- gao(x~f1,data=my.data, alpha=0.05,control=2, silent=FALSE) result <- gao(x~f1,data=my.data, alpha=0.05,control=2, silent=TRUE) result <- gao(x~f1,data=my.data, alpha=0.05)
x=c(rnorm(40)) f1=c(rep(1,10),rep(2,10),rep(3,10),rep(4,10)) my.data <- data.frame(x,f1) result <- gao(x~f1,data=my.data, alpha=0.05,control=2, silent=FALSE) result <- gao(x~f1,data=my.data, alpha=0.05,control=2, silent=TRUE) result <- gao(x~f1,data=my.data, alpha=0.05)
Basically, it is a helper function for gatherStatistics(). It extracts the parameters from the simObject$results and creates a data.frame from this. Every used parameter gets its own column. Every row corresponds to one object in simObject$results. If a object A from simObject$results does not contain a parameter P that another object B does, then the row for object A will have "" in the column for the parameter P.
gatherParameters(simObject)
gatherParameters(simObject)
simObject |
An object returned by simulation() |
A data.frame with rows for every object in simObject$results and columns for the used parameter.
MarselScheer
#' # this function generates pValues myGen <- function(n, n0) { list(procInput=list(pValues = c(runif(n-n0, 0, 0.01), runif(n0))), groundTruth = c(rep(FALSE, times=n-n0), rep(TRUE, times=n0))) } # need some simulation()-Object I can work with sim <- simulation(replications = 3, list(funName="myGen", fun=myGen, n=200, n0=c(50,100)), list(list(funName="BH", fun=function(pValues, alpha) BH(pValues, alpha, silent=TRUE), alpha=c(0.25, 0.5)), list(funName="holm", fun=holm, alpha=c(0.25, 0.5),silent=TRUE))) gatherParameters(sim)
#' # this function generates pValues myGen <- function(n, n0) { list(procInput=list(pValues = c(runif(n-n0, 0, 0.01), runif(n0))), groundTruth = c(rep(FALSE, times=n-n0), rep(TRUE, times=n0))) } # need some simulation()-Object I can work with sim <- simulation(replications = 3, list(funName="myGen", fun=myGen, n=200, n0=c(50,100)), list(list(funName="BH", fun=function(pValues, alpha) BH(pValues, alpha, silent=TRUE), alpha=c(0.25, 0.5)), list(funName="holm", fun=holm, alpha=c(0.25, 0.5),silent=TRUE))) gatherParameters(sim)
This function facilitates gathering statistics from the object returned by simulation().
gatherStatistics(simObject, listOfStatisticFunctions, listOfAvgFunctions)
gatherStatistics(simObject, listOfStatisticFunctions, listOfAvgFunctions)
simObject |
An object returned by simulation() |
listOfStatisticFunctions |
List of statistics that shall be calculated for the elements in simObject |
listOfAvgFunctions |
List of functions that will be used to summarize/average the calculated statistics for all elements in simObject$results with the same parameter constellation. If this is argument is missing no averaging will be done. Instead the resulting data.frame will keep one row for every object in simObject$results. |
For every simulation()-Object in simObject$results all statistics in listOfStatisticFunctions are calculated. If in addition listOfAvgFunctions is provided then the statistics of the objects that have the same parameter constellation are averaged by the functions in listOfAvgFunctions. The resulting data.frame will then keep only one row for every parameter constellation.
statisticDF |
A data.frame that can be of two different kinds. If listOfAvgFunctions is provided, then the resulting data.frame will have a row for every parameter constellation that occurs in the simObject$results. There will be columns for every parameter used. Also length(listOfAvgFunctions) * length(listOfStatisticFunctions) additional columns will be created. Every statistic is calculated for every applied procedure and then all values that belong to a specific parameter constellation are "averaged" by applying all function from listOfAvgFunctions. For example, suppose FDP is a function from listOfStatisticFunctions that calculates the realized false discovery proportion, that is number of true hypotheses that were rejected divided by the number of all rejected hypotheses. Also suppose mean and sd are functions in listOfAvgFunctions, then the mean and the standard deviation of the statistic FDP are calculated. If listOfAvgFunctions is not provided, then the resulting data.frame will have a row for every simObject$results. Every parameter will have its own column. Additional columns for every function in listOfStatisticFunction will be created. |
MarselScheer
#' # this function generates pValues myGen <- function(n, n0) { list(procInput=list(pValues = c(runif(n-n0, 0, 0.01), runif(n0))), groundTruth = c(rep(FALSE, times=n-n0), rep(TRUE, times=n0))) } # need some simulation()-Object I can work with sim <- simulation(replications = 10, list(funName="myGen", fun=myGen, n=200, n0=c(50,100)), list(list(funName="BH", fun=function(pValues, alpha) BH(pValues, alpha, silent=TRUE), alpha=c(0.25, 0.5)), list(funName="holm", fun=holm, alpha=c(0.25, 0.5),silent=TRUE))) # Make my own statistic function NumberOfType1Error <- function(data, result) sum(data$groundTruth * result$rejected) # Get now for every object in sim$results one row with the number of Type 1 Errors result.all <- gatherStatistics(sim, list(NumOfType1Err = NumberOfType1Error)) # Average over all sim$results-Objects with common parameters result1 <- gatherStatistics(sim, list(NumOfType1Err = NumberOfType1Error), list(MEAN = mean)) print(result1) result2 <- gatherStatistics(sim, list(NumOfType1Err = NumberOfType1Error), list(q05 = function(x) quantile(x, probs=0.05), MEAN = mean, q95 = function(x) quantile(x, probs=0.95))) print(result2) # create some plots require(lattice) histogram(~NumOfType1Err | method*alpha, data = result.all$statisticDF) barchart(NumOfType1Err.MEAN ~ method | alpha, data = result2$statisticDF)
#' # this function generates pValues myGen <- function(n, n0) { list(procInput=list(pValues = c(runif(n-n0, 0, 0.01), runif(n0))), groundTruth = c(rep(FALSE, times=n-n0), rep(TRUE, times=n0))) } # need some simulation()-Object I can work with sim <- simulation(replications = 10, list(funName="myGen", fun=myGen, n=200, n0=c(50,100)), list(list(funName="BH", fun=function(pValues, alpha) BH(pValues, alpha, silent=TRUE), alpha=c(0.25, 0.5)), list(funName="holm", fun=holm, alpha=c(0.25, 0.5),silent=TRUE))) # Make my own statistic function NumberOfType1Error <- function(data, result) sum(data$groundTruth * result$rejected) # Get now for every object in sim$results one row with the number of Type 1 Errors result.all <- gatherStatistics(sim, list(NumOfType1Err = NumberOfType1Error)) # Average over all sim$results-Objects with common parameters result1 <- gatherStatistics(sim, list(NumOfType1Err = NumberOfType1Error), list(MEAN = mean)) print(result1) result2 <- gatherStatistics(sim, list(NumOfType1Err = NumberOfType1Error), list(q05 = function(x) quantile(x, probs=0.05), MEAN = mean, q95 = function(x) quantile(x, probs=0.95))) print(result2) # create some plots require(lattice) histogram(~NumOfType1Err | method*alpha, data = result.all$statisticDF) barchart(NumOfType1Err.MEAN ~ method | alpha, data = result2$statisticDF)
The Hochberg step-up procedure is based on marginal p-values. It controls the FWER in the strong sense under joint null distributions of the test statistics that satisfy Simes' inequality.
hochberg(pValues, alpha, silent=FALSE)
hochberg(pValues, alpha, silent=FALSE)
pValues |
The used raw pValues. |
alpha |
The level at which the FDR shall be controlled. |
silent |
If true any output on the console will be suppressed. |
The Hochberg procedure is more powerful than Holm's (1979) procedure, but the test statistics need to be independent or have a distribution with multivariate total positivity of order two or a scale mixture thereof for its validity (Sarkar, 1998). Both procedures use the same set of critical values c(i)=alpha/(m-i+1). Whereas Holm's procedure is a step-down version of the Bonferroni test, and Hochberg's is a step-up version of the Bonferroni test. Note that Holm's method is based on the Bonferroni inequality and is valid regardless of the joint distribution of the test statistics.
A list containing:
adjPValues |
A numeric vector containing the adjusted pValues |
rejected |
A logical vector indicating which hypotheses are rejected |
criticalValues |
A numeric vector containing critical values used in the step-up-down test |
errorControl |
A Mutoss S4 class of type |
WerftWiebke
Hochberg, Y. (1988). A sharper Bonferroni procedure for multiple tests of significance.
Biometrika, 75:800-802.
Huang, Y. and Hsu, J. (2007). Hochberg's step-up method: cutting corners off Holm's step-down method. Biometrika, 94(4):965-975.
alpha <- 0.05 p <-c(runif(10, min=0, max=0.01), runif(10, min=0.9,max=1)) result <- hochberg(p, alpha) result <- hochberg(p, alpha, silent=TRUE)
alpha <- 0.05 p <-c(runif(10, min=0, max=0.01), runif(10, min=0.9,max=1)) result <- hochberg(p, alpha) result <- hochberg(p, alpha, silent=TRUE)
Holm's step-down-procedure is applied to pValues. It controls the FWER in the strong sense under arbitrary dependency.
holm(pValues, alpha, silent=FALSE)
holm(pValues, alpha, silent=FALSE)
pValues |
pValues to be used. They can have arbitrary dependency structure. |
alpha |
The level at which the FWER shall be controlled |
silent |
If true any output on the console will be suppressed. |
Holm's procedure uses the same critical values as Hochberg's procedure, namely c(i)=alpha/(m-i+1), but is a step-down version while Hochberg's method is a step-up version of the Bonferroni test. Holm's method is based on the Bonferroni inequality and is valid regardless of the joint distribution of the test statistics, whereas Hochberg's method relies on the assumption that Simes' inequality holds for the joint null distribution of the test statistics. If this assumption is met, Hochberg's step-up procedure is more powerful than Holm's step-down procedure.
A list containing:
adjPValues |
A numeric vector containing the adjusted pValues |
rejected |
A logical vector indicating which hypotheses are rejected |
criticalValues |
A numeric vector containing critical values used in the step-down test |
errorControl |
A Mutoss S4 class of type |
MarselScheer
S. Holm (1979). A simple sequentially rejective multiple
test procedure. Scand. J. Statist. Vol. 6, 65-70.
Huang, Y. and Hsu, J. (2007). Hochberg's step-up method: cutting corners off Holm's step-down method. Biometrika, 94(4):965-975.
r <- c(runif(50), runif(50, 0, 0.01)) result <- holm(r, 0.05) result <- holm(r, 0.05, silent = TRUE)
r <- c(runif(50), runif(50, 0, 0.01)) result <- holm(r, 0.05) result <- holm(r, 0.05, silent = TRUE)
Hommel's step-up-procedure.
hommel(pValues, alpha, silent=FALSE)
hommel(pValues, alpha, silent=FALSE)
pValues |
pValues to be used. They need a independent structure. |
alpha |
The level at which the FWER should be controlled |
silent |
Logical. If true, any output on the console will be suppressed. |
The method is applied to p-values. It controls the FWER in the strong sense when the hypothesis tests are independent or when they are non-negatively associated.
The method is based upon the closure principle and the Simes test.
A list containing:
adjPValues |
A numeric vector containing the adjusted pValues |
rejected |
A logical vector indicating which hypotheses are rejected |
criticalValues |
A numeric vector containing critical values used in the step-up-down test. |
errorControl |
A Mutoss S4 class of type |
HackNiklas
G. Hommel (1988). A stagewise rejective multiple test procedure based on a modified Bonferroni test. Biometrika 75, pp. 383-386
pval <- c(runif(50), runif(50, 0, 0.01)) result <- hommel(pval, 0.05) result <- hommel(pval, 0.05, silent = TRUE)
pval <- c(runif(50), runif(50, 0, 0.01)) result <- hommel(pval, 0.05) result <- hommel(pval, 0.05, silent = TRUE)
Blanchard-Roquain (2009) 1-stage adaptive step-up
indepBR(pValues, alpha, lambda=1, silent=FALSE)
indepBR(pValues, alpha, lambda=1, silent=FALSE)
pValues |
the used p-values (assumed to be independent) |
alpha |
the level at which the FDR should be controlled. |
lambda |
parameter of the procedure, should belong to (0, 1/alpha) (lambda=1 default) |
silent |
if true any output on the console will be suppressed. |
This is a step-up procedure with critical values
C_i = alpha * min( i * ( 1 - lambda * alpha) / (m - i + 1) , lambda )
where alpha is the level at which FDR should be controlled and lambda an arbitrary parameter belonging to (0, 1/alpha) with default value 1. This procedure controls FDR at the desired level when the p-values are independent.
A list containing:
rejected |
A logical vector indicating which hypotheses are rejected |
criticalValues |
A numeric vector containing critical values used in the step-up-down test |
errorControl |
A Mutoss S4 class of type |
GillesBlanchard
Blanchard, G. and Roquain, E. (2009) Adaptive False Discovery Rate Control under Independence and Dependence Journal of Machine Learning Research 10:2837-2871.
Calculates the joint cumulative distribution function of order statistics of n iid. U(0,1)-distributed random variables at argument vec. Because of numerical issues n should not be greater than 100.
jointCDF.orderedUnif(vec)
jointCDF.orderedUnif(vec)
vec |
a numeric vector. The length of the vector also determines the number of random variables considered. |
Following Shorack, Wellner (1986) or Finner, Roters (2002) by applying Bolshev's recursion the joint distribution is calculated.
The return value is the following probability P(U_(1:n) <= vec[1], ..., U_(n:n) <= vec[n]), where U_1, ..., U_n are assumed to be iid. uniformly distributed on [0,1]. The i-th ordered value is denoted by U_(i:n) and n equals length(vec)
MarselScheer
Shorack, G. R. and Wellner, J. A. (1986). Empirical Processes with Applications to Statistics. Wiley, New York.
Finner, H. and Roters, M. (2002). Multiple hypotheses testing and expected type I errors. Ann. Statist. 30, 220-238.
Linear Step Up Service Function
linearStepUp(sorted, q, m, adjust=FALSE, m0=m, pi0, constant=1)
linearStepUp(sorted, q, m, adjust=FALSE, m0=m, pi0, constant=1)
sorted |
Numeric vector of sorted pvalues |
q |
Error rate to control for. |
m |
Number of hypothesis tested. |
adjust |
Logical value for p-value adjustmet (unusable). |
m0 |
Known or estimated number of true null hypotheses. |
pi0 |
Known or estimated proportion of true null hypothesis. Is redundant when |
constant |
A Scaling constant for the denominator of the critical values. |
A Mutoss service function called by other procedures.
A list containing the following objects:
Cutoff |
The largest p-value of rejected hypotheses. |
Pvals |
A data frame containing the original p-values, critical values, adjusted p-values and rejections. |
JonathanRosenblatt
Test for compatible classes for comparison
mu.test.class(classes)
mu.test.class(classes)
classes |
A list of class names. |
Internal function of muToss package. Takes list of classes and tests if they are all muToss.
True if all classes are muToss. False otherwise.
MuToss-Coding Team.
Tests if all hypotheses have the same names.
mu.test.name(hyp.names)
mu.test.name(hyp.names)
hyp.names |
Character vector of hypotheses names. |
Internal muToss function.
Gives a notice when hypotheses names in different procedures are found different.
MuToss-Coding Team
Tests that different procedures used the same error rates.
mu.test.rates(rates)
mu.test.rates(rates)
rates |
Numeric vector error rates extracted fomr muToss objects. |
Internal muToss function.
A notice if error rates differ.
MuToss-Coding Team.
Tests if the same pvalues were used by different procedures.
mu.test.same.data(pvals)
mu.test.same.data(pvals)
pvals |
Data frame of p-values used by each procedure. |
Internal muToss function.
Stops if different data was used by different procedures.
MuToss-Coding Team
Tests that different procedures use the same error types.
mu.test.type(types)
mu.test.type(types)
types |
Character vector of error types extracted from muToss objects. |
Internal muToss function.
Returns a notice if error types differ.
MuToss-Coding Team.
Simultaneous confidence intervals for arbitrary parametric contrasts in unbalanced one-way layouts. The procedure controls the FWER in the strong sense.
multcomp.wrapper(model, hypotheses, alternative, rhs=0, alpha, factorC)
multcomp.wrapper(model, hypotheses, alternative, rhs=0, alpha, factorC)
model |
a fitted model, for example an object returned by lm, glm, or aov etc. It is assumed that coef and vcov methods are available for model. |
hypotheses |
a specification of the linear hypotheses to be tested. |
alternative |
a character string specifying the alternative hypothesis, must be one of 'two.sided' (default), 'greater' or 'less'. |
rhs |
an optional numeric vector specifying the right hand side of the hypothesis. |
alpha |
the significance level |
factorC |
character string, specifing the factor variable of interest |
this function, it is possible to compute simultaneous confidence for arbitrary parametric contrasts in the unbalanced one way layout. Moreover, it computes p-values. The simultaneous confidence intervals are computed using multivariate t-distribution.
A list containing:
adjPValues |
A numeric vector containing the adjusted pValues |
rejected |
A logical vector indicating which hypotheses are rejected |
confIntervals |
A matrix containing the estimates and the lower and upper confidence bound |
errorControl |
A Mutoss S4 class of type |
MuToss-Coding Team
data(warpbreaks) # Tukey contrast on the levels of the factor 'Tension' multcomp.wrapper(aov(breaks ~ tension, data = warpbreaks), hypotheses = "Tukey", alternative="two.sided", factorC="tension",alpha=0.05) # Williams contrast on 'Tension' multcomp.wrapper(aov(breaks ~ tension, data = warpbreaks), hypotheses= "Williams", alternative="two.sided",alpha=0.05,factorC="tension") # Userdefined contrast matrix K <-matrix(c(-1,0,1,-1,1,0, -1,0.5,0.5),ncol=3,nrow=3,byrow=TRUE) multcomp.wrapper(aov(breaks ~ tension, data = warpbreaks), hypotheses=K, alternative="two.sided",alpha=0.05,factorC="tension") # Two-way anova multcomp.wrapper(aov(breaks ~ tension*wool, data = warpbreaks), hypotheses="Tukey", alternative="two.sided",alpha=0.05,factorC="wool") multcomp.wrapper(aov(breaks ~ tension*wool, data = warpbreaks), hypotheses="Tukey", alternative="two.sided",alpha=0.05,factorC="tension") multcomp.wrapper(aov(breaks ~ tension*wool, data = warpbreaks), hypotheses=K, alternative="two.sided",alpha=0.05, factorC="tension") data(iris) multcomp.wrapper(model=lm(Sepal.Length ~ Species, data=iris), hypotheses="Tukey","two.sided",alpha=0.05, factorC="Species") K <-matrix(c(-1,0,1,-1,1,0, -1,0.5,0.5),ncol=3,nrow=3,byrow=TRUE) multcomp.wrapper(model=lm(Sepal.Length ~ Species, data=iris), hypotheses=K,"two.sided",alpha=0.05, factorC="Species")
data(warpbreaks) # Tukey contrast on the levels of the factor 'Tension' multcomp.wrapper(aov(breaks ~ tension, data = warpbreaks), hypotheses = "Tukey", alternative="two.sided", factorC="tension",alpha=0.05) # Williams contrast on 'Tension' multcomp.wrapper(aov(breaks ~ tension, data = warpbreaks), hypotheses= "Williams", alternative="two.sided",alpha=0.05,factorC="tension") # Userdefined contrast matrix K <-matrix(c(-1,0,1,-1,1,0, -1,0.5,0.5),ncol=3,nrow=3,byrow=TRUE) multcomp.wrapper(aov(breaks ~ tension, data = warpbreaks), hypotheses=K, alternative="two.sided",alpha=0.05,factorC="tension") # Two-way anova multcomp.wrapper(aov(breaks ~ tension*wool, data = warpbreaks), hypotheses="Tukey", alternative="two.sided",alpha=0.05,factorC="wool") multcomp.wrapper(aov(breaks ~ tension*wool, data = warpbreaks), hypotheses="Tukey", alternative="two.sided",alpha=0.05,factorC="tension") multcomp.wrapper(aov(breaks ~ tension*wool, data = warpbreaks), hypotheses=K, alternative="two.sided",alpha=0.05, factorC="tension") data(iris) multcomp.wrapper(model=lm(Sepal.Length ~ Species, data=iris), hypotheses="Tukey","two.sided",alpha=0.05, factorC="Species") K <-matrix(c(-1,0,1,-1,1,0, -1,0.5,0.5),ncol=3,nrow=3,byrow=TRUE) multcomp.wrapper(model=lm(Sepal.Length ~ Species, data=iris), hypotheses=K,"two.sided",alpha=0.05, factorC="Species")
A p-value procedure which controls the FDR for independent test statistics.
multiple.down(pValues, alpha)
multiple.down(pValues, alpha)
pValues |
A numeric vector of p-values |
alpha |
The FDR error rate to control |
A non-linear step-down p-value procedure which control the FDR for independent test statistics and enjoys more power then other non-adaptive procedure such as the linear step-up (BH). For the case of non-independent test statistics, non-adaptive procedures such as the linear step-up (BH) or the all-purpose conservative Benjamini-Yekutieli (2001) are recommended.
A list containing:
rejected |
A logical vector indicating which hypotheses are rejected |
criticalValues |
A numeric vector containing critical values used in the step-up-down test. |
adjPValues |
A numeric vector containing adjusted p-values. |
pi0 |
An estimate of the proportion of true null hypotheses among all hypotheses (pi0=m0/m). |
errorControl |
A Mutoss S4 class of type |
Jonathan Rosenblatt
pvals<- runif(100)^2 alpha<- 0.2 result<- multiple.down(pvals, alpha) result plot(result[['criticalValues']]~pvals) plot(result[['adjPValues']]~pvals) abline(v=alpha)
pvals<- runif(100)^2 alpha<- 0.2 result<- multiple.down(pvals, alpha) result plot(result[['criticalValues']]~pvals) plot(result[['adjPValues']]~pvals) abline(v=alpha)
A service function used by multiple.down
multiple.down.adjust(sorted, m)
multiple.down.adjust(sorted, m)
sorted |
A sorted pvalue vector. |
m |
The number of hypotheses tested. |
JonathanRosenblatt
A Mutoss object can store the input for a multiple test procedure and also the output.
data
:Raw data used in model
model
:link function,error family and design
description
:a general description
statistic
:for Z, T or F statistics
hypotheses
:of class ANY
hypNames
:identifiers for the hypotheses tested
criticalValues
:procedure-specific critical values
pValues
:raw p-values
adjPValues
:procedure-specific adjusted p-values
errorControl
:A Mutoss S4 class of type errorControl
rejected
:Logical vector of the output of a procedure at a given error rate
qValues
:Storey's estimates of the supremum of the pFDR
locFDR
:Efron's local fdr estimates
pi0
:Estimate of the proportion of null hypotheses
confIntervals
:Confidence intervals for selected parameters
commandHistory
:commandHistory
MuToss-Coding Team
Applies a function to a Mutoss object.
mutoss.apply(mutossObj, f, label = deparse(substitute(f)) , recordHistory = TRUE , ...)
mutoss.apply(mutossObj, f, label = deparse(substitute(f)) , recordHistory = TRUE , ...)
mutossObj |
the Mutoss object the function should be applied to |
f |
the function that should be applied |
label |
the label affixed to all slots of the Mutoss object that are changed by the procedure, defaults to the name of parameter f |
recordHistory |
if true, the calling command is concatenated verbatim to the commandHistory slot |
... |
additional parameters that are passed to the function |
This functions is intended for applying functions for multiplicity control on Mutoss class objects using the console and not the Mutoss GUI.
A Mutoss object after applying the given function
mutossObj |
Object of S4 class Mutoss |
Kornelius Rohmeyer
newObjectBonf <- mutoss.apply(new(Class="Mutoss", pValues=runif(10)), f=bonferroni, label="Bonferroni Correction", alpha=0.05) ## Not run: TODO: EXAMPLE PROBLEM newObjectHolm <- mutoss.apply(new(Class="Mutoss", pValues=runif(10)), f=holm, label="Holm's step-down-procedure", alpha=0.05, silent=T) newObjectAORC <- mutoss.apply(new(Class="Mutoss", pValues=runif(10)), f=aorc, label="Asymptotically optimal rejection curve", alpha=0.05, startIDX_SUD = 1, silent=T) ## End(Not run)
newObjectBonf <- mutoss.apply(new(Class="Mutoss", pValues=runif(10)), f=bonferroni, label="Bonferroni Correction", alpha=0.05) ## Not run: TODO: EXAMPLE PROBLEM newObjectHolm <- mutoss.apply(new(Class="Mutoss", pValues=runif(10)), f=holm, label="Holm's step-down-procedure", alpha=0.05, silent=T) newObjectAORC <- mutoss.apply(new(Class="Mutoss", pValues=runif(10)), f=aorc, label="Asymptotically optimal rejection curve", alpha=0.05, startIDX_SUD = 1, silent=T) ## End(Not run)
Fisher-type (2x3) table as model for marginal hypotheses testing problems, Fisher (2x2) table as model for marginal hypotheses testing problems and others...
A list containing the model description
Plots the confidence intervals
mutoss.plotCI(mat)
mutoss.plotCI(mat)
mat |
Matrix containing the confidence interval limits. TODO specify the matrix layout. |
A MutossMethod
object describes a method that is applicable to Mutoss
objects.
label
:A character string that contains the label that will be shown in menus.
errorControl
:One of the following character strings: FWER, FWER.weak, FDR, FDX, gFWER, perComparison.
callFunction
:A character string that contains the name of the Mutoss-compatible function.
output
:A character vector of the possible output of the function.
info
:A character string with info text. Should contain small description, author, reference etc..
assumptions
:A character vector of assumptions for this method.
parameters
:A list of optional description of parameters - see MuToss developer handbook.
list
:For extensions a list where you can put all your miscellaneous stuff.
The notterman
data set is a data.frame containing 18 paired samples of 7457 gene expression values from Notterman et al. (2001).
The vector notterman.grpLabel
contains 36 labels of type Tumor
or Normal
specifying the type of tissue for each column of the notterman
data set.
The vector T.Test.tumor.vs.normal
contains the resulting 7457 numeric p-values from the 7457 t-tests applied to each row of the data set.
notterman notterman.grpLabel T.Test.tumor.vs.normal
notterman notterman.grpLabel T.Test.tumor.vs.normal
notterman - A data.frame containing 36 columns with 7457 observations
notterman.grpLabel - A vector containing 36 labels of type Tumor
or Normal
T.Test.tumor.vs.normal - A vector containing 7457 numeric p-values
D.A. Notterman, U. Alon, A.J. Sierk, and A.J. Levine: Transcriptional Gene Expression Profiles of Colorectal Adenoma, Adenocarcinoma, and Normal Tissue Examined by Oligonucleotide Arrays, Cancer Research, 2001, vol. 61, pp. 3124-3130.
Simultaneous confidence intervals for relative contrast effects The procedure controls the FWER in the strong sense.
nparcomp(formula, data, type=c("UserDefined", "Tukey", "Dunnett", "Sequen", "Williams", "Changepoint", "AVE", "McDermott", "Marcus", "UmbrellaWilliams"), control=NULL, conflevel=0.95, alternative=c("two.sided", "less", "greater"), rounds=3, correlation=FALSE, asy.method=c("logit", "probit", "normal", "mult.t"), plot.simci=FALSE, info=TRUE, contrastMatrix=NULL)
nparcomp(formula, data, type=c("UserDefined", "Tukey", "Dunnett", "Sequen", "Williams", "Changepoint", "AVE", "McDermott", "Marcus", "UmbrellaWilliams"), control=NULL, conflevel=0.95, alternative=c("two.sided", "less", "greater"), rounds=3, correlation=FALSE, asy.method=c("logit", "probit", "normal", "mult.t"), plot.simci=FALSE, info=TRUE, contrastMatrix=NULL)
formula |
A two-sided 'formula' specifying a numeric response variable and a factor with more than two levels. If the factor contains less than 3 levels, an error message will be returned |
data |
data A dataframe containing the variables specified in formula |
type |
type Character string defining the type of contrast. It should be one of "Tukey", "Dunnett", "Sequen", "Williams", "Changepoint", "AVE", "McDermott", "Marcus" |
control |
control Character string defining the control group in Dunnett comparisons. By default it is the first group by lexicographical ordering |
conflevel |
The confidence level for the 1 - conflevel confidence intervals. By default it is 0.05 |
alternative |
Character string defining the alternative hypothesis, one of "two.sided", "less" or "greater" |
rounds |
Number of rounds for the numeric values of the output. By default it is rounds=3 |
correlation |
Correlation A logical whether the estimated correlation matrix and covariance matrix should be printed |
asy.method |
asy.method character string defining the asymptotic approximation method, one of "logit", for using the logit transformation function, "probit", for using the probit transformation function, "normal", for using the multivariate normal distribution or "mult.t" for using a multivariate t-distribution with a Satterthwaite Approximation |
plot.simci |
plot.simci A logical indicating whether you want a plot of the confidence intervals |
info |
info A logical whether you want a brief overview with informations about the output |
contrastMatrix |
arbitrary contrast matrix given by the user |
With this function, it is possible to compute nonparametric simultaneous confidence intervals for relative contrast effects in the unbalanced one way layout. Moreover, it computes adjusted p-values. The simultaneous confidence intervals can be computed using multivariate normal distribution, multivariate t-distribution with a Satterthwaite Approximation of the degree of freedom or using multivariate range preserving transformations with Logit or Probit as transformation function. There is no assumption on the underlying distribution function, only that the data have to be at least ordinal numbers
A list containing:
adjPValues |
A numeric vector containing the adjusted pValues |
rejected |
A logical vector indicating which hypotheses are rejected |
confIntervals |
A matrix containing the estimates and the lower and upper confidence bound |
errorControl |
A Mutoss S4 class of type |
FrankKonietschke
## Not run: # TODO Check this example and set a seed! grp <- rep(1:5,10) x <- rnorm(50, grp) dataframe <- data.frame(x,grp) # Williams Contrast nparcomp(x ~grp, data=dataframe, asy.method = "probit", type = "Williams", alternative = "two.sided", plot.simci = TRUE, info = TRUE) # Dunnett Contrast nparcomp(x ~grp, data=dataframe, asy.method = "probit",control=1, type = "Dunnett", alternative = "two.sided", plot.simci = TRUE, info = TRUE) # Dunnett dose 3 is baseline nparcomp(x ~grp, data=dataframe, asy.method = "probit", type = "Dunnett", control = "3",alternative = "two.sided", plot.simci = TRUE, info = TRUE) ## End(Not run)
## Not run: # TODO Check this example and set a seed! grp <- rep(1:5,10) x <- rnorm(50, grp) dataframe <- data.frame(x,grp) # Williams Contrast nparcomp(x ~grp, data=dataframe, asy.method = "probit", type = "Williams", alternative = "two.sided", plot.simci = TRUE, info = TRUE) # Dunnett Contrast nparcomp(x ~grp, data=dataframe, asy.method = "probit",control=1, type = "Dunnett", alternative = "two.sided", plot.simci = TRUE, info = TRUE) # Dunnett dose 3 is baseline nparcomp(x ~grp, data=dataframe, asy.method = "probit", type = "Dunnett", control = "3",alternative = "two.sided", plot.simci = TRUE, info = TRUE) ## End(Not run)
Simultaneous confidence intervals for relative contrast effects The procedure controls the FWER in the strong sense.
nparcomp.wrapper(model, data, hypotheses, alpha, alternative, asy.method)
nparcomp.wrapper(model, data, hypotheses, alpha, alternative, asy.method)
model |
A two-sided formula specifying a numeric response variable and a factor with more than two levels. |
data |
A dataframe containing the variables specified the model |
hypotheses |
Character string defining the type of contrast. It should be one of "Tukey", "Dunnett", "Sequen", "Williams", "Changepoint", "AVE", "McDermott", "Marcus". |
alpha |
the significance level |
alternative |
Character string defining the alternative hypothesis, one of "two.sided", "less" or "greater" |
asy.method |
A character string defining the asymptotic approximation method, one of "logit", for using the logit transformation function, "probit", for using the probit transformation function, "normal", for using the multivariate normal |
With this function, it is possible to compute nonparametric simultaneous confidence intervals for relative contrast effects in the unbalanced one way layout. Moreover, it computes adjusted p-values. The simultaneous confidence intervals can be computed using multivariate normal distribution, multivariate t-distribution with a Satterthwaite Approximation of the degree of freedom or using multivariate range preserving transformations with Logit or Probit as transformation function. There is no assumption on the underlying distribution function, only that the data have to be at least ordinal numbers
A list containing:
adjPValues |
A numeric vector containing the adjusted pValues |
rejected |
A logical vector indicating which hypotheses are rejected |
confIntervals |
A matrix containing the estimates and the lower and upper confidence bound |
errorControl |
A Mutoss S4 class of type |
FrankKonietschke
The robust version uses the Wilcoxon-Mann-Whitney test, otherwise a t-test will be performed.
onesamp.marginal(data, robust, alternative, psi0)
onesamp.marginal(data, robust, alternative, psi0)
data |
the data set |
robust |
a logical variable indicating whether a t-test or a Wilcoxon-Mann-Whitney test should be used. |
alternative |
a character string specifying the alternative hypothesis,
must be one of |
psi0 |
a numeric that defines the hypothesized null value |
pValues |
A numeric vector containing the unadjusted pValues |
MuToss-Coding Team
Wilcoxon, F. (1945). Individual Comparisons by Ranking Methods. Biometrics Bulletin 1:80-83. Mann, H. and Whitney, D. (1947). On a test of whether one of two random variables is stochastically larger than the other. Annals of Mathematical Statistics 18:50-60 Student (1908). The probable error of a mean. Biometrika, 6(1):1-25.
Bejamini-Hochberg (2000) oracle linear step-up Procedure
oracleBH(pValues, alpha, pi0, silent=FALSE)
oracleBH(pValues, alpha, pi0, silent=FALSE)
pValues |
pValues to be used |
alpha |
the level at which the FWER should be controlled |
pi0 |
miraculousy known number of true null hypotheses |
silent |
Logical, if true any output on the console will be suppressed. |
Knowledge of the number of true null hypotheses (m0) can be very useful to improve upon the performance of the FDR controlling procedure. For the oracle linear step-up procedure we assume that m0 were given to us by an 'oracle', the linear step-up procedure with q0 = q*m/m0 would control the FDR at precisely the desired level q in the independent and continuous case, and would then be more powerful in rejecting hypotheses for which the alternative holds.
A list containing:
adjPValues |
A numeric vector containing the adjusted pValues |
rejected |
A logical vector indicating which hypotheses are rejected |
criticalValues |
A numeric vector containing critical values used in the step-up-down test. |
errorControl |
A Mutoss S4 class of type |
HackNiklas
pval <- c(runif(50), runif(50, 0, 0.01)) result <- oracleBH(pValues=pval,alpha=0.05,pi0=0.85)
pval <- c(runif(50), runif(50, 0, 0.01)) result <- oracleBH(pValues=pval,alpha=0.05,pi0=0.85)
The robust version uses the Wilcoxon signed rank test, otherwise a paired t-test will be performed.
paired.marginal(data, model, robust, alternative, psi0, equalvar)
paired.marginal(data, model, robust, alternative, psi0, equalvar)
data |
the data set |
model |
the result of a call to |
robust |
a logical variable indicating whether a paired t-test or a Wilcoxon signed rank test should be used. |
alternative |
a character string specifying the alternative hypothesis,
must be one of |
psi0 |
a numeric that defines the hypothesized null value |
equalvar |
a logical variable indicating whether to treat the two variances as being equal |
A vector of classlabels needs to be provided to distinguish the two paired groups. The arrangement of group indices does not matter, as long as the columns are arranged in the same corresponding order between groups. For example, if group 1 is code as 0 and group 2 is coded as 1, for 3 pairs of data, it does not matter if the classlabel is coded as (0,0,0,1,1,1) or (1,1,1,0,0,0) or (0,1,0,1,0,1) or (1,0,1,0,1,0), the paired differences between groups will be calculated as group2 - group1.
pValues |
A numeric vector containing the unadjusted pValues |
MuToss-Coding Team
Wilcoxon, F. (1945). Individual Comparisons by Ranking Methods. Biometrics Bulletin 1:80-83.
Generates standard output for pValues, rejected and adjustedPValues.
printRejected(rejected, pValues=NULL, adjPValues=NULL)
printRejected(rejected, pValues=NULL, adjPValues=NULL)
rejected |
logical Vector indicating which pValue is rejected. |
pValues |
the used pValues. |
adjPValues |
the adjusted pValues. |
It generates an output on the console with the number of hypotheses (number of pValues) and the number of rejected hypotheses (number of rejected pValues). Further a data.frame is constructed, one column containing the rejected pValues, one the index number of the rejected pValues and if given one column with the corresponding adjusted pValues.
MarselScheer
The function pval2locfdr
takes a vector of p-values and
estimates for each case the local fdr.
pval2locfdr(pValues, cutoff)
pval2locfdr(pValues, cutoff)
pValues |
pValues to be used. |
cutoff |
The local fdr cutoff for rejection. Hypotheses with |
A list containing:
locfdr |
Numeric vector with local FDR values for each case |
rejected |
Logical vector indicating rejection/retention for each hypothesis when a |
JonathanRosenblatt
Strimmer, K. (2008). fdrtool: a versatile R package for estimating local and tail
area-based false discovery rates. Bioinformatics 24: 1461-1462.
Efron B., Tibshirani R., Storey J. D. and Tusher, V. (2001). Empirical Bayes Analysis of a Microarray Experiment.
Journal of the American Statistical Association 96(456):1151-1160.
pvals<- runif(1000)^2 pval2locfdr(pvals) pval2locfdr(pValues=pvals, cutoff=0.4)
pvals<- runif(1000)^2 pval2locfdr(pvals) pval2locfdr(pValues=pvals, cutoff=0.4)
The function pval2qval
takes a vector of p-values and
estimates for each case the tail area-based FDR, which can be regarded as a p-value corrected for multiplicity.
This is done by calling the fdrtool
function.
If a cutoff is supplied, a vector of rejected hypotheses will be returned as well.
pval2qval(pValues, cutoff)
pval2qval(pValues, cutoff)
pValues |
Numeric vector of p-values to be used. |
cutoff |
The positive FDR cutoff for rejection. Hypotheses with |
A list containing:
qValues |
A numeric vector with one q-value for each hypothesis. |
rejected |
A logical vector indicating rejection/retention for each hypothesis when |
JonathanRosenblatt
Strimmer, K. (2008). fdrtool: a versatile R package for estimating local and tail
area-based false discovery rates. Bioinformatics 24: 1461-1462.
Storey, J. D. (2003) The Positive False Discovery Rate: A Bayesian Interpretation and the q-Value.
The Annals of Statistics 31(6): 2013-2035
pvals<- runif(1000)^2 pval2qval(pvals) pval2qval(pValues=pvals, cutoff=0.1)
pvals<- runif(1000)^2 pval2qval(pvals) pval2qval(pValues=pvals, cutoff=0.1)
A function plotting p-values
pValuesPlot(pValues)
pValuesPlot(pValues)
pValues |
A numeric containing the pValues to plot. |
MarselScheer
Storey's (2001) q-value Procedure
Qvalue(pValues, lambda=seq(0, 0.9, 0.05), pi0.method="smoother", fdr.level=NULL, robust=FALSE, smooth.df=3, smooth.log.pi0=FALSE, silent=FALSE)
Qvalue(pValues, lambda=seq(0, 0.9, 0.05), pi0.method="smoother", fdr.level=NULL, robust=FALSE, smooth.df=3, smooth.log.pi0=FALSE, silent=FALSE)
pValues |
pValues to be used (only necessary input) |
lambda |
Value of the tuning parameter to be used |
pi0.method |
Method for automatically choosing tuning parameter in the estimation of pi_0. Either 'smoother' or 'bootstrap' |
fdr.level |
Level at which to control the FDR |
robust |
Logical, whether to make estimate more robust for small p-values. |
smooth.df |
Number of degrees of freedom to use when estimating pi_0 with the smoother. |
smooth.log.pi0 |
Logical, if TRUE and pi0.method = 'smoother', pi0 will be estimated by applying a smoother to a scatterplot of log(pi_0) estimates against the tuning parameter lambda. |
silent |
logical scalar. If |
The Qvalue procedure estimates the q-values for a given set of p-values. The q-value of a test measures the proportion of false positive incurred when that particular test is called sigificant. It gives the scientist a hypothesis testing error measure for each observed statistic with respect to the pFDR.
Note: If no options are selected, then the method used to estimate pi0 is the smoother method desribed in Storey and Tibshirani (2003). The bootstrap method is described in Storey, Taylor and Siegmund (2004).
A list containing:
qValues |
A vector of the estimated q-values |
pi0 |
An estimate of the proportion of null hypotheses |
errorControl |
A Mutoss S4 class of type |
HackNiklas
Storey, John (2001). The Positive False Discovery Rate: A Baysian Interpretation and the Q-Value. The Annals of Statistics, Vol. 31, No. 6, 2013-2035.
pval <- c(runif(50), runif(50, 0, 0.01)) result <- Qvalue(pval) result <- Qvalue(pval, lambda=0.5)
pval <- c(runif(50), runif(50, 0, 0.01)) result <- Qvalue(pval) result <- Qvalue(pval, lambda=0.5)
Rank truncated p-Value procedure The program computes the exact distribution and with it the p-Value
ranktruncated(pValues, K, silent=FALSE)
ranktruncated(pValues, K, silent=FALSE)
pValues |
Vector of p-Values (not sorted) |
K |
the number of hypotheses / p-Values being in w |
silent |
If true any output on the console will be suppressed. |
This function computes the exact distribution of the product of
at most K significant p-values of observed p-values. Thus, one gets the
pvalue from the exact distribution. This has certain advantages for genomewide
association scans: K can be chosen on the basis of a hypothesised
disease model, and is independent of sample size. Furthermore,
the alternative hypothesis corresponds more closely to the
experimental situation where all loci have fixed effects.
Please note that this method is implemented with factorials and binomial coefficients and the computation becomes numerical instable for large number of p-values.
Used.pValue: List information about the used pValues; RTP: Test statistic and pValue
Frank Konietschke
Dubridge, F., Koeleman, B.P.C. (2003). Rank truncated product of P-values, with application to genomewide association scans. Genet Epidemiol. 2003 Dec;25(4):360-6
pvalues<-runif(10) result <- ranktruncated(pvalues,K=2,silent=FALSE) # take the K=2 smallest pvalues result <- ranktruncated(pvalues,K=2,silent=TRUE) # take the K=2 smallest pvalues result <- ranktruncated(pvalues,K=5,silent=TRUE) # take the K=5 smallest pvalues
pvalues<-runif(10) result <- ranktruncated(pvalues,K=2,silent=FALSE) # take the K=2 smallest pvalues result <- ranktruncated(pvalues,K=2,silent=TRUE) # take the K=2 smallest pvalues result <- ranktruncated(pvalues,K=5,silent=TRUE) # take the K=5 smallest pvalues
REGWQ - Ryan / Einot and Gabriel / Welsch test procedure
This function computes REGWQ test for given
data including p samples. It is based on a stepwise or
layer approach to significance testing. Sample means are
ordered from the smallest to the largest.
The largest
difference, which involves means that are r = p steps apart,
is tested first at level of significance; if significant,
means that are
steps apart are tested at a different
level
of significance and so on. Compare to the Student-
Newman-Keuls test, the
levels are adjusted for the p-1 different
layers by the formula
, if p=k or p=k-1,
otherwise. It might happen that the
quantiles are not descending in p. In this case, they are adapted by
.
The REGWQ procedure, like Tukey's procedure, requires
equal sample n's. However, in this algorithm, the procedure is
adapted to unequal sample sized which can lead to still
conservative test decisions.
regwq(formula, data, alpha, MSE=NULL, df=NULL, silent=FALSE)
regwq(formula, data, alpha, MSE=NULL, df=NULL, silent=FALSE)
formula |
Formula defining the statistical model containing the response and the factors |
data |
dataset containing the response and the grouping factor |
alpha |
The level at which the error should be controlled. By default it is alpha=0.05. |
MSE |
Optional for a given variance of the data |
df |
Optional for a given degree of freedom |
silent |
If true any output on the console will be suppressed. |
A list containing:
adjPValues |
A numeric vector containing the adjusted pValues |
rejected |
A logical vector indicating which hypotheses are rejected |
statistics |
A numeric vector containing the test-statistics |
confIntervals |
A matrix containing only the estimates |
errorControl |
A Mutoss S4 class of type |
Frank Konietschke
Hochberg, Y. & Tamhane, A. C. (1987). Multiple Comparison Procedures, Wiley.
x = rnorm(50) grp = c(rep(1:5,10)) dataframe <- data.frame(x,grp) result <- regwq(x~grp, data=dataframe, alpha=0.05,MSE=NULL, df=NULL, silent = TRUE) result <- regwq(x~grp, data=dataframe, alpha=0.05,MSE=NULL, df=NULL, silent = FALSE) result <- regwq(x~grp, data=dataframe, alpha=0.05,MSE=1, df=Inf, silent = FALSE) # known variance result <- regwq(x~grp, data=dataframe, alpha=0.05,MSE=1, df=1000, silent = FALSE) # known variance
x = rnorm(50) grp = c(rep(1:5,10)) dataframe <- data.frame(x,grp) result <- regwq(x~grp, data=dataframe, alpha=0.05,MSE=NULL, df=NULL, silent = TRUE) result <- regwq(x~grp, data=dataframe, alpha=0.05,MSE=NULL, df=NULL, silent = FALSE) result <- regwq(x~grp, data=dataframe, alpha=0.05,MSE=1, df=Inf, silent = FALSE) # known variance result <- regwq(x~grp, data=dataframe, alpha=0.05,MSE=1, df=1000, silent = FALSE) # known variance
Returns the highest rejected p-value and its index given some critical values.
reject(sorted, criticals)
reject(sorted, criticals)
sorted |
Sorted p-values |
criticals |
Critical values |
A list with elements
cutoff |
highest rejected p-value |
cut.index |
index of highest rejected p-value |
Tries to load a package. If this package does not exist, it will ask the user whether the package should be installed and loaded. If the user negates, we will raise an error via stop.
requireLibrary(package)
requireLibrary(package)
package |
Package to load |
NULL
MuToss-Coding Team
Rom's step-up-procedure is applied to pValues. The procedure controls the FWER in the strong sense if the pValues are stochastically independent.
rom(pValues, alpha, silent=FALSE)
rom(pValues, alpha, silent=FALSE)
pValues |
pValues to be used. They are assumed to be stochastically independent. |
alpha |
the level at which the FWER shall be controlled. |
silent |
if true any output on the console will be suppressed. |
This function calculates the critical values by the formula given in Finner, H. and Roters, M. (2002) based on the joint distribution of order statistics. After that a step-up test is performed to reject hypotheses associated with pValues.
Since the formula for the critical values is recursive, the calculation of adjusted pValues is far from obvious and is not implemented here.
A list containing:
adjPValues |
A numeric vector containing the adjusted pValues |
rejected |
A logical vector indicating which hypotheses are rejected. |
criticalValues |
A numeric vector containing critical values used in the step-up-down test. |
errorControl |
A Mutoss S4 class of type |
Marsel Scheer
Rom, D. M. (1990). A sequentially rejective test procedure based on a modified Bonferroni inequality. Biometrika 77, 663-665.
Finner, H. and Roters, M. (2002). Multiple hypotheses testing and expected type I errors. Ann. Statist. 30, 220-238.
r <- c(runif(50), runif(50, 0, 0.01)) result <- rom(r, 0.05) result <- rom(r, 0.05, silent = TRUE)
r <- c(runif(50), runif(50, 0, 0.01)) result <- rom(r, 0.05) result <- rom(r, 0.05, silent = TRUE)
A general step-down procedure.
SD(pValues, criticalValues)
SD(pValues, criticalValues)
pValues |
pValues to be used. |
criticalValues |
criticalValues for the step-down procedure |
Suppose we have n pValues and they are already sorted. The procedure starts with comparing pValues[1] with criticalValues[1]. If pValues[1] <= criticalValues[1], then the hypothsis associated with pValues[1] is rejected and the algorithm carries on with second smallest pValue and criticalValue in the same way. The algorithm stops rejecting at the first index i for which pValues[i] > criticalValues[i]. Thus pValues[j] is rejected if and only if pValues[i] <= criticalValues[i] for all i <= j.
rejected logical vector indicating if hypotheses are rejected or retained.
MarselScheer
The classical Sidak correction returns adjusted p-values, ensuring strong FWER control under the assumption of independence of the input p-values. It only uses the fact that the probability of no incorrect rejection is the product over true nulls of those marginal probabilities (using the assumed independence of p-values).
sidak(pValues, alpha, silent=FALSE)
sidak(pValues, alpha, silent=FALSE)
pValues |
pValues to be used. |
alpha |
The level at which the FWER shall be controlled (optional). |
silent |
logical scalar. If |
The procedure is more generally valid for positive orthant dependent test statistics.
It is recommended to use the step-down version of the Sidak correction instead (see SidakSD), which is valid under the exact same assumptions but is more powerful.
A list containing:
adjPValues |
A numeric vector containing the adjusted pValues |
rejected |
(if alpha is given) A logical vector indicating which hypotheses are rejected |
errorControl |
A Mutoss S4 class of type |
MuToss-Coding Team
Sidak, Z. (1967). Rectangular confidence regions for the means of multivariate normal distributions. Journal of the American Statistical Association, 62:626-633.
alpha <- 0.05 p <-c(runif(10, min=0, max=0.01), runif(10, min=0.9, max=1)) result <- sidak(p) result <- sidak(p, alpha) result <- sidak(p, alpha, silent=TRUE)
alpha <- 0.05 p <-c(runif(10, min=0, max=0.01), runif(10, min=0.9, max=1)) result <- sidak(p) result <- sidak(p, alpha) result <- sidak(p, alpha, silent=TRUE)
The Sidak-like (1987) step-down procedure is applied to pValues The Sidak-like step-down procedure is an improvement over the Holm's (1979) step-down procedure. The improvement is analogous to Sidak's correction over the original Bonferroni procedure. This Sidak-like step-down procedure assumes positive orthant dependent test statistics.
SidakSD(pValues, alpha, silent=FALSE)
SidakSD(pValues, alpha, silent=FALSE)
pValues |
The used raw pValues. |
alpha |
The level at which the FWER shall be controlled. |
silent |
If true any output on the console will be suppressed. |
A list containing:
adjPValues |
a numeric vector containing the adjusted pValues |
rejected |
a logical vector indicating which hypotheses are rejected |
criticalValues |
a numeric vector containing critical values used in the step-up-down test |
errorControl |
A Mutoss S4 class of type |
WerftWiebke
Hollander, B.S. and Covenhaver, M.D. (1987). An Improved Sequentially Rejective Bonferroni Test Procedure. Biometrics, 43(2):417-423, 1987.
alpha <- 0.05 p <-c(runif(10, min=0, max=0.01), runif(10, min=0.9,max=1)) result <- SidakSD(p, alpha) result <- SidakSD(p, alpha, silent=TRUE)
alpha <- 0.05 p <-c(runif(10, min=0, max=0.01), runif(10, min=0.9,max=1)) result <- SidakSD(p, alpha) result <- SidakSD(p, alpha, silent=TRUE)
This function generates data according to a specified function and parameters and then applies specified procedures to the generated data. The generated data is stored in $data and the results are stored in $results. In order to recognize which results and generated data belong together every result contains an element $data.set.number. The data generating function must return a list which contains a list $procInput. Every element in $procInput will be used as an input parameter for the procedures provided by listOfProcedures.
simulation(replications, DataGen, listOfProcedures, discardProcInput=FALSE)
simulation(replications, DataGen, listOfProcedures, discardProcInput=FALSE)
replications |
The number of replications. This means how many simulation runs will be performed. |
DataGen |
A list that contains the function and parameters for generating data which will be analyzed be the procedures in listOfProcedures. It must contain the elements $funName (character) $fun (function) |
listOfProcedures |
A list of lists which contains the procedures with their parameters for the simulation. |
discardProcInput |
A list of lists which contains the procedures with their parameters |
A list with 2 elements. $data contains the objects generated by DataGen. $results contains the objects generated by the procedures augmented by the data set number and the parameter constellation.
MarselScheer
# this function generates pValues myGen <- function(n, n0) { list(procInput=list(pValues = c(runif(n-n0, 0, 0.01), runif(n0))), groundTruth = c(rep(FALSE, times=n-n0), rep(TRUE, times=n0))) } sim <- simulation(replications = 10, list(funName="myGen", fun=myGen, n=200, n0=c(50,100)), list(list(funName="BH", fun=function(pValues, alpha) BH(pValues, alpha, silent=TRUE), alpha=c(0.25, 0.5)), list(funName="holm", fun=holm, alpha=c(0.25, 0.5),silent=TRUE))) # the following happend: # Call myGen(200,50) and append result to sim$data # Apply bonferroni and holm each with alpha 0.25 and 0.5 to this data set # Append the results to sim$restults # Repeat this 10 times. # Call myGen(200, 100) and append restult to sim$data # Apply bonferroni and holm each with alpha 0.25 and 0.5 to this data set # Append the results to sim$restults # Repeat this 10 times. length(sim$data) length(sim$results) # we now reproduce the 6th item in results print(sim$results[[6]]$data.set.number) print(sim$results[[6]]$parameters) all(BH(sim$data[[2]]$procInput$pValues, 0.5, silent=TRUE)$adjPValues == sim$results[[6]]$adjPValues) # # Just calculating some statistics and making some plots NumberOfType1Error <- function(data, result) sum(data$groundTruth * result$rejected) result.all <- gatherStatistics(sim, list(NumOfType1Err = NumberOfType1Error)) result <- gatherStatistics(sim, list(NumOfType1Err = NumberOfType1Error), list(median=median, mean=mean, sd=sd)) print(result) require(lattice) histogram(~NumOfType1Err | method*alpha, data = result.all$statisticDF) barchart(NumOfType1Err.median + NumOfType1Err.mean ~ method | alpha, data = result$statisticDF)
# this function generates pValues myGen <- function(n, n0) { list(procInput=list(pValues = c(runif(n-n0, 0, 0.01), runif(n0))), groundTruth = c(rep(FALSE, times=n-n0), rep(TRUE, times=n0))) } sim <- simulation(replications = 10, list(funName="myGen", fun=myGen, n=200, n0=c(50,100)), list(list(funName="BH", fun=function(pValues, alpha) BH(pValues, alpha, silent=TRUE), alpha=c(0.25, 0.5)), list(funName="holm", fun=holm, alpha=c(0.25, 0.5),silent=TRUE))) # the following happend: # Call myGen(200,50) and append result to sim$data # Apply bonferroni and holm each with alpha 0.25 and 0.5 to this data set # Append the results to sim$restults # Repeat this 10 times. # Call myGen(200, 100) and append restult to sim$data # Apply bonferroni and holm each with alpha 0.25 and 0.5 to this data set # Append the results to sim$restults # Repeat this 10 times. length(sim$data) length(sim$results) # we now reproduce the 6th item in results print(sim$results[[6]]$data.set.number) print(sim$results[[6]]$parameters) all(BH(sim$data[[2]]$procInput$pValues, 0.5, silent=TRUE)$adjPValues == sim$results[[6]]$adjPValues) # # Just calculating some statistics and making some plots NumberOfType1Error <- function(data, result) sum(data$groundTruth * result$rejected) result.all <- gatherStatistics(sim, list(NumOfType1Err = NumberOfType1Error)) result <- gatherStatistics(sim, list(NumOfType1Err = NumberOfType1Error), list(median=median, mean=mean, sd=sd)) print(result) require(lattice) histogram(~NumOfType1Err | method*alpha, data = result.all$statisticDF) barchart(NumOfType1Err.median + NumOfType1Err.mean ~ method | alpha, data = result$statisticDF)
Student - Newman - Keuls rejective test procedure. The procedure controls the FWER in the WEAK sense.
snk(formula, data, alpha, MSE=NULL, df=NULL, silent=FALSE) snk.wrapper(model, data, alpha, silent=FALSE)
snk(formula, data, alpha, MSE=NULL, df=NULL, silent=FALSE) snk.wrapper(model, data, alpha, silent=FALSE)
formula |
Formula defining the statistical model containing the response and the factor levels. |
model |
Model with formula, containing the response and the factor levels |
data |
dataset containing the response and the grouping factor. |
alpha |
The level at which the error should be controlled. By default it is alpha=0.05. |
MSE |
Optional for a given variance of the data. |
df |
Optional for a given degree of freedom. |
silent |
If true any output on the console will be suppressed. |
This function computes the Student-Newman-Keuls test for given
data including p samples. The Newman-Keuls procedure is based on a stepwise or
layer approach to significance testing. Sample means are
ordered from the smallest to the largest. The largest
difference, which involves means that are r = p steps apart,
is tested first at level of significance; if significant,
means that are r = p - 1 steps apart are tested at
level
of significance and so on. The Newman-Keuls procedure provides an
r-mean significance level equal to
for each group of
r ordered means, that is, the probability of falsely rejecting
the hypothesis that all means in an ordered group are equal to
. It follows that the concept of error rate applies
neither on an experimentwise nor on a per comparison basis-the
actual error rate falls somewhere between the two.
The Newman-Keuls procedure, like Tukey's procedure, requires
equal sample n's. However, in this algorithm, the procedure is
adapted to unequal sample sized which can lead to still
conservative test decisions.
It should be noted that the Newman-Keuls and Tukey procedures
require the same critical difference for the first comparison
that is tested. The Tukey procedure uses this critical difference
for all the remaining tests, whereas the Newman-Keuls procedure
reduces the size of the critical difference, depending on the
number of steps separating the ordered means. As a result, the
Newman-Keuls test is more powerful than Tukey's test. Remember,
however, that the Newman-Keuls procedure does not control the
experimentwise error rate at .
A list containing:
adjPValues |
A numeric vector containing the adjusted pValues |
rejected |
A logical vector indicating which hypotheses are rejected |
statistics |
A numeric vector containing the test-statistics |
confIntervals |
A matrix containing only the estimates |
errorControl |
A Mutoss S4 class of type |
Frank Konietschke
Keuls M (1952). "The use of the studentized range in connection with an analysis of variance". Euphytica 1: 112-122
x = rnorm(50) grp = c(rep(1:5,10)) dataframe <- data.frame(x,grp) result <- snk(x~grp, data=dataframe, alpha=0.05,MSE=NULL, df=NULL, silent = TRUE) result <- snk(x~grp, data=dataframe,alpha=0.05,MSE=NULL, df=NULL, silent = FALSE) result <- snk(x~grp, data=dataframe,alpha=0.05,MSE=1, df=Inf, silent = FALSE) # known variance result <- snk(x~grp, data=dataframe,alpha=0.05,MSE=1, df=1000, silent = FALSE) # known variance
x = rnorm(50) grp = c(rep(1:5,10)) dataframe <- data.frame(x,grp) result <- snk(x~grp, data=dataframe, alpha=0.05,MSE=NULL, df=NULL, silent = TRUE) result <- snk(x~grp, data=dataframe,alpha=0.05,MSE=NULL, df=NULL, silent = FALSE) result <- snk(x~grp, data=dataframe,alpha=0.05,MSE=1, df=Inf, silent = FALSE) # known variance result <- snk(x~grp, data=dataframe,alpha=0.05,MSE=1, df=1000, silent = FALSE) # known variance
The Storey-Taylor-Siegmund procedure for estimating pi0 is applied to pValues. The formula is equivalent to that in Schweder and Spjotvoll (1982), page 497, except the additional '+1' in the nominator that introduces a conservative bias which is proven to be sufficiently large for FDR control in finite families of hypotheses if the estimation is used for adjusting the nominal level of a linear step-up test.
storey_pi0_est(pValues, lambda)
storey_pi0_est(pValues, lambda)
pValues |
The raw p-values for the marginal test problems |
lambda |
A tuning parameter in the interval (0, 1) |
A list containing:
pi0 |
A numeric number containing the estimated value of pi0 |
lambda |
A numeric number containing the tuning parameter for the estimation |
MarselScheer
Schweder, T. and Spjotvoll, E. (1982). Plots of P-values to evaluate many tests simultaneously. Biometrika 69, 3, 493-502.
Storey, J. D., Taylor, J. E. and Siegmund, D. (2004). Strong control, conservative point estimation and simultaneous conservative consistency of false discovery rates: a unified approach. JRSS B 66, 1, 187-205.
my.pvals <- c(runif(50), runif(50, 0, 0.01)) result <- storey_pi0_est(my.pvals, 0.5)
my.pvals <- c(runif(50), runif(50, 0, 0.01)) result <- storey_pi0_est(my.pvals, 0.5)
A general step-up procedure.
SU(pValues, criticalValues)
SU(pValues, criticalValues)
pValues |
pValues to be used. |
criticalValues |
criticalValues for the step-up procedure |
Suppose we have n pValues and they are already sorted. The procedure starts with comparing pValues[n] with criticalValues[n]. If pValues[n] > criticalValues[n], then the hypothesis associated with pValues[n] is retained and the algorithm carries on with the next pValue and criticalValue, here for example pValues[n-1] and criticalValues[n-1]. The algorithm stops retaining at the first index i for which pValues[i] <= criticalValues[i]. Thus pValues[j] is rejected if and only if their exists an index i with j <= i and pValues[i] <= criticalValues[i].
rejected logical vector indicating if hypotheses are rejected or retained.
MarselScheer
A general step-up-down procedure.
SUD(pValues, criticalValues, startIDX_SUD)
SUD(pValues, criticalValues, startIDX_SUD)
pValues |
pValues to be used. |
criticalValues |
criticalValues for the step-up-down procedure |
startIDX_SUD |
the index (between 1 and length(pValues)) used for the first comparison of pValues[startIDX_SUD] and criticalValues[startIDX_SUD]. Depending on the result of this comparison the algorithm decides to proceed in step-up or step-down manner. |
Suppose we have n pValues and they are already sorted. The procedure compares pValues[startIDX_SUD] with criticalValues[startIDX_SUD] and then proceeds in step-up or step-down manner, depending on the result of this initial comparision.
If pValues[startIDX_SUD] <= criticalValues[startIDX_SUD], then the procedure rejects the hypotheses associated with pValues[1], ..., pValues[startIDX_SUD] and carries on in a step-down manner from startIDX_SUD to n to reject additional hypotheses.
If pValues[startIDX_SUD] > criticalValues[startIDX_SUD], then the procedure retains hypotheses associated with pValues[startIDX_SUD], ..., pValues[n] and carries on in a step-up manner with pValues[startIDX_SUD - 1], ..., pValues[1].
If startIDX_SUD equals n the algorithm behaves like a step-up procedure.
If startIDX_SUD equals 1 the algorithm behaves like a step-down procedure.
rejected logical vector indicating if hypotheses are rejected or retained.
MuToss-Coding Team
The two-step estimation method of Benjamini, Krieger and Yekutieli for estimating pi0 is applied to pValues.
It consists of the following two steps:
Step 1. Use the linear step-up procedure at level alpha' =alpha/(1+alpha). Let r1 be the number of
rejected hypotheses. If r1=0 do not reject any hypothesis and stop; if r1=m reject all m
hypotheses and stop; otherwise continue.
Step 2. Let and
.
TSBKY_pi0_est(pValues, alpha)
TSBKY_pi0_est(pValues, alpha)
pValues |
The raw p-values for the marginal test problems |
alpha |
The parameter (to be interpreted as significance level) for the procedure |
pi0.TSBKY |
The estimated proportion of true null hypotheses. |
WerftWiebke
Benjamini, Y., Krieger, A. and Yekutieli, D. (2006). Adaptive linear step-up procedures that control the false discovery rate Biometrika 93, 3, page 495.
my.pvals <- c(runif(50), runif(50, 0, 0.01)) result <- TSBKY_pi0_est(my.pvals, 0.1)
my.pvals <- c(runif(50), runif(50, 0, 0.01)) result <- TSBKY_pi0_est(my.pvals, 0.1)
Tukey HSD test and simultaneous confidence intervals for all pairs comparisons in factorial designs. The procedure controls the FWER in the strong sense.
tukey.wrapper(model, alpha, factorC)
tukey.wrapper(model, alpha, factorC)
model |
A fitted model, for example an object returned by lm, glm, or aov etc. It is assumed that coef and vcov methods are available for model. Usually, it is an aov fit |
alpha |
The significance level |
factorC |
Specifies a factor |
this function, it is possible to compute all pairs comparisons for expectations and simultaneous confidence intervals in factorial linear models. Hereby, the all-pairs comparisons can be performed for user given effects. The overall variance is estimated by the linear model as well as the degree of freedom used by the studentized range distribution.
A list containing:
adjPValues |
A numeric vector containing the adjusted pValues |
rejected |
A logical vector indicating which hypotheses are rejected |
confIntervals |
A matrix containing the estimates and the lower and upper confidence bound |
errorControl |
A Mutoss S4 class of type |
Frank Konietschke et al.
data(warpbreaks) # Tukey contrast on the levels of the factor "Tension" tukey.wrapper(aov(breaks ~ tension, data = warpbreaks), factorC="tension",alpha=0.05) # Two-way anova with interaction tukey.wrapper(aov(breaks ~ tension*wool, data = warpbreaks),alpha=0.05,factorC="tension") # Two-way anova without interaction tukey.wrapper(aov(breaks ~ tension+wool, data = warpbreaks),alpha=0.05,factorC="tension") tukey.wrapper(aov(breaks ~ tension, data = warpbreaks),alpha=0.05,factorC="tension") data(iris) tukey.wrapper(lm(Sepal.Length ~ Species, data=iris),alpha=0.05, factorC="Species")
data(warpbreaks) # Tukey contrast on the levels of the factor "Tension" tukey.wrapper(aov(breaks ~ tension, data = warpbreaks), factorC="tension",alpha=0.05) # Two-way anova with interaction tukey.wrapper(aov(breaks ~ tension*wool, data = warpbreaks),alpha=0.05,factorC="tension") # Two-way anova without interaction tukey.wrapper(aov(breaks ~ tension+wool, data = warpbreaks),alpha=0.05,factorC="tension") tukey.wrapper(aov(breaks ~ tension, data = warpbreaks),alpha=0.05,factorC="tension") data(iris) tukey.wrapper(lm(Sepal.Length ~ Species, data=iris),alpha=0.05, factorC="Species")
A p-value procedure which controls the FDR for independent test statistics.
two.stage(pValues, alpha)
two.stage(pValues, alpha)
pValues |
A numeric vecor of p-values. |
alpha |
The FDR error rate to control. |
In the Benjamini-Krieger-Yekutieli two-stage procedure the linear step-up procedure is used in stage one to estimate m0 which is re-plugged in a linear step-up. This procedure is more powerful then non-adaptive procedures, while still controlling the FDR. On the other hand, error control is not guaranteed under dependence in which case more conservative procedures should be used (e.g. BH).
A list containing:
rejected |
A logical vector indicating which hypotheses are rejected |
criticalValues |
A numeric vector containing critical values used in the step-up-down test. |
adjPValues |
A numeric vector containing adjusted p-values. |
pi0 |
An estimate of the proportion of true null hypotheses among all hypotheses (pi0=m0/m). |
errorControl |
A Mutoss S4 class of type |
JonathanRosenblatt
pvals<- runif(100)^2 two.stage(pvals, 0.1)
pvals<- runif(100)^2 two.stage(pvals, 0.1)
The robust version uses the Wilcoxon-Mann-Whitney test, otherwise a two-sample t-test will be performed.
twosamp.marginal(data, model, robust, alternative, psi0, equalvar)
twosamp.marginal(data, model, robust, alternative, psi0, equalvar)
data |
the data set |
model |
the result of a call to |
robust |
a logical variable indicating whether a two sample t-test or a Wilcoxon-Mann-Whitney test should be used. |
alternative |
a character string specifying the alternative hypothesis,
must be one of |
psi0 |
a numeric that defines the hypothesized null value |
equalvar |
a logical variable indicating whether to treat the two variances as being equal |
A vector of classlabels needs to be provided to distinguish the two groups.
pValues |
A numeric vector containing the unadjusted pValues |
MuToss-Coding Team
Wilcoxon, F. (1945). Individual Comparisons by Ranking Methods. Biometrics Bulletin 1:80-83. Mann, H. and Whitney, D. (1947). On a test of whether one of two random variables is stochastically larger than the other. Annals of Mathematical Statistics 18:50-60 Student (1908). The probable error of a mean. Biometrika, 6(1):1-25.
Blanchard-Roquain (2009) 2-stage adaptive step-up
twostageBR(pValues, alpha, lambda=1, silent=FALSE)
twostageBR(pValues, alpha, lambda=1, silent=FALSE)
pValues |
the used p-values (assumed to be independent) |
alpha |
the level at which the FDR should be controlled. |
lambda |
parameter of the procedure, should belong to (0, 1/alpha) (lambda=1 default) |
silent |
if true any output on the console will be suppressed. |
This is an adaptive linear step-up procedure where the proportion of true nulls is estimated using the Blanchard-Roquain 1-stage procedure with parameter lambda, via the formula
estimated pi_0 = ( m - R(alpha,lambda) + 1) / ( m*( 1 - lambda * alpha ) )
where R(alpha,lambda) is the number of hypotheses rejected by the BR 1-stage procedure, alpha is the level at which FDR should be controlled and lambda an arbitrary parameter belonging to (0, 1/alpha) with default value 1. This procedure controls FDR at the desired level when the p-values are independent.
A list containing:
rejected |
A logical vector indicating which hypotheses are rejected |
errorControl |
A Mutoss S4 class of type |
GillesBlanchard
Blanchard, G. and Roquain, E. (2009) Adaptive False Discovery Rate Control under Independence and Dependence Journal of Machine Learning Research 10:2837-2871.