Learn R Programming

maxLik (version 0.5-6)

maxBHHH: BHHH Maximization

Description

This function is essentially maxNR where the hessian is approximated by the outer product of the gradient vector. It is suitable for likelihood maximisation only.

Usage

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

Arguments

fn
log-likelihood function to be maximised, must have the parameter vector as the first argument and must return vector of observation-specific likelihood values if numeric gradient is requested (those are summed for the single likelihood
grad
gradient of the log-likelihood function. Must have the parameter vector as the first argument. If NULL, numeric gradient is used. It must return a matrix, where rows corresponds to the gradient vectors of individual observa
hess
Hessian of the function. Not used by maxBHHH, for compatibility with the other maximisation routines.
start
initial values for the parameters.
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 "maxim":
  • 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. Hence we have to calculate log-likelihood and gradient by individual observations. Hessian is approximated as sum of outer products of the gradients of individual observations, or, in the matrix form, -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, start=1, print.level=2)
summary(a)
## Estimate with analytic gradient
a <- maxBHHH(loglik, gradlik, start=1)
summary(a)

Run the code above in your browser using DataLab