AutoCorr¶
Measures the serial correlation.
This method computes the Pearson correlation between the current value and the value seen n
steps before.
Parameters¶
- lag (int)
Attributes¶
- name
Examples¶
The following examples are taken from the pandas documentation.
>>> from river import stats
>>> auto_corr = stats.AutoCorr(lag=1)
>>> for x in [0.25, 0.5, 0.2, -0.05]:
... print(auto_corr.update(x).get())
0
0
-1.0
0.103552
>>> auto_corr = stats.AutoCorr(lag=2)
>>> for x in [0.25, 0.5, 0.2, -0.05]:
... print(auto_corr.update(x).get())
0
0
0
-1.0
>>> auto_corr = stats.AutoCorr(lag=1)
>>> for x in [1, 0, 0, 0]:
... print(auto_corr.update(x).get())
0
0
0
0
Methods¶
get
Return the current value of the statistic.
update
Update and return the called instance.
Parameters
- x (numbers.Number)