ewmStd#

swordfish.function.ewmStd()#

Calculate exponentially weighted moving standard deviation.

Exactly one of the parameters com, span, halfLife and alpha must be specified.

Parameters:
  • X (Constant) – A numeric vector.

  • com (Constant, optional) – A non-negative floating number and specifies decay in terms of center of mass. alpha=1/(1+com) where alpha is the decay factor.

  • span (Constant, optional) – A positive floating number larger than 1 and specifies decay in terms of span. alpha=2/(span+1).

  • halfLife (Constant, optional) – A positive floating number and specifies decay in terms of half-life. alpha=1-exp(log(0.5)/halfLife).

  • alpha (Constant, optional) – A floating number between 0 and 1 and directly specifies decay.

  • minPeriods (Constant, optional) – An integer indicating the minimum number of observations in window required to have a value (otherwise result is NULL). The default value is 0.

  • adjust (Constant, optional) –

    A Boolean value. The default value is true.

    • If adjust=true, the weights are (1-alpha)^(n-1), (1-alpha)^(n-2), …, 1-alpha, 1 divided by their sum.

    • If adjust=false, the weights are (1-alpha)^(n-1), (1-alpha)^(n-2)*alpha, (1-alpha)^(n-3)*alpha^2,…, (1-alpha)*alpha, alpha.

  • ignoreNA (Constant, optional) – A Boolean value indicating whether to ignore missing values. The defaut value is false.

  • other (Constant, optional) – A numeric vector of the same length as X.

  • bias (Constant, optional) – A Boolean value indicating whether the result is biased. The default value is false, meaning the bias is corrected.