maxBHHH {maxLik} | R Documentation |
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.
maxBHHH(fn, grad = NULL, hess=NULL, start, print.level = 0, iterlim = 100, ...)
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 value). If the parameters are out of range, fn should
return NA . |
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
observations and the columns to the individual parameters. This matrix is summed over
observations in order to get a single gradient vector. It's matrix
product is used for approximating the Hessian. |
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 . |
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
.
Object of class "maxim":
type |
Character string: "BHHH maximisation" |
Plus the other components inherited from maxNR
.
As maxBHHH
uses likelihood-specific
information equation, it is only suitable for maximising log-likelihood!
Ott Toomet otoomet@ut.ee
## 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)