x<-seq(0,1,by=0.01) y<-dbinom(2,20,x) plot(x,y,type="l") # 曲線を描くだけなら,上3行の代わりにcurve(dbinom(2,20,x),0,1)でOK x[which.max(y)]