Learn R Programming

GeneralizedHyperbolic (version 0.8-6)

hyperbHessian: Calculate Two-Sided Hessian for the Hyperbolic Distribution

Description

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

Usage

hyperbHessian(x, param, hessianMethod = "exact",
              whichParam = 1:5)
sumX(x, mu, delta, r, k)

Value

hyperbHessian gives the approximate or exact Hessian matrix for the data vector x and the estimated parameter vector

param. sumX is a sum term used in calculating the exact Hessian. It is called by hyperbHessian when the argument

hessianMethod = "exact". It is not expected to be called directly by users.

Arguments

x

Data vector.

param

The maximum likelihood estimates parameter vector of 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

Two methods are available to calculate the Hessian exactly ( "exact") or approximately ("tsHessian").

whichParam

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

mu

Value of the parameter \(\mu\) of the hyperbolic distribution.

delta

Value of the parameter \(\delta\) of the hyperbolic distribution.

r

Parameter used in calculating a cumulative sum of the data vector x.

k

Parameter used in calculating a cumulative sum of the data vector x.

Author

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

Details

The formulae for the exact Hessian are derived by Maple software with some simplifications. For now, the exact Hessian can only be obtained based on the first, second or the last parameterization sets. The approximate Hessian is obtained via a call to tsHessian from the package DistributionUtils. summary.hyperbFit calls the function hyperbHessian to calculate the Hessian matrix when the argument hessian = TRUE.

Examples

Run this code
### Calculate the exact Hessian using hyperbHessian:
param <- c(2, 2, 2, 1)
dataVector <- rhyperb(500, param = param)
fit <- hyperbFit(dataVector, method = "BFGS")
coef <- coef(fit)
hyperbHessian(x = dataVector, param = coef, hessianMethod = "exact",
              whichParam = 2)
              
### Or calculate the exact Hessian using summary.hyperbFit method:
summary(fit, hessian = TRUE)


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

Run the code above in your browser using DataLab