createTable {BGcom} | R Documentation |
This function creates an output table with the results from the Bayesian model in a csv format.
createTable(dir,output.ratio,output.bay,name)
dir |
directory for storing the table |
output.ratio |
The output object from the Frequentist model (ratio function) |
output.bay |
The output object from the Bayesian model (baymod function) |
name |
Name of the .csv file where the output is stored |
To select a list of interesting features from the Bayesian model we suggest two decision rules in the paper: 1. the maximum of Median(R(q)) only for the subset of credibility intervals which do not include 1 2. the largest threshold q for which the ratio R(q) il bigger than 2
The first one is pointing out the strongest deviation from independence, whilst the second is the largest threshold where the number of genes called in common at least doubles the number of genes in common under independence.
An object of the class list with two recommended decision rules:
max |
the results of the Rmax statistic |
rule2 |
the results using the rule R larger than 2 (see details) |
Marta Blangiardo
1. M.Blangiardo and S.Richardson Statistical tools for synthesizing lists of differentially expressed features in related experiments (under revision)
data = simulation(n=2000,GammaA=1,GammaB=1,r1=0.5,r2=0.8,DEfirst=1000,DEsecond=800,DEcommon=700) T<- ratio(n=length(data$Pval1),data1=data$Pval1,data2=data$Pval2,interval=0.01,dir="D:/",name="CompData1Data2",pvalue=TRUE) BayesianModel<- baymod(n=length(data$Pval1),data1=data$Pval1,data2=data$Pval2,repl=1000,output.ratio=T,dir="D:/") output.table <- createTable(dir="D:/",output.ratio=T,output.bay=BayesianModel,name="OutputTable") ## The function is currently defined as function(dir,output.ratio,output.bay,name){ temp = length(output.ratio$int)-sum(output.ratio$int>0)+1 matrix.results = cbind(output.ratio$thresh.ratios,round(output.bay,3),output.ratio$int[temp:(length(output.ratio$int))],output.ratio$L1[temp:(length(output.ratio$int))],output.ratio$L2[temp:(length(output.ratio$int))]) names.matrix = c("q","LowCI","MedCI","HighCI","O11","O1+","O+1") dimnames(matrix.results)[[2]]<-names.matrix #Decision rules: #1) Maximum for CI not including 1 max.R = max(matrix.results[round(round(matrix.results[,2],2),1)>1,3]) maximum = matrix.results[matrix.results[,3]==max.R,] #2) Rule 2 R2 = max(matrix.results[round(round(matrix.results[,3],2),3)>=2 & round(round(matrix.results[,2],2),1)>1 ,1]) rule2 = matrix.results[matrix.results[,1]==R2,] setwd(dir) write.csv(matrix.results,paste(name,".csv"),row.names=FALSE) return(list(maximum=maximum,rule2=rule2)) }