nigHessian: Calculate Two-Sided Hessian for the Normal Inverse Gaussian...

View source: R/nigHessian.R

nigHessianR Documentation

Calculate Two-Sided Hessian for the Normal Inverse Gaussian Distribution

Description

Calculates the Hessian of a function, either exactly or approximately. Used to obtaining the information matrix for maximum likelihood estimation.

Usage

nigHessian(x, param, hessianMethod = "tsHessian",
              whichParam = 1:5, ...)

Arguments

x

Data vector.

param

The maximum likelihood estimates parameter vector of the normal inverse Gaussian distribution. The normal inverse Gaussian distribution has the same sets of parameterizations as the hyperbolic distribution.There are five different sets of parameterazations can be used in this function, the first four sets are listed in hyperbChangePars and the last set is the log scale of the first set of the parameterization, i.e., mu,log(delta),Pi,log(zeta).

hessianMethod

Only the approximate method ("tsHessian") has actually been implemented so far.

whichParam

Numeric. A number between 1 to 5 indicating which set of the parameterization is the specified value in argument param belong to.

...

Values of other parameters of the function fun if required.

Details

The approximate Hessian is obtained via a call to tsHessian from the package DistributionUtils. summary.nigFit calls the function nigHessian to calculate the Hessian matrix when the argument hessian = TRUE.

Value

nigHessian gives the approximate or exact Hessian matrix for the data vector x and the estimated parameter vector param.

Author(s)

David Scott d.scott@auckland.ac.nz, Christine Yang Dong c.dong@auckland.ac.nz

Examples

### Calculate the exact Hessian using nigHessian:
param <- c(2, 2, 2, 1)
dataVector <- rnig(500, param = param)
fit <- nigFit(dataVector, method = "BFGS")
coef=coef(fit)
nigHessian(x=dataVector, param=coef, hessianMethod = "tsHessian",
           whichParam = 2)
              
### Or calculate the exact Hessian using summary.nigFit method:
### summary(fit, hessian = TRUE)

## Calculate the approximate Hessian:
summary(fit, hessian = TRUE, hessianMethod = "tsHessian")

GeneralizedHyperbolic documentation built on Nov. 26, 2023, 5:07 p.m.