Skip to content

Mode ​

The most frequently occurring element of the collection.

Mode(collection)the most frequently occurring element.
Typed signatures
TypePackageApplies
((collection<nothing | number> | number)+) -> nan | real | signed_infinitycombinatoricsreplaces compute-enginealways
((collection<nothing | number> | number)+) -> nan | real | signed_infinitycompute-enginealways

Domain: Collections

Details
  • The mode occurs exactly as many times as the highest frequency in the collection: Count(c,Mode(c))Count(c, Mode(c)) gives that frequency. See Count.
  • When several elements share the highest frequency, Mode returns just one. See Commonest for every tied value.
  • See Mean and Median for other measures of central tendency.

Examples

Basic #
live ↗
InMode([1,2,2,3])\mathrm{Mode}(\bigl\lbrack1, 2, 2, 3\bigr\rbrack)Out22
live ↗
InMode([1,2,3,3,2,3])\mathrm{Mode}(\bigl\lbrack1, 2, 3, 3, 2, 3\bigr\rbrack)Out33
Scope #

Exact rationals

live ↗
InMode([12,1,12])\mathrm{Mode}(\bigl\lbrack\frac{1}{2}, 1, \frac{1}{2}\bigr\rbrack)Out12\frac{1}{2}

Symbols and numbers mixed, three-way tie: the first to appear wins; Commonest lists all three, bb, aa, 22, as Wolfram's does

live ↗
InMode([b,a,c,2,a,b,1,2])\mathrm{Mode}(\bigl\lbrack b, a, c, 2, a, b, 1, 2\bigr\rbrack)Outbb
Properties #

The mode occurs exactly as many times as the highest frequency in the collection. See Count

live ↗
InCount([1,2,2,3],Mode([1,2,2,3]))=2\mathrm{Count}(\bigl\lbrack1, 2, 2, 3\bigr\rbrack, \mathrm{Mode}(\bigl\lbrack1, 2, 2, 3\bigr\rbrack))=2OutTrue\mathrm{True}
Possible issues #

With a tie for most frequent, Mode returns just one; see Commonest for every tied value

live ↗
InMode([1,1,2,2,3])\mathrm{Mode}(\bigl\lbrack1, 1, 2, 2, 3\bigr\rbrack)Out11

Empty data has no mode; compute-engine returns NaNNaN

live ↗
InMode([])\mathrm{Mode}(\bigl\lbrack\bigr\rbrack)OutNaN⁡\operatorname{NaN}
About
Examples7
Checked againstWolfram Language 6 agree1 differ
CrosswalkWikipediaMathWorldWikidataBritannica

See also: Mean, Median, Commonest