Computes a Kendall rank correlation S-statistic for permutations of censored data. Collectively these represent the variation in S expected when the null hypothesis is true. Called by censeaken. computeS is not expected to be of much use to users on its own.
computeS(x, y, ycen, seas = NULL, R = R)
Column of the time variable, either a sequence of days or decimal times, etc. Time data for one season.
The column of y (response variable) values plus detection limits for one season.
The y-variable indicators, where 1 (or TRUE
) indicates a detection limit in the y
column, and 0 (or FALSE
) indicates a detected value in y
.
Name of a single season classification. Usually though not necessarily a text variable.
The number of repetitions in the permutation process. R is often between 999 and 9999 (+ the 1 observed test statistic produces 1000 to 10000 realizations).
An Rx1 matrix containing an S-value for each of the R data permutations.
Helsel, D.R., Hirsch, R.M., Ryberg, K.R., Archfield, S.A., Gilroy, E.J., 2020. Statistical Methods in Water Resources. U.S. Geological Survey Techniques and Methods, book 4, chapter A3, 458p., https://doi.org/10.3133/tm4a3.
data(Brumbaugh)
#Artifical time and season variables for demonstration purposes
Brumbaugh$time=1:nrow(Brumbaugh)
Brumbaugh$sea=as.factor(round(runif(nrow(Brumbaugh),1,4),0))
with(Brumbaugh,computeS(time,Hg,HgCen,sea,R=100))
#> [,1]
#> [1,] -208
#> [2,] 20
#> [3,] 222
#> [4,] 430
#> [5,] 550
#> [6,] -96
#> [7,] 854
#> [8,] -348
#> [9,] 1132
#> [10,] -810
#> [11,] -744
#> [12,] 256
#> [13,] 768
#> [14,] 398
#> [15,] -460
#> [16,] -6
#> [17,] -324
#> [18,] -710
#> [19,] -336
#> [20,] -634
#> [21,] -72
#> [22,] 230
#> [23,] 44
#> [24,] -312
#> [25,] -154
#> [26,] -146
#> [27,] -308
#> [28,] 204
#> [29,] 850
#> [30,] -242
#> [31,] -38
#> [32,] 582
#> [33,] -54
#> [34,] -516
#> [35,] 768
#> [36,] -56
#> [37,] -322
#> [38,] 256
#> [39,] -132
#> [40,] 780
#> [41,] 192
#> [42,] -598
#> [43,] -982
#> [44,] -434
#> [45,] 554
#> [46,] -778
#> [47,] 260
#> [48,] 328
#> [49,] 888
#> [50,] 462
#> [51,] 528
#> [52,] -308
#> [53,] 892
#> [54,] -504
#> [55,] -376
#> [56,] -632
#> [57,] 1598
#> [58,] 310
#> [59,] -106
#> [60,] -168
#> [61,] 10
#> [62,] 294
#> [63,] 396
#> [64,] -104
#> [65,] -1230
#> [66,] -682
#> [67,] 142
#> [68,] -484
#> [69,] 582
#> [70,] 430
#> [71,] 190
#> [72,] 312
#> [73,] 464
#> [74,] 484
#> [75,] 404
#> [76,] -776
#> [77,] -292
#> [78,] 136
#> [79,] 858
#> [80,] 472
#> [81,] -226
#> [82,] -412
#> [83,] -50
#> [84,] 882
#> [85,] 918
#> [86,] -846
#> [87,] -792
#> [88,] -1300
#> [89,] 774
#> [90,] 758
#> [91,] 1124
#> [92,] 200
#> [93,] 470
#> [94,] -514
#> [95,] 470
#> [96,] 438
#> [97,] 472
#> [98,] -336
#> [99,] -82
#> [100,] 18