R/mymaxlikg.R

Defines functions mymaxlikg

#' @title mymaxlikg
#'
#'
#' @param lfun
#' @param theta
#'
#' @return
#' @export
#'
#' @examples
mymaxlikg=function(lfun="logbin2",theta) { # default log lik is a combination bin
  nth=length(theta)  # nu. of valuse used in theta
  thmat=matrix(theta,nr=nth,nc=1,byrow=TRUE) # Matrix of theta
  z=apply(thmat,1,lfun) # z holds the log lik values
  zmax=max(which(z==max(z)))  # finding the INDEX of the max lik
  plot(theta,exp(z),type="l") # plot of lik
  abline(v=theta[zmax],col="Blue")   #  verical line through max
  axis(3,theta[zmax],round(theta[zmax],4))  # one tick on the third axis
  theta[zmax]   # theta corresponding to max lik
}
MatthewG24/MATH4753gonz0029MSG documentation built on Nov. 13, 2020, 3:58 a.m.