Search code examples
pythongraphitetrend

Need to analyse trend of time series data


I need to setup a check on timeseries data and report increase or decrease of trend, the data is in form of signal where static thresholding is not working, I have tried polyfit for slope calculation but its not giving correct estimation.

I have been using static threshold for 3 times in a day, because traffic volume change in 24hours(day/night)

& days trend of metric on which I need to setup a Check


Solution

  • No trend.

    enter image description here

    Linear fit shows about -0.011 slope, so you could call it "a decreasing trend", but given a measurement errors and random variation and/or unknown dependent variables - I will dare not to call it so. Very small slopes close to zero is more practical to simply consider as zero, unless it's proven that it's not a random errors source. There are some peaks, but they are not important statistically for a regression. Another argument that there's no trend at all - is that 50 degree polynomial regression shows resemblance to sin(x) plot (red line) with a confidence of 74%. So you can safely report that there is no trend, or that nothing is changing.