ewma {quarks}R Documentation

Exponentially weighted moving average

Description

Estimates volatility of a return series by means of an exponentially weighted moving average.

Usage

ewma(x, lambda = 0.94)

Arguments

x

a numeric vector of asset returns

lambda

decay factor for the calculation of weights; default is 0.94

Value

Returns a numerical vector vol that contains the computed volatility.

Examples

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')

[Package quarks version 1.1.4 Index]