| maxBFGS {micEcon} | R Documentation |
This function is a wrapper for optim where the arguments are
compatible with maxNR
maxBFGS(fn, grad = NULL, theta, print.level = 0, iterlim = 200, tol = 1e-06, ... )
fn |
function to be maximised. In order to use numeric gradient
and BHHH method, fn must return vector of
observation-specific likelihood values. Those are summed by maxNR
if necessary. If the parameters are out of range, fn should
return NA. See details for constant parameters. |
grad |
gradient of the function. If NULL, numeric
gradient is used. For BHHH method it must return a matrix, where
rows corresponds to the gradients of the observations. Note that
this corresponds to
t(numericGradient(fn)), not numericGradient(fn).
It is summed over
observations in order to get a single gradient vector. |
theta |
initial values for the parameters to be optimized over. |
print.level |
a larger number prints more working information. |
iterlim |
maximum number of iterations. |
tol |
the absolute convergence tolerance (see optim). |
... |
further arguments for fn and grad. |
Object of class "maximisation":
maximum |
value of fn at maximum. |
estimate |
best set of parameters found. |
gradient |
gradient at parameter value estimate. |
hessian |
value of Hessian at optimum. |
code |
integer. Success code, 0 is success (see
optim). |
message |
character string giving any additional information returned by the optimizer, or NULL. |
iterations |
two-element integer vector giving the number of
calls to 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. |
type |
character string "BFGS maximisation". |
Ott Toomet otoomet@ut.ee
# Maximum Likelihood estimation of Poissonian distribution n <- rpois(100, 3) loglik <- function(l) n*log(l) - l - lfactorial(n) # we use numeric gradient summary(maxBFGS(loglik, theta=1)) # you would probably prefer mean(n) instead of that ;-) # Note also that maxLik is better suited for Maximum Likelihood