I am using data which I suspect is distributed according to the Normal Inverse Gaussian distribution (NIG). The literature says that the 4 parameters of the NIG distribution can be estimated from the sample mean, variance, kurtosis, and skewness. I would like to test the fit of NIG with the calculated parameters and the data. Now, my function is written as:

NIG2[x_, {α_, β_, μ_, δ_}] := 
  (α/(δ π)) Exp[Sqrt[α^2 - β^2] - (β μ)/δ] (K1[α*Sqrt[1 + ((x - μ)/δ)^2]]
    Sqrt[1 + ((x - μ)/δ)^2]) Exp[β/δ x];

Edit: The K1 function is the Bessel function of the third kind which is:

K1[w_] = Integrate[ Exp[ -w (t + t^(-1)) / 2 ] , {t, 0, Infinity}]
         (*  = ConditionalExpression[2 BesselK[1, w], Re[w] > 0]  *) 

The four parameters are

{α, β, μ, δ}

and their values are (respectively):

{0.635655,  - 0.00143495 I, 6.87671, 1.56309}

I saw Mr Alpha's answer to a similar query where data followed an AR(4) process. I tried using the residualAnalysis module presented, but Mathematica claims that NIG2 is not a valid process. Yet the 4 plots do appear to be quite correct as the residuals seem distributed normally.

How should I test data against a NIG distribution function?

  • 1
    $\begingroup$ whats K1? (15) $\endgroup$
    – george2079
    Dec 23, 2015 at 15:44
  • $\begingroup$ Sorry, forgot to say that K1 is the Bessel Function of the third kind: K1[w_] = 1/2 \!( *SubsuperscriptBox[([Integral]), (0), ([Infinity])](Exp[(- *FractionBox[(w ((t + t^(((-1)))))), (2)])] [DifferentialD]t)); $\endgroup$
    – Xavier_B
    Dec 23, 2015 at 18:39
  • $\begingroup$ Can you edit the question to add the definition of K1 (at a glance I don't see a "third kind" Bessel function directly available..) $\endgroup$
    – george2079
    Dec 23, 2015 at 18:59
  • $\begingroup$ I did't understand your question. What do you want to do with this function? Just use it to fit your data with calculation of the optimal alfa, beta etc? $\endgroup$
    – Rom38
    Dec 24, 2015 at 6:27
  • 1
    $\begingroup$ I think they're all probably closely related: DistributionFitTest, EstimatedDistribution, FindDistributionParameters; maybe FindDistribution. I can't think of anything else. Maybe someone with a better statistics will come along. Things can get a little slow on SE this time of the year. $\endgroup$
    – Michael E2
    Dec 25, 2015 at 20:28

1 Answer 1


Mathematica's HyperbolicDistribution[λ,α,β,δ,μ] is the generalized hyperbolic distribution.

When λ = -1/2, it is the NIG distribution. So it can be used directly with FindDistributionParameters or EstimatedDistribution to fit a NIG to data, and then check the fit by DistributionFitTest.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.