ベータ分布を円周に描く
# (0,pi/2)の角座標 theta <- seq(from=0,to=pi/2,length=100) theta <- theta[-c(1,length(theta))] # それに対応する y1=cos(theta), p1 = y1^2なる「成功確率変数」 p <- cos(theta)^2 # 円周上での一様分布 x.theta <- rep(1,length(theta)) # それに対応するp =(0,1)での「一様分布」 x.p <- x.theta/sqrt(p*(1-p)) plot(x.p) # 成否観測(A,B) A <- 2 B <- 2 # Jeffreys priorの下での、成功率の事後分布 y <- dbeta(p,0.5+A,0.5+B) # 円周上の事後分布値に変換 plot(y. <- y*sqrt(p*(1-p))) # 円周上での分布 # 単位円の外側の「高さ」を事後分布値とする xy <- cbind((y.+1)*cos(theta),(y.+1)*sin(theta)) # 単位円を描くための準備 phi <- seq(from=0,to=2*pi,length=1000) XY <- cbind(cos(phi),sin(phi)) xyXY <- rbind(xy,XY) xlim <- ylim <- range(xyXY) plot(xy,xlim=xlim,ylim=ylim) points(XY,type="l") dev.new() plot(y)