ewma: Exponentially weighted moving average

Description Usage Arguments Value Examples

View source: R/ewma.R

Description

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

Usage

1
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

1
2
3
4
5
6
7
prices <- DAX30$price.close
returns <- diff(log(prices))
date <- DAX30$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')

quarks documentation built on Sept. 6, 2021, 9:07 a.m.