Compare right tails of two sample distributions using a quantile-based approach (QBA); see if(!exists(".Rdpack.currefs")) .Rdpack.currefs <-new.env();Rdpack::insert_citeOnly(keys="Soliman_etal_2014_insurance;textual",package="funtimes",cached_env=.Rdpack.currefs) , if(!exists(".Rdpack.currefs")) .Rdpack.currefs <-new.env();Rdpack::insert_citeOnly(keys="Soliman_etal_2015_insurance;textual",package="funtimes",cached_env=.Rdpack.currefs) , and if(!exists(".Rdpack.currefs")) .Rdpack.currefs <-new.env();Rdpack::insert_citeOnly(keys="Lyubchich_Gel_2017_insurance;textual",package="funtimes",cached_env=.Rdpack.currefs) .
tails_q(x0, x1, q =0.99)
Arguments
x0, x1: vectors of the same length (preferably). Tail in x1 is compared against the tail in x0.
q: a quantile defining the right tail for both x0 and x1. Values above the thresholds quantile(x0, probs = q) and quantile(x1, probs = q) are considered as the respective right tails.
Returns
A list with two elements: - d: the step in probabilities for defining the quantiles.
Pk: vector of differences of the intervals' centers.
Details
Sturges' formula is used to calculate the number of intervals (k) to split the upper 100(1−q)\
(the right tails). Then, each tail is divided into equally-filled intervals with a quantile step d=(1−q)/k. Pk reports the difference between corresponding intervals' centers obtained from x0 and x1.