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)

Arguments

x

Column of the time variable, either a sequence of days or decimal times, etc. Time data for one season.

y

The column of y (response variable) values plus detection limits for one season.

ycen

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.

seas

Name of a single season classification. Usually though not necessarily a text variable.

R

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).

Value

An Rx1 matrix containing an S-value for each of the R data permutations.

References

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.

See also

Examples

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,]   974
#>   [2,]   134
#>   [3,]  -272
#>   [4,] -1938
#>   [5,]    -4
#>   [6,]   114
#>   [7,]   130
#>   [8,]  -816
#>   [9,]   -94
#>  [10,]   266
#>  [11,]  -688
#>  [12,]   272
#>  [13,]   922
#>  [14,]   280
#>  [15,]   -40
#>  [16,]   418
#>  [17,]  -454
#>  [18,]    80
#>  [19,]   828
#>  [20,]   -92
#>  [21,]   886
#>  [22,]  -174
#>  [23,]   560
#>  [24,] -1106
#>  [25,]   562
#>  [26,]   442
#>  [27,]  -658
#>  [28,]  -148
#>  [29,]  -520
#>  [30,] -1080
#>  [31,]   452
#>  [32,]   110
#>  [33,]  -472
#>  [34,]   648
#>  [35,]   524
#>  [36,]    10
#>  [37,]   360
#>  [38,]  -428
#>  [39,] -1438
#>  [40,]  -930
#>  [41,]  -588
#>  [42,]   360
#>  [43,]   110
#>  [44,]   828
#>  [45,]   336
#>  [46,]   436
#>  [47,]   698
#>  [48,]   558
#>  [49,]  -144
#>  [50,]   538
#>  [51,]   284
#>  [52,]  -280
#>  [53,]   486
#>  [54,]  -296
#>  [55,]  -436
#>  [56,]  -160
#>  [57,]  -246
#>  [58,]   -14
#>  [59,]   -18
#>  [60,]  -548
#>  [61,]   206
#>  [62,]  -150
#>  [63,]  -876
#>  [64,]    62
#>  [65,]  -188
#>  [66,]   576
#>  [67,]   926
#>  [68,]   258
#>  [69,]   156
#>  [70,]    62
#>  [71,]  -706
#>  [72,]   542
#>  [73,]  -328
#>  [74,]   182
#>  [75,]  -600
#>  [76,]   380
#>  [77,]   246
#>  [78,]  -422
#>  [79,]   324
#>  [80,]  -218
#>  [81,]  -258
#>  [82,]   290
#>  [83,]  -558
#>  [84,]  1226
#>  [85,]  1432
#>  [86,]   410
#>  [87,]   306
#>  [88,]    60
#>  [89,]  -440
#>  [90,]  1328
#>  [91,]   248
#>  [92,]  -122
#>  [93,]   120
#>  [94,]  -318
#>  [95,]   176
#>  [96,]  -284
#>  [97,]   208
#>  [98,]  -150
#>  [99,]   866
#> [100,]    64