# q.tails: Quantile-Based Tails Comparison In funtimes: Functions for Time Series Analysis

## Description

Compare right tails of two sample distributions using a quantile-based approach (QBA); see \insertCiteSoliman_etal_2014_insurance;textualfuntimes, \insertCiteSoliman_etal_2015_insurance;textualfuntimes, and \insertCiteLyubchich_Gel_2017_insurance;textualfuntimes.

## Usage

 `1` ```q.tails(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.

## Details

Sturges' formula is used to calculate 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`.

## Value

A list with two elements:

 `d` the step in probabilities for defining the quantiles. `Pk` vector of differences of the intervals' centers.

## Author(s)

Vyacheslav Lyubchich, Yulia R. Gel

## References

\insertAllCited

`i.tails`
 ```1 2 3``` ```x0 <- rnorm(1000) x1 <- rt(1000, 5) q.tails(x0, x1) ```