Thank you so much for all you have done. I performed the analyses using the old data according to your suggestion. It works well. Thanks!
2) simulate the two models separately and got "migration.dat" and "no migration.dat";
3) I combined the two ".data" files and then performed the rejection.exe with the command: rejection.exe jointdata.dat target.trg output 12 9 0.025
However, the R reported errors when I performed the "model_choice.r". I also tried the "model_choice.mod.r" that you have modified. It still does not work. I am sorry for bothering you again.
> #import Mark Beaumont's scripts
> source("calmod.mod.r") #commented JSL 2014-12-11
>
> #import the .rej file
> abc.rej <- data.matrix(read.table("test.rej"))
>
> #import the .trg files
> target <- data.matrix(read.table("test.trg"))
>
> #Bar plot for model-choice (rejection)
> top1<-length(which(abc.rej[,2]==1))/length(abc.rej[,2]) #modified JSL 2014-12-11
> top2<-length(which(abc.rej[,2]==2))/length(abc.rej[,2]) #modified JSL 2014-12-11
> print(c(top1,top2))
[1] 0.556 0.444
> write(c(top1,top2),"modelprob_rej.txt")
> barplot(c(top1,top2),names=c("Model1","Model2"))
> abline(h=1.0/2,col="red")
>
> #Bar plot for model-choice (regression)
> res.topol<-calmod(target,abc.rej[,2],abc.rej[,13:21],1,rej=F) #modified JSL 2014-12-11