backtesting ewma presentation

22
1 Backtesting Análise de Risco (7) R.Vicente

Upload: danielmiraglia

Post on 23-Jun-2015

704 views

Category:

Documents


1 download

DESCRIPTION

Any comments???

TRANSCRIPT

Page 1: Backtesting EWMA Presentation

1

Backtesting Análise de Risco (7)

R.Vicente

Page 2: Backtesting EWMA Presentation

2

Resumo

Basle Traffic Light Teste de Proporção de Falhas (Kupiec POF)Tempo até Primeira Falha (Kupiec TUFF)Ponderação por tamanho de perda (Lopez)Tempo entre FalhasBibliografia

Page 3: Backtesting EWMA Presentation

3

Basle Traffic Light

( 250; 1%) (1 )n N nNP n N q q q

n−⎛ ⎞

= = = −⎜ ⎟⎝ ⎠

0%5%

10%15%20%25%30%

0 1 2 3 4 5 6 7 8 9 10 11 12

n

P(n

|N,q

)

Page 4: Backtesting EWMA Presentation

4

Basle Traffic Light

0%

20%

40%

60%

80%

100%

0 1 2 3 4 5 6 7 8 9 10 11 12

n

SU

M(P

(k|N

,q);k

<n)

# Exceções Prob. Cumulativa0 8,11%1 28,58%2 54,32%3 75,81%4 89,22%5 95,88%6 98,63%7 99,60%8 99,89%9 99,97%

10 99,99%11 100,00%12 100,00%13 100,00%

Para intervalo de confiança = 99%

Page 5: Backtesting EWMA Presentation

5

Basle Traffic LightEWMA Lambda=0,99

-12%

-8%

-4%

0%

4%

8%

12%

ago-

01

set-0

1

out-0

1

nov-

01

dez-

01

jan-0

2

fev-0

2

mar

-02

abr-0

2

mai-

02

jun-0

2

jul-0

2

ago-

02

EWMA Backtest

1%

2%

3%

4%

5%

6%

7%

8%

9%

1% 2% 3% 4% 5% 6% 7% 8%

Previsão com 99% (unicaudal)

P&L

n=4

PETR4

Page 6: Backtesting EWMA Presentation

6

Basle Traffic LightEWMA Lambda=0,96

-12%-8%

-4%0%4%

8%

12%

ago-0

1

set-0

1

out-0

1

nov-0

1

dez-0

1

jan-02

fev-02

mar-0

2

abr-0

2

mai-0

2

jun-02

jul-02

ago-0

2

EWMA Backtest

1%

2%

3%

4%

5%

6%

7%

8%

9%

1% 2% 3% 4% 5% 6% 7% 8% 9%

Previsão com 99% (unicaudal)

P&L

n=6

PETR4

Page 7: Backtesting EWMA Presentation

7

Basle Traffic LightEWMA Lambda=0,5

-12%-8%-4%0%4%8%

12%

ago-

01

set-0

1

out-0

1

nov-

01

dez-

01

jan-0

2

fev-0

2

mar

-02

abr-0

2

mai-

02

jun-0

2

jul-0

2

ago-

02

EWMA Backtest

1%

2%

3%

4%

5%

6%

7%

8%

9%

1% 3% 5% 7% 9% 11% 13% 15% 17%

Previsão com 99% (unicaudal)

P&L

n=10

PETR4

Page 8: Backtesting EWMA Presentation

8

Basle Traffic LightMedida paliativa para corrigir modelos rejeitados: aumentar

coeficiente de confiança.

# Exceções Prob. Cumulativa Confiança0 8,11% 2,331 28,58% 2,332 54,32% 2,333 75,81% 2,334 89,22% 2,335 95,88% 2,736 98,63% 2,837 99,60% 2,988 99,89% 3,089 99,97% 3,18

10 99,99% 3,3311 100,00% 3,3312 100,00% 3,3313 100,00% 3,33

EWMA Lambda=0,5

-12%-8%-4%0%4%8%

12%

ago-

01

set-0

1

out-0

1

nov-

01

dez-

01

jan-

02

fev-

02

mar

-02

abr-0

2

mai

-02

jun-

02

jul-0

2

ago-

02

EWMA Backtest

1%

3%

5%

7%

9%

11%

13%

15%

17%

19%

1% 6% 11% 16%

Previsão com 99% (unicaudal)

P&L

Page 9: Backtesting EWMA Presentation

9

Proporção de Falhas

Hipótese nula: Probabilidade estimada na amostra = 1% .

0 ˆ: 0,01nH p pN

= = =

N= # de pontos e n=# de falhas observadas. Teste de razão de verossimilhança:

( )1% (1 1%)2 ln

1

n N n

n N nLRn nN N

⎛ ⎞⎜ ⎟−⎜ ⎟= −⎜ ⎟⎛ ⎞ ⎛ ⎞−⎜ ⎟⎜ ⎟ ⎜ ⎟⎝ ⎠ ⎝ ⎠⎝ ⎠

LR tem distribuição com 1 grau

de liberdade quando

2χ0

2

4

6

8

10

12

14

1 2 3 4 5 6 7 8 9 10

LR

N →∞n

Page 10: Backtesting EWMA Presentation

10

0%10%20%30%40%50%60%70%80%90%

100%

0 2 4 6 8 10

LR

Ch

i 2 A

cum

ula

do

Com 95 % de confiança não rejeitamos a hipótese nula de p=1% se

max( ) 95%P LR LR< =

Proporção de Falhas

MAXLR LR<

0

2

4

6

8

10

12

14

1 2 3 4 5 6 7 8 9 10

n

LR

3,84 7MAXLR n= → <

Page 11: Backtesting EWMA Presentation

11

Proporção de FalhasEWMA Lambda=0,96

-12%

-8%

-4%0%

4%

8%

12%

ago-

01

set-0

1

out-0

1

nov-

01

dez-

01

jan-

02

fev-

02

mar

-02

abr-

02

mai

-02

jun-

02

jul-0

2

ago-

02

n=6Não Rejeita Hipótese Nula.

Page 12: Backtesting EWMA Presentation

12

Tempo até a Primeira Falha

Hipótese nula: Para q=1%, 1 falha a cada 100 dias. Alternativamente, o tempo médio para a primeira falha na amostra é de 100 dias.

01ˆ: 0,01H p pν

= = =

1

10,01(1 0,01)2 ln

1 11TUFFLR

ν

ν

ν ν

⎛ ⎞⎜ ⎟−⎜ ⎟= −⎜ ⎟⎛ ⎞⎛ ⎞−⎜ ⎟⎜ ⎟⎜ ⎟⎝ ⎠⎝ ⎠⎝ ⎠

1ν probabilidade de falha em um dia.

LR tem distribuição com 1 grau

de liberdade quando

2χN →∞

Page 13: Backtesting EWMA Presentation

13

Tempo até a Primeira Falha

0

2

4

6

8

2 42 82 122 162 202 242 282 322 362 402

ν

LRCom 95% de confiança e MINν ν>

MAXν ν<

( ) 95%MAXP LR LR< =

3,84 7 438MAXLR ν= → < <

Page 14: Backtesting EWMA Presentation

14

Tempo até a Primeira Falha

18ν =

Lambda=0,96

Não rejeita Hipótese Nula.

EWMA Lambda=0,96

-12%

-8%

-4%0%

4%

8%

12%

ago-

01

set-0

1

out-0

1

nov-

01

dez-

01

jan-0

2

fev-

02

mar

-02

abr-0

2

mai-

02

jun-0

2

jul-0

2

ago-

02

Page 15: Backtesting EWMA Presentation

15

Função de Magnitude de PerdaHipótese Nula: Os log-retornos de 1 dia têm distribuição condicional normal com média nula.

,

0, . .

j jj j

j j

R VaRR VaR

C VaR

c c

⎧⎪ −⎪⎪ >⎪⎪=⎨⎪⎪⎪⎪⎪⎩250

2501

jj

C C=

=∑

Page 16: Backtesting EWMA Presentation

16

Função de Magnitude de PerdaDada a hipótese nula pode ser obtido via simulação utilizando am=ostras i.i.d. de uma distribuição Normal N(0,1):

0 0.5 1 1.5 2 2.5 30

50

100

150

250C

Com 95% de confiança 250 1, 2C <

Page 17: Backtesting EWMA Presentation

17

EWMA Lambda=0,96

-12%

-8%

-4%0%

4%

8%

12%

ago-

01

set-0

1

out-0

1

nov-

01

dez-

01

jan-0

2

fev-

02

mar

-02

abr-0

2

mai-

02

jun-0

2

jul-0

2

ago-

02

250 2,31C =

Função de Magnitude de Perda

35% 28%1%

52% e 79%

35%

Rejeita Hipótese Nula com 95 % de confiança

Page 18: Backtesting EWMA Presentation

18

Tempo Entre Falhas

Hipótese nula: As falhas são independentes e para q=1%, o tempo médio entre falhas na amostra é de 100 dias.

1

1

1 1

1 12

1 1

0,01(1 0,01) 0,01(1 0,01)2 ln 2 ln1 11 1 11

k

k

n

k

k k

LRν ν

ν ν

ν νν ν

− −

− −=

⎛ ⎞ ⎛ ⎞⎜ ⎟ ⎜ ⎟

− −⎜ ⎟ ⎜ ⎟= − −⎜ ⎟ ⎜ ⎟⎛ ⎞⎛ ⎞ ⎛ ⎞⎛ ⎞⎜ ⎟ ⎜ ⎟−−⎜ ⎟⎜ ⎟ ⎜ ⎟⎜ ⎟⎜ ⎟⎜ ⎟ ⎝ ⎠⎝ ⎠⎝ ⎠⎝ ⎠ ⎝ ⎠⎝ ⎠

LR tem distribuição com n+1 graus de liberdade quando 2χ N →∞

kν é o tempo entre as falhas k-1 e k.

Page 19: Backtesting EWMA Presentation

19

Tempo Entre Falhas

0%

20%

40%

60%

80%

100%

0 5 10 15

LR

Chi

2 A

cum

ulad

o

Com 95% de confiança LR<12,6.

Page 20: Backtesting EWMA Presentation

20

Tempo Entre Falhas

LR >18 Rejeita a Hipótese nula com 95% de confiança

EWMA Lambda=0,96

-12%

-8%

-4%0%

4%

8%

12%

ago-

01

set-0

1

out-0

1

nov-

01

dez-

01

jan-0

2

fev-

02

mar

-02

abr-0

2

mai-

02

jun-0

2

jul-0

2

ago-

02

17 dias

43 dias

143 dias

4 dias

1 dia

17 dias

Page 21: Backtesting EWMA Presentation

21

Sumário

Proporção deFalhas

?

N

VaR subestimado

Tempo entre falhas

?

S

N

Correlação entreFalhas

S Magnitude?

N

Caudas pesadas

SOK

Page 22: Backtesting EWMA Presentation

22

Bibliografia

• Jorion P., Value at Risk, Irwin, 1997.

• RiskMetrics Technical Document (www.riskmetrics.com).• Basle Committee on Banking Supervision, “Supervisory Framework for the use of Backtesting in Conjunction with the Internal Models Approach to Market Risk Capital Requirements”, Jan/96, www.bis.org

Leituras ComplementaresHaas, Marcus, New Methods in Backtesting, 2001, www.gloriamundi.org

Blanco, C. e Ihle, G., How Good is Your VaR ? Using Backtesting to Assess System Performance, Financial Engineering News nr. 11, http://fenews.com