pairwiseSNHT: Pairwise Standard Normal Homogeneity Test

Description Usage Arguments Details Value Author(s) References Examples

Description

This function performs a pairwise standard normal homogeneity test on the data supplied, as described in Menne & Williams (2009).

Usage

1
pairwiseSNHT(data, dist, k, period, crit=100, returnStat=FALSE, ...)

Arguments

data

The data to be analyzed for changepoints. It must be a data.frame and contain either two or three columns. The mandatory columns are data and location, named as such. The option column is time, and this argument will be passed to snht.

dist

A distance matrix which provides the distance between location i and location j. Rows and columns must be named with the locations in data. Note that non-symmetric distances may be used. In that case, neighbors for station i will be determined by the smallest values in the row of dist corresponding to i.

k

How many of the nearest neighbors should be used to construct pairwise difference time series? Note that more than k neighbors may be used if there are ties in the distances between locations.

period

The SNHT works by calculating the mean of the data on the previous period observations and the following period observations. Thus, this argument controls the window size for the test statistics.

crit

The critical value such that if the snht statistic is larger than crit, a changepoint is assumed to have occured. Defaults to 100, as recommended in Haimberger (see references).

returnStat

See return value. If TRUE, the snht statistics for each time point and for each difference pair are returned.

...

Additional arguments to pass to the snht function (such as robust, time, or estimator).

Details

The pairwise snht works with a set of time series. For each time series, it's closest k neighbors are determined, and a time series of the difference between each of those time series is created. The snht is then applied to each of these difference time series. Changepoints in one time series can be detected by searching for large values of the test statistic across all difference time series for a particular location.

The usefulness of the pairwise snht is that it removes any patterns in the data that could affect the basic snht. For example, seasonal and linear trends that exist globally will be removed from the difference series, and thus changepoints are more easily detected.

Value

If returnStat is TRUE, the snht statistics for each time point and for each difference pair are returned.

Otherwise, a named list is returned. The first element, data, contains the homogenized data in the same format as the supplied data. The second element, breaks, contains a data.frame where the first column is the location where a break occured, the second column is the time of the break, and the third column is the amount that data after the break was shifted by.

Author(s)

Josh Browning (jbrownin@mines.edu) keyword ~snht ~homogeneity ~pairwise

References

L. Haimberger. Homogenization of radiosonde temperature time series using innovation statistics. Journal of Climate, 20(7): 1377-1403, 2007.

Menne, M. J., & Williams Jr, C. N. (2009). Homogenization of temperature series via pairwise comparisons. Journal of Climate, 22(7), 1700-1717.

Examples

1
2
3
4
5
6
dist = matrix(1, nrow=2, ncol=2)
colnames(dist) = c(1, 2)
rownames(dist) = c(1, 2)
dist = dist - diag(2)
pairwiseSNHT(data=data.frame(data=c(rep(1, 10), rep(2, 10), rep(3, 10), rep(4, 10)),
                             location=rep(1:2, each=10)), dist=dist, k=1, period=2)

Example output

$data
   data location time
1     1        1    1
2     1        1    2
3     1        1    3
4     1        1    4
5     1        1    5
6     1        1    6
7     1        1    7
8     1        1    8
9     1        1    9
10    1        1   10
11    3        1   11
12    3        1   12
13    3        1   13
14    3        1   14
15    3        1   15
16    3        1   16
17    3        1   17
18    3        1   18
19    3        1   19
20    3        1   20
21    2        2    1
22    2        2    2
23    2        2    3
24    2        2    4
25    2        2    5
26    2        2    6
27    2        2    7
28    2        2    8
29    2        2    9
30    2        2   10
31    4        2   11
32    4        2   12
33    4        2   13
34    4        2   14
35    4        2   15
36    4        2   16
37    4        2   17
38    4        2   18
39    4        2   19
40    4        2   20

$breaks
NULL

snht documentation built on May 1, 2019, 10:05 p.m.