Skip to content

GB2 distribution with strange quantiles for extreme parameter values #3

@rm-1997

Description

@rm-1997

I fitted a GB2 distribution to my income data and then got puzzled when examining the parameter estimates. I observed that for parameters similar to c(809.6687, 116.4727, 0.0342, 0.0278), the quantile values returned by qGB2 are somewhat strange. For instance, the 10% Percentile is still 0 which does not make sense to me, in particular when having a look at the associated density function. Also, using the random number generator rGB2 many 0 values are drawn from the distribution.

I compared the results to the ones by the GB2 R package. Here, the quantile values look more reasonable to me for the very same set of GB2 parameters. For standard GB2 parameters, the two packages return identical results but not for some extreme parameter values. Why is that and might this be a potential bug in the gamlss.dist package?

Here, my example code:

##### GB2 Distribution #####

rm(list = ls())

set.seed(79)

library(GB2)
library(gamlss.dist)

params = c(809.6687, 116.4727, 0.0342, 0.0278)
# params = c(1, 1, 1, 0.5)
mu = params[1]
sigma = params[2]
nu = params[3]
tau = params[4]

GB2::qgb2(c(0.1, 0.5, 0.9), shape1 = sigma, scale = mu, shape2 = nu, shape3 = tau)
gamlss.dist::qGB2(c(0.1, 0.5, 0.9), mu = mu, sigma = sigma, nu = nu, tau = tau)

GB2::pgb2(c(10, 100, 1000, 10000), shape1 = sigma, scale = mu, shape2 = nu, shape3 = tau)
gamlss.dist::pGB2(c(10, 100, 1000, 10000), mu = mu, sigma = sigma, nu = nu, tau = tau)

GB2::dgb2(c(10, 100, 1000, 10000), shape1 = sigma, scale = mu, shape2 = nu, shape3 = tau)
gamlss.dist::dGB2(c(10, 100, 1000, 10000), mu = mu, sigma = sigma, nu = nu, tau = tau)


r1 = GB2::rgb2(100000, shape1 = sigma, scale = mu, shape2 = nu, shape3 = tau)
summary(r1)
sum(r1 == 0)
r2 = gamlss.dist::rGB2(100000, mu = mu, sigma = sigma, nu = nu, tau = tau)
summary(r2)
sum(r2 == 0)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions