###################################################################
################################################################### looking
################################################################### at
################################################################### integer
################################################################### valued
################################################################### maximum
################################################################### likelihood
################################################################### #########
par(mfrow = c(2, 2))
############################################################# Brian
############################################################# Dennis' plot
############################################################# of the
############################################################# likelihood#######
############################################################# (Uses
############################################################# parameter
############################################################# t)#######
m = 49
n = 20
x = 12
t = seq(m, 200, 1) #alternative t = m:200
like = exp(lfactorial(n) - lfactorial(x) - lfactorial(n - x) + x * log(m/t) +
(n - x) * log(1 - m/t))
plot(t, like, type = "l", xlab = "t", ylab = "likelihood", main = "Brian's original \nlikelihood")
that = n * m/x
abline(v = that, lty = 3, lwd = 3)
######### show the integer valued MLE is between 2 points...
plot(t, like, type = "l", xlab = "t", ylab = "likelihood", main = "Enhance",
xlim = c(that - 10, that + 10))
abline(v = c(floor(that), that, ceiling(that)), lty = c(2, 1, 2))
text(82, 0.1, paste("The MLE is", that))
text(82, 0.075, paste("The ceiling(MLE) is", ceiling(that)))
text(82, 0.05, paste("The floor(MLE) is", floor(that)))
########## show the likelihoods...
tnew = 81
like81 = exp(lfactorial(n) - lfactorial(x) - lfactorial(n - x) + x * log(m/tnew) +
(n - x) * log(1 - m/tnew))
tnew = 82
like82 = exp(lfactorial(n) - lfactorial(x) - lfactorial(n - x) + x * log(m/tnew) +
(n - x) * log(1 - m/tnew))
tnew = 81 + 2/3
likeMLE = exp(lfactorial(n) - lfactorial(x) - lfactorial(n - x) + x * log(m/tnew) +
(n - x) * log(1 - m/tnew))
plot(t, like, type = "l", xlab = "t", ylab = "likelihood", main = "Enhance",
xlim = c(that - 10, that + 10))
abline(v = c(floor(that), that, ceiling(that)), lty = c(2, 1, 2))
text(82, 0.1, paste("L(81)=", like81))
text(82, 0.075, paste("The L(82)=", like82))
text(82, 0.05, paste("The MLE=", likeMLE))