censeaken: Seasonal Kendall permutation test on censored data

Description Usage Arguments Value References See Also Examples

View source: R/censeaken.R

Description

Seasonal Kendall permutation test on censored data

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
censeaken(
  time,
  y,
  y.cen,
  group,
  LOG = FALSE,
  R = 4999,
  nmin = 4,
  seaplots = FALSE,
  printstat = TRUE
)

Arguments

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 TRUE) indicates a detection limit in the y.var column, and 0 (or FALSE) indicates a detected value in y.var.

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 = TRUE). To compute in original units, specify the option LOG = FALSE (or LOG = 0).

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 TRUE/FALSE option of whether to print the resulting statistics in the console window, or not. Default is TRUE.

Value

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.

References

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.

See Also

NADA::cenken

Examples

1
2
3
4
5
6
7
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))

NADA2 documentation built on April 30, 2021, 5:09 p.m.