0

I try to understand how the standardized generahl hyperbolic distribution is implemented in R. The command of the fBasics package is dsgh:

function (x, zeta = 1, rho = 0, lambda = 1, log = FALSE) 
{
    if (length(zeta) == 3) {
        lambda = zeta[3]
        rho = zeta[2]
        zeta = zeta[1]
    }
    param = .paramGH(zeta, rho, lambda)
    ans = dgh(x, param[1], param[2], param[3], param[4], lambda, 
        log)
    ans
}

The main point is the ans= dgh(x,....) this means, it uses the density of the general hyperbolic distribution with the given parameters. But the result is not the standardized version, but just the normal version, since it only transforms the specified parameters when the function is called to get another parameterized form but this is not the standardized version?

So you call the function with e.g.

> dsgh(mydata,zeta=2,rho=0.2,lambda=2,log=FALSE)

it transforms the zeta rho and lambda values into the parametrization, which is needed for the dgh function, but it does not standardize it?

And if you do

 > dsgh(mydata,zeta=1,rho=0,lambda=1,log=FALSE)

this is not correct, since you only get one special case of the standardized version, but there are different possible parameter combinations in the transformed parametrization, which lead to a mean zero and variance equal to one (standardization)?

Stat Tistician
  • 2,321
  • 5
  • 34
  • 57
  • By typing dgh at the R command line you can see its full source code (which is only a half dozen lines after the argument checking is over), which ought to answer all your questions about it. – whuber May 01 '13 at 18:32
  • @whuber I know I can get this code, since I got the code via this way for the dsgh command?! – Stat Tistician May 01 '13 at 18:32
  • @whuber as I said: If you type in dgh at look what it does, you can see, that it gives you the density for the generalized hyperbolic distribution, but NOT FOR THE STANDARDIZED, that's exactlay, what I said in my post! – Stat Tistician May 01 '13 at 18:34
  • I beg to differ, because I can't make sense of what you have said in your post. I can't tell from what you've written what the problem is, what you're expecting the code to do, or what it does. Since the details of the code are in full view to you (including the internal functions like .paramGH and .kappaGH), why don't you read them and resolve for yourself whatever issue you are concerned with? – whuber May 01 '13 at 18:36
  • @whuber I just want to have the standardized version of the generalized hyperbolic distribution. And dgh is not giving it! And dsgh also does not do it, or at leas I cannot see, how, since they just transform the input variables to another parametrization and then use the dgh function? This gives again a generalized hyperbolic distribution, but not a standardized one? – Stat Tistician May 01 '13 at 18:39
  • I think I begin to understand, because I have re-read your previous two questions about this distribution. It might not be necessary to do much of anything, but it all depends on what you mean by "have" a "standardized version." What computations do you want to do with it? Density, CDF, inverseCDF, generate random variates? In all of those cases, a simple affine transformation of the variable at the right time does the trick: you only need to know the mean and variance, whose formulas you have already posted. But what's the matter with dsgh? It works! – whuber May 01 '13 at 18:44
  • I intended to close this question as too localized, because it appears there is no problem here at all, unless you can provide evidence that dsgh et al. are not performing as claimed in their documentation. But I see this is really a duplicate of a previous question. – whuber May 01 '13 at 18:47
  • @whuber I am not getting, how R does the standardization? I wanted to it like this: http://stats.stackexchange.com/questions/57804/different-possible-parameter-combinations-to-obtain-a-standardized-generalized-h but it is not working, resp. there are more than just one solution? – Stat Tistician May 01 '13 at 19:29

0 Answers0