# NOT RUN {
bf <- Butterfly(10000)
bf_SP <- bf[,c(1,2,9)]
m <- 2
scaleQ <- 5:25
thd <- quantile(bf_SP$Y,probs=c(0,0.1,0.2,0.3,
0.4,0.5,0.6,
0.7,0.8,0.9))
nbr_shuf <- 100
Sm_thd_shuf <- matrix(0,length(thd),nbr_shuf)
for (i in 1:nbr_shuf){
bf_SP_shuf <- cbind(bf_SP[,1:2],sample(bf_SP$Y,length(bf_SP$Y)))
Sm_thd_shuf[,i] <- MINDID_FMC(bf_SP_shuf, scaleQ, m, thd)
}
mean_shuf <- apply(Sm_thd_shuf,1,mean)
dev.new(width=6, height=4)
matplot(1:10,Sm_thd_shuf,type="l",lty=1,col=rgb(1,0,0,0.25),
ylim=c(-0.05,0.05),ylab=bquote(S[.(m)]),xaxt="n",
xlab="",cex.lab=1.2)
axis(1,1:10,labels = FALSE)
text(1:10,par("usr")[3]-0.01,srt=45,ad=1,
labels=c("0_100", "10_100","20_100","30_100",
"40_100","50_100","60_100",
"70_100","80_100","90_100"),xpd=T,font=2,cex=1)
mtext("Thresholds",side=1,line=3.5,cex=1.2)
lines(1:10,mean_shuf,type="b",col="blue",pch=19)
legend.text<-c("Shuffled","mean")
legend.pch=c(NA,19)
legend.lwd=c(2,2)
legend.col=c("red","blue")
legend("topleft",legend=legend.text,pch=legend.pch,lwd=legend.lwd,
col=legend.col,ncol=1,text.col="black",cex=1,box.lwd=1,bg="white")
# }
Run the code above in your browser using DataLab