Learn R Programming

micEcon (version 0.2-4)

maxBHHH: BHHH maximisation

Description

This function is essentially maxNR where the hessian is approximated by the information equation.

Usage

maxBHHH(fn, grad = NULL, hess=NULL, theta, print.level = 0, iterlim = 100,
   ...)

Arguments

fn
function to be maximised, must return vector of observation-specific likelihood values. Those are summed for a single likelihood value. If the parameters are out of range, fn should return NA. See details for const
grad
gradient of the function. If NULL, numeric gradient is used. It must return a matrix, where rows corresponds to the gradient vectors of individual observations. Note that this corresponds to t(numericGradient(fn))
hess
Hessian of the function. Not used, for argument compatibility reasons.
theta
initial values for the parameters to be optimized over.
print.level
a larger number prints more working information.
iterlim
maximum number of iterations.
...
further arguments for maxNR, fn and grad.

Value

  • Object of class "maximisation":
  • typeCharacter string: "BHHH maximisation"
  • Plus the other components inherited from maxNR.

Warning

As maxBHHH uses likelihood-specific information equation, it is only suitable for maximising log-likelihood!

Details

maxBHHH uses information equality in order to approximate the hessian of the log-likelihood function. This must be average (summed) over individual observations. Hence we need log-likelihood and gradient by observations, hessian is calculated as -t(gradient) %*% gradient.

See Also

maxNR, maxBFGS, optim, nlm.

Examples

Run this code
## ML estimation of exponential duration model:
t <- rexp(100, 2)
loglik <- function(theta) log(theta) - theta*t
gradlik <- function(theta) 1/theta - t
## Estimate with numeric gradient and hessian
a <- maxBHHH(loglik, theta=1, print.level=2)
summary(a)
## Estimate with analytic gradient
a <- maxBHHH(loglik, gradlik, theta=1)
summary(a)

Run the code above in your browser using DataLab