Wolfram Language

Quantities in Probability & Statistics

Simulate Quantities

Simulate waiting times from a quantity distribution.

In[1]:=
Click for copyable input
wait\[ScriptCapitalD] = QuantityDistribution[ExponentialDistribution[.4], "Minutes"]
Out[1]=

Single observation is a Quantity.

In[2]:=
Click for copyable input
RandomVariate[wait\[ScriptCapitalD]]
Out[2]=

A sample of multiple observations is a QuantityArray.

In[3]:=
Click for copyable input
sample = RandomVariate[wait\[ScriptCapitalD], 100]
Out[3]=

Visualize the sample using Histogram.

In[4]:=
Click for copyable input
Histogram[sample, AxesLabel -> Automatic]
Out[4]=

Calculate selected descriptive statistics of the sample.

In[5]:=
Click for copyable input
stats = {Mean, Median, Min, Max}; TableForm[Map[#[sample] &, stats], TableHeadings -> {stats, None}]
Out[5]//TableForm=

Related Examples

de es fr ja ko pt-br ru zh