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] 9.349545e-01 2.224308e-06 1.607231e-10 1.094512e-05 1.239409e-04
rhh(5, a = 0, b = 1, alpha = 0.1)
#> [1] 2.034210e-01 7.145115e-03 1.614672e-02 1.082168e-11 4.078671e-05
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