# theta=0 means independent sampling, so after seeing
# allele 1 three times the pr. remains 1/2
pr.next.allele(1,seen=matrix(c(1,1,1),nrow=1),fr=c(1/2,1/2),theta=0)
# theta>0 slighly increases the pr. of
# seeing the same allele again
pr.next.allele(1,seen=matrix(c(1,1,1),nrow=1),fr=c(1/2,1/2),theta=0.05)
# the function also works on vectors
# after seeing 1,1,1, the pr. of 1 remains 1/2
# and the same applies to the pr. of 2 after 2,2,1
pr.next.allele(c(1,2),seen=matrix(c(1,1,1,2,2,1),nrow=2,byrow=TRUE),fr=c(1/2,1/2),theta=0)
pr.next.allele(c(1,2),seen=matrix(c(1,1,1,2,2,1),nrow=2,byrow=TRUE),fr=c(1/2,1/2),theta=0.05)
Run the code above in your browser using DataLab