calc_index_trend: A function to calculate a logistic, linear or non-parametric...

Description Usage Arguments Value Details

View source: R/calc_indices_trends.R

Description

A function to calculate a logistic, linear or non-parametric trend of an index.

Usage

1
calc_index_trend(index, trend, targs, time = NULL)

Arguments

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.

  • method Three methods are available: (1) logit ("log_reg") or (2) linear regression ("lin_reg") or (3) "MannKendall" calculates a TheilSen slope and a MannKendall test.

  • count set to TRUE, if the data is count data.

  • NAmaxTrend Maximum value of NAs for calculation of trend. If value is exceeded, trend is set to NA.

time

Vector of years to base trend calculation on. If not provided and data is not a named vector or array, calculation is aborted.

Value

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.

Details

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


Climandes/ClimIndVis documentation built on Oct. 24, 2021, 10:52 a.m.