Skip to content
Prev 12372 / 15274 Next

student t mixture VaR in R // imitate example 2.23 in C.Alexander: Market Risk IV

A final remark with respect to the expected shortfall:
The formula (p.133 IV.2.90) in the book of Alexander is not right either.

There are some helping analytical formulas for the ES in a book of 
Cizek, H?rdle and Weron (2011): "Statistical Tools for Finance and 
Insurance". They are helping at least once one finds out (the notation 
is a mess!) that in this book "c" and "\sigma" BOTH denote the scaling 
factor of the student t distribution (p.60f. and  p.73) and NOT the 
standard deviation.

The following syntax works fine (as to my best knowledge):


#############################################################################
# VaR and ES for bivariate student t mixtures

# arbitrary values for the two component Student t distributions:
p_quiet <- 0.9                        # mixing law
mu_quiet <- 0.5                     # first mean
mu_stress <- -0.3                    # second mean
df_quiet <- 25                        # first degrees of freedom
df_stress <- 3                            # second degrees of freedom
variance_quiet <- 0.0285^2    # first variance
variance_stress <- 1^2               # second variance
theta <- 0.01                            # coverage of VaR and ES (the 
latter being called "Expected Tail Loss" in C.Alexander)

#############################################################################
# VaR

find_quant <- function(quant) {
      (p_quiet*pt( 
(quant-mu_quiet)/sqrt(variance_quiet)*sqrt(df_quiet/(df_quiet-2))  , df 
= df_quiet)
       + (1-p_quiet)*pt( 
(quant-mu_stress)/sqrt(variance_stress)*sqrt(df_stress/(df_stress-2)) , 
df = df_stress) - theta)
}
t_mix_VaR <- -uniroot(f = find_quant, interval = c(-5, 1), 
maxiter=10000, tol = 1e-12)$root

#############################################################################
# ES

scale_quiet <-  sqrt( variance_quiet ) * sqrt( (df_quiet-2)/df_quiet )
scale_stress <-  sqrt( variance_stress ) * sqrt( (df_stress-2)/df_stress )
c_quiet <- (-t_mix_VaR-mu_quiet)/scale_quiet
c_stress <- (-t_mix_VaR-mu_stress)/scale_stress
Ttail_quiet <- dt( c_quiet ,df=df_quiet ) * (df_quiet+ c_quiet^2) / 
(df_quiet-1)
Ttail_stress <- dt( c_stress ,df=df_stress ) * (df_stress+ c_stress^2) / 
(df_stress-1)
t_mix_ETL <-  ( 1/theta*( p_quiet*( scale_quiet*Ttail_quiet - 
mu_quiet*pt(c_quiet , df=df_quiet ) )
                + (1-p_quiet)*( scale_stress*Ttail_stress  - 
mu_stress*pt(c_stress , df=df_stress ) )   ) )

### Results
t_mix_VaR
t_mix_ETL

#############################################################################







Am 4/27/2014 2:07 PM, schrieb Johannes Moser:
--