Professional Documents
Culture Documents
R/Finance 2009: Applied Finance with R University of Illinois Chicago, April 25, 2009
Eric Zivot Professor and Gary Waterman Distinguished Scholar, Department of Economics Adjunct Professor, Departments of Finance and Statistics University of Washington
Outline
Hedge fund of funds environment Factor model risk measurement R implementation i l i in i corporate environment i Dealing with unequal data histories Some thoughts on S-PLUS and S+FinMetrics vs. R in Finance
Non-normal N l behavior b h i
Asymmetry (skewness) and fat tails (excess k t i) kurtosis)
Serial correlation
Performance smoothing, illiquid positions
Unequal histories
Eric Zivot 2009
Risk budgeting
Component, incremental, marginal
Commercial Products
www riskdata com www.riskdata.com www finanalytica com www.finanalytica.com
it ~ (0, 2,i )
cov( f jt , it ) = 0 for all j , i and t cov( it , jt ) = 0 for i j
Eric Zivot 2009
Practical Considerations
Many potential risk factors ( > 50) High collinearity among some factors Risk i k factors f vary across discipline/strategy di i li / Nonlinear effects Dynamic effects Time varying coefficients Common histories for factors; unequal histories for fund performance
Eric Zivot 2009
+ ik E[ Fkt ]
+ ik E [ Fkt ]
i = E [ Rit ] ( i1 E [ F1t ] +
Eric Zivot 2009
+ ik E [ Fkt ])
Variance Decomposition p
2 var( Rit ) = i var(Ft )i + var( it ) = i F i + ,i
systematic
specific
12 var(F1t ) + 22 var(F2t ) +
212 cov(F1t , F2t ) +
+ k2 var(Fkt )
+ 2k 1k cov(Fk 1t , Fkt )
Eric Zivot 2009
Covariance
R t = + B Ft + t
n 1 n 1 n k k 1 n 1
var( ( Rt ) = FM = B F B + D D = diag ( , ,
2 ,1 2 ,n
Note:
Portfolio Analysis
w = (w1,, wn ) = portfolio p weights g
R pt = w R t = w + w BFt + w t = wi Rit = wi i + wi i Ft + wi it
i =1 i =1 i =1 i =1 n n n n
= p + p Ft + pt
2 p , systematic 2 Rp = 2 p
p
B F B w
Dw
p
= w (BF Bw + Dw)
CR = w
n
p w
Components p to risk
1 CR = CR i = p
i =1
VaR = q = F ( )
1
F = CDF of returns R
Expected Shortfall (ES)
ES = E[ R | R VaR ]
R p ~ N ( p , ), = w FM w
2 p 2 p
VaR = p p z , z = ( )
N 1
ES = p p
N
( z )
CF ES :
Formula given in Boudt, Peterson and Croux (2008) "Estimation and Decomposition of Downside Risk for Portfolios with Non-Normal Returns," Journal of Risk and implementation in PerformanceAnalytics
i =1
VaR wi = wi
w
i =1
m VaR , i ,
= M simulated returns
mVaR ,i
t:Rpt =VaR
Rit , mES ,i
Eric Zivot 2009
t:Rpt VaR
Rit
Unequal Histories
Risk factors Fund performance
R1,T
R n ,T
R1,T T1 R n ,T T n
X 11316 69 -0.04 1998 2000 2002 2004 2006 2008 X 15614 45 -0.06 1998 -0.02 0.02 -0.0 08 X 153684 -0.04 0.00 00 X 104314 -0.15 -0.10 -0.05 0.00 0.05 0.00 0 0.02 0.04 -0 0.3 -0.2 -0.1 0.0 0 0.1 -0.08 -0 0.04 0.00
X 29554
X 165939
St Statistics ti ti on common histories hi t i (truncated (t t d data) d t ) may be unreliable Difficult to compute non-normal tail risk measures
Excel E l Spreadsheets xlsReadWrite R: Fit factor models RODBC Excel Spreadsheets RODBC R: Simulation, portfolio calculations, risk analysis R data files
Reports
Yes
Fit factor model : Variable selection: leaps, MASS Collinearity diagnostics: car d dynamic i regression: i d l dynlm
R data file
Stability analysis
CUSUM etc: t strucchange t h Rolling analysis: rollapply (zoo) Time Ti varying i parameters: dlm dl
Dynamic effects
dynlm, lmtest
Eric Zivot 2009
-0 .0 8
PACF
ACF
0.6 0.8 1.0 -0.2 0.0 0.2 0.4 0.6 0 0.8 1.0
Empirica al Quantiles
-0.2 0.0 0.2 0.4
-0.04
-0.02
0.00
0. .02
-2
5
-1 0
Lag
10
norm Quantiles
1
15
Density 0 10 20 30 40 50 60
1.5
X 14487 75 -0.4 -0.3 -0.2 -0.1 0.0 -0.05 0.05 0.15 0.25 -0.004 0.000 0.004
X 144874
(Intercept) (
2007
Index
2008 2009 X 144911 0.0 0.1 0.2 0.3 0
Index
2008 2009
Derive marginal distribution of Ri from p(Ri|F) and p(F) Simulate Ri and Calculate functional of interest
Unobserved p performance, , Sharpe p ratio, , ETL etc
Eric Zivot 2009
Simulation Algorithm
Draw F 1 ,, F M by resampling from the empirical distribution of F. For each F u (u = 1, 1 , M), ) draw a value R i ,u from the estimated conditional distribution of Ri given F= F u (e.g., (e g from fitted factor model assuming normal errors) M { R i ,u }u =1 is i the h desired d i d sample l for f Ri M 5000
Eric Zivot 2009
What to do with {R } ?
M i ,u u =1
Backfill missing fund performance Compute fund and portfolio performance measures Estimate non-parametric fund and portfolio tail risk i k measures Compute non-parametric risk budgeting measures Standard errors can be computed p using ga bootstrap procedure
Eric Zivot 2009
-0.05 1998
0 0.00
0.05
2000
2002 Index
2004
2006
D e n sity
1 0
2 0
3 0
4 0
5 0
6 0
-0.08
-0.06
-0.04
-0.02 Returns
0.00
0.02
0.04
References
Boudt, , K., , B. Peterson and C. Croux ( (2008) ) "Estimation and Decomposition of Downside Risk for Portfolios with NonNormal Returns," Journal of Risk Dowd, D d K K. (2002) (2002), Measuring M i Market M k Risk Ri k, John J h Wil Wiley and d Sons Goodwo Goodworth, t , T. . and a d C. Jones Jo es ( (2007). 007). Factor-based, acto based, No Nonparametric Risk Measurement Framework for Hedge Funds and Fund-of-Funds, The European Journal of Finance. Hallerback, H ll b k J. J (2003) (2003). Decomposing D i Portfolio P f li Value-at-Risk: V l Ri k A General Analysis, The Journal of Risk 5/2. Jorian, P. (2007), Value at Risk, Third Edition, McGraw Hill
Eric Zivot 2009
References
Jiang, g, Y. ( (2009). ) Overcoming g Data Challenges g in Fund-off Funds Portfolio Management, PhD Thesis, Department of Statistics, University of Washington. Lo, L A. A (2007). (2007) Hedge H d F Funds: d An A Analytic A l i Perspective P i , Princeton. Yamai, a a , Y. .a and d T. . Yoshiba os ba ( (2002). 00 ). Comparative Co pa at ve Analyses a yses of o Expected Shortfall and Value-at-Risk: Their Estimation Error, Decomposition, and Optimization, Institute for Monetary and Economic Studies, Bank of Japan. Japan