library(tidyverse)
library(qpd)
library(hrbrthemes)
Introduction
One of the recent papers I included in Quantile Statistics Overlay is Nair and Vineshkumar (2023). 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 (2019) provided the helpful definition of bivariate quantiles, which extends the univariate case for quantile function of
The bivariate quantile function of
where
Recall, that the the joint survival function is
The conditional distribution function
The conditional survival function
We can find the conditional quantile function
Examples
Nair and Vineshkumar (2023) 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 distribution1
The marginal quantile functions
Now, we need to invert this, i.e. solve it for
We are almost there. Now we drop in marginal
Which is exactly the solution provided in the paper. Now we can proceed to sampling from our brand new bivariate quantile function.
<- function(u, cc){
qmardiapareto1 <- (-1/cc) #minus inverse c
mic 1-u)^mic-1
(
}
<- function(u2, u1, cc){
qmardiapareto21 <- (-1/cc)
mic 1-u1)^mic*((1-u2)^mic-1)
(
}
set.seed(1)
<- 1e3
n <- 10
cc ::tibble(u1=runif(n),
tibbleu2=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 (2019). Here, the joint survival function is given by
where
We find the conditional survival and distribution functions as
Now we invert
And drop in the marginal quantile function instead of
Which is exactly the result in the paper.
<- function(u, a, p){
qotherpareto1 <- (-1/p) #minus inverse p
mip 1/a*(1-u)^mip-1
}
<- function(u2, u1, a2, a1, b, p){
qotherpareto21 <- (-1/p)
mip <- a1*((1-u2)^mip-1)*((1-u1)^mip)
num <- a1*a2+b*((1-u1)^mip-1)
den /den
num
}
set.seed(1)
<- 1e3
n <- 10
p <- 0.2; a1 <- 0.4; b <- 0.1
a2 ::tibble(u1=runif(n),
tibbleu2=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 (1960) proposed two kinds of bivariate exponential distributions. The Type I distribution has the survival function
The marginal quantile function is, of course,
Gumbel (1960) defined the distribution by the joint distribution function, which is slightly more verbose than the survival function.
The first step is to find the conditional survival and distribution functions.
Now we need to invert this conditional distribution function for
So the Gumbel bivariate exponential function becomes
This is the exactly the result reported in the paper.
<- function(u, lambda){
qgumbelexp1 -log(1-u)/lambda
}
<- function(u2, u1, lambda2, lambda1, theta){
qgumbelexp21 -lambda1*log(1-u2)/(lambda1*lambda2-theta*log(1-u1))
}
set.seed(1)
<- 1e3
n <- 3
theta <- 1; lambda2 <- 2
lambda1 ::tibble(u1=runif(n),
tibbleu2=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 (2023). The authors list 9 properties, which are, in some sense, extensions of Gilchrist (2000) properties for univariate QFs. In particular, the properties 6 through 9 are pretty cool.
The authors start by stating that the conditional bQFs
It turns out (Property 6) that the conditional bQF
Property 8 says that for the positive QFs the product is also a valid conditional bQF, generalizing the “product rule” (Gilchrist 2000). Finally, Property 9 generalizes the “Q-transformation rule”, postulating that for every increasing transformation functions
Conclusion
So why do we care? Given what we have discussed in Perepolkin, Goodrich, and Sahlin (2021), 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
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
Footnotes
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}
}