Wolfram Language

Quantities in Probability & Statistics

Distribution with Quantity Parameters

Approximate height distribution with normal distribution with mean of 70 inches and standard deviation of 6.5 inches. The distribution can be constructed using Quantity as a corresponding mean and standard deviation parameters and will yield an appropriate QuantityDistribution.

In[1]:=
Click for copyable input
height\[ScriptCapitalD] = NormalDistribution[Quantity[70, "Inches"], Quantity[6.5, "Inches"]]
Out[1]=

The distribution represents a random variable in the specified units.

In[2]:=
Click for copyable input
averageHeight = Mean[height\[ScriptCapitalD]]
Out[2]=

Compute with the distribution using appropriate quantity arguments.

In[3]:=
Click for copyable input
CDF[height\[ScriptCapitalD], Quantity[170, "Centimeters"]]
Out[3]=

Compute probability that a person's height is between 65 and 72 inches.

In[4]:=
Click for copyable input
Probability[Quantity[65, "in"] < x < Quantity[72, "in"], x \[Distributed] height\[ScriptCapitalD]]
Out[4]=

Assuming this height distribution, find an average time of a hat falling from a person's head on Earth.

In[5]:=
Click for copyable input
NExpectation[Sqrt[(2 h)/Entity["Planet", "Earth"]["Gravity"]], h \[Distributed] height\[ScriptCapitalD]]
Out[5]=

Related Examples

de es fr ja ko pt-br ru zh