# NOT RUN {
### To access the tutorial document for this package, type in R (not run here):
# vignette('SigTree')
## Assume 10 OTUs are measured in each of
## 20 subjects receiving treatment 2, and
## 15 subjects receiving treatment 1.
## For each OTU, test null: Mean2=Mean1
## using a Wilcoxon Rank Sum test.
## Simulate data, and obtain p-values and differences
set.seed(1234)
library(MASS)
X2 <- mvrnorm(n=20, mu=runif(10), Sigma=diag(10))
X1 <- mvrnorm(n=15, mu=runif(10), Sigma=diag(10))
p1.orig <- p2 <- diff <- rep(NA,10)
for(i in 1:10)
{
p1.orig[i] <- wilcox.test(X1[,i],X2[,i],
alt='less', exact=FALSE)$p.value
p2[i] <- wilcox.test(X1[,i],X2[,i],
exact=FALSE)$p.value
diff[i] <- mean(X2[,i]) - mean(X1[,i])
}
## Convert two-sided p-values to one-sided
p1.new <- p2.p1(p2,diff)
## Compare with 'original' one-sided p-values
plot(p1.new,p1.orig); abline(0,1)
# }
Run the code above in your browser using DataLab