maxBHHH {micEcon} | R Documentation |
This function is essentially maxNR
where the hessian is
approximated by the information equation.
maxBHHH(fn, grad = NULL, hess=NULL, theta, print.level = 0, iterlim = 100, ...)
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 constant parameters. |
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)) , not numericGradient(fn) .
It is summed over
observations in order to get a single gradient vector. |
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 . |
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
.
Object of class "maximisation":
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, theta=1, print.level=2) summary(a) ## Estimate with analytic gradient a <- maxBHHH(loglik, gradlik, theta=1) summary(a)