Introduction
n = 10
y = 8
likefun = function(theta) {theta^y * (1 - theta)^(n-y)}
curve(likefun,from = 0,to = 1, main=paste("n = ",n,"; y = ",y),xlab="theta", ylab="likelihood")
abline(v=y/n,col='gray')
What if we got 10 heads?
n = 10
y = 10
likefun = function(theta) {theta^y * (1 - theta)^(n-y)}
curve(likefun,from = 0,to = 1, main=paste("n = ",n,"; y = ",y),xlab="theta", ylab="likelihood")
abline(v=y/n,col='gray')