Wolfram Language

Quantities in Probability & Statistics

Give Units to Any Distribution

Create a distribution of arrival time in seconds from distribution of its magnitude.

In[1]:=
Click for copyable input
\[ScriptCapitalD] = QuantityDistribution[ExponentialDistribution[3], "Seconds"]
Out[1]=

Use QuantityUnit and QuantityMagnitude to extract the unit of the associated random variate and the distribution of its magnitude.

In[2]:=
Click for copyable input
QuantityUnit[\[ScriptCapitalD]]
Out[2]=
In[3]:=
Click for copyable input
QuantityMagnitude[\[ScriptCapitalD]]
Out[3]=

Any distribution, including formula distributions, derived distributions, etc., can be used as the distribution of the magnitude.

In[4]:=
Click for copyable input
mag\[ScriptCapitalD] = ProbabilityDistribution[{"HF", x}, {x, 0, \[Infinity]}];
In[5]:=
Click for copyable input
lifetime\[ScriptCapitalD] = QuantityDistribution[mag\[ScriptCapitalD], "Hours"]
Out[5]=

Related Examples

de es fr ja ko pt-br ru zh