You are on page 1of 20

Programming in Finance Using R

Lille Campus: Dr. Paolo MAZZA, PhD, HDR


Paris Campus: Dr. Alexandre RUBESAM, PhD
IESEG School of Management
Second Mission

The second mission deals with performance analysis.

We will first go through a set of introductory elements before getting to


the mission.

The purpose of this short introduction is not to be exhaustive on


performance analysis but to provide necessary elements to be able
to code in R.

Many thanks to Mikael Petitjean who has inspired much of these slides
Some theoretical elements
Traditional Measures

• Jensen’s alpha
• The Sharpe ratio
• The Information ratio
• The Treynor ratio
• Functional relationships
• Scope and use of these measures
1. Jensen’s alpha
According to the CAPM, no security should be above nor below
the SML, that is, every asset is fairly priced.
Jensen’s alpha is positive (negative) when the average return
on a portfolio is above (below) that predicted by the CAPM,
given the portfolio's beta and the average market return.
Jensen's measure is one of the ways to help determine if a
portfolio is earning the proper return for its level of risk. If alpha
is positive, then the portfolio is earning excess returns i.e. the
fund manager "beats the market" thanks to his or her stock
picking / tactical allocation skills.
__ __________ __
 i  Ri  E ( Ri )  ( Ri  RF )  [ E ( Ri )  RF ]
 Realized Risk Premium - Expected Risk Premium
__________ ___________
 ˆ i  ( Ri  RF )  ˆi ( RM  RF )
 Realized Risk Premium - Estimated Risk Premium
2. The Sharpe Ratio
Measures the “excess return per unit of volatility” for a well-
diversified portfolio P. The return (numerator) is defined as the
incremental average return of an investment over the risk free rate.
Risk (denominator) is defined as the standard deviation of the
investment returns.
RP  RF
SP 
P
The Sharpe ratio is a measure of the slope of the line relating the
risk-free rate and the risk-return characteristics of a well-diversified
risky investment.

The Sharpe ratio should be used to compare well-diversified


portfolios, but not to decide on the inclusion of individual assets (or
portfolios still containing unsystematic risk) within a portfolio.
3. The Information Ratio

Sharpe (1994) provided a new interpretation if the risk-free rate is


replaced by a index used as benchmark (B)
The difference RP – RB represents the return of a zero-cost strategy,
being long in P and short in B
n

 n 1 n
IRP  t 1
Pt

P with TEP   P [ 
T 1 t 1
(  Pt   P ]
) 2 1/ 2

 P
TEP

where DPt = RPt – RBt (i.e. return premium over the


benchmark index return) and sD is the tracking error w.r.t.
the index (also called, residual risk)
This is typically the version used to rank competing trackers or to
rank well-diversified portfolios
Requirement: a single reliable benchmark index must be clearly
identified ex ante for the comparison to be meaningful
3. The Information Ratio

Graphical interpretation

RP-RB

Benchmark
TEP

The benchmark is a passive portfolio.


Both A and B have greater return than the market
B has a better excess return per unit of residual risk (tracking
error) than A.
4. The Treynor Ratio
The Treynor ratio reflects the (annualized geometric mean of)
portfolio excess return per unit of systematic risk.

RP  RF RP  RF
TRP  ModifiedTRP 
P  P * '( RP  RF )
Useful to combine funds into a well-diversified portfolio
Active portfolio managers typically use the Treynor-Black version
with abnormal return (= alpha) in the numerator.
TRP   P / P
This version is appropriate when comparing active funds meant to
be grouped in a portfolio in which unsystematic risk will be
diversified away.
Note that a very low denominator (= low beta) implies a very high
(absolute) value of the ratio.
However, a low beta typically goes along with a low significance
(R²) of the regression, which casts doubt on the significance of the
performance.
Extensions and alternatives
The CAPM has given rise to:

1. Alternative measures (to the traditional ones)


 Other ways to express information and measure
performance
 Measures that address some pitfalls of the CAPM into
account (e.g. taking market timing into account)
2. Extensions of the traditional measures
 The Sharpe ratio

 Jensen’s alpha;

 The Treynor ratio.

Then, some totally different measure rely on the structure of


investor preferences or alternative distributional assumptions.
2. Extensions of the Sharpe ratio
2.2.1. Downside risk measures
2.2.1.1 Sortino ratio
Sortino revisits the Sharpe ratio but
On the denominator, it focuses on downside risk through the
“downside deviation” (DD).

RP  RFL
Sortino P 
DD P
The downside deviation (sometimes called ‘downside risk’) looks
like the semi-deviation except that the deviations are taken from the
R L:

DDP 
1 T
 RP,t  RFL 2
T t 1
where RP,t  RL
F
2. Extensions of the Sharpe ratio
2.2.1.3. Drawdown Ratios
A drawdown is the maximum loss that can be realized by buying
at the peak and selling at the bottom (from peak to valley) over
some sub-period of time.
The next sub-period of time starts when the previous peak is
“recovered” (i.e. exceeded)
The maximum drawdown is the maximum of all these
drawdowns over the whole sample period
Drawdowns are rather difficult to compute in a simple
spreadsheet
2. Extensions of the Sharpe ratio
2.2.2. Sharpe Ratio (or Return) over VaR

Instead of considering the standard deviation of return in the


denominator, we can use the Value-at-Risk (VaR)

A “N-days a% VaR” answers the following question: “What is the loss


level that should not be exceeded in N business days at a a%
confidence level?”

Hence, VaR can be customized to different time periods and/or different


confidence levels. For example, 10-days 95% VaR =

VaRP,   E ( RP )  Z1 ( RP )   R10days  1.645 R10 days


2. Extensions of the Sharpe ratio
If 10-day 95% VaR = 8 million implies that:

 I should be 95% confident I won’t lose more than 8


millions in the next 10 trading days
 There is 95% chance that my loss will be smaller than 8
millions in the next 10 days
 There is 5% chance that my loss will be larger than 8
millions in the next 10 days
 Unanswered question: How much I could lose in that 5%
scenarios?
2. Extensions of the Sharpe ratio
VaR can also be computed in many different ways: Historical VaR,
Gaussian VaR, MC VaR, Kernel VaR, modified VaR
“Modified VaR” (or C-F VaR) is the Cornish-Fisher correction for VaR
 For alternative investments, the notions of (positive or
negative) asymmetry and fat tails do make sense.
 They can be captured by skewness (Sk) and excess kurtosis
(K = Ku - 3). See next graph. For the normal distribution, these
indicators are normalized to 0, whatever the expectation and
standard deviation.
 The VaR measure can be modified to account for nonzero
skewness and kurtosis through the Cornish-Fisher formula:
MVaRP,   E ( RP )  z1 ( RP )

z1  Z1 
6

1 2

Z1  1 Sk 
24

1 3

Z1  3Z1 K 
1
36
 
2Z13  5Z1 Sk 2

Operationally, pick the quantile of the standard normal and recompute a


modified quantile that accounts for the higher moments.
2. Extensions of the Sharpe ratio

Negative skewness (Sk < 0)


= the left tail is longer
= lower probability of a huge gain /
higher probability of a huge loss
(w.r.t positive skewness)
(not desirable, ceteris paribus)

High kurtosis (Ku > 3)


= heavy tails
= more density in the tails
(not desirable, ceteris paribus)
2. Extensions of the Sharpe ratio
The Expected Shortfall (ES) is often preferred
Because VaR does not provide any information about the shape of
the tail or the expected size of loss beyond the confidence level
ES = expected tail loss (ETL) = (Expected) Tail VaR = Conditional VaR
(CVaR)
If the underlying distribution for RP is a continuous distribution,

𝐸𝑆𝛼 𝑅𝑃 = 𝐸 𝑅𝑃 𝑅𝑃 ≤ 𝑉𝑎𝑅𝛼 𝑅𝑃 ]
The Mission
The Mission

Check your emails.

I have been told that your boss sent something…


The Mission

Hint:
Use at least the following packages:
PerformanceAnalytics, zoo, quantmod

Read the PerformanceAnalytics documentation

You might also like