Description
Calculates the slope, offset, and detrended standard deviation for a given data series.
Formula
First calculates the mean x (time) and y (data) values of the entire series.
Calculates sums of data and time multiplied by time re-centered around the mean time:
$$
s_{data} = \Sigma_{i=0}^n data_{i} * (time_{i} - time_{mean}) \\
s_{time} = \Sigma_{i=0}^n (time_{i} - time_{mean})^2 \\
$$
Then calculates series slope and offset:
$$
slope = \frac {s_{data}} {s_{time}} \\
offset = data_{mean} - slope * time_{mean}\\
$$
And calculates the standard deviation from the detrended data:
$$
s = \Sigma_{i=0}^n (data_{i} - offset - slope*time{i})^2 \\
\sigma = \sqrt{\frac{s}{n}}
$$
Source
Edit me