scipy.stats.mstats.count_tied_groups#
- scipy.stats.mstats.count_tied_groups(x, use_missing=False)[source]#
Counts the number of tied values.
- Parameters:
- xsequence
Sequence of data on which to counts the ties
- use_missingbool, optional
Whether to consider missing values as tied.
- Returns:
- count_tied_groupsdict
Returns a dictionary (nb of ties: nb of groups).
Examples
>>> from scipy.stats import mstats >>> import numpy as np >>> z = [0, 0, 0, 2, 2, 2, 3, 3, 4, 5, 6] >>> mstats.count_tied_groups(z) {2: 1, 3: 2}
In the above example, the ties were 0 (3x), 2 (3x) and 3 (2x).
>>> z = np.ma.array([0, 0, 1, 2, 2, 2, 3, 3, 4, 5, 6]) >>> mstats.count_tied_groups(z) {2: 2, 3: 1} >>> z[[1,-1]] = np.ma.masked >>> mstats.count_tied_groups(z, use_missing=True) {2: 2, 3: 1}