WOLFRAM NOTEBOOK

Relationships Between Statistical Distributions

Seth J. Chandler 2019

The Quantile Function

Statistical distributions have a quantile function associated with them. The quantile function may be thought of as the inverse as the CDF. As such it takes a value between 0 and 1 and asks: for what x would the CDF of x with respect to the distribution equal that value.
Let' s take an example. Suppose we have a logistic distribution with mean of 0 and a second parameter of 1.
In[]:=
expo_1=ExponentialDistribution[1]
Out[]=
ExponentialDistribution[1]
Here' s its PDF and CDF plotted and as a mathematical expression.
In[]:=
With[{pdf=PDF[expo_1,x],cdf=CDF[expo_1,x]},{Labeled[Plot[pdf,{x,-1,11}],pdf],Labeled[Plot[cdf,{x,-1,11}],cdf]}]
Out[]=
-x
x0
0
True
,
1-
-x
x0
0
True
I can now ask the question, what real value of x makes CDF[expo_1,x]==4/5.
In[]:=
Reduce[CDF[expo_1,x]4/5,x,Reals]
Out[]=
xLog[5]
I' ll call that answer the 4/5 (or 08. or 80 %) “quantile” of the distribution.
Or I can ask what real value of x makes CDF[expo_1, x] == 3/10
Reduce[CDF[expo_1,x]3/10,x,Reals]
Out[]=
xLog[2]+Log[5]-Log[7]
I' ll call that answer the 3/10 (or 0.3 or 30 %) “quantile” of the distribution.
Indeed, I can ask what value of x makes CDF[expo_1, x] == q, where q is some arbitrary number between 0 and 1.
In[]:=
expo_1Quantile=Reduce[{CDF[expo_1,x]q},x,Reals]
Out[]=
(q0&&x<0)||0q<1&&xLog
1
1-q
Or we can ask for the function directly!
In[]:=
expo_1QuantileFunction=Quantile[expo_1,q]
Out[]=
ConditionalExpression
-Log[1-q]
q<1
True
,0q1

Moving From One Quantile Function to Another

Moving from one distribution to another

Now that we understand the quantile function, let’s look at one for the exponential distribution with a parameter of 3.
In[]:=
expo_3=Quantile[ExponentialDistribution[3],q]
Out[]=
ConditionalExpression
-
1
3
Log[1-q]
q<1
True
,0q1
How do we get from expo_1 to expo_3? Well, if we, divide by 3 it looks like we’re there.
In[]:=
(expo_1QuantileFunction)/3//PiecewiseExpand
Out[]=
ConditionalExpression
q1
-
1
3
Log[1-q]
True
,0q1
So the function xx/3 gets us there. That’s the transformation function between ExponentialDistribution[1] and ExponentialDistribution[3]
By the way, here' s how we could get there directly.
In[]:=
TransformedDistribution[x/3,xExponentialDistribution[1]]
Out[]=
ExponentialDistribution[3]

Moving from an exponential distribution to chi squared distribution

What about moving from an exponential distribution to a chi squared distribution: what' s the transformation function there.
In[]:=
χ=Quantile[ChiSquareDistribution[2],q]
Out[]=
ConditionalExpression
2InverseGammaRegularized[1,0,q]
0<q<1
0
q0
True
,0q1
This one' s a little hard. But let' s solve for q in expo_1
In[]:=
inverse_expo_1=First@Solve[xexpo_1QuantileFunction,q,Reals]
Out[]=
{qConditionalExpression[1-
-x
,x0]}
And now let' s plug that in to .
In[]:=
χ/.inverse_expo_1
Out[]=
ConditionalExpression
2InverseGammaRegularized[1,0,1-
-x
]
0<1-
-x
<1
0
1-
-x
0
True
,x0&&0
-x
1
And that' s our transformation function :
In[]:=
expoToχTransform=TransformedDistribution[2InverseGammaRegularized[1,0,1-
-x
],xexpo_1]
Out[]=
TransformedDistribution[2InverseGammaRegularized[1,0,1-
-x.
],x.ExponentialDistribution[1]]
Let' s see what the CDF of this is :
In[]:=
CDF[expoToχTransform,x]//Simplify
Out[]=
1-
-x/2
x>0
0
True
And let' s see if that is indeed the CDF of the ChiSquared distribution with 2 degrees of freedom.
In[]:=
CDF[ChiSquareDistribution[2],x]
Out[]=
1-
-x/2
x>0
0
True
We' ve done it.

Another example : exponential to Weibull

Here' s the quantile function of something called a Weibull Distribution.
In[]:=
weibull_Quantile=Quantile[WeibullDistribution[2,3],q]
Out[]=
ConditionalExpression
3
-Log[1-q]
0<q<1
0
q0
True
,0q1
Let' s compute the transformation :
In[]:=
expo_1_to_Weibull=weibull_Quantile/.inverse_expo_1
Out[]=
ConditionalExpression
3
-Log[
-x
]
0<1-
-x
<1
0
1-
-x
0
True
,x0&&0
-x
1
And so here' s the transformed distribution:
In[]:=
expo_1_to_Weibull_Transform=TransformedDistribution3
-Log[
-x
]
,xexpo_1
Out[]=
TransformedDistribution3
-Log[
-x.
]
,x.ExponentialDistribution[1]
And here' s the CDF of our transformed distribution :
In[]:=
CDF[expo_1_to_Weibull_Transform,x]
Out[]=
1-
-
2
x
9
x>0
0
True
Let' s compare that with the official CDF of the Weibull Distribution:
In[]:=
CDF[WeibullDistribution[2,3],x]
Out[]=
1-
-
2
x
9
x>0
0
True

The Lesson

You can move from any distribution to another distribution with the appropriate transformation function. Sometimes it will, however, not be possible to express that transformation function in conventional mathematical functions. Here’s a picture showing some relationships.
Source; https : // en.wikipedia.org/wiki/Relationships_among _probability _distributions #/media/File : Relationships_among _some _of _univariate _probability _distributions.jpg
Wolfram Cloud

You are using a browser not supported by the Wolfram Cloud

Supported browsers include recent versions of Chrome, Edge, Firefox and Safari.


I understand and wish to continue anyway »

You are using a browser not supported by the Wolfram Cloud. Supported browsers include recent versions of Chrome, Edge, Firefox and Safari.