File Exchange

## EWMA St.Dev.

version 1.0.0.0 (1.24 KB) by
This code calculates the Exponentially Weighted Moving Average Standard Deviation

Updated 09 Mar 2012

Exponentially weighted moving average (EWMA) standard deviation applies different weights to different returns. More recent returns have greater weight on the variance. The exponentially weighted moving average (EWMA) introduces lambda, called the smoothing parameter. Lambda must be less than one.

### Cite As

Lorenzo Brancali (2020). EWMA St.Dev. (https://www.mathworks.com/matlabcentral/fileexchange/35539-ewma-st-dev), MATLAB Central File Exchange. Retrieved .

Marvellous function

Bnu_Jbc

Sorry, because it is not a note written in English, it is impossible to understand.

Simon

Correct me if I am wrong but this code appears to have an error.

F(i,:)=((d^(i-1))*(X(t-i,:)-mean(X))^2);

Assume d = 0.94. When i = 1, which corresponds to the most recent observation, d^i-1 = 1.0. The product of d^i-1*(1-d) which yields 0.06 should be applied to the squared return (subtract mean zero) of the most recet observation. However, with X(t-1, :) in your formula above, d^i-1*(1-d) for i = 1 is in fact applied to the next most recent observation.

Perhaps my explanation is not very clear but fundamentally when you supply say 20 returns to the formula, you shouldnt compute against 20-1 observations.

Juan Pablo Hernandez

##### MATLAB Release Compatibility
Created with R2008a
Compatible with any release
##### Platform Compatibility
Windows macOS Linux