Function Repository Resource:

StatisticsSummary

Source Notebook

Create summary statistics for numeric data

Contributed by: Jon McLoone

ResourceFunction["StatisticsSummary"][data]

generates summary statistics such as Mean,Median and Quartiles for each column of data.

Details

ResourceFunction["StatisticsSummary"] expects rectangular data as either a matrix or a List of associations, or a Dataset of either of these structures.
ResourceFunction["StatisticsSummary"] can handle lists, lists of associations, matrices or Dataset expressions containing these.

Examples

Basic Examples (1) 

Create a dataset of summary statistics for each column in a Dataset:

In[1]:=
ResourceFunction["StatisticsSummary"][Dataset[{
   <|"Age" -> 5, "Height" -> 160|>,
   <|"Age" -> 8, "Height" -> 110|>,
   <|"Age" -> 8, "Height" -> 110|>
   }]]
Out[1]=

Scope (3) 

Summarize a list of associations:

In[2]:=
ResourceFunction["StatisticsSummary"][{
  <|"Age" -> 10, "Height" -> 160|>,
  <|"Age" -> 8, "Height" -> 110|>,
  <|"Age" -> 5, "Height" -> 120|>
  }]
Out[2]=

Summarize a list of lists:

In[3]:=
ResourceFunction["StatisticsSummary"][{{1, 2}, {3, 4}}]
Out[3]=

Summarize a single list:

In[4]:=
ResourceFunction[
 "StatisticsSummary"][{1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 5}]
Out[4]=

Applications (2) 

Use StatisticsSummary on the values on the "Planets" dataset:

In[5]:=
ResourceFunction["StatisticsSummary"][
 ExampleData[{"Dataset", "Planets"}][All, KeyDrop["Moons"]]]
Out[5]=

Use StatisticsSummary on the values in the "Fisher iris" dataset:

In[6]:=
ResourceFunction["StatisticsSummary"][
 First /@ ExampleData[{"MachineLearning", "FisherIris"}, "Data"]]
Out[6]=

Possible Issues (3) 

StatisticsSummary will ignore non-numeric data:

In[7]:=
ResourceFunction["StatisticsSummary"][{"a", "b", "a", "c"}]
Out[7]=

StatisticsSummary will only return a single unique mode:

In[8]:=
ResourceFunction["StatisticsSummary"][{1, 1, 2}]
Out[8]=

Multimodal data or data whose elements are all unique will not return a value for the mode:

In[9]:=
ResourceFunction["StatisticsSummary"][{1, 1, 2, 2}]
Out[9]=

Publisher

Jon McLoone

Version History

  • 1.1.0 – 07 July 2021

Source Metadata

Related Resources

License Information