Calculates the Hessian of a function, either exactly or approximately. Used to obtain the information matrix for maximum likelihood estimation.
hyperbHessian(x, param, hessianMethod = "exact",
whichParam = 1:5)
sumX(x, mu, delta, r, k)
Data vector.
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)
.
Two methods are available to calculate the
Hessian exactly ( "exact"
) or approximately
("tsHessian")
.
Numeric. A number between 1 to 5 indicating which
set of the parameterization is the specified value in argument
param
belong to.
Value of the parameter
Value of the parameter
Parameter used in calculating a cumulative sum of the data vector x.
Parameter used in calculating a cumulative sum of the data vector x.
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.
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
.
# NOT RUN {
### 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