Skip to content

Commit

Permalink
version 1.1
Browse files Browse the repository at this point in the history
  • Loading branch information
Marta Cousido Rocha authored and cran-robot committed Apr 1, 2020
1 parent e5d1396 commit ae3b764
Show file tree
Hide file tree
Showing 6 changed files with 58 additions and 81 deletions.
12 changes: 6 additions & 6 deletions DESCRIPTION
@@ -1,23 +1,23 @@
Package: DiscreteQvalue
Title: Improved q-Values for Discrete Uniform and Homogeneous Tests
Version: 1.0
Version: 1.1
Authors@R: c(
person("Marta", "Cousido Rocha", email = "martacousido@uvigo.es", role = c("aut", "cre")),
person("José Carlos", "Soage González", email = "jsoage@uvigo.es", role = "ctr"),
person("Jacobo", "de Uña Álvarez", email = "jacobo@uvigo.es", role = c("aut", "ths")),
person("Sebastian", "Döhler", role = "aut"))
Maintainer: Marta Cousido Rocha <martacousido@uvigo.es>
Suggests: coin, exactRankTests
Description: We consider a multiple testing procedure used in many modern applications which is the q-value method proposed by Storey and Tibshirani (2003) <DOI:10.1073/pnas.1530509100>. The q-value method is based on the false discovery rate (FDR), hence versions of the q-value method can be defined depending on which estimator of the proportion of true null hypotheses, pi_0, is plugged in the FDR estimator. We implement the q-value method based on two classical pi_0 estimators, and furthermore, we propose and implement three versions of the q-value method for homogeneous discrete uniform P-values based on pi_0 estimators which take into account the discrete distribution of the P-values.
Description: We consider a multiple testing procedure used in many modern applications which is the q-value method proposed by Storey and Tibshirani (2003), <doi:10.1073/pnas.1530509100>. The q-value method is based on the false discovery rate (FDR), hence versions of the q-value method can be defined depending on which estimator of the proportion of true null hypotheses, p0, is plugged in the FDR estimator. We implement the q-value method based on two classical pi0 estimators, and furthermore, we propose and implement three versions of the q-value method for homogeneous discrete uniform P-values based on pi0 estimators which take into account the discrete distribution of the P-values.
License: GPL-2
Suggests: coin, exactRankTests
Encoding: UTF-8
LazyData: true
RoxygenNote: 6.1.1
RoxygenNote: 7.1.0
NeedsCompilation: no
Packaged: 2019-10-18 11:50:39 UTC; mcousido
Packaged: 2020-04-01 15:54:56 UTC; sidor
Author: Marta Cousido Rocha [aut, cre],
José Carlos Soage González [ctr],
Jacobo de Uña Álvarez [aut, ths],
Sebastian Döhler [aut]
Repository: CRAN
Date/Publication: 2019-10-21 14:10:09 UTC
Date/Publication: 2020-04-01 17:10:03 UTC
10 changes: 5 additions & 5 deletions MD5
@@ -1,13 +1,13 @@
970ce37301636fdf018ca7dc7720feef *DESCRIPTION
67c6b1ac01047b99329b62ef1eaa09a9 *DESCRIPTION
7bfde1202d230b6a402ee8ebce063bf7 *NAMESPACE
99d11c9365bd702b3c6745653d2a4f54 *R/DQ.R
f21f951c37b09f5992a30f3162fa1be0 *R/DiscreteQvalue-package.R
bb0600fe49b8c2afcdffd2ace7c8a65d *R/DQ.R
61e7f0ea026295ced643197c220cb1e3 *R/DiscreteQvalue-package.R
e68c9ac0031f740090ae4021fa05e70e *R/Rp.R
2870a617b29b5aa1007e0ca873f4f72f *R/est.pi0.disc.R
2150e473f533b75e5b36e7aa197d9873 *R/get.tbl.full.R
02ada31f03a0159dc5f9b869c8299846 *R/pi0_G.R
488461989d439b1b767dff05cdf1c754 *R/q.value_pi0.R
6872e15a0f5749b95ab2c58f3a3489b3 *R/which.min.left.R
b4023ca91a7eb70ccf323577144a0c4e *R/zzz.R
da67ea25e1e1ab57440b1d0618c1791e *man/DQ.Rd
18de3241147263624d248c3a2a0949dd *man/DiscreteQvalue-package.Rd
716395cf277d4bcb62d4229565d09ca7 *man/DQ.Rd
bc3f5c41492fc831c516b055821621f6 *man/DiscreteQvalue-package.Rd
44 changes: 15 additions & 29 deletions R/DQ.R
@@ -1,23 +1,23 @@
#' @title Improved q-Values for Discrete Uniform and Homogeneous Tests
#' @title Improved q-values for discrete uniform and homogeneous tests
#' @aliases DQ
#' @description Performs the five versions of the q-value method considered in Cousido-Rocha et al. (2019). The q-value method is based on the false discovery rate (FDR), and the versions differ in the estimator of the proportion of true null hypotheses, \eqn{\pi_0}{\pi_0}, which is plugged in the FDR estimator. Specifically, we consider as possible estimators for \eqn{\pi_0}{\pi_0}: two usual estimators for continuous and possibly heterogeneous P-values; an estimator for discrete P-values defined in two steps: firstly the P-values are randomized, and then the usual \eqn{\pi_0}{\pi_0} estimator for continuous P-values is applied; and the estimators recently proposed for discrete P-values by Liang (2016) and Chen et al. (2014).
#' @description Performs the five versions of the q-value method considered in Cousido-Rocha et al. (2019). The q-value method is based on the false discovery rate (FDR), and the versions differ in the estimator of the proportion of true null hypotheses, \eqn{\pi_0}{π_0}, which is plugged in the FDR estimator. Specifically, we consider as possible estimators for \eqn{\pi_0}{π_0}: two usual estimators for continuous and possibly heterogeneous P-values; an estimator for discrete P-values defined in two steps: firstly the P-values are randomized, and then the usual \eqn{\pi_0}{π_0} estimator for continuous P-values is applied; and the estimators recently proposed for discrete P-values by Liang (2016) and Chen et al. (2014).
#'
#'
#' @param pv A vector of P-values.
#' @param ss Support of the discrete distribution of the P-values. Only required for “Liang”, “Chen” and “Rand” methods which are specifically proposed for discrete P-values. If the P-values are continuous the methods “ST” and “SS” do not need this argument, hence “ss=NULL” by default.
#' @param ss_inf Logical. Default is FALSE. A variable indicating whether the support of the discrete distribution of the P-values is finite or infinite. See details.
#' @param method The q-value method. By default the “Chen” method is computed.
#' @param lambda The value of the tuning parameter to estimate \eqn{\pi_0}{\pi_0} when the method is “ST”. See details.
#' @param lambda The value of the tuning parameter to estimate \eqn{\pi_0}{π_0} when the method is “ST”. See details.
#'
#' @details The function implements the five different versions of the q-value method in Cousido-Rocha et al. (2019).
#' Three versions are novel adaptions for the case of homogeneous discrete uniform P-values, whereas the other two
#' are classical versions of the q-value method for P-values which follow a continuous uniform distribution under the global null hypothesis.
#' The classical versions are the q-value method based on the \eqn{\pi_0}{\pi_0} estimator proposed in Storey (2002) with tunning parameter \eqn{\lambda}{lambda} = 0.5,
#' and the q-value procedure which uses the \eqn{\pi_0}{\pi_0} estimator in Storey and Tibshirani (2003) who proposed an automatic method to estimate \eqn{\pi_0}{\pi_0}.
#' The classical versions are the q-value method based on the \eqn{\pi_0}{π_0} estimator proposed in Storey (2002) with tunning parameter \eqn{\lambda}{lambda} = 0.5,
#' and the q-value procedure which uses the \eqn{\pi_0}{π_0} estimator in Storey and Tibshirani (2003) who proposed an automatic method to estimate \eqn{\pi_0}{π_0}.
#' We refer to these methods as “SS” and “ST”, respectively. On the other hand the three adaptations of the q-value method
#' for homogeneous discrete uniform P-values are: “Liang” which considers the \eqn{\pi_0}{\pi_0} estimator proposed in
#' for homogeneous discrete uniform P-values are: “Liang” which considers the \eqn{\pi_0}{π_0} estimator proposed in
#' Liang (2016); “Chen” which uses a simplification for homogeneous discrete P-values of the algorithm for
#' the estimation of \eqn{\pi_0}{\pi_0} proposed in Chen et al. (2014); and “Rand” which employs the standard q-value procedure but applied to
#' the estimation of \eqn{\pi_0}{π_0} proposed in Chen et al. (2014); and “Rand” which employs the standard q-value procedure but applied to
#' randomized P-values. For details of the different q-value versions, in
#' particular for the novel adaptations for homogeneous discrete uniform P-values, see Cousido-Rocha et al. (2019).
#'
Expand Down Expand Up @@ -70,20 +70,6 @@
#'
#'
#' @examples
#' \dontshow{
#' set.seed(123)
#' p <- 100
#' n = m = 5
#' X <- matrix(rnorm(n * p), ncol = n)
#' Y <- matrix(rnorm(m * p), ncol = m)
#' p <- nrow(X)
#' pv <- 1:p
#' for (i in 1:p){
#' pv[i] <- t.test(X[i, ], Y[i, ])$p.value
#' }
#'
#' R <- DQ(pv, method = "ST")
#' }
#'
#' # We consider a simple simulated data set to illustrate the use of the DQ function.
#' # We have simulated the following situation.
Expand Down Expand Up @@ -176,7 +162,7 @@
#' p <- nrow(X)
#' pv <- 1:p
#' for (i in 1:p){
#' pv[i] <-wilcox.exact(X[i, ], Y[i, ])$p.value
#' pv[i] <- wilcox.exact(X[i, ], Y[i, ])$p.value
#' }
#'
#' # When the sample size is small, in this case n=m=5, the distribution of
Expand Down Expand Up @@ -262,11 +248,11 @@
#' # course s_inf = TRUE.
#'
#' indicator <- which(ss <= 0.5)
#' ss <- ss[indicator]
#' R <- DQ(pv, ss = ss, s_inf = "TRUE", method = "Chen")
#' ssi <- ss[indicator]
#' R <- DQ(pv, ss = ssi, ss_inf = "TRUE", method = "Chen")
#' # For Liang method the relevant support values are also the values below 0.5, hence
#' # ss defined above is suitable.
#' R <- DQ(pv, ss = ss, s_inf = "TRUE", method = "Liang")
#' R <- DQ(pv, ss = ssi, ss_inf = "TRUE", method = "Liang")
#'
#' # For Rand method the relevant support values are those ones with match with
#' # the P-values, and also the largest support points smaller than each one of such P-values.
Expand All @@ -282,7 +268,7 @@
#' ind_final <- unique(sort(c(ind, ind_minus)))
#' ss <- ss[ind_final]
#' # Now, we can apply Rand method.
#' R <- DQ(pv, ss = ss, s_inf = "TRUE", method = "Rand")
#' R <- DQ(pv, ss = ss, ss_inf = "TRUE", method = "Rand")
#'
#'}
#'
Expand All @@ -291,14 +277,14 @@
#' @export
DQ <- function(pv, ss = NULL, ss_inf = FALSE, method = c("ST", "SS", "Liang", "Chen", "Rand"), lambda = seq(0.05, 0.95, 0.05)){

# message("Call:", "\n")
# cat("Call:", "\n")
# print(match.call())

match.arg(method)

if (missing(method)) {
method <- "ST"
message("'ST' method used by default\n")
cat("'ST' method used by default\n")
}

if(method == "ST" || method == "SS"){
Expand Down Expand Up @@ -380,7 +366,7 @@ DQ <- function(pv, ss = NULL, ss_inf = FALSE, method = c("ST", "SS", "Liang", "C

##### Liang method
if(method == "Liang"){

p.grid<-ss
NN <- length(ss)
p.count.mat <- get.tbl.full(pv, NN, ss)
pi0_Liang <- est.pi0.disc(p.count.mat, p.grid)$pi0 # DEVOLVE A FUNCIÓN pi0 método Liang
Expand Down
14 changes: 7 additions & 7 deletions R/DiscreteQvalue-package.R
@@ -1,19 +1,19 @@
#' @title Improved q-Values for Discrete Uniform and Homogeneous Tests
#' @title Improved q-values for discrete uniform and homogeneous tests
#'
#'
#' @description This package implements five different versions of the q-value multiple testing procedure
#' proposed by Storey and Tibshirani (2003). The q-value method
#' is based on the false discovery rate (FDR); different versions of the q-value method can be defined depending
#' on the particular estimator used for the proportion of true null hypotheses, \eqn{\pi_0}{\pi_0}, which is plugged in the FDR formula. The
#' first version of the q-value uses the \eqn{\pi_0}{\pi_0} estimator in Storey (2002), with tunning parameter \eqn{\lambda}{lambda} = 0.5; whereas
#' the second version uses the \eqn{\pi_0}{\pi_0} estimator in Storey and Tibshirani (2003), which is based on an automatic method to
#' on the particular estimator used for the proportion of true null hypotheses, \eqn{\pi_0}{π_0}, which is plugged in the FDR formula. The
#' first version of the q-value uses the \eqn{\pi_0}{π_0} estimator in Storey (2002), with tunning parameter \eqn{\lambda}{lambda} = 0.5; whereas
#' the second version uses the \eqn{\pi_0}{π_0} estimator in Storey and Tibshirani (2003), which is based on an automatic method to
#' select the tunning parameter
#' \eqn{\lambda}{lambda}. These two methods are only appropriate when the P-values follow a continuous uniform distribution
#' under the global null hypothesis. This package also provides three other versions of the q-value for
#' homogeneous discrete uniform P-values, which often appear in practice.
#' The first discrete version of the q-value uses the \eqn{\pi_0}{\pi_0} estimator
#' The first discrete version of the q-value uses the \eqn{\pi_0}{π_0} estimator
#' proposed in Liang (2016).
#' The second discrete q-value method uses the estimator of \eqn{\pi_0}{\pi_0} proposed in Chen et al. (2014),
#' The second discrete q-value method uses the estimator of \eqn{\pi_0}{π_0} proposed in Chen et al. (2014),
#' when simplified for the special case of homogeneous discrete P-values.
#' The third discrete version of the q-value employs a standard procedure but applied on randomized P-values.
#' Once the estimated q-values are computed, the q-value method
Expand All @@ -25,7 +25,7 @@
#' \itemize{
#' \item{Package: ‘DiscreteQvalue’}
#' \item{Version: 1.0}
#' \item{Maintainer: Marta Cousido Rocha \email{martacousido@uvigo.es}}
#' \item{Maintainer: Marta Cousido Rocha \email{martacousido@@uvigo.es}}
#' \item{License: GPL-2}
#' }
#'
Expand Down
47 changes: 19 additions & 28 deletions man/DQ.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit ae3b764

Please sign in to comment.