No, you should not use the Mann-Whitney $U$ test in this circumstance.
Here's why: Dunn's test is an appropriate post hoc test* following rejection of a Kruskal-Wallis test. If one proceeds by moving from a rejection of Kruskal-Wallis to performing ordinary pair-wise rank sum (i.e. Wilcoxon or Mann-Whitney) tests, then two problems obtain: (1) the ranks used for the pair-wise rank sum tests are not the ranks used by the Kruskal-Wallis test; and (2) the rank sum tests do not use the pooled variance implied by the Kruskal-Wallis null hypothesis. Dunn's test does not have these problems
Post hoc tests following rejection of a Kruskal-Wallis test which have been adjusted for multiple comparisons may fail to reject all pairwise tests for a given family-wise error rate or given false discovery rate corresponding to a given $\alpha$ for the omnibus test, just as with any other multiple comparison omnibus/post hoc testing scenario.
Unless you have reason to believe that one group's survival time is longer or shorter than another's a priori, you should be using the two-sided tests.
Dunn's test can be performed in Stata using dunntest (type net describe dunntest, from(https://www.alexisdinno.com/stata)
), and in R using the dunn.test package.
Also, I wonder if you might take a survival analysis approach to assessing whether and when an animal dies based on different conditions?
* A few less well-known post hoc pair-wise tests to follow a rejected Kruskal-Wallis, include Conover-Iman (like Dunn, but based on the t distribution, rather than the z distribution, implemented for Stata in the conovertest package, and for R in the conover.test package), and the Dwass-Steel-Citchlow-Fligner tests.
The Kruskal-Wallis $H$ statistic is given by:
$$H=\frac{\frac{12\sum_{i=1}^{k}{n_{i}\left(\bar{R}_{i}-\bar{R}\right)^{2}}}{N\left(N+1\right)}}{1-\frac{\sum{T}}{N^{3}-N}}\text{, where:}$$
$k$ is the number of groups;
$N$ is the number of observations across all groups;
$n_{i}$ is the number of observations in the $i^{th}$ group;
$\bar{R}$ is the mean rank of all observations;
$\bar{R}_{i}$ is the rank sum of observations from the $i^{th}$ group (ranks are across observations from all groups); and
$T=t^{3}-t$ for each set of tied ranks, where $t$ is the number of ties in the set, and $\sum{T}$ is the sum of this quantity across all sets of tied ranks.
When there are no ties $T=0$, the denominator of $H$ simplifies to $1$.
For $N=50,000$ and a uniform distribution of ties across your eleven possible values the denominator of $H$ is approximately:
$$1-\frac{11\left(4545^3-45\right)}{50000^3-50000} \approx 0.9997$$
Assuming a highly skewed distribution of ties—say all but ten observations tied on a single value—the denominator of $H$ is approximately:
$$1-\frac{\left(49,990^3-49,990\right)}{50000^3-50000} \approx 0.0006$$
The most extreme case would be where all $N$ observations were tied on the same value, in which case the denominator of $H$ would simplify to $0$, and $H$ would thus be undefined.
Because the cubed term in $T$ can never be greater than $N^{3}$, I do not think it is possible to obtain a negative value of the denominator, and therefore not possible to obtain a negative value of $H$.
Conclusion:
- It is not possible to obtain a negative value of $H$ by adjusting for ties using Kruskal & Wallis formula for $H$ (Equation 1.2) and their adjustment for ties (Equation 1.3).
- Cubing a large $N$ might place one's software in the position of trying to calculate beyond its available precision, and numerical inconsistencies might thus result.
Kruskal, W. H. and Wallis, A. (1952). Use of ranks in one-criterion variance analysis. Journal of the American Statistical Association, 47(260):583–621.
Best Answer
If Y is meant to be a grouping variable, the p-value in R is around 0.45
But it makes no difference whether that 35 is set to 13 or 35 or 1300 - the p-value is exactly the same. It is clearly robust to outliers.
With continuity correction, the p-value is somewhat higher.
Edit:
Here's an illustration of just how the Kruskal-Wallis p-value responds as you move the third observation around - that is, this is an empirical influence curve for the p-value as
x[3]
is moved (takes the various values of delta).We see that the Kruskal-Wallis is highly insensitive to all but a small range of values for
x[3]
(it is constant to the left of $[1,2]$ and constant to the right of it). It's really insensitive.The grey line is the p-value with x[3] omitted. As you see, no value for
x[3]
will allow the Kruskal-Wallis to attain that p-value, though makingx[3]=2
comes closest.It's a rank-based ANOVA. It doesn't actually 'use' the median for anything.
The measure of location-shift that corresponds to the Wilcoxon-Mann-Whitney (and hence to the Kruskal-Wallis) is the median of pairwise differences between the samples.
Compare:
(I'm not sure why it doesn't have better accuracy there)
If you change the 35 to 13 or 1300, you get the same estimate of shift.
If you add a whole new observation - if your original data in the first group was just (2, 2), then adding an additional observation changes the p-value. (This would be the case even if the median was the estimate of location shift.)