optim where the arguments are
compatible with maxNRmaxBFGS(fn, grad = NULL, hess=NULL, start, print.level = 0, iterlim = 200,
tol = 1e-08, reltol=tol, ... )
maxSANN(fn, grad = NULL, hess = NULL, start, print.level = 0, iterlim =
10000, tol = 1e-08, reltol=tol, temp = 10, tmax = 10, parscale = rep(1, length = length(start)), ...)
maxNM(fn, grad = NULL, hess = NULL, start, print.level = 0, iterlim =
500, tol = 1e-08, reltol=tol, parscale = rep(1, length = length(start)), alpha = 1, beta = 0.5, gamma = 2, ...)fn must return vector of
observation-specific likelihood values. Those are summed by maxNR
ifNULL, numeric
gradient is used (only maxBFGS uses gradient). Gradient may return
a matrix, where columns correspond to the parameters and rows tmaxNR.optim)optimfn and grad.fn at maximum.estimate.optim).fn and gr, respectively.
This excludes those calls needed to
compute the Hessian, if requested, and any calls to fn to compute a
finite-difference approximation to the gradient.optim, nlm, maxNR, maxBHHH.# Maximum Likelihood estimation of the parameter of Poissonian distribution
n <- rpois(100, 3)
loglik <- function(l) n*log(l) - l - lfactorial(n)
# we use numeric gradient
summary(maxBFGS(loglik, start=1))
# you would probably prefer mean(n) instead of that ;-)
# Note also that maxLik is better suited for Maximum LikelihoodRun the code above in your browser using DataLab