Mode - Maple Help

# Online Help

###### All Products    Maple    MapleSim

Student[Statistics]

 Mode
 compute the mode

 Calling Sequence Mode(A, numeric_option, output_option) Mode(M, numeric_option, output_option) Mode(X, numeric_option, output_option)

Parameters

 A - M - X - algebraic; random variable numeric_option - (optional) equation of the form numeric=value where value is true or false output_option - (optional) equation of the form output=x where x is value, plot, or both

Description

 • The Mode function computes the mode of a specified random variable or a data sample, and then puts the result into a set. The mode of a set of sample data is the most frequently occurring item in it.
 • The first parameter can be a data sample (e.g., a Vector), a Matrix data sample, a random variable, or an algebraic expression involving random variables (see Student[Statistics][RandomVariable]).
 • If the option output is not included or is specified to be output=value, then the function will return the value of the mode. If output=plot is specified, then the function will return a plot of the input data set and its mode. If output=both is specified, then both the value and the plot of the mode will be returned.

Computation

 • By default, all computations involving random variables are performed symbolically (see option numeric below).
 • The Mode function selects the values that occur most frequently in the data set. If values appear differently but have the same numeric value, such as $2$, $2.0$, and $\sqrt{4}$, then Mode will consider them equal. If values that appear differently are a mode of the data set, then Mode uses a floating point value equal to that mode if there is one in the data set, or an arbitrarily selected non-floating point value otherwise.
 • By default, the mode is computed according to the rules mentioned above. To always compute the mode numerically, specify the numeric or numeric = true option.

Examples

 > $\mathrm{with}\left(\mathrm{Student}\left[\mathrm{Statistics}\right]\right):$

Compute the mode of the binomial distribution with parameters $p$ and $q$.

 > $\mathrm{Mode}\left(\mathrm{BinomialRandomVariable}\left(p,q\right)\right)$
 $\left\{\begin{array}{cc}\left\{{0}\right\}& {q}{=}{0}\\ \left\{{p}\right\}& {q}{=}{1}\\ \left\{\left({1}{+}{p}\right){}{q}{,}\left({1}{+}{p}\right){}{q}{-}{1}\right\}& \left(\left({1}{+}{p}\right){}{q}\right){::}{'}{\mathrm{integer}}{'}\\ \left\{⌊\left({1}{+}{p}\right){}{q}⌋\right\}& {\mathrm{otherwise}}\end{array}\right\$ (1)

Use numeric parameters.

 > $\mathrm{Mode}\left(\mathrm{BinomialRandomVariable}\left(20,0.6\right)\right)$
 $\left\{{12}\right\}$ (2)
 > $A≔⟨1,2,2,2,2,2,3,4,5,5,5,6,7,7,7,7.0,7,7,8,8,1,1,2,3,4,5⟩:$
 > $\mathrm{Mode}\left(A\right)$
 $\left\{{2}{,}{7.0}\right\}$ (3)

This data sample has two modes: $2$ and $7$. The value $7$ occurs in two versions: as a floating point value and as an integer. Mode uses the floating point value as the return value.

Use the numeric option.

 > $\mathrm{Mode}\left(A,\mathrm{numeric}\right)$
 $\left\{{2.}{,}{7.0}\right\}$ (4)

Use the output=plot option.

 > $\mathrm{Mode}\left(A,\mathrm{output}=\mathrm{plot}\right)$

Consider the following Matrix data sample.

 > $M≔\mathrm{Matrix}\left(\left[\left[3,\mathrm{\pi },4\right],\left[4,\mathrm{\pi },4\right],\left[3.0,3.1415926,4\right],\left[2,1,10\right],\left[4,110,\mathrm{sqrt}\left(2\right)\right]\right]\right)$
 $\left[\begin{array}{ccc}3& \mathrm{π}& 4\\ 4& \mathrm{π}& 4\\ 3.0& 3.1415926& 4\\ 2& 1& 10\\ 4& 110& \sqrt{2}\end{array}\right]$ (5)

Compute the mode of each of the columns.

 > $\mathrm{Mode}\left(M\right)$
 $\left[\begin{array}{ccc}\left\{4,3.0\right\}& \left\{\mathrm{π}\right\}& \left\{4\right\}\end{array}\right]$ (6)

Use the output=both option.

 > $\mathrm{mode},\mathrm{graph}≔\mathrm{Mode}\left(M,\mathrm{output}=\mathrm{both}\right)$
 ${\mathrm{mode}}{,}{\mathrm{graph}}{≔}\left[\begin{array}{ccc}\left\{{4}{,}{3.0}\right\}& \left\{{\mathrm{\pi }}\right\}& \left\{{4}\right\}\end{array}\right]{,}{}$ (7)
 > $\mathrm{mode}$
 $\left[\begin{array}{ccc}\left\{4,3.0\right\}& \left\{\mathrm{π}\right\}& \left\{4\right\}\end{array}\right]$ (8)
 > $\mathrm{graph}$

 > 

References

 Stuart, Alan, and Ord, Keith. Kendall's Advanced Theory of Statistics. 6th ed. London: Edward Arnold, 1998. Vol. 1: Distribution Theory.

Compatibility

 • The Student[Statistics][Mode] command was introduced in Maple 18.
 • For more information on Maple 18 changes, see Updates in Maple 18.

 See Also