FDR functions for permutation-based estimators, including pi0 as well as FDR confidence intervals. The confidence intervals account for dependencies between tests by the incorporation of an overdispersion parameter, which is estimated from the permuted data. — From the package description
You can install fdrci from GitHub with:
# install.packages("devtools")
::install_github("USCbiostats/fdrci") devtools
This is a basic example which shows you how to solve a common problem:
library(fdrci)
= 100
ss = 100
nvar = as.data.frame(matrix(rnorm(ss*nvar),nrow=ss,ncol=nvar))
X = as.data.frame(matrix(rnorm(ss*nvar),nrow=ss,ncol=nvar))
Y = 10
nperm
= function(X,Y){
myanalysis = ncol(X)
ntests = as.data.frame(matrix(NA,nrow=ntests,ncol=2))
rslts names(rslts) = c("ID","pvalue")
"ID"] = 1:ntests
rslts[,for(i in 1:ntests){
= cor.test(X[,i],Y[,i],na.action="na.exclude",
fit alternative="two.sided",method="pearson")
"pvalue"] = fit$p.value
rslts[i,
}return(rslts)
# End myanalysis
}
# Generate observed results
= myanalysis(X,Y)
obs
# Generate permuted results
= vector('list',nperm)
perml for(p_ in 1:nperm){
= X[order(runif(nvar)),]
X1 = myanalysis(X1,Y)
perml[[p_]]
}
# FDR results table
= fdrTbl(obs$pvalue,perml,"pvalue",nvar,0,3)
myfdrtbl # Plot results
FDRplot(myfdrtbl,0,3,annot="A. An Example")
#> Warning: Removed 13 rows containing missing values (geom_path).
#> Warning: Removed 13 rows containing missing values (geom_point).
#> Warning: Removed 13 rows containing missing values (geom_text).