pandas.stats.moments.ewmcov¶
- pandas.stats.moments.ewmcov(arg1, arg2=None, com=None, span=None, halflife=None, min_periods=0, bias=False, freq=None, pairwise=None, how=None)¶
Exponentially-weighted moving covariance
Parameters : arg1 : Series, DataFrame, or ndarray
arg2 : Series, DataFrame, or ndarray, optional
if not supplied then will default to arg1 and produce pairwise output
com : float. optional
Center of mass: ,
span : float, optional
Specify decay in terms of span,
halflife : float, optional
Specify decay in terms of halflife,
min_periods : int, default 0
Number of observations in sample to require (only affects beginning)
freq : None or string alias / date offset object, default=None
Frequency to conform to before computing statistic
adjust : boolean, default True
Divide by decaying adjustment factor in beginning periods to account for imbalance in relative weightings (viewing EWMA as a moving average)
how : string, default ‘mean’
Method for down- or re-sampling
pairwise : bool, default False
If False then only matching columns between arg1 and arg2 will be used and the output will be a DataFrame. If True then all pairwise combinations will be calculated and the output will be a Panel in the case of DataFrame inputs. In the case of missing elements, only complete pairwise observations will be used.
Returns : y : type of input argument
Notes
Either center of mass or span must be specified
EWMA is sometimes specified using a “span” parameter s, we have that the decay parameter is related to the span as
where c is the center of mass. Given a span, the associated center of mass is
So a “20-day EWMA” would have center 9.5.