Get WRTDS trends using seasonal Kendall tests

wrtdstrnd_sk(dat_in, ...)

# S3 method for default
wrtdstrnd_sk(dat_in, mobrks, yrbrks, molabs, yrlabs, ...)

# S3 method for tidal
wrtdstrnd_sk(
  dat_in,
  mobrks,
  yrbrks,
  molabs,
  yrlabs,
  tau = NULL,
  trndvar = "norm",
  ...
)

# S3 method for tidalmean
wrtdstrnd_sk(dat_in, mobrks, yrbrks, molabs, yrlabs, trndvar = "bt_norm", ...)

Arguments

dat_in

input tidal or tidalmean object which must already have fitted model data

...

methods passed to or from other methods

mobrks

list of month groupings where each month is an integer from 1 to 12, see examples

yrbrks

numeric vector of breaks for years, see examples

molabs

character vector of names for month breaks, see examples

yrlabs

character vector of names for year breaks, see examples

tau

numeric vector of quantile for estimating trends

trndvar

chr string of variable for trend evaluation, usually back-transformed, flow-normalized results, see details

Value

A data.frame with summary trends for each grouping, including med as the median value for the period of observation, tau as the magnitude and direction of the trend, slope as the Thiel-Sen slope for change per year, chitest as the significance test evaluating heterogeneity between seasons, ztest indicating significance of the overall trend, and perchg as 100 multiplied by the ratio of the annual slope to the median estimate of the time period (percent change per year).

As noted in kendallSeasonalTrendTest, the overall test is not appropriate if chitest indicates a small p-value.

Details

Trends are based on kendallSeasonalTrendTest for user-specified time periods. In general, the seasonal Kendall test evaluates monotonic trends using a non-parametric approach that accounts for seasonal variation in the time series.

All trends are based on back-transformed, flow-normalized results by default. The variable for evaluating trends can be changed with 'trndvar' as 'res', 'norm', or 'fit' for tidal objects and as 'res', 'bt_norm', or 'bt_fits' for tidalmean objects. In all cases, back-transformed variables are evaluated.

The user must supply the annual and monthly aggregation periods to the appropriate arguments. These are passed to cut and are left-open, right-closed along the interval.

References

Hirsch, R.M., Slack, J.R., Smith, R.A. 1982. Techniques of trend analysis for monthly water quality data. Water Resources Research, 18:107-121.

Millard, S. P. 2013. EnvStats: An R Package for Environmental Statistics. Springer, New York.

Examples

## load a fitted model object
data(tidfit)
data(tidfitmean)

## get trends

# setup month, year categories
mobrks <- list(c(1, 2, 3), c(4, 5, 6), c(7, 8, 9), c(10, 11, 12))
yrbrks <- c(1973, 1985, 1994, 2003, 2012)
molabs <- c('JFM', 'AMJ', 'JAS', 'OND')
yrlabs <- c('1974-1985', '1986-1994', '1995-2003', '2004-2012')

wrtdstrnd_sk(tidfit, mobrks, yrbrks, molabs, yrlabs)
#> Warning: `cols` is now required when using `unnest()`.
#>  Please use `cols = c(med, tau, slope, chitest, ztest)`.
#> Warning: `cols` is now required when using `unnest()`.
#>  Please use `cols = c(med, tau, slope, chitest, ztest)`.
#>         cat       med        tau       slope      chitest        ztest
#> 1 1974-1985 21.171745 -0.4882334 -0.62562353 2.368091e-02 5.398681e-12
#> 2 1986-1994 11.360865 -0.9766355 -0.40860507 1.000000e+00 2.627767e-36
#> 3 1995-2003  9.246354 -0.9166667 -0.14861032 9.996939e-01 1.364710e-32
#> 4 2004-2012  8.717610  0.1990741  0.02080644 7.639788e-07 1.052157e-02
#> 5       JFM  7.372369 -0.9508020 -0.31484132 9.802877e-01 8.455010e-49
#> 6       AMJ 10.819629 -0.8347669 -0.30022373 8.774386e-01 2.308578e-37
#> 7       JAS 17.679262 -0.7595646 -0.33248583 9.544791e-01 1.683405e-31
#> 8       OND 12.055548 -0.8586627 -0.28668848 7.801474e-01 1.104585e-36
#>       perchg
#> 1 -2.9549928
#> 2 -3.5966017
#> 3 -1.6072316
#> 4  0.2386714
#> 5 -4.2705583
#> 6 -2.7748061
#> 7 -1.8806545
#> 8 -2.3780626
wrtdstrnd_sk(tidfitmean, mobrks, yrbrks, molabs, yrlabs)
#> Warning: `cols` is now required when using `unnest()`.
#>  Please use `cols = c(med, tau, slope, chitest, ztest)`.
#> Warning: `cols` is now required when using `unnest()`.
#>  Please use `cols = c(med, tau, slope, chitest, ztest)`.
#>         cat       med        tau       slope   chitest        ztest     perchg
#> 1 1974-1985 22.198997 -0.6890992 -0.78412359 0.1017271 1.697431e-23 -3.5322478
#> 2 1986-1994 12.555580 -0.9385848 -0.40268622 0.9979971 1.118780e-33 -3.2072292
#> 3 1995-2003 10.124687 -0.9398148 -0.17426990 0.9918695 3.554650e-34 -1.7212374
#> 4 2004-2012  9.329409 -0.2638889 -0.07575692 0.0000000 6.716431e-04 -0.8120227
#> 5       JFM  8.301696 -0.9972532 -0.35058696 0.9946647 1.563265e-53 -4.2230762
#> 6       AMJ 11.446765 -0.9567656 -0.37814440 0.8472119 1.454361e-48 -3.3035047
#> 7       JAS 20.415325 -0.7883110 -0.37436019 0.9156738 8.225853e-34 -1.8337214
#> 8       OND 13.537128 -0.9005979 -0.33969478 0.7074333 4.224367e-40 -2.5093563