EWMA: EWMA Model

Description Usage Arguments Details Value Author(s) Examples

Description

EWMA model to estimate volatility, covariance, and correlation

Usage

1
2
EWMA(R, lambda = 0.94, initialWindow = 10, n = 10,
  type = c("volatility", "covariance", "correlation"))

Arguments

R

xts object of asset returns

lambda

smoothing parameter, must be greater than 0 or less than 1. If NULL, lambda will be estimated by minimizing the mean squared error between the estimated value and the realized value.

initialWindow

initial window of observations used in estimating the initial conditions

n

number of periods used to calculate realized volatility, covariance, or correlation.

type

estimate volatility, covariance, or correlation.

Details

If lambda=NULL, the lambda value can be estimated for univariate estimates of volatility, covariance, and correlation by minimizing the mean squared error between the estimated value and realized value.

Value

an EWMA object with the following elements

Author(s)

Ross Bennett and Thomas Fillebeen

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
# data and parameters for EWMA estimate
data(crsp_weekly)
R <- largecap_weekly[, 1:2]
mvR <- largecap_weekly[,1:4]
lambda <- 0.94
initialWindow <- 150

# volatility estimate of univariate data
lambda <- estimateLambdaVol(R[,1], initialWindow, n=10)
vol1 <- EWMA(R[,1], lambda=NULL, initialWindow, n=10, "volatility")
vol1a <- EWMA(R[,1], lambda, initialWindow, n=10, "volatility")
all.equal(vol1$estimate, vol1a$estimate)
vol1

# covariance estimate of bivariate data
lambda <- estimateLambdaCov(R, initialWindow, n=10)
cov1 <- EWMA(R, lambda=NULL, initialWindow, n=10, "covariance")
cov1a <- EWMA(R, lambda, initialWindow, n=10, "covariance")
all.equal(cov1$estimate, cov1a$estimate)
cov1

# correlation estimate of bivariate data
lambda <- estimateLambdaCor(R, initialWindow, n=10)
cor1 <- EWMA(R, lambda=NULL, initialWindow, n=10, "correlation")
cor1a <- EWMA(R, lambda, initialWindow, n=10, "correlation")
all.equal(cor1$estimate, cor1a$estimate)
cor1

# Multivariate EWMA estimate of covariance
lambda <- 0.94
cov_mv <- EWMA(mvR, lambda, initialWindow, type="covariance")
cov_mv

# Multivariate EWMA estimate of correlation
cor_mv <- EWMA(mvR, lambda, initialWindow, type="correlation")
cor_mv

GARPFRM documentation built on May 2, 2019, 5:45 p.m.

Related to EWMA in GARPFRM...