#simulate some data sets: matrices of log-abundance levels
nsam<-20 #number of individuals
nfeat<-40 #number of features (metabolites, genes,...)
diffs<-c(1:4) #features with differential log-abundance levels
lfc<-5 #differential quantity
# create data sets:
x <- matrix(rnorm(nfeat*nsam), nrow = nfeat, ncol = nsam) #case
y <- matrix(rnorm(nfeat*nsam), nrow = nfeat, ncol = nsam) #control
x[diffs,] <- x[diffs,] + lfc
stat<-rnorm(nfeat) #a vector of statistics
stat[diffs]<-stat[diffs]+lfc
# shrinkage estimator ----------
z1 <- nlocfdr.stat(stat=stat,param=rowMeans(x))
z2 <- nlocfdr.x(x=x,y=y,pval.fun="wilcox.test",nulltype=1,df=3)
Run the code above in your browser using DataLab