The name of this R package “dhh” can be understood as “Distributions with Heavy Heads”. The probability density function of the heavy-headed distribution is $$f(x) = \frac{\alpha (b-a)^{-\alpha}}{(x-a)^{1-\alpha}}I\{a<x<b\},$$ with parameters a < b and α > 0. For the motivation and derivation of this distribution, please see the references.
This package contains four functions on a heavy-headed distribution:
dhh
: the probability density functionphh
: the cumulative distribution function (CDF)qhh
: the quantile functionrhh
: the random variablesNext, I will introduce these functions with examples.
To use this library, we can first install it and then use the following command.
dhh
This function dhh(x, a, b, alpha)
gives the values of
the density of the heavy-headed distribution.
The default values of a
, b
and
alpha
are 0
, 1
and
0.1
, respectively. Then, the following two commands give
the same result, the value of the density at 0.5
.
The argument x
can be a vector.
We can take a look at the plots of some density functions.
phh
This function phh(x, a, b, alpha)
gives the values of
the CDF of the heavy-headed distribution.
The default values of a
, b
and
alpha
are 0
, 1
and
0.1
, respectively. Then, the following two commands give
the same result, the value of the density at 0.5
.
The argument x
can be a vector.
We can take a look at the plots of some CDF’s.
qhh
This function qhh(p, a, b, alpha)
gives the quantiles of
the heavy-headed distribution.
The default values of a
, b
and
alpha
are 0
, 1
and
0.1
, respectively. Then, the following two commands give
the same result, the value of the density at 0.5
.
The argument p
can be a vector.
We can take a look at the plots of some quantile functions.
rhh
This function rhh(n, a, b, alpha1)
generate n i.i.d. random variables following
the heavy-headed distribution.
The default values of a
, b
and
alpha
are 0
, 1
and
0.1
, respectively. Then, the following two commands are the
same.
rhh(5)
#> [1] 2.525729e-03 2.477041e-01 7.144244e-01 4.132912e-12 5.378194e-14
rhh(5, a = 0, b = 1, alpha = 0.1)
#> [1] 3.095572e-06 1.917127e-01 3.260570e-02 5.347089e-05 2.687832e-10
We can generate 10000 i.i.d. random variables and plot the histogram. Then we can add the density plot.
We can also check the fact that the density goes to infinity as
a
goes to a
.
Runlong Tang (2018) A Note On Finite Moments, Rediscovery Of The Pareto Distribution and Distributions With Heavy Tails and Heads (v1) https://sites.google.com/site/tangrunlong/notes-on-finance