尤度とかそういうものについて その4

MikuHatsune2010-12-10

その3の続き。

L<- 1:500                             # 尤度比
a<- seq(from=0,to=1,by=0.01)          # 事前確率

f<- function(L,a){
  return((L*a)/(L*a+1-a))
}
theta<- 40
phi<- 35
library(rgl)
m<- expand.grid(L,a)
M<- matrix(f(m$Var1,m$Var2),nr=length(L),nc=length(a))
persp(M,col=rainbow(length(L)),
      xlab="Likelyhood ratio",
      ylab="Prior reliability",
      zlab="Positive probability",
      theta=theta,phi=phi)
plot3d(row(M),col(M),M,col=rainbow(length(L)),
       xlab="Likelyhood ratio",
       ylab="Prior reliability",
       zlab="Positive probability")

事前確率が0.5のとき

L<- 1:1000 
f1<- function(L,a=1/2){
  return((L*a)/(L*a+1-a))
}
plot(unlist(lapply(L,f1)),type="s",
     xlab="Likelyhood ratio",ylab="Positive probability",main="Prior probability=0.5")