gs_quant.timeseries.statistics.exponential_std — gs_quant 0.1 documentation

# gs_quant.timeseries.statistics.exponential_std

`exponential_std`(x, beta=0.75)

  Exponentially weighted standard deviation

  Parameters

    - x (`Series`) – time series

    - beta (`float`) – how much to weigh the previous price in the time series, thus controlling how much importance we place on the (more distant) past. Must be between 0 (inclusive) and 1 (exclusive)

  Return type

    `Series`

  Returns

    time series of standard deviation of the input series

  Usage

  Provides an unbiased estimator of exponentially weighted standard deviation of a series [\(X_0\), \(X_1\), \(X_2\), …]:

  \(S_t = \sqrt{[EWMA(X_t^2) - EWMA(X_t)^2] * DF_t}\)

  where \(EWMA(X_t)\) is the exponential moving average at \(t\) (see function `exponential_moving_average()`), \(DF_t\) is the debiasing factor (see Weighted sample variance for further details):

  \(DF_t = \frac{(\sum_{i=0}^t w_i)^2} {(\sum_{i=0}^t w_i)^2 - \sum_{i=0}^t w_i^2}\)

  where \(w_i\) is the weight assigned to \(i\) th observation:

  \(w_i = (1-\beta)\beta^i\) for i<t; \(\beta^i\) for i=t

  Examples

  Generate price series and compute exponentially weighted standard deviation of returns

      >>> prices = generate_series(100)
      >>> exponential_std(returns(prices), 0.9)

  See also

  `std()` `var()` `exponential_moving_average()`