nHess {dbd}R Documentation

Numerical hessian calculation.

Description

Calculate an approximation to the hessian of the negative log likelihood of a db or beta binomial distribution via a numerical (finite differencing based) procedure as effected by optimHess().

Usage

nHess(object, x, silent=TRUE)

Arguments

object

An object of class "mleDb" or "mleBb" as returned by the function mleDb() or mleBb().

x

Numeric vector of non-negative integer data, presumably the data set on the basis of which object was calculated. Ignored if object is of class "mleDb".

silent

Logical scalar. If the call to optimHess() throws an error, should the error message be suppressed? (A possibly less informative warning will be issued in any case.)

Details

It is up to the user to make sure that (when object is of class "mleBb") object and x are “mutually compatible”, i.e. are appropriately paired up.

Note that this function calculates the hessian of the negative log likelihood of the distribution in question, as minimised by optim(). Hence its inverse is an estimate of the covariance matrix of the parameter estimates. (Do not take the negative of this hessian before inverting it to get the desired covariance matrix!)

This function is mainly present to investigate possible differences between the numerical approximation to the hessian, which is what optim() uses in its maximisation procedure, and the analytic form of the hessian.

Value

A two-by-two positive definite (with any luck!) numeric matrix. Its inverse is an estimate of the covariance matrix of the parameter estimates.

Author(s)

Rolf Turner r.turner@auckland.ac.nz

See Also

aHess() mleDb() mleBb() optim() optimHess()

Examples

X <- hmm.discnp::SydColDisc
X$y <- as.numeric(X$y)
X <- split(X,f=with(X,interaction(locn,depth)))
x <- X[[19]]$y
fit <- mleDb(x, ntop=5)
H   <- nHess(fit,x)
print(solve(H)) # Compare with ...
print(vcov(fit))

[Package dbd version 0.0-22 Index]