Note
Go to the end to download the full example code
Kendall
Example using your package
kendall-m_pvalue 0.8652
kendall-m_z -0.1698
kendall-m_trend_existence False
kendall-m_trend_direction no trend
kendall-x [107.28833...
kendall-model [0.8652046...
kendall-id Kendall
dtype: object
kendall test (monotonic)
==================================
statistic (z): -0.170
pvalue (manual): 0.86520
trend exists: False
trend direction: no trend
==================================
Identifier:
Kendall
9 # Libraries
10 import numpy as np
11 import pandas as pd
12
13 # Import pyAMR
14 from pyamr.core.stats.kendall import kendall
15 from pyamr.core.stats.kendall import KendallWrapper
16
17 # ----------------------------
18 # set basic configuration
19 # ----------------------------
20 # Set pandas configuration.
21 pd.set_option('display.max_colwidth', 14)
22 pd.set_option('display.width', 150)
23 pd.set_option('display.precision', 4)
24
25 # ----------------------------
26 # create data
27 # ----------------------------
28 # Constants
29 length = 100
30 offset = 100
31 slope = 10
32
33 # Create timeseries.
34 x = np.arange(length)
35 y = np.random.rand(length) * slope + offset
36
37 # ---------------------
38 # Create kendall object
39 # ---------------------
40 # Create object
41 kendall = KendallWrapper(estimator=kendall).fit(x=y)
42
43 # Print series.
44 print("\n")
45 print(kendall.as_series())
46
47 # Print summary.
48 print("\n")
49 print(kendall.as_summary())
50
51 # Print identifier
52 print("\nIdentifier:")
53 print(kendall._identifier())
Total running time of the script: ( 0 minutes 0.011 seconds)