#' MaxLikelihood 2 param
#'
#' @param theta1
#' @param theta2
#' @param lfun
#' @param ...
#'
#' @return
#' @export
#'
#' @examples
maxlikg2=function(theta1,theta2,lfun="logbinpois",...){
n1=length(theta1)
n2=length(theta2)
z=outer(theta1,theta2,lfun)
contour(theta1,theta2,exp(z),...) # exp(z) gives the lik
maxl=max(exp(z)) # max lik
coord=which(exp(z)==maxl,arr.ind=TRUE) # find the co-ords of the max
th1est=theta1[coord[1]] # mxlik estimate of theta1
th2est=theta2[coord[2]]
abline(v=th1est,h=th2est)
axis(3,th1est,round(th1est,2))
axis(4,th2est,round(th2est,2),las=1)
list(th1est=th1est,th2est=th2est)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.