メモ
- replace=TRUE/FALSEでのサンプリングの違い
n1 <- 500 n2 <- 500 N <- n1+n2 r <- n1/N k <- 100 t<-0:k x <- t y <- n1-x z <- k-x w <- n2-z Pt <- exp(lgamma(k+1)-lgamma(t+1)-lgamma(k-t+1)+t*log(r)+(k-t)*log(1-r)) Pf <- exp(lgamma(n1+1)+lgamma(n2+1)+lgamma(k+1)+lgamma(N-k+1)-(lgamma(x+1)+lgamma(y+1)+lgamma(z+1)+lgamma(w+1)+lgamma(N+1))) plot(Pt,Pf) matplot(cbind(Pt,Pf),type="l")