Relationships Between Statistical Distributions
Relationships Between Statistical Distributions
Seth J. Chandler 2019
The Quantile Function
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[]=
,
|
|
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)||0≤q<1&&xLog
1
1-q
Or we can ask for the function directly!
In[]:=
expo_1QuantileFunction=Quantile[expo_1,q]
Out[]=
ConditionalExpression
,0≤q≤1
|
Moving From One Quantile Function to Another
Moving From One Quantile Function to Another
Moving from one distribution 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
,0≤q≤1
|
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
,0≤q≤1
|
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
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
,0≤q≤1
|
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≥0]}
-x
And now let' s plug that in to .
In[]:=
χ/.inverse_expo_1
Out[]=
ConditionalExpression
,x≥0&&0≤≤1
|
-x
And that' s our transformation function :
In[]:=
expoToχTransform=TransformedDistribution[2InverseGammaRegularized[1,0,1-],xexpo_1]
-x
Out[]=
TransformedDistribution[2InverseGammaRegularized[1,0,1-],x.ExponentialDistribution[1]]
-x.
Let' s see what the CDF of this is :
In[]:=
CDF[expoToχTransform,x]//Simplify
Out[]=
|
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[]=
|
We' ve done it.
Another example : exponential to Weibull
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
,0≤q≤1
|
Let' s compute the transformation :
In[]:=
expo_1_to_Weibull=weibull_Quantile/.inverse_expo_1
Out[]=
ConditionalExpression
,x≥0&&0≤≤1
|
-x
And so here' s the transformed distribution:
In[]:=
expo_1_to_Weibull_Transform=TransformedDistribution3
-Log[]
,xexpo_1-x
And here' s the CDF of our transformed distribution :
Let' s compare that with the official CDF of the Weibull Distribution:
The Lesson
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