Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

NH

Normal Inverse Gaussian and Hyperbolic Distribution


Description

Functions for fitting uni- and multivariate NIG and HYP distribution.

Usage

fit.NH(data, case = c("NIG", "HYP"), symmetric = FALSE,
       se = FALSE, ...)
fit.mNH(data, symmetric = FALSE, case = c("NIG", "HYP"),
        kvalue = NA, nit = 2000, tol = 1e-10, ...)
MCECMupdate(data, mix.pars, mu, Sigma, gamma, optpars, optfunc,
xieval=FALSE, ...)
MCECM.Qfunc(lambda, chi, psi, delta, eta, xi)
EMupdate(data, mix.pars, mu, Sigma, gamma, symmetric, 
         scaling = TRUE, kvalue = 1)

Arguments

case

character, whether NIG or HYP shall be used.

chi

numeric, chi parameter.

data

numeric, data.

delta

numeric, delta parameter.

eta

numeric, eta parameter.

kvalue

numeric, value to which the determinant of the dispersion matrix is constrained.

lambda

numeric, lambda parameter.

mix.pars

vector, values of lambda, chi and psi.

mu

numeric, value of location parameters.

nit

integer, maximum number of iterations.

optpars

vector, parameters to optimize over.

optfunc

function, the function to be optimized.

psi

numeric, pi parameter.

scaling

logical, whether determinant scaling of Sigma shall be fixed.

se

logical, whether standard errors should be calculated.

Sigma

matrix, value of Sigma.

symmetric

logical, whether symmetric case should be fitted.

tol

numeric, tolerance for convergence.

gamma

numeric, value of gamma

xi

numeric, xi parameter.

xieval

logical, whether log moment xi shall be evaluated.

...

ellipsis, arguments are passed down to optim().

Details

fit.NH(): See pages 78–80 of QRM. Case ‘NIG’ sets lambda = -1/2; case ‘HYP’ sets lambda = 1.
fit.mNH(): Fitting is accomplished by using a variant of the EM algorithm (see pages 81–83 in QRM).
MCECMupdate(): updates estimates of mixing parameters in EM estimation of generalized hyperbolic (see Algorithm 3.14, steps (5) and (6) on page 83 in QRM).
MCECM.Qfunc(): a functional form that must be optimized when fitting members of generalized hyperbolic family with an MCECM algorithm (see function Q2 on page 82 of QRM).
EMupdate(): updates estimates of location (mu), dispersion (Sigma) and skewness (gamma) parameters in EM estimation of multivariate generalized hyperbolic distributions (see pages 81–83 in QRM; in that case k is the determinant of the sample covariance matrix. “EM” is an acronym for for “Expectation-Maximization” type of algorithm used to fit proposed multivariate hyperbolic models to actual data).

Examples

library(QRM)
data(DJ)
r <- returns(DJ) 
s <- window(r[, "MSFT"], "1993-01-01", "2000-12-31")
mod.NIG <- fit.NH(100 * s, method = "BFGS")
## multivariate
stocks <- c("AXP","EK","BA","C","KO","MSFT",
            "HWP","INTC","JPM","DIS")
ss <- window(r[, stocks], "1993-01-01", "2000-12-31")
fridays <- time(ss)[isWeekday(time(ss), wday = 5)]
ssw <- aggregate(ss, by = fridays, FUN = sum)
mod.mNIG <- fit.mNH(ssw, symmetric = FALSE, case = "NIG")

QRM

Provides R-Language Code to Examine Quantitative Risk Management Concepts

v0.4-31
GPL (>= 2)
Authors
Bernhard Pfaff [aut, cre], Marius Hofert [ctb], Alexander McNeil [aut] (S-Plus original (QRMlib)), Scott Ulmann [trl] (First R port as package QRMlib)
Initial release
2020-02-15

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.