ghyp {QRMlib} | R Documentation |
Density and random number generation for univariate generalized hyperbolic distribution in new QRM (Chi-Psi-Gamma) parameterization. (The dispersion matrix Sigma is identically 1, i.e. a scalar 1.) See pp. 77-81 in QRM.
dghyp(x, lambda, chi, psi, mu=0, gamma=0, logvalue=FALSE) rghyp(n, lambda, chi, psi, mu=0, gamma=0)
x |
vector of values at which to evaluate density |
n |
sample size |
lambda |
scalar mixing parameter |
chi |
scalar mixing parameter |
psi |
scalar mixing parameter |
mu |
location parameter |
gamma |
skewness parameter |
logvalue |
should log density be returned; default is FALSE |
See page 78 in QRM for joint density formula (3.30) with Sigma (dispersion matrix) the identity and d=1 (meaning a univariate distribution) applies.
The univariate QRM parameterization is defined in terms of parameters chi-psi-gamma instead of the alpha-beta-delta model used by Blaesild (1981) in earlier literature. If gamma is 0, we have a normal variance mixture where the mixing variable W has a GIG generalized inverse gaussian) distribution with parameters lambda, chi, psi. This thickens the tail.
If gamma exceeds zero, we have a normal mean-variance mixture where the mean is also perturbed to equal mu + (W * gamma) which introduces ASYMMETRY as well.
Values for lambda and mu are identical in both QRM and B parameterizations. Sigma does not appear in the parameter list since in the univariate case its value is identically 1.
values of density or log-density (dghyp) or random sample (rghyp)
Density values from dgyhp() should be identical to those from dghypB() if the alpha-beta-delta parameters of the B type are translated to the corresponding gamma-chi-psi parameters of the QRM type by formulas on pp 79-80.
documentation by Scott Ulman for R-language distribution
data(DJ); #Make returns from timeSeries (the default is log-returns). #Ret.DJ is a timeSeries class. Ret.DJ <- mk.returns(DJ); DJ30dailyTS <- window(Ret.DJ, from="1993-01-01", to="2000-12-31"); DJ30daily <- 100*seriesData(DJ30dailyTS); #Extract only the Microsoft returns as 'rseries'; remember this is a vector--not a timeSeries rseries <- DJ30daily[,"MSFT"]; #The default case for fit.NH(() is NIG requiring lambda = -1/2. mod.NIG <- fit.NH(rseries); xvals <- seq(from=min(rseries),to=max(rseries),length=100); yvals.NIG <- dghyp(xvals,lambda=-1/2,chi=mod.NIG$par.ests[1], psi=mod.NIG$par.ests[2],mu=mod.NIG$par.ests[3],gamma=mod.NIG$par.ests[4]);