Visualizing the trend of the data

In this, we will be plotting the data, Visualizing its trend, and matching the trend.

Python3




import matplotlib.pyplot as plt
 
gfg_data = [54, 52, 53, 59, 56, 57,
            51, 52, 50, 53]
 
plt.plot(gfg_data)


Output:

Example 2: Mann-Kendall Trend  test on the trend present  in the data:

Python3




import pymannkendall as mk
 
gfg_data = [1, 2, 3, 4, 5]
 
# perform Mann-Kendall Trend Test
mk.original_test(gfg_data)


Output:

Mann_Kendall_Test(trend=’increasing’, h=True, p=0.0274863361115103, z=2.2045407685048604, Tau=1.0, s=10.0,

 var_s=16.666666666666668, slope=1.0, intercept=1.0)

Output Interpretation:

Since in the above example, the p-value is 0.027 which is less than the threshold(0.5) which is the alpha(0.5) then we fail not to reject the accepted hypothesis i.e. we do have sufficient evidence to say that sample has a trend present.

How to Perform a Mann-Kendall Trend Test in Python

In this article, we will be looking at the various approaches to perform a Mann-Kendall test in Python.

Mann-Kendall Trend Test is used to determine whether or not a trend exists in time series data. It is a non-parametric test, meaning there is no underlying assumption made about the normality of the data.

Similar Reads

Mann-Kendall Trend Test using mk.original_test() function

In this approach, the mk.original_test() function with required parameters from the pymannkendall library to conduct the Mann-Kendall Trend test on the given data in the python programming language. To install the pymannkendall library for mk.original_test() function:...

Visualizing the trend of the data

...

Visualizing the trend of the data:

In this, we will be plotting the data, Visualizing its trend, and matching the trend....

Contact Us