ewma | R Documentation |
Estimates volatility of a return series by means of an exponentially weighted moving average.
ewma(x, lambda = 0.94)
x |
a numeric vector of asset returns |
lambda |
decay factor for the calculation of weights; default is |
Returns a numerical vector vol
that contains the computed
volatility.
prices <- DAX$price_close
returns <- diff(log(prices))
date <- DAX$ref_date[-1]
cvar <- ewma(x = returns, lambda = 0.94)
csig <- sqrt(cvar)
plot(date, csig, type = 'l',
main = 'conditional standard deviations for the DAX30 return series')
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.