Generalized hyperbolic distribution in R
How to use the package "generalized hyperbolic distribution" in order to fit the paramters in the NIG d开发者_Go百科istribution to a data set?
Developing @Prasad Chalasani's comment, you need to install the ghyp
package. When I did, the packages gtools
, gdata
, numDeriv
and gplots
were also installed automatically. However, I then got the same error as you Error: could not find function "fit.NIGuv"
, which I resolved by installing the bitops
package manually.
The documentation gives an example of the following code using fit.NIGuv()
library(ghyp)
data(smi.stocks)
nig.fit <- fit.NIGuv(smi.stocks[,"SMI"], opt.pars = c(alpha.bar = FALSE),
alpha.bar = 1, control = list(abs.tol = 1e-8))
nig.fit
summary(nig.fit)
hist(nig.fit)
where the output includes
Asymmetric Normal Inverse Gaussian Distribution:
Parameters:
alpha.bar mu sigma gamma
1.0000000000 0.0008370731 0.0112098776 -0.0007205143
log-likelihood:
5495.705
and I think this is the kind of thing you are looking for.
精彩评论