volatility: Conditional volatilities

Description Usage Arguments Details Value Author(s) References See Also Examples

Description

A function to compute the conditional volatilities of univariate and multivariate volatility models.

Usage

1
2
3
4
5
6
## S3 method for class 'UnivVola'
vola(object, ...)
## S3 method for class 'fGARCH'
vola(object, ...)
## S3 method for class 'MultiEWMA'
vola(object, ...)

Arguments

object

An object of class UnivVola, fGARCH or MultiEWMA.

...

Arguments passed to methods.

Details

Returns conditional volatilities of univariate and multivariate volatility models. In the latter case, the values in each row correspond to the square-root of the diagonal elements of the corresponding conditional variance-covariance matrix.

Value

A zoo object containing the volatilities.

Author(s)

Bernhard Eder

References

Danielsson (2011). Financial Risk Forecasting. Wiley. Chichester.

Jorion (2007). Value at Risk, 3rd. McGraw-Hill. New York.

Ruppert and Matteson (2015). Statistics and Data Analysis for Financial Engineering, 2nd. Springer. New York.

See Also

UnivVola, MultiEWMA, varcov, ccor.

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
library("zoo")

# Load returns
data("CRSPday_zoo")
y <- CRSPday_zoo

# Compute multivariate EWMA model (RiskMetrics)
EWMA <- MultiEWMA(y, center = TRUE)

# Compute variance-covariance matrix based on volatilities and correlation matrix
  # Compute relevant volatilities
  EWMAvola <- vola(EWMA)
  head(EWMAvola)
  
  # Compute conditional correlations
  EWMAcor <- ccor(EWMA, duplicates = TRUE, diagonal = TRUE)
  
  # Initialize output object
  TT <- dim(EWMAcor)[1]
  c <- sqrt(dim(EWMAcor)[2])
  VarCov <- matrix(NA, dim(EWMAcor)[1], dim(EWMAcor)[2])

  # Compute variance-covariance matrix
  for(i in 1:TT){
    VarCov[i, ] <- c(diag(as.numeric(EWMAvola[i, ])) 
                      %*% matrix(as.numeric(EWMAcor[i, ]), c, c,  byrow = TRUE) 
                      %*% diag(as.numeric(EWMAvola[i, ]))
                      )
  }
  
# Format output
VarCov <- zoo(VarCov, order.by = index(EWMAvola))

# Compare variance-covariance matrices
head(VarCov)
head(EWMA$Variances)

LFUrmutils documentation built on Jan. 3, 2020, 3 a.m.