SEM¶
Running standard error of the mean using Welford's algorithm.
Parameters¶
-
ddof
Default →
1
Delta Degrees of Freedom. The divisor used in calculations is
n - ddof
, wheren
is the number of seen elements.
Attributes¶
-
n (int)
Number of observations.
Examples¶
from river import stats
X = [3, 5, 4, 7, 10, 12]
sem = stats.SEM()
for x in X:
sem.update(x)
print(sem.get())
0.0
1.0
0.577350
0.853912
1.240967
1.447219
from river import utils
X = [1, 4, 2, -4, -8, 0]
rolling_sem = utils.Rolling(stats.SEM(ddof=1), window_size=3)
for x in X:
rolling_sem.update(x)
print(rolling_sem.get())
0.0
1.5
0.881917
2.403700
2.905932
2.309401
Methods¶
get
Return the current value of the statistic.
revert
update
Update the called instance.
Parameters
- x — 'numbers.Number'
- w — defaults to
1.0