Description Usage Arguments Value Details
View source: R/calc_indices_trends.R
A function to calculate a logistic, linear or non-parametric trend of an index.
1 | calc_index_trend(index, trend, targs, time = NULL)
|
index |
Array (dim>1) of index or variable for which trend is calculated. |
trend |
Logical or character. If trend is a character string with "MannKendall" a non-parametric Mann-Kendall test is applied and a TeilSen slope estimated. |
targs |
List of arguments for calculation of trends. Depending on index or variable different methods for the trend calculations have to be chosen.
|
time |
Vector of years to base trend calculation on. If not provided and data is not a named vector or array, calculation is aborted. |
The function returns a list with two elements "statistics" and "data". Data is an array with the variable dimension and four additional dimensions for fitted trend line, upper and lower confidence interval and a local polynomial regression fitting. "statistics" is an array with the variable dimensions and additional a dimension for start year, end year, p-value, relative trend, absolute trend and trend method.
The default trend estimation and test depends on the nature of the calculated index:
For continuous data (e.g. sum, mean, prcptot, spi) by default an ordinary linear regression is calculated with time as predictor for the trend estimate and a students-t test. For not normaly distributed data (e.g.precipitation), a logarithmic transformation is applied before the trend calculation.
For count data (e.g dd, cdd, cwd) by default a logistic regression is calculated with time as predictor for the trend estimation and a students-t test. In the calculation a correction for overdispersion is applied.
If you choose trend = "MannKendall" instead of trend = TRUE the non-parametric Mann-Kendall test based on the relative ranking in the series is applied and a Theil-Sen slope is estimated. See e.g. Yue et al. 2002 or Mann (1945), Kendall (1975).
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.