MCPcopy Index your code
hub / github.com/statsmodels/statsmodels / ewma

Function ewma

examples/python/recursive_ls.py:104–115  ·  view source on GitHub ↗
(series, beta, n_window)

Source from the content-addressed store, hash-verified

102
103
104def ewma(series, beta, n_window):
105 nobs = len(series)
106 scalar = (1 - beta) / (1 + beta)
107 ma = []
108 k = np.arange(n_window, 0, -1)
109 weights = np.r_[beta**k, 1, beta**k[::-1]]
110 for t in range(n_window, nobs - n_window):
111 window = series.iloc[t - n_window:t + n_window + 1].values
112 ma.append(scalar * np.sum(weights * window))
113 return pd.Series(ma,
114 name=series.name,
115 index=series.iloc[n_window:-n_window].index)
116
117
118m2_ewma = ewma(

Callers 1

recursive_ls.pyFile · 0.85

Calls 2

sumMethod · 0.80
appendMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…