# Example data of observed and predicted log2-ratios
vecObs <- c(rep(0,40),rep(0.6,15),rep(0,10),rep(-0.4,20),rep(0,15))+rnorm(100,sd=0.2)
vecPred <- c(rep(median(vecObs[1:40]),40),rep(median(vecObs[41:55]),15),
rep(median(vecObs[56:65]),10),rep(median(vecObs[66:85]),20),rep(median(vecObs[86:100]),15))
# Plot observed values (black) and predicted values (red)
plot(vecObs,pch=20)
points(vecPred,col="red",pch=20)
# Run merge function
merge.obj <- mergeLevels(vecObs,vecPred)
# Add merged values to plot
points(merge.obj$vecMerged,col="blue",pch=20)
# Examine optimum threshold
merge.obj$sq
Run the code above in your browser using DataLab