R Under development (unstable) (2024-08-15 r87022 ucrt) -- "Unsuffered Consequences" Copyright (C) 2024 The R Foundation for Statistical Computing Platform: x86_64-w64-mingw32/x64 R is free software and comes with ABSOLUTELY NO WARRANTY. You are welcome to redistribute it under certain conditions. Type 'license()' or 'licence()' for distribution details. R is a collaborative project with many contributors. Type 'contributors()' for more information and 'citation()' on how to cite R or R packages in publications. Type 'demo()' for some demos, 'help()' for on-line help, or 'help.start()' for an HTML browser interface to help. Type 'q()' to quit R. > library(ClassComparison) Loading required package: oompaBase > > suppressWarnings( RNGversion("3.5.3") ) > set.seed(782562) > betaPerc <- 0.10 > nGenes <- 1000 > alpha <- 0.2 > nUnif <- trunc(nGenes*(1-betaPerc)) > pvals <- c(runif(nUnif), rbeta(nGenes-nUnif, alpha, 1)) > fit <- Bum(pvals) > > fit@ahat [1] 0.1645129 > fit@lhat [1] 0.9184144 > fit@pihat [1] 0.9318363 > > fdr <- 0.2 > countSignificant(fit, alpha=fdr, by="FDR") [1] 46 > picked <- selectSignificant(fit, alpha=fdr, by="FDR") > > truth <- rep(c("Null", "Real"), times=c(nUnif, nGenes-nUnif)) > > table(truth, byFDR=picked) byFDR truth FALSE TRUE Null 895 5 Real 59 41 > > conf <- 0.80 > countSignificant(fit, alpha=conf, by="EmpiricalBayes") [1] 30 > epicked <- selectSignificant(fit, alpha=conf, by="EmpiricalBayes") > > table(truth, EB=epicked) EB truth FALSE TRUE Null 900 0 Real 70 30 > > table(byFDR=picked, EB=epicked) EB byFDR FALSE TRUE FALSE 954 0 TRUE 16 30 > > # unknown method > try( countSignificant(fit, by="HandWaving") ) Error in match.arg(by, c("FDR", "FalseDiscovery", "falsediscovery", "EmpiricalBayes", : 'arg' should be one of "FDR", "FalseDiscovery", "falsediscovery", "EmpiricalBayes", "empiricalbayes" > > # out of range > try( b <- Bum(rnorm(1000)) ) Error in Bum(rnorm(1000)) : all p-values must be between 0 and 1 > try( b <- Bum(c(pvals, 1.1)) ) Error in Bum(c(pvals, 1.1)) : all p-values must be between 0 and 1 > > # bad input type > try( b <- Bum(LETTERS) ) Error in Bum(LETTERS) : all p-values must be between 0 and 1 > try( b <- Bum(factor(LETTERS) )) Error in if (any(pvals < 0) || any(pvals > 1)) { : missing value where TRUE/FALSE needed In addition: Warning messages: 1: In Ops.factor(pvals, 0) : '<' not meaningful for factors 2: In Ops.factor(pvals, 1) : '>' not meaningful for factors > > proc.time() user system elapsed 0.46 0.07 0.53