Seasonal Kendall permutation test on censored data
censeaken( time, y, y.cen, group, LOG = FALSE, R = 4999, nmin = 4, seaplots = FALSE, printstat = TRUE )
time | Column of the time variable, either a sequence of days or decimal times, etc. Will be the scale used for time in the trend analysis. |
---|---|
y | The column of y (response variable) values plus detection limits |
y.cen | The y-variable indicators, where 1 (or |
group | Column of the season classifications. A factor in R, so usually though not necessarily a text variable. If numeric, define as a factor before running the script. |
LOG | Indicator of whether to compute the trend analysis in the original y units, or on their logarithms. The default is to use the logarithms (LOG = |
R | The number of repetitions in the permutation process. R is often between 999 and 9999 (adding +1 to represent the observed test statistic produces 1000 to 10000 repetitions). By default R=4999. Increasing R results in lower variation in the p-values produced between runs. |
nmin | The minimum number of observations needed for the entire time period to be tested, per season. For example, with 1 sample per year per season over an 8-year period, you have 8 observations for each season. You can increase this number if you want a higher minimum. Don’t decrease it below the default of 4. If there are fewer than nmin values that season is skipped and not included in the overall test and a note of this will be printed in the console. |
seaplots | In addition to the plot of the overall Seasonal Kendall trend line, plots of the trend in individual seasons can also be drawn. |
printstat | Logical |
Prints the Kendall trend test results for each season individually. The overall Seasonal Kendall test and Theil-Sen line results are both printed and returned.
If seaplots=TRUE
each season's trend line will be plotted seperately. A plot of the overall Seasonal Kendall (Akritas-Theil-Sen) line is always plotted.
If seaplots=FALSE
only the overall Seasonal Kendall (Akritas-Theil-Sen) line will be plotted on a data scatterplot.
Helsel, D.R., 2011. Statistics for censored environmental data using Minitab and R, 2nd ed. John Wiley & Sons, USA, N.J.
Hirsch, R.M., Slack, J.R., Smith, R.A., 1982. Techniques of Trend Analysis for Monthly Water Quality Data, Water Res. Reseach 18, 107-121.
# \donttest{ data(Brumbaugh) # Artificial 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,censeaken(time,Hg,HgCen,sea,seaplots = TRUE))#> #> DATA ANALYZED: Hg vs time by sea #> ----------#> Season N S tau pval Intercept slope #> 1 1 25 7 0.0233 0.88841 0.1786 0.0001333 #> ----------#> Season N S tau pval Intercept slope #> 1 2 41 31 0.0378 0.73566 0.24865 0.0002793 #> ----------#> Season N S tau pval Intercept slope #> 1 3 54 -93 -0.065 0.49196 0.28531 -0.0006268 #> ----------#> Season N S tau pval Intercept slope #> 1 4 13 -34 -0.436 0.044084 0.29485 -0.001527 #> ---------- #> Seasonal Kendall test and Theil-Sen line#> reps_R N S_SK tau_SK pval intercept slope #> 1 4999 133 -89 -0.0339 0.6046 0.25022 -0.0004083 #> ----------# }