Learn R Programming

HyMETT (version 1.1.3)

calc_annual_stat_trend: Calculate trend in annual statistics

Description

Calculate trend in annual statistics

Usage

calc_annual_stat_trend(data = NULL, year, value, ...)

Value

A tibble (see tibble::tibble) with test statistic, p-value, trend coefficients, and trend calculations. See Details.

Arguments

data

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

year

'numeric' vector when data = NULL, or 'character' string identifying year column name when data is specified. Year of each value in value parameter.

value

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

Details

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_stat

Mann-Kendall test statistic, returned directly from EnvStats::kendallTrendTest

p_value

z_stat p-value, returned directly from EnvStats::kendallTrendTest

sen_slope

Sen slope in units value per year, returned directly from EnvStats::kendallTrendTest

intercept

Sen slope intercept, returned directly from EnvStats::kendallTrendTest

trend_mag

Trend magnitude over entire period, in units of value, calculated as sen_slope * (max(year) \(-\) min(year))

val_beg/end

Calculated value at beginning or end of period, calculated as sen_slope * year + intercept

val_perc_change

Percentage change over period, calculated as (val_end - val_beg) / val_beg * 100

References

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

See Also

kendallTrendTest

Examples

Run this code
calc_annual_stat_trend(data = example_annual, year = "WY", value = "annual_mean")

Run the code above in your browser using DataLab