-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathREADME.Rmd
executable file
·80 lines (61 loc) · 2.11 KB
/
README.Rmd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
---
output: github_document
---
[](https://travis-ci.org/USCbiostats/fdrci)
[](https://ci.appveyor.com/project/gvegayon/fdrci)
<!-- README.md is generated from README.Rmd. Please edit that file -->
```{r setup, include = FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>",
fig.path = "man/figures/README-",
out.width = "100%"
)
```
# fdrci
> 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
## Installation
You can install fdrci from GitHub with:
```{r gh-installation, eval = FALSE}
# install.packages("devtools")
devtools::install_github("USCbiostats/fdrci")
```
## Example
This is a basic example which shows you how to solve a common problem:
```{r example}
library(fdrci)
ss = 100
nvar = 100
X = as.data.frame(matrix(rnorm(ss*nvar),nrow=ss,ncol=nvar))
Y = as.data.frame(matrix(rnorm(ss*nvar),nrow=ss,ncol=nvar))
nperm = 10
myanalysis = function(X,Y){
ntests = ncol(X)
rslts = as.data.frame(matrix(NA,nrow=ntests,ncol=2))
names(rslts) = c("ID","pvalue")
rslts[,"ID"] = 1:ntests
for(i in 1:ntests){
fit = cor.test(X[,i],Y[,i],na.action="na.exclude",
alternative="two.sided",method="pearson")
rslts[i,"pvalue"] = fit$p.value
}
return(rslts)
} # End myanalysis
# Generate observed results
obs = myanalysis(X,Y)
# Generate permuted results
perml = vector('list',nperm)
for(p_ in 1:nperm){
X1 = X[order(runif(nvar)),]
perml[[p_]] = myanalysis(X1,Y)
}
# FDR results table
myfdrtbl = fdrTbl(obs$pvalue,perml,"pvalue",nvar,0.5,3)
myfdrtbl1 = fdrTbl(obs$pvalue,perml,"pvalue",n.col,0.5,3,correct="BH")
fdrTbl(obs$pvalue, NULL, "pvalue",n.col,0.5,3,meff = TRUE, seff = TRUE, mymat = X, nperms = 5)
# Plot results
FDRplot(myfdrtbl,0,3,annot="A. An Example")
```