Wolfram Language

Quantities in Probability & Statistics

Truncated Distribution with Quantities

The diameter of an American cranberry follows a normal distribution with mean 16 mm and standard deviation 1.6 mm. A fruit must be at least 15 mm across to be sold as whole; otherwise, it is used in the production of cranberry sauce. Find the size distribution of the fruits being sold as whole.

Click for copyable input
cran\[ScriptCapitalD] = NormalDistribution[Quantity[16, "Millimeters"], Quantity[1.6, "Millimeters"]]; \[ScriptCapitalD] = TruncatedDistribution[{Quantity[15, "Millimeters"], \[Infinity]}, cran\[ScriptCapitalD]];

Compare probability density functions.

Click for copyable input
Plot[{PDF[cran\[ScriptCapitalD], Quantity[x, "Milimeters"]], PDF[\[ScriptCapitalD], Quantity[x, "Milimeters"]]}, {x, 10, 22}, PlotLegends -> {"cran\[ScriptCapitalD]", "\[ScriptCapitalD]"}, Filling -> Axis, AxesLabel -> {"mm"}]

Assuming that a one-pound package of cranberries has volume around 30 in3, find the average lower and upper bounds for the number of cranberries in such a package.

Click for copyable input
lowerbound = Floor[NExpectation[ Divide[Quantity[30, "Inches"^3], Volume[Cuboid[{0, 0, 0}, {x, x, x}]]], x \[Distributed] \[ScriptCapitalD]]]
Click for copyable input
upperbound = Ceiling[NExpectation[ Divide[Quantity[30, "Inches"^3], Volume[Ball[{0, 0, 0}, x/2]]], x \[Distributed] \[ScriptCapitalD]]]

Related Examples

de es fr ja ko pt-br ru zh