29
A. Ruckstuhl -- WBL 2017, Lecture 3 of SAoFD -- Page 1 Blockkurs Statistical Analysis Statistical Analysis of Financial Data of Financial Data Prof. Dr. Andreas Ruckstuhl Prof. Dr. Andreas Ruckstuhl Dozent für Statistische Datenanalyse Dozent für Statistische Datenanalyse Institut für Datenanalyse und Prozess Design IDP Institut für Datenanalyse und Prozess Design IDP Zürcher Hochschule für Angewandte Wissenschaften ZHAW Zürcher Hochschule für Angewandte Wissenschaften ZHAW [email protected] [email protected] 23. Januar 2017 23. Januar 2017

Statistical Analysis of Financial Data · EM.sol2

Embed Size (px)

Citation preview

Page 1: Statistical Analysis of Financial Data · EM.sol2

A. Ruckstuhl -- WBL 2017, Lecture 3 of SAoFD -- Page 1

Blockkurs

Statistical Analysis Statistical Analysis of Financial Dataof Financial Data

Prof. Dr. Andreas RuckstuhlProf. Dr. Andreas RuckstuhlDozent für Statistische DatenanalyseDozent für Statistische Datenanalyse

Institut für Datenanalyse und Prozess Design IDPInstitut für Datenanalyse und Prozess Design IDPZürcher Hochschule für Angewandte Wissenschaften ZHAWZürcher Hochschule für Angewandte Wissenschaften ZHAW

[email protected]@zhaw.ch23. Januar 201723. Januar 2017

Page 2: Statistical Analysis of Financial Data · EM.sol2

A. Ruckstuhl -- WBL 2017, Lecture 3 of SAoFD -- Page 2

Your Lecturer

  Name: Andreas Ruckstuhl

  Civil Status: Married, 2 children

  Education:   Dr. sc. math. ETH

Position: Professor of Statistical Data Analysis, ZHAW WinterthurLecturer, WBL Applied Statistics, ETH Zürich

Connection: More than fifteen years of cooperation with Peter Meier,   Centre for Asset Management, ZHAW

One of the central topics is “alternative investments”,but also multi factor models and index construction

Page 3: Statistical Analysis of Financial Data · EM.sol2

A. Ruckstuhl -- WBL 2017, Lecture 3 of SAoFD -- Page 3

• Lecture 1: Financial Data and Their Properties

• Lecture 2: Model for Conditional Heteroskedasticity and Risk Measures

• Lecture 3: Statistical Issues When Applying Portfolio Theory– Portfolio Theory– Estimating =E(R) and σR

– Effects of Estimation Error on the Optimal Portfolio

• Lecture 4: Financial Factor Models

• Lecture 5: Copulas

Page 4: Statistical Analysis of Financial Data · EM.sol2

A. Ruckstuhl -- WBL 2017, Lecture 3 of SAoFD -- Page 4

How should we invest our wealth?

Portfolio theory is based upon two principles:

• Maximize the expected return; and

• Minimize the riskdefined as the standard deviation (also called volatility) of the returns in standard modern finance

 

• These goals are (somewhat) at odds:

  riskier assets generally have a higher expected return

• Without risk premiums, few investors would invest in risky assets

risk premium is the difference between expected return of a risky asset and the risk‐free rate

Page 5: Statistical Analysis of Financial Data · EM.sol2

A. Ruckstuhl -- WBL 2017, Lecture 3 of SAoFD -- Page 5

• A key concept:Reduction of risk by diversifying the portfolio of assets held

➔ Faced with the problem of constructing an investment portfolio that we hold for one time period (=holding period)

➔ Holding period = one day, one month, one quarter, one year, 10 years , …

➔ At the end of the holding period we might want to readjust the portfolio

Page 6: Statistical Analysis of Financial Data · EM.sol2

A. Ruckstuhl -- WBL 2017, Lecture 3 of SAoFD -- Page 6

A simple case: Two risky assets• With returns R1 and R2 

and expected returns 

• Mix them in proportion w and (1‐w), respectively

• The return on the portfolio is 

• The expected return on the portfolio is

• Let ρ12 be the correlation between R1 and R2 

the variance of the returns on the portfolio RP is

where the covariance σ 12 equals ρ12 σ 1 σ 2 

• In vector notation: 

1 1 2 2andE R E R

1 2(1 )pR wR w R

1 2(1 )pE R w w

2 2 2 2 21 2 12(1 ) 2 (1 )p PVar R w w w w

Page 7: Statistical Analysis of Financial Data · EM.sol2

A. Ruckstuhl -- WBL 2017, Lecture 3 of SAoFD -- Page 7

Example:

In Fig.: all points are graphed when  w[0,1] and  is ‐0.4 (green), 0 (black) and +0.4 (blue)→ shape of the por olio fron er depends  on the correlation ρ.• If ρ=1 → there is no benefit from diversifica on• If ρ=‐1 → there exists a por olio weight w such that 

σp2=0 

The left most point on each curve achieves the minimum value of risk and is called minimum variance portfoliominimum variance portfolio

Using differential calculus, one can easily derive the proportion w from the expression for P   thereof  the minimum variance portfolio  (red point on the curve)cf. Exercise 1, or in general Appendix A.

1 2 1 20.14, 0.08, 0.2, 0.15

,P P PE R

The points on each curve that have an expected return at least as large as the minimum variance portfolio are called the efficient frontierefficient frontier

At R1: w=0;  at R2: w=1

0.08 0.10 0.12 0.14 0.16 0.18 0.20

0.08

0.09

0.10

0.11

0.12

0.13

0.14

Risk P

Exp

exte

d R

etur

n P

R1

R2

=-0.4 =0 =0.4

Page 8: Statistical Analysis of Financial Data · EM.sol2

A. Ruckstuhl -- WBL 2017, Lecture 3 of SAoFD -- Page 8

Combining two Risky Assets with a Risk‐Free Asset• Let Rf be the risk‐free asset:  E(Rf)=f  and  Var(Rf) = 0

• Assume f=0.06  In Fig: F represents the risk‐free asset•   for a portfolio consisting of a fixed portfolio of two risky 

assets and the risk‐free asset is a line connecting F with a point on the efficient frontier

,P P PE R

• The slope of each line is called its Sharpe’s ratioSharpe’s ratio::

• T on the efficient frontier represents the portfolio highest Sharpe’s ratio. 

• It is the optimal portfolio for the purpose of mixing with the risk‐free asset. 

• T is called the tangency portfoliotangency portfolio

p f

p

E R

0.00 0.05 0.10 0.15 0.20

0.06

0.08

0.10

0.12

0.14

Risk P

Exp

exte

d R

etur

n P

RF

R1

R2

T

Page 9: Statistical Analysis of Financial Data · EM.sol2

A. Ruckstuhl -- WBL 2017, Lecture 3 of SAoFD -- Page 9

Optimality ResultThe optimal or efficient portfolios mix the tangency portfolio with the risk‐free asset. Each efficient portfolio has two properties:

• It has a higher expected return than any other portfolio with the same or smaller risk, and

• It has a smaller risk than any other portfolio with the same or higher expected return.

How to find the tangency portfolio?

The proportion wT for the tangency portfolio is

where V1= 1 ‐ f and V2= 2 ‐ f  (called excess expected returns)

 Can maximize expected returns subject to a lower bound on the risk,  or minimize the risk subject to a lower bound on the expected returns   by mixing F and T (i.e., find the point on [F,T] which satisfies the constraint)   

2

1 2 2 12 1 22 2

1 2 2 1 1 2 12 1 2T

V VwV V V V

Page 10: Statistical Analysis of Financial Data · EM.sol2

A. Ruckstuhl -- WBL 2017, Lecture 3 of SAoFD -- Page 10

Risk‐free interest rate f:

• While the term "risk‐free interest rate" is an established concept in the theory of financial markets, there are no regulations on how to determine it and, as such, it is not officially established.

• Proxies for the risk‐free rate: Use the returns on domestically held short‐dated government bonds(e.g., US Treasury bill rates, Geldmarktbuchforderungen (GMBF) der Schweizerischen Eidgenossenschaft)However, government bonds may be risky as well ….

• In practice, of course, very few (if any) borrowers have access to finance at the risk free rate.

Note that the issue of “risk‐free interest rate” is not a statistical issue but rather a conceptual issue in finance 

Page 11: Statistical Analysis of Financial Data · EM.sol2

A. Ruckstuhl -- WBL 2017, Lecture 3 of SAoFD -- Page 11

What should we use as the values of =E(R) and σR?

• If returns on the asset are assumed to be stationary, then we can take a time series of past returns and use the 

– sample mean and – standard deviation.

  Whether the stationary assumption is realistic is always debatable …

• How far back in time should one gather data?A long series, say 10 or 20 years, will give much less variable estimates.However, if the series is not stationary but rather has slowly shifting parameters, then a shorter series (maybe 1 or 2 years) will be more representative of the future…… and almost every time series of returns is nearly stationary over short enough time periods.

Page 12: Statistical Analysis of Financial Data · EM.sol2

A. Ruckstuhl -- WBL 2017, Lecture 3 of SAoFD -- Page 12

Example: Allocate capital to the equity markets of ten different countries: 

MSCI Hong Kong, MSCI Singapore, MSCI Brazil, MSCI Argentina, MSCI UK, MSCI Germany, MSCI Canada, MSCI France, MSCI Japan, S&P 500 (USA). 

We use monthly data from January 1988 to January 2002, inclusive.  “MSCI” = “Morgan Standley Capital  Index”; “S&P” = “Standard and Poors.” 

In R:# Prepare Data (be careful with log-returns/returns/%)> dat <- read.table("EquityMarkets.txt",header=T)[,4:13]> n <- nrow(dat)> R <- (dat[2:n,]/dat[1:(n-1),] - 1) # log return, cf tutorial

# Mathematics to optimise a portfolio with more than # two risky assets# (see Appendix and my R function plot.efficientFrontier() # which is built on R package quadprog)

Page 13: Statistical Analysis of Financial Data · EM.sol2

A. Ruckstuhl -- WBL 2017, Lecture 3 of SAoFD -- Page 13

Example (cont.) source("SAFD_RFn_Lecture3.R")EM.sol <- plot.efficientFrontier(100*R, mufree=1.3/12)# 2002str(EM.sol)List of 5 $ mvp : num [1:2] 3.157 0.902 # (sigma, mu) $ Wmvp : num [1:10] 0.0808 0.00169 ... $ tp : num [1:2] 4.42 1.67 # (sigma, mu) $ Wtp : num [1:10] 0.2472 -0.1928 ... $ tpSharpe: num 0.353

Page 14: Statistical Analysis of Financial Data · EM.sol2

A. Ruckstuhl -- WBL 2017, Lecture 3 of SAoFD -- Page 14

Selling Short• With the tangency portfolio we obtain the following proportions:

> EM.sol$Wtp 0.2489 ‐0.1950  0.0438  0.0723  0.0716  0.0319  0.0521  0.1781 ‐0.1752   0.6714

• There are negative proportions!!

This means that this asset is to be sold short

• To sell a stock shortsell a stock short, one sells the stock without owning it. The stock must be borrowed from, e.g., a broker. At a later point in time, one buys the stock and gives it back to the lender

• Selling short is a way to profit if a stock prices goes down.

• If short selling is unwanted, you must include the corresponding constraint into the optimisation. 

(Results on slide 13 requires short selling)

Page 15: Statistical Analysis of Financial Data · EM.sol2

A. Ruckstuhl -- WBL 2017, Lecture 3 of SAoFD -- Page 15

Efficient Frontier with and without Selling Short• ## Selling short allowed

EM.sol1 <- plot.efficientFrontier(100*R, mufree=1.3/12)round(EM.sol1$Wtp,4)0.2489 -0.1950 0.0438 0.0723 0.0716 0.0319 0.0521 0.1781 -0.1752 0.6714

• ## Selling short not allowedEM.sol2 <- plot.efficientFrontier(100*R, mufree=1.3/12, noSS=TRUE)round(EM.sol2$Wtp,4)0.1099 0.0000 0.0336 0.0636 0.0613 0.0671 0.0000 0.1013 0.0000 0.5631

Page 16: Statistical Analysis of Financial Data · EM.sol2

A. Ruckstuhl -- WBL 2017, Lecture 3 of SAoFD -- Page 16

Basic Considerations • Measurable uncertainty/risk (MU) vs unmeasurable uncertainty(UU) (*)

• MU = situations where the probabilities are known (e.g., in gambling (dice), probabilities can be found by simple reasoning and an assumption of symmetry)

• UU = situations where the probabilities are unknownUU is much like the Greek concept of fate; there isn’t much one can say about the future except that it is uncertain

• MU is rather rare outside gambling and random sampling• BUT, statistical inference is the science of estimating probabilities using 

data and assuming that the data are representative of what is to be estimated; i.e., statistical inference is a way out of UU

• Hence, if we are willing to assume that future returns will be similar to past returns (i.e., stationarity), we can act as if uncertainty is measurable using statistical inference.BUT: Never drive a car by looking solely in the rear view mirror – unless you want to crash

(*) According  to University of Chicago economist Frank Knight

Page 17: Statistical Analysis of Financial Data · EM.sol2

A. Ruckstuhl -- WBL 2017, Lecture 3 of SAoFD -- Page 17

When N (number of risky assets) is small, the theory of portfolio optimisation can be applied using sample means and sample covariance matrix.

However, the effect of estimation error, especially with larger values of N, can result in portfolio that only appear efficient.

What is the effect of the estimation error on

• Proportions w?

• Tangency portfolio T?

• Sharpe’s Ratio?

Page 18: Statistical Analysis of Financial Data · EM.sol2

A. Ruckstuhl -- WBL 2017, Lecture 3 of SAoFD -- Page 18

A Bootstrap Simulation Experiment to analyse the effect of estimation on the tangency portfolio

Idea: • The sample of size n is the “true population” of the N=10 assets 

→ sample mean     and covariance matrix     are the “true parameters”

• Bootstrap resampling mimics the sampling process. – Each resample has the same sample size n as the original sample– The resamples are drawn with replacement  from the original sample– Calculate all the statistics we are interested in on each resample;e.g.,                    , Sharpe’s ratio*,k, …, for k=1, …, B 

• Compare the estimated with the actual Sharpe’s ratio:ActualActual Sharpe’s ratio:  Sharpe’s ratio: In each resample we calculate Sharpe’s ratio based on the proportions                                 but use the “true” mean     and the “true” covariance matrix 

Page 19: Statistical Analysis of Financial Data · EM.sol2

A. Ruckstuhl -- WBL 2017, Lecture 3 of SAoFD -- Page 19

Example: Allocate capital to the equity markets of ten different countries

Bootstrapping the estimated Sharpe’s ratio of the tangency portfolio  (B=250)

In R:> EM.TPboot <- BootTP(Dat=100*R, mufree=1.3/12, maxMu=20, nBoot=250, setSeed=123)> boxplot(EM.TPboot[,1:2], las=1, ylab="Sharpe's ratio")> abline(h=EM.sol$tpSharpe, lty=2, lwd=2, col="gray")

Dashed horizontal line = Sharpe’s ratio of the «true» tangency portfolio (=0.353)

• All resampled tangency portfolio have actual Sharpe’s ratio below 0.352

• The estimated Sharpe’s ratios overestimate the true Sharpe’s ratio quite seriously

• The estimated Sharpe’s ratio is always larger than the actual Sharpe’s ratio

Page 20: Statistical Analysis of Financial Data · EM.sol2

A. Ruckstuhl -- WBL 2017, Lecture 3 of SAoFD -- Page 20

Bootstrap simulation (cont.)• Effect on the tangency portfolio compared to the efficient frontier and to 

the «true» tangency portfolio–Huge variability in both directions (each time skewed to the right)–Overestimation of expected returns

– max(round(sapply(R*100, FUN=mean),3))3.419 ## = Argentina

Why is max(muP) larger than 3.419?(Answer: Because of short selling)→ without short selling see next slide

Page 21: Statistical Analysis of Financial Data · EM.sol2

A. Ruckstuhl -- WBL 2017, Lecture 3 of SAoFD -- Page 21

Bootstrap simulation (cont.)• What if we know either

– the expected return of the assets ( volatility must be estimated)–Volatility of the assets ( expected return must be estimated)

   known /  estimated   known /  estimated

Page 22: Statistical Analysis of Financial Data · EM.sol2

A. Ruckstuhl -- WBL 2017, Lecture 3 of SAoFD -- Page 22

Conclusion• The efficient frontier is not estimated very accurately.

• Estimation of   and   yields a lot of variability in the estimated  optimal portfolio

• The optimal portfolio is very sensitive to estimation errors in , i.e., much more than to estimation errors in 

 

Consequence: Avoid considering future returns in the optimisation and use other portfolio construction approaches; e.g., 

• Using minimum risk/variance portfolio (i.e., red points on slide 7)

• Using optimisation approaches like «risk parity» or «risk budgeting» 

But in any case,we need a good estimation of the variance‐covariance matrix

Page 23: Statistical Analysis of Financial Data · EM.sol2

A. Ruckstuhl -- WBL 2017, Lecture 3 of SAoFD -- Page 23

What if we had more data?More data do help, though perhaps not as much as we would like.

And be aware: Suppose that we were considering selecting a portfolio from all 3000 stocks on the Russell index.• there would be (3000*2999/2)4.5million covariances to estimate!• A tremendous amount of data would be need to be collected and, after 

that effort, the effects of estimation error in 3000 means and 4.5million covariances would be overwhelming – though  the computer computes the estimates easily!

• Of course, using a longer time series carries the danger that the data may not be stationary anymore

• Another problem is that some of the times series may not be available for earlier time periods

Hence, although implementing the theory is computationally feasible, this theory may be used if the number of assets is small (clearly below ten).

Page 24: Statistical Analysis of Financial Data · EM.sol2

A. Ruckstuhl -- WBL 2017, Lecture 3 of SAoFD -- Page 24

Other ways of out of the problem: improving estimation• Bagging:

Idea: Suppose we are estimating some quantity, e.g., the optimal portfolio weight to achieve an expected return of xxx. We have one estimate from the original sample, and B additional estimate, one from each of the bootstrap samples. The bagging estimates is the average of all of these bootstrap estimates. This may yield improved results since bagging can dramatically reduce the variance of unstable procedures.  Richard Michaud has patented methods of portfolio rebalancing that essentially are an application of bagging (around 1998).

• Principal Components and Factor Models (cf. next week)

Page 25: Statistical Analysis of Financial Data · EM.sol2

A. Ruckstuhl -- WBL 2017, Lecture 3 of SAoFD -- Page 25

Minimum Risk/Variance Portfolio• Bootstrap Simulation with Data from Slide 19:

EM.MVPboot <- BootMVP(Dat=100*R, nBoot=250, setSeed=998876)plot.efficientFrontier(Dat=100*R, mufree=NULL, xlim=c(0, 6), ylim=c(0,1.7))points(EM.MVPboot$out$riskMVP, EM.MVPboot$out$muMVP)

Page 26: Statistical Analysis of Financial Data · EM.sol2

A. Ruckstuhl -- WBL 2017, Lecture 3 of SAoFD -- Page 26

• Portfolio Theory is a nice piece of mathematicsImplementing the theory is computationally feasible / simple

• The results of the theory are disappointing when the two inputs “returns” and “covariances” are estimated from the data by its sample versionsyou may used it if the number of assets is small (clearly below ten).

• The main troublemaker is the estimated returns. The optimal tangency portfolio is very sensitive to the input values of the returns.(Be aware that the weights result from a nonlinear function of of the estimated parameter)

• Use bootstrap simulation experiments to learn more about the effect of estimation errors

Page 27: Statistical Analysis of Financial Data · EM.sol2

A. Ruckstuhl -- WBL 2017, Lecture 3 of SAoFD -- Page 27

• Lecture 3 in the book:

• Chapter 16: Portfolio Selection

Page 28: Statistical Analysis of Financial Data · EM.sol2

A. Ruckstuhl -- WBL 2017, Lecture 3 of SAoFD -- Page 28

Finding the Gobal Minimum Variance PortfolioLet be Σ the covariance matrix, w the vector of weightsthen the problem can be expressed as

The Lagrangian for this problem is

And the first order conditions for a minimum are

Page 29: Statistical Analysis of Financial Data · EM.sol2

A. Ruckstuhl -- WBL 2017, Lecture 3 of SAoFD -- Page 29

Finally, substitute the value for λ back into (1) to solve for     :

Remark: To invert  Σ  is not trivial numerically, particularly if the dimension of Σ is big