-
程序源码
6cbcac370ce420fa2221a292d11acd84000……【阅读全文】
6cbcac370ce420fa2221a292d11acd84000……【阅读全文】
去除序列比对结果中的连续空位(此处以不少于2个空位为例)。
1 2 3 4 | >one ATGC---ATGCA >two A---ATG--GC- |
1 2 3 4 | >one AGCA >two AGC- |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 | plot.tri <- function(n = 1000, col ="blue", ani=FALSE, cex=1.2){ p <- runif(n); X <- rbind(rep(0, n), rep(0, n)) B <- cbind(c(0,0),c(0.25,0.433),c(0.5,0)) if(ani) plot(0,0,xlim=c(0,1),ylim=c(0,0.85),type="n",xlab="",ylab="") for(i in 2:n){ pp <- p[i]; ind <- rank(c(c(1/3,2/3,1), pp), ties.method="min")[4] X[,i] <- 0.5*X[,i-1] + B[,ind] if(ani) points(X[1,i], X[2,i],pch = ".", cex = 1, col = col) } if(!ani) plot(X[1,], X[2,],pch = ".", cex = cex, col = col, xlab="", ylab="") } plot.tri(100000, ani=TRUE) |
1 2 3 4 5 6 | n=50000; r=0.7;r_e=(1-r*r)^.5; X=rnorm(n); Y=X*r+r_e*rnorm(n); Y=ifelse(X>0,Y,-Y); plot(X,Y,col="pink") |
本福特定律,也称为本福德法则,说明一堆从实际生活得出的数据中,以1为首位数字的数的出现机率约为总数的三成,接近期望值1/9的3倍。推广来说,越大的数,以它为首几位的数出现的机率就越低。它可用于检查各种数据是否有造假。
一组平均增长的数据开始时,增长得较慢,由最初的数字a增长到另一个数字a + 1起首的数的时间,必然比a + 1起首的数增长到a + 2,需要更多时间,所以出现率就更高了。
从数数目来说,顺序从1开始数,1,2,3,…,9,从这点终结的话,所有数起首的机会似乎相同,但9之后的两位数10至19,以1起首的数又大大抛离了其他数了。而下一堆9起首的数出现之前,必然会经过一堆以2,3,4,…,8起首的数。若果这样数法有个终结点,以1起首的数的出现率一般都比9大。
Continue reading
Get every new post delivered to your Inbox
Join other followers