8.8 Practice Problems
Problem 8.1. For the series \(4, 7, 6, 9, 11\) compute \(S\) by hand, listing all \(\binom {5}{2} = 10\) pairwise signs. Compute \(\operatorname {var}(S)\) and the Theil–Sen slope, taking \(t = 1, 2, 3, 4, 5\).
Show solution
Solution. With \(t = 1,\ldots ,5\) and \(x = 4, 7, 6, 9, 11\), the ten pairwise signs are \[\begin {array}{llll} (4,7)\ + & (4,6)\ + & (4,9)\ + & (4,11)\ +\\ (7,6)\ - & (7,9)\ + & (7,11)\ + &\\ (6,9)\ + & (6,11)\ + & &\\ (9,11)\ + & & & \end {array}\] Nine are positive and one negative, so \[S = 9 - 1 = 8 .\] There are no ties, so \[\operatorname {var}(S) = \dfrac {n(n-1)(2n+5)}{18} = \dfrac {5(4)(15)}{18} = 16.6667 .\] The ten pairwise slopes \(\dfrac {x_j - x_i}{t_j - t_i}\) are \[-1,\ 1,\ 1,\ 1.3333,\ 1.6667,\ 1.75,\ 2,\ 2.5,\ 3,\ 3,\] and the Theil–Sen estimate is the median of these, the mean of the fifth and sixth: \[\widehat {\beta } = \dfrac {1.6667 + 1.75}{2} = 1.7083 \text { per unit time}.\]
Problem 8.2. Show that if every observation is distinct then \(\operatorname {var}(S)\) reduces to \(\dfrac {n(n-1)(2n+5)}{18}\), and evaluate it for \(n = 10\).
Show solution
Solution. If every observation is distinct then every tied group has size \(t_p = 1\), and each term of the correction is \[t_p(t_p - 1)(2t_p + 5) = 1(0)(7) = 0 .\] The whole sum vanishes and \[\operatorname {var}(S) = \dfrac {n(n-1)(2n+5)}{18}.\] For \(n = 10\), \[\operatorname {var}(S) = \dfrac {10 \times 9 \times 25}{18} = 125,\] so the standard deviation of \(S\) is \(\sqrt {125} = 11.18\).
Problem 8.3. Take the series of Problem 1 and replace the final value \(11\) by \(1100\). Recompute \(S\) and the Theil–Sen slope. Then fit a least-squares line to both the original and the altered series. Comment on which estimate of trend survived the outlier and why.
Show solution
Solution. Replacing \(11\) by \(1100\) changes the value but not its rank: it was the largest observation and it still is. Every pairwise sign is therefore unchanged and \[S = 8 \text { exactly as before.}\] The Mann–Kendall test does not move at all.
The Theil–Sen slope moves, but modestly. Four of the ten pairwise slopes involve the altered point and become large, but they are pushed to the top of the sorted list where the median does not reach: \[\widehat {\beta }: \quad 1.7083 \longrightarrow 3.0000 .\]
Least squares has no such protection: \[\widehat {\beta }_{\text {OLS}}: \quad 1.6000 \longrightarrow 219.4000 .\]
| original | altered | factor | |
| Mann–Kendall \(S\) | \(8\) | \(8\) | \(1.00\) |
| Theil–Sen | \(1.7083\) | \(3.0000\) | \(1.76\) |
| Least squares | \(1.6000\) | \(219.4000\) | \(137.1\) |
One corrupted reading in five multiplies the least-squares slope by \(137\) and leaves the Mann–Kendall statistic untouched. This is the whole case for rank-based methods on environmental data, where a misplaced decimal point or a faulty gauge is an ordinary occurrence rather than a hypothetical one.
Problem 8.4. Explain why the continuity correction subtracts \(1\) from a positive \(S\) but adds \(1\) to a negative \(S\), and show that in both cases the effect is to reduce \(\left |Z\right |\).
Show solution
Solution. The statistic \(S\) takes only integer values, while the normal distribution used to approximate it is continuous. The correction is the usual device of treating the integer \(s\) as covering the interval \(\left (s - \tfrac 12,\ s + \tfrac 12\right )\), and here it is applied so as to shrink \(\left |S\right |\) towards zero.
For \(S > 0\) we use \(S - 1\), and since \(S > 0\), \[\left |S - 1\right | < \left |S\right | \quad \Longrightarrow \quad \dfrac {S-1}{\sqrt {\operatorname {var}(S)}} < \dfrac {S}{\sqrt {\operatorname {var}(S)}} .\] For \(S < 0\) we use \(S + 1\), and since \(S < 0\), \[\left |S + 1\right | < \left |S\right | \quad \Longrightarrow \quad \left |\dfrac {S+1}{\sqrt {\operatorname {var}(S)}}\right | < \left |\dfrac {S}{\sqrt {\operatorname {var}(S)}}\right | .\] In both cases \(\left |Z\right |\) is reduced, the \(p\)-value is enlarged, and the trend is made harder to declare. The correction can only ever be conservative: it will never turn a non-significant result into a significant one.
Problem 8.5. A series of length \(n = 45\) has significant lag-1 autocorrelation \(\rho _1 = 0.35\) and no other significant lags. Compute the variance inflation factor \(n/n^{*}\) and the effective sample size \(n^{*}\).
Show solution
Solution. Only lag \(1\) survives the significance screen, so the sum has the single term \(\ell = 1\): \[\dfrac {n}{n^{*}} = 1 + \dfrac {2}{n(n-1)(n-2)}(n-1)(n-2)(n-3)\,\rho _1 = 1 + \dfrac {2(n-3)}{n}\,\rho _1 .\] With \(n = 45\) and \(\rho _1 = 0.35\), \[\dfrac {n}{n^{*}} = 1 + \dfrac {2(42)}{45}(0.35) = 1 + 0.6533 = 1.6533 .\] Hence \[n^{*} = \dfrac {45}{1.6533} = 27.2 .\] Forty-five correlated observations carry about as much information about trend as twenty-seven independent ones. The variance of \(S\) must be multiplied by \(1.6533\), which divides \(Z\) by \(\sqrt {1.6533} = 1.286\).
Problem 8.6. Suppose the same series instead returned a single significant autocorrelation \(\rho _3 = -0.31\) at lag \(3\). Compute the unclipped inflation factor. What would the uncorrected and corrected tests conclude if \(S = 210\) and there are no ties? Which of the two is trustworthy, and why?
Show solution
Solution. With the single significant lag at \(\ell = 3\), \[\dfrac {n}{n^{*}} = 1 + \dfrac {2}{45(44)(43)}(42)(41)(40)(-0.31) = 1 + 1.6180(-0.31) = 0.4984 .\]
Now the consequences. There are no ties, so \[\operatorname {var}(S) = \dfrac {45(44)(95)}{18} = 10450, \qquad \sqrt {\operatorname {var}(S)} = 102.2 .\]
Uncorrected: \(Z = \dfrac {210 - 1}{102.2} = 2.045\), giving \(p = 0.041\) — significant at the \(5\%\) level.
With the unclipped factor: \(\operatorname {var}^{*}(S) = 10450(0.4984) = 5208\), so \(Z = 2.896\) and \(p = 0.0038\) — ten times more significant.
With the factor clipped at \(1\): unchanged from uncorrected, \(Z = 2.045\), \(p = 0.041\).
The uncorrected and the clipped results are trustworthy; the unclipped one is not. A correction for serial dependence has been allowed to strengthen the evidence, which is impossible on its own logic: dependence destroys information, it does not create it. The \(-0.31\) is almost certainly a chance artefact of the \(1.96/\sqrt {n}\) screen, and clipping is what stops it doing damage.
Problem 8.7. Twenty rain gauges are tested for trend, giving the \(p\)-values \[0.001,\ 0.002,\ 0.003,\ 0.004,\ 0.006,\ 0.008,\ 0.010,\ 0.015,\ 0.030,\ 0.045,\] \[0.06,\ 0.09,\ 0.13,\ 0.20,\ 0.28,\ 0.37,\ 0.49,\ 0.61,\ 0.77,\ 0.95 .\] At \(\alpha = 0.05\), which are significant (a) uncorrected, (b) under Bonferroni, (c) under Benjamini–Hochberg? Comment on the difference.
Show solution
Solution. Here \(m = 20\) and \(\alpha = 0.05\).
(a) Uncorrected. Reject wherever \(p < 0.05\): the first ten \(p\)-values, from \(0.001\) to \(0.045\). Ten significant — and about one of the twenty would be expected to fall below \(0.05\) by chance alone even with no trend anywhere.
(b) Bonferroni. Compare each against \(\alpha /m = 0.05/20 = 0.0025\). Only \(0.001\) and \(0.002\) survive. Two significant.
(c) Benjamini–Hochberg. Compare \(p_{(i)}\) against \(\dfrac {i}{20}(0.05) = 0.0025\,i\): \[\begin {array}{rlll} i=1: & 0.001 \leq 0.0025 & \checkmark & \\ i=2: & 0.002 \leq 0.0050 & \checkmark & \\ i=3: & 0.003 \leq 0.0075 & \checkmark & \\ i=4: & 0.004 \leq 0.0100 & \checkmark & \\ i=5: & 0.006 \leq 0.0125 & \checkmark & \\ i=6: & 0.008 \leq 0.0150 & \checkmark & \\ i=7: & 0.010 \leq 0.0175 & \checkmark & \\ i=8: & 0.015 \leq 0.0200 & \checkmark & \\ i=9: & 0.030 \leq 0.0225 & \times & \\ i=10: & 0.045 \leq 0.0250 & \times & \end {array}\] The largest \(i\) satisfying the inequality is \(k = 8\), so the eight smallest \(p\)-values are declared significant. Eight significant.
Bonferroni asks how confident we are of having made no error at all, and at \(m = 20\) that costs six genuine findings. Benjamini–Hochberg accepts that perhaps one of its eight is wrong — that is what a false discovery rate of \(5\%\) means — and recovers them. For a map of rain gauges, where the question is which stations to look at more closely, the second is the useful guarantee.
Problem 8.8. Write down, in words, why the Theil–Sen slope and the Mann–Kendall statistic must always agree in sign.
Show solution
Solution. Both quantities are built from the same \(\binom {n}{2}\) pairwise comparisons.
\(S\) counts the pairs that increase minus the pairs that decrease. The Theil–Sen estimate is the median of the pairwise slopes, and a pairwise slope \(\dfrac {x_j - x_i}{t_j - t_i}\) with \(i < j\) is positive precisely when that pair increases, since the denominator is positive.
So the pairwise slopes are positive for exactly the pairs \(S\) counts as \(+1\) and negative for exactly those it counts as \(-1\). If \(S > 0\) then more than half the slopes are positive, so the median of them is positive. If \(S < 0\) then more than half are negative and the median is negative.
Test and estimate cannot disagree, which is not true of a \(t\)-test paired with a least-squares slope on skewed data.
Prescribed Readings
- 1.
- Conover W.J., (1999) Practical non parametric statistics, \(3^{rd}\) ed. John Wiley and Sons. ISBN: 0 471 16068 7
- 2.
- Hollander M. and Wolf D.A., (1999) Non parametric statistical
methods. John Wiley and Sons. ISBN: 0 471 19045 5
Recommended Readings
- 1.
- Mood A.M., Grabill F.A. and Boes D.C., (1974) Introduction to the theory of statistics. McGraw-Hill. ISBN: 0 070 42864 5
- 2.
- Lehman E.L., (2006) Non-parametrics: Statistical methods based on ranks, McGraw-Hill. ISBN: 0 387 35212 1
For the chapter on trend
- 1.
- Mann H.B., (1945) Nonparametric tests against trend. Econometrica 13, 245–259
- 2.
- Kendall M.G., (1975) Rank Correlation Methods, 4th ed. Charles Griffin, London
- 3.
- Theil H., (1950) A rank-invariant method of linear and polynomial regression analysis. Nederl. Akad. Wetensch. Proc. 53, 386–392
- 4.
- Sen P.K., (1968) Estimates of the regression coefficient based on Kendall’s tau. J. Amer. Statist. Assoc. 63, 1379–1389
- 5.
- Hirsch R.M. and Slack J.R., (1984) A nonparametric trend test for seasonal data with serial dependence. Water Resources Research 20, 727–732
- 6.
- Hamed K.H. and Rao A.R., (1998) A modified Mann–Kendall trend test for autocorrelated data. Journal of Hydrology 204, 182–196
- 7.
- Benjamini Y. and Hochberg Y., (1995) Controlling the false discovery rate. J. Roy. Statist. Soc. B 57, 289–300
Questions on this section
Stuck on something here? Ask below and it stays attached to this topic.