Slope

Ipaper.slope_mkFunction
slope_mk(y::AbstractVector, x::AbstractVector=1:length(y); ci=0.95)

Arguments

  • y: numeric vector
  • x: (optional) numeric vector
  • ci: critical value of autocorrelation

Return

  • Z0 : The original (non corrected) Mann-Kendall test Z statistic.

  • pval0 : The original (non corrected) Mann-Kendall test p-value

  • Z : The new Z statistic after applying the correction

  • pval : Corrected p-value after accounting for serial autocorrelation N/n*s Value of the correction factor, representing the quotient of the number of samples N divided by the effective sample size n*s

  • slp : Sen slope, The slope of the (linear) trend according to Sen test. slp is significant, if pval < alpha.

References

  1. Hipel, K.W. and McLeod, A.I. (1994), Time Series Modelling of Water Resources and Environmental Systems. New York: Elsevier Science.

  2. Libiseller, C. and Grimvall, A., (2002), Performance of partial Mann-Kendall tests for trend detection in the presence of covariates. Environmetrics, 13, 71–84, doi:10.1002/env.507.

Example

slope_mk([4.81, 4.17, 4.41, 3.59, 5.87, 3.83, 6.03, 4.89, 4.32, 4.69])

A = rand(100, 100, 30, 4)
@time r = mapslices(slope_mk, A; dims=3);
source
Ipaper.slope_pFunction
slope_p(y::AbstractVector, x::AbstractVector=1:length(y))

Reference

  1. https://zhuanlan.zhihu.com/p/642186978

Example

x = [1, 2, 3, 4, 5];
y = [2, 4, 5, 4, 6];
slope_p(y)
source