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,] -540
#> [2,] -144
#> [3,] 432
#> [4,] -350
#> [5,] -394
#> [6,] -30
#> [7,] 880
#> [8,] -144
#> [9,] -296
#> [10,] -224
#> [11,] -362
#> [12,] 524
#> [13,] -228
#> [14,] 118
#> [15,] 312
#> [16,] -1094
#> [17,] 266
#> [18,] 210
#> [19,] 248
#> [20,] -482
#> [21,] 126
#> [22,] -52
#> [23,] 1024
#> [24,] 222
#> [25,] -274
#> [26,] -316
#> [27,] 642
#> [28,] -610
#> [29,] -92
#> [30,] -106
#> [31,] -102
#> [32,] 1050
#> [33,] 596
#> [34,] 274
#> [35,] 584
#> [36,] -216
#> [37,] 528
#> [38,] -418
#> [39,] 330
#> [40,] -888
#> [41,] 354
#> [42,] -782
#> [43,] -456
#> [44,] -4
#> [45,] -166
#> [46,] 1164
#> [47,] 982
#> [48,] -240
#> [49,] 748
#> [50,] 20
#> [51,] -68
#> [52,] -1276
#> [53,] -514
#> [54,] -598
#> [55,] 22
#> [56,] -332
#> [57,] 68
#> [58,] -330
#> [59,] 124
#> [60,] -1114
#> [61,] -202
#> [62,] -358
#> [63,] 102
#> [64,] 1106
#> [65,] 780
#> [66,] 388
#> [67,] 130
#> [68,] 202
#> [69,] -242
#> [70,] -272
#> [71,] -130
#> [72,] -188
#> [73,] -722
#> [74,] 4
#> [75,] 60
#> [76,] 138
#> [77,] -30
#> [78,] 70
#> [79,] -334
#> [80,] -356
#> [81,] 388
#> [82,] -244
#> [83,] 204
#> [84,] 654
#> [85,] -672
#> [86,] 328
#> [87,] 222
#> [88,] -312
#> [89,] 150
#> [90,] -262
#> [91,] -128
#> [92,] 222
#> [93,] 400
#> [94,] 774
#> [95,] -338
#> [96,] 964
#> [97,] 206
#> [98,] 76
#> [99,] -182
#> [100,] 950