词条 | Medcouple |
释义 |
In statistics, the medcouple is a robust statistic that measures the skewness of a univariate distribution. It is defined as a scaled median difference of the left and right half of a distribution. Its robustness makes it suitable for identifying outliers in adjusted boxplots.[2][3] Ordinary box plots do not fare well with skew distributions, since they label the longer unsymmetrical tails as outliers. Using the medcouple, the whiskers of a boxplot can be adjusted for skew distributions and thus have a more accurate identification of outliers for non-symmetrical distributions. As a kind of order statistic, the medcouple belongs to the class of incomplete generalised L-statistics. Like the ordinary median or mean, the medcouple is a nonparametric statistic, thus it can be computed for any distribution. DefinitionIn order to harmonise with zero-based indexing in many programming languages, we will index from zero in all that follows. Let be an ordered sample of size , and let be the median of . Define the sets , , of sizes and respectively. For and , we define the kernel function where is the sign function. The medcouple is then the median of the set{{rp|998}} . In other words, we split the distribution into all values greater or equal to the median and all values less than or equal to the median. We define a kernel function whose first variable is over the greater values and whose second variable is over the lesser values. For the special case of values tied to the median, we define the kernel by the signum function. The medcouple is then the median over all values of . Since the medcouple is not a median applied to all couples, but only to those for which , it belongs to the class of incomplete generalised L-statistics.{{rp|998}} Properties of the medcoupleThe medcouple has a number of desirable properties. A few of them are directly inherited from the kernel function. The medcouple kernelWe make the following observations about the kernel function :
These properties are in turn inherited by the medcouple. Thus, the medcouple is independent of the mean and standard deviation of a distribution, a desirable property for measuring skewness. For ease of computation, these properties enable us to define the two sets where . This makes the set have range of at most 1, median 0, and keep the same medcouple as . For , the medcouple kernel reduces to Using the recentred and rescaled set we can observe the following.
With properties 1, 2, and 4, we can thus define the following matrix, If we sort the sets and in decreasing order, then the matrix has sorted rows and sorted columns,{{rp|1006}} The medcouple is then the median of this matrix with sorted rows and sorted columns. The fact that the rows and columns are sorted allows the implementation of a fast algorithm for computing the medcouple. RobustnessThe breakdown point is the number of values that a statistic can resist before it becomes meaningless, i.e. the number of arbitrarily large outliers that the data set may have before the value of the statistic is affected. For the medcouple, the breakdown point is 25%, since it is a median taken over the couples such that .{{rp|1002}} ValuesLike all measures of skewness, the medcouple is positive for distributions that are skewed to the right, negative for distributions skewed to the left, and zero for symmetrical distributions. In addition, the values of the medcouple are bounded by 1 in absolute value.{{rp|998}} Algorithms for computing the medcoupleBefore presenting medcouple algorithms, we recall that there exist algorithms for the finding the median. Since the medcouple is a median, ordinary algorithms for median-finding are important. Naïve algorithmThe naïve algorithm for computing the medcouple is slow.{{rp|1005}} It proceeds in two steps. First, it constructs the medcouple matrix which contains all of the possible values of the medcouple kernel. In the second step, it finds the median of this matrix. Since there are entries in the matrix in the case when all elements of the data set are unique, the algorithmic complexity of the naïve algorithm is . More concretely, the naïve algorithm proceeds as follows. Recall that we are using zero-based indexing.
The final call to median on a vector of size can be done itself in operations, hence the entire naïve medcouple algorithm is of the same complexity. Fast algorithmThe fast algorithm outperforms the naïve algorithm by exploiting the sorted nature of the medcouple matrix . Instead of computing all entries of the matrix, the fast algorithm uses the Kth pair algorithm of Johnson & Mizoguchi.[15] The first stage of the fast algorithm proceeds as the naïve algorithm. We first compute the necessary ingredients for the kernel matrix, , with sorted rows and sorted columns in decreasing order. Rather than computing all values of , we instead exploit the monotonicity in rows and columns, via the following observations. Comparing a value against the kernel matrixFirst, we note that we can compare any with all values of in time.[15]{{rp|150}} For example, for determining all and such that , we have the following function: '''function''' greater_h('''kernel''' h, '''int''' p, '''int''' q, '''real''' u): ''// h is the kernel function, h(i,j) gives the ith, jth entry of H'' ''// p and q are the number of rows and columns of the kernel matrix H'' ''// vector of size p'' P := '''vector'''(p) ''// indexing from zero'' j := 0 ''// starting from the bottom, compute the least upper bound for each row'' '''for''' i := p - 1, p - 2, ..., 1, 0: ''// search this row until we find a value less than u'' '''while''' j < q '''and''' h(i, j) > u: j := j + 1 '''endwhile''' ''// the entry preceding the one we just found is greater than u P[i] := j - 1 '''endfor''' '''return''' P '''endfunction''' This greater_h function is traversing the kernel matrix from the bottom left to the top right, and returns a vector of indices that indicate for each row where the boundary lies between values greater than and those less than or equal to . This method works because of the row-column sorted property of . Since greater_h computes at most values of , its complexity is .[15]{{rp|150}} Conceptually, the resulting vector can be visualised as establishing a boundary on the matrix as suggested by the following diagram, where the red entries are all larger than : The symmetric algorithm for computing the values of less than is very similar. It instead proceeds along in the opposite direction, from the top right to the bottom left: '''function''' less_h('''kernel''' h, '''int''' p, '''int''' q, '''real''' u): ''// vector of size p'' Q := '''vector'''(p) ''// last possible row index'' j := q - 1 ''// starting from the top, compute the greatest lower bound for each row'' '''for''' i := 0, 1, ..., p - 2, p - 1: ''// search this row until we find a value greater than u'' '''while''' j >= 0 '''and''' h(i, j) < u: j := j - 1 '''endwhile''' ''// the entry following the one we just found is less than u Q[i] := j + 1 '''endfor''' '''return''' Q '''endfunction''' This lower boundary can be visualised like so, where the blue entries are smaller than : For each , we have that , with strict inequality occurring only for those rows that have values equal to . We also have that the sums give, respectively, the number of elements of that are greater than , and the number of elements that are greater than or equal to . Thus this method also yields the rank of within the elements of .[15]{{rp|149}} Weighted median of row mediansThe second observation is that we can use the sorted matrix structure to instantly compare any element to at least half of the entries in the matrix. For example, the median of the row medians across the entire matrix is less than the upper left quadrant in red, but greater than the lower right quadrant in blue: More generally, using the boundaries given by the and vectors from the previous section, we can assume that after some iterations, we have pinpointed the position of the medcouple to lie between the red left boundary and the blue right boundary:[15]{{rp|149}} The yellow entries indicate the median of each row. If we mentally re-arrange the rows so that the medians align and ignore the discarded entries outside the boundaries, we can select a weighted median of these medians, each entry weighted by the number of remaining entries on this row. This ensures that we can discard at least 1/4 of all remaining values no matter if we have to discard the larger values in red or the smaller values in blue: Each row median can be computed in time, since the rows are sorted, and the weighted median can be computed in time, using a binary search.[15]{{rp|148}} Kth pair algorithmPutting together these two observations, the fast medcouple algorithm proceeds broadly as follows.[15]{{rp|148}}
The initial sorting in order to form the function takes time. At each iteration, the weighted median takes time, as well as the computations of the new tentative and left and right boundaries. Since each iteration discards at least 1/4 of all remaining entries, there will be at most iterations.[15]{{rp|150}} Thus, the whole fast algorithm takes time.[15]{{rp|150}} Let us restate the fast algorithm in more detail.
In real-world use, the algorithm also needs to account for errors arising from finite-precision floating point arithmetic. For example, the comparisons for the medcouple kernel function should be done within machine epsilon, as well as the order comparisons in the greater_h and less_h functions. Software/source code
See also{{Portal|Statistics}}
References1. ^1 {{cite web| url = http://exploringdatablog.blogspot.ca/2011/02/boxplots-and-beyond-part-ii-asymmetry.html| title = Boxplots and Beyond – Part II: Asymmetry| first = Ron| last = Pearson| date = February 6, 2011| accessdate = April 6, 2015| website = exploringdata.blogspot.ca}} [1][2][3]2. ^1 {{cite journal|author=M. Hubert|author2=E. Vandervieren|date=2008|title=An adjusted boxplot for skewed distributions|journal=Computational Statistics and Data Analysis|volume=52|issue=12|pages=5186–5201|doi=10.1016/j.csda.2007.11.008}} 3. ^1 2 3 4 5 6 7 8 9 10 {{cite journal|author=Donald B. Johnson|author2=Tetsuo Mizoguchi|date=May 1978|title=Selecting The Kth Element In X + Y And X1 + X2 +...+ Xm|journal=SIAM Journal on Computing|volume=7|issue=2|pages=147–153|doi=10.1137/0207013}} }} 4 : Robust statistics|Nonparametric statistics|Statistical deviation and dispersion|Statistical outliers |
随便看 |
|
开放百科全书收录14589846条英语、德语、日语等多语种百科知识,基本涵盖了大多数领域的百科知识,是一部内容自由、开放的电子版国际百科全书。