Statistics with Units

Mathematica supports a large number of descriptive statistics operations on datasets composed of Quantity expressions, including location, covariance, correlation, and shape statistics functions. A general description of these functions can be found in "Descriptive Statistics".

For univariate datasets, statistics functions require that all elements within the dataset contain compatible units. If the units are not compatible, an error message describing the conflict is returned.

Here is a dataset.
In[1]:=
Click for copyable input
This finds the Mean and Median of the univariate data.
In[2]:=
Click for copyable input
Out[2]=
Here is a matrix composed of Quantity expressions.
In[3]:=
Click for copyable input
Out[3]=
Location functions will evaluate matrices.
In[4]:=
Click for copyable input
Out[4]=
In[5]:=
Click for copyable input
Out[5]//MatrixForm=
Moment will have UnitDimensions of the Product of input data columns, based on the moment specifications.
In[6]:=
Click for copyable input
Out[6]=
In[7]:=
Click for copyable input
Out[7]=

Multivariate Data

For multivariate datasets, statistics functions require that all elements within each column of the dataset contain compatible units. If the units are not compatible, an error message describing the conflict is returned.

Here is multivariate data with different units in each column.
In[8]:=
Click for copyable input
Out[8]=
Location functions will evaluate column-wise on multivariate datasets.
In[9]:=
Click for copyable input
Out[9]=
In[10]:=
Click for copyable input
Out[10]//MatrixForm=
Moment will have UnitDimensions of the Product of input data columns, based on the moment specifications.
In[11]:=
Click for copyable input
Out[11]=
New to Mathematica? Find your learning path »
Have a question? Ask support »