Calculate trend in annual statistics
calc_annual_stat_trend(data = NULL, year, value, ...)A tibble (see tibble::tibble) with test statistic, p-value, trend coefficients, and
trend calculations. See Details.
'data.frame'. Optional data.frame input, with columns containing year and value.
Column names are specified as strings in the corresponding parameter. Default is NULL.
'numeric' vector when data = NULL, or 'character' string identifying year column
name when data is specified. Year of each value in value parameter.
'numeric' vector when data = NULL, or 'character' string identifying value column
name when data is specified. Values to calculate trend on.
further arguments to be passed to or from EnvStats::kendallTrendTest.
This function is a wrapper for EnvStats::kendallTrendTest with the passed equation
value ~ year. The returned values include Mann-Kendall test statistic and p-value,
Theil-Sen slope and intercept values, and trend details (Millard, 2013; Helsel and others, 2020).
z_statMann-Kendall test statistic, returned directly from
EnvStats::kendallTrendTest
p_valuez_stat p-value, returned directly from
EnvStats::kendallTrendTest
sen_slopeSen slope in units value per year, returned directly from
EnvStats::kendallTrendTest
interceptSen slope intercept, returned directly from EnvStats::kendallTrendTest
trend_magTrend magnitude over entire period, in units of value,
calculated as sen_slope * (max(year) \(-\) min(year))
val_beg/endCalculated value at beginning or end of period, calculated as
sen_slope * year + intercept
val_perc_changePercentage change over period, calculated as
(val_end - val_beg) / val_beg * 100
Millard, S.P., 2013, EnvStats: An R Package for Environmental Statistics: New York, New York, Springer, 291 p. [Also available at https://doi.org/10.1007/978-1-4614-8456-1.]
Helsel, D.R., Hirsch, R.M., Ryberg, K.R., Archfield, S.A., and Gilroy, E.J., 2020, Statistical methods in water resources: U.S. Geological Survey Techniques and Methods, book 4, chap. A3, 458 p. [Also available at https://doi.org/10.3133/tm4a3.]
kendallTrendTest
calc_annual_stat_trend(data = example_annual, year = "WY", value = "annual_mean")
Run the code above in your browser using DataLab