Bivariate quantiles

Author

Deemah

Published

February 28, 2023

library(tidyverse)
library(qpd)
library(hrbrthemes)

Introduction

One of the recent papers I included in Quantile Statistics Overlay is Nair and Vineshkumar (). Prof. N. Unnikrishnan Nair is the former head of Statistics Department at the Cochin University of Science and Technology (Kerala, India). His co-author here is Dr B. Vineshkumar, the Assistant Professor of Statistics at the Government Arts College, Thiruvananthapuram (also in Kerala). Prof. N.U. Nair and Dr. Vineshkumar have been prolific contributors to the field of quantile statistics and I will be including more of their work into our overlay publication.

Bivariate Quantiles

The earlier paper Vineshkumar and Nair () provided the helpful definition of bivariate quantiles, which extends the univariate case for quantile function of X

Qi(ui)=inf{xi|Fi(xi)ui},uiI=[0,1]

The bivariate quantile function of (X1,X2) is then given by

Q(u1,u2)=(Q1(u1),Q21(u2|u1))

where

Q1(u1)=inf{x1|F1(x1)u1}Q21(u2|u1)=inf{x2|P(X2x2|X1>Q1(u1))u2}

Recall, that the the joint survival function is F¯(x1,x2)=1F1(x1)F2(x2)+F(x1,x2) (), which is a multivariate extension of the univariate survival function F¯(x)=1F(x). The authors factorize the joint survival function F¯(x1,x2) as follows:

F¯(x1,x2)=P(X1>x1)P(X2>x2|X1>x1)=F¯(x1)F¯21(x1,x2)

The conditional distribution function F21(x1,x2) should not be confused with the marginal distribution function F2(x2). The conditional distribution function can be computed from the joint distribution function using the formulae above (with the help of the marginal).

The conditional survival function F¯21(x1,x2) and the corresponding conditional quantile function Q21(u2|u1) constitute the main element in the definition of bivariate quantiles.

Q21(u2|u1)=inf{x2|F21(Q1,x2)u2}

We can find the conditional quantile function Q21 by inverting the conditional distribution function F21 for x2, and substituting the marginal Q1(u1) instead of x1.

Examples

Nair and Vineshkumar () provide several examples which might be illuminating to have a closer look at.

Mardia’s bivariate Pareto distribution

The authors provide a survival function for the Mardia’s bivariate Pareto distribution

F¯(x1,x2)=(x1+x2+1)c,x1,x2>1,c>0

The marginal quantile functions Qi(ui)=(1ui)1/c1, therefore the marginal distribution functions are Fi(xi)=(xi+1)c+1 for i=1,2. We can find the conditional survival function F¯21(x1,x2)=P(X2>x2|X1>x1), and corresponding conditional distribution function F21(x1,x2) as

F¯21(x1,x2)=F¯(x1,x2)F¯1(x1)=(x1+x2+1)c(x1+1)cF21(x1,x2)=1(x1+x2+1x1+1)c

Now, we need to invert this, i.e. solve it for x2, because we are interested in conditional quantile function Q21(u2|u1).

u2=1(x1+x2+1x1+1)c(1u2)1/c=x1+x2+1x1+1(1u2)1/c(x1+1)=x1+x2+1(1u2)1/c(x1+1)x11=x2

We are almost there. Now we drop in marginal Q1(u1)=(1u1)1/c1 instead of x1.

(1u2)1/c([(1u1)1/c1]+1)[(1u1)1/c1]1=x2(1u2)1/c(1u1)1/c(1u1)1/c=x2Q21(u1,u2)=(1u1)1/c[(1u2)1/c1]

Which is exactly the solution provided in the paper. Now we can proceed to sampling from our brand new bivariate quantile function.

qmardiapareto1 <- function(u, cc){
  mic <- (-1/cc) #minus inverse c
  (1-u)^mic-1
}

qmardiapareto21 <- function(u2, u1, cc){
  mic <- (-1/cc)
  (1-u1)^mic*((1-u2)^mic-1)
}

set.seed(1)
n <- 1e3
cc <- 10
tibble::tibble(u1=runif(n),
               u2=runif(n),
               x1=qmardiapareto1(u1,cc),
               x2=qmardiapareto21(u2, u1, cc)) %>%  
  ggplot()+
  geom_point(aes(x1, x2))+
  theme_ipsum_rc(grid_col="grey95")

Bivariate Pareto distribution

Another variant of bivariate Pareto distribution is provided in Vineshkumar and Nair (). Here, the joint survival function is given by

F¯(x1,x2)=(1+a1x1+a2x2+bx1x2)p

where x1,x2>0,a1,a2>0,0b(p1)a1a2. The marginal distribution is given by Fi(xi)=1(1+aixi)p and the inverse is Qi(ui)=1ai[(1ui)1/p1].

We find the conditional survival and distribution functions as

F¯21(x1,x2)=F¯(x1,x2)F¯1(x1)=(1+a1x1+a2x2+bx1x2)p(1+a1x1)pF21(x1,x2)=1(1+a1x1+a2x2+bx1x21+a1x1)p

Now we invert F21 for x2.

u2=1(1+a1x1+a2x2+bx1x21+a1x1)p(1u2)1/p=1+a1x1+a2x2+bx1x21+a1x1(1u2)1/p(1+a1x1)1a1x1=a2x2+bx1x2(1u2)1/p(1+a1x1)1a1x1=x2(a2+bx1)x2=(1u2)1p+a1x1(1u2)1pa1x11a2+bx1

And drop in the marginal quantile function instead of x1.

Q21(u2|u1)=(1u2)1p+a1x1(1u2)1pa1x11a2+bx1Q21(u2|u1)=(1u2)1p+a1[1a1[(1u1)1/p1]](1u2)1pa1[1a1[(1u1)1/p1]]1a2+b[1a1[(1u1)1/p1]]Q21(u2|u1)=(1u2)1p+[(1u1)1/p1](1u2)1p[(1u1)1/p1]1a2+ba1[(1u1)1/p1]Q21(u2|u1)=a1[(1u2)1p(1u1)1/p(1u1)1/p]a1a2+b[(1u1)1/p1]Q21(u2|u1)=a1(1u1)1/p[(1u2)1p1]]a1a2+b[(1u1)1/p1]

Which is exactly the result in the paper.

qotherpareto1 <- function(u, a, p){
  mip <- (-1/p) #minus inverse p
  1/a*(1-u)^mip-1
}

qotherpareto21 <- function(u2, u1, a2, a1, b, p){
  mip <- (-1/p)
  num <- a1*((1-u2)^mip-1)*((1-u1)^mip)
  den <- a1*a2+b*((1-u1)^mip-1)
  num/den
}

set.seed(1)
n <- 1e3
p <- 10
a2 <- 0.2; a1 <- 0.4; b <- 0.1
tibble::tibble(u1=runif(n),
               u2=runif(n),
               x1=qotherpareto1(u1, a1, p),
               x2=qotherpareto21(u2, u1, a2, a1, b, p)) %>%  
  ggplot()+
  geom_point(aes(x1, x2))+
  theme_ipsum_rc(grid_col="grey95")

Gumbel’s bivariate exponential distribution

Gumbel () proposed two kinds of bivariate exponential distributions. The Type I distribution has the survival function

F¯(x1,x2)=exp[λ1x1λ2x2θx1x2]

The marginal quantile function is, of course, Qi(ui)=ln(1ui)/λi and the corresponding marginal distribution function is Fi(xi)=1exp[λixi].

Gumbel () defined the distribution by the joint distribution function, which is slightly more verbose than the survival function.

F¯(x1,x2)=1F1(x1)F2(x2)+F(x1,x2)F(x1,x2)=exp[λ1x1λ2x2θx1x2]1+1exp[λ1x1]+1exp[λ2x2]F(x1,x2)=1exp[λ1x1]exp[λ2x2]+exp[λ1x1λ2x2θx1x2]

The first step is to find the conditional survival and distribution functions.

F¯21(x1,x2)=F¯(x1,x2)F¯1(x1)=exp[λ1x1λ2x2θx1x2]exp[λ1x1]F21(x1,x2)=1exp[λ2x2θx1x2]

Now we need to invert this conditional distribution function for u2 and drop in the marginal quantile function Q1(u1) in place of x1.

u2=1exp[λ2x2θx1x2]1u2=exp[λ2x2θx1x2]ln(1u2)=λ2x2θx1x2ln(1u2)=x2(λ2θx1)ln(1u2)λ2θx1=x2ln(1u2)λ2θ[ln(1u1)/λ1]=x2λ1ln(1u2)λ2λ1θ[ln(1u1)]=x2Q21(u2|u1)=λ1ln(1u2)λ2λ1θln(1u1)

So the Gumbel bivariate exponential function becomes

Q(u1,u2)=(1λ1ln(1u1),λ1ln(1u2)λ2λ1θln(1u1))

This is the exactly the result reported in the paper.

qgumbelexp1 <- function(u, lambda){
 -log(1-u)/lambda
}

qgumbelexp21 <- function(u2, u1, lambda2, lambda1, theta){
 -lambda1*log(1-u2)/(lambda1*lambda2-theta*log(1-u1))
}

set.seed(1)
n <- 1e3
theta <- 3
lambda1 <- 1; lambda2 <- 2
tibble::tibble(u1=runif(n),
               u2=runif(n),
               x1=qgumbelexp1(u1, lambda1),
               x2=qgumbelexp21(u2, u1, lambda2, lambda1, theta)) %>%  
  ggplot()+
  geom_point(aes(x1, x2))+
  theme_ipsum_rc(grid_col="grey95")

Properties of bivariate quantiles

You might ask: “Wow, that’s a lot of math! Why do we care about bivariate quantiles?” and “Well, don’t they require invertible joint distribution functions?”

The cool thing about bivariate quantile functions (bQFs) come from their properties discussed in Nair and Vineshkumar (). The authors list 9 properties, which are, in some sense, extensions of Gilchrist () properties for univariate QFs. In particular, the properties 6 through 9 are pretty cool.

The authors start by stating that the conditional bQFs Q21 do not necessarily have to come from inverting the conditional distribution function F21. In fact, any left-continuous, increasing function in u2, for all u1[0,1] can be picked at Q21 (provided that the combination (Q1,Q21) results in a meaningful bivariate model).

It turns out (Property 6) that the conditional bQF Q21(u2|u1) can be constructed as a sum of two univariate QFs, i.e. this represents a valid bQF (Q1(u1),Q1(u1)+Q2(u2)). If Q1 is left-bounded at zero, i.e. Q1(0)=0 then the marginals of such bQF are Q1(u1) and Q2(u2)! This finding generalizes Gilchrist’s “addition rule” (). Similar to the univariate case, also works for quantile densities (Property 7).

Property 8 says that for the positive QFs the product is also a valid conditional bQF, generalizing the “product rule” (). Finally, Property 9 generalizes the “Q-transformation rule”, postulating that for every increasing transformation functions T1 and T2, [T1(Q1(u1)),T1(Q1(u1))+T2(Q2(u2))] is also a valid bQF. The main implication here is that the bQFs can be defined without the reference to the join distribution function (and even without closed form F(x1,x2))!

Conclusion

So why do we care? Given what we have discussed in Perepolkin, Goodrich, and Sahlin (), priors can be defined using the quantile functions without the reference to the densities. This not only means that you don’t need PDFs to define the prior, but also that you don’t need QDF, because it will cancel itself with the Jacobian.

Now with bQFs, you can define the bivariate priors using quantile functions, provided that the conditional bQF Q21 that you crafted makes sense.

Perhaps some Stan examples would be in order. I am sure we will come back to the bivariate quantiles for some cool quantile distribution application soon.

References

Gilchrist, Warren. 2000. Statistical Modelling with Quantile Functions. Boca Raton: Chapman & Hall/CRC.
Gumbel, E. J. 1960. “Bivariate Exponential Distributions.” Journal of the American Statistical Association 55 (292): 698–707. https://doi.org/10.2307/2281591.
Kundu, Debasis, and Rameshwar D. Gupta. 2009. “Bivariate Generalized Exponential Distribution.” Journal of Multivariate Analysis 100 (4): 581–93. https://doi.org/10.1016/j.jmva.2008.06.012.
Nair, N. Unnikrishnan, and B. Vineshkumar. 2023. “Properties of Bivariate Distributions Represented Through Quantile Functions.” American Journal of Mathematical and Management Sciences 0 (0): 1–12. https://doi.org/10.1080/01966324.2021.2016522.
Perepolkin, Dmytro, Benjamin Goodrich, and Ullrika Sahlin. 2021. “The Tenets of Quantile-Based Inference in Bayesian Models.” Preprint. https://osf.io/enzgs: Open Science Framework. https://doi.org/10.31219/osf.io/enzgs.
Vineshkumar, Balakrishnapillai, and Narayanan Unnikrishnan Nair. 2019. “Bivariate Quantile Functions and Their Applications to Reliability Modelling.” Statistica 79 (1, 1): 3–21. https://doi.org/gpdd87.

Footnotes

  1. There seems to be a typo in the paper. It says -1 instead of +1 in the survival function↩︎

  2. Note that the paper missed the square brackets around the basic quantile function↩︎

Citation

BibTeX citation:
@online{perepolkin2023,
  author = {Dmytro Perepolkin},
  title = {Bivariate Quantiles},
  date = {2023-02-28},
  url = {https://www.ddrive.no/posts/2023-02-28-bivariate-quantiles/},
  langid = {en}
}
For attribution, please cite this work as:
Dmytro Perepolkin. 2023. “Bivariate Quantiles.” $D /Drive Blog. February 28, 2023. https://www.ddrive.no/posts/2023-02-28-bivariate-quantiles/.