0% found this document useful (0 votes)
51 views

Quantitative Risk Management in R: The Normal Distribution

The document discusses quantitative risk management in R and introduces concepts related to normal distributions including properties, estimating parameters from data, and testing whether data follows a normal distribution. It also covers the Student's t-distribution as an alternative to the normal distribution to model financial returns that may have heavier tails. Methods like maximum likelihood estimation are used to fit Student's t-distributions to sample return data.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
51 views

Quantitative Risk Management in R: The Normal Distribution

The document discusses quantitative risk management in R and introduces concepts related to normal distributions including properties, estimating parameters from data, and testing whether data follows a normal distribution. It also covers the Student's t-distribution as an alternative to the normal distribution to model financial returns that may have heavier tails. Methods like maximum likelihood estimation are used to fit Student's t-distributions to sample return data.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 23

QUANTITATIVE RISK MANAGEMENT IN R

The normal distribution


Quantitative Risk Management in R

Definition of normal
● If risk factors follow GBM, then log-returns should be
independent normal
● Is this the case?
● A variable x is normal if it has density:
(x µ)2
1
fX (x) = p e
2⇡
2

Depends on two parameters: µ and


Quantitative Risk Management in R

Properties of the normal


2
● µ is the mean and is the variance
2
● Usual notation: X ⇠ N (µ, )

● Parameters easily estimated from data


● Sum of 2+ independent normal variables is also normal
Quantitative Risk Management in R

Central limit theorem (CLT)


Quantitative Risk Management in R

How to estimate a normal distribution


● Data: X1 , . . . , Xn
Xnn
11 X
● Method of moments: µ̂µ̂== XXt t 

nnt=1

 22
ˆˆuu==
t=1
11 Xn
X n
(X 22
t t µ̂)
(X µ̂)
nn 11t=1
t=1

● Application to FTSE log-returns from 2008-09


Quantitative Risk Management in R

FTSE example
> head(ftse)
[1] -0.09264548 -0.08178433 -0.07428657 -0.05870079 -0.05637430
-0.05496918

> tail(ftse)
[1] 0.05266208 0.06006960 0.07742977 0.07936751 0.08469137
0.09384244

> mu <- mean(ftse)


> sigma <- sd(ftse)
> c(mu, sigma)
[1] -0.0003378627 0.0194090385
Quantitative Risk Management in R

Displaying the fi!ed normal


> hist(ftse, nclass = 20, probability = TRUE)
> lines(ftse, dnorm(ftse, mean = mu, sd = sigma), col = "red")
QUANTITATIVE RISK MANAGEMENT IN R

Let’s practice!
QUANTITATIVE RISK MANAGEMENT IN R

Testing for normality


Quantitative Risk Management in R

How to test for normality


● Use the quantile-quantile plot (Q-Q plot)
● Sample quantiles of data versus theoretical quantiles of a
normal distribution

> data <- rnorm(1000, 



mean = 3, 

sd = 2)
> qqnorm(data)
> qqline(data)
Quantitative Risk Management in R

Interpreting the Q-Q plot


● Data with heavier tails than normal: inverted S shape
● Data with lighter tails than normal: S shape
● Data from a very skewed distribution: curved shape

> qqnorm(ftse)
> qqline(ftse)
QUANTITATIVE RISK MANAGEMENT IN R

Let’s practice!
QUANTITATIVE RISK MANAGEMENT IN R

Skewness, kurtosis and


the Jarque-Bera test
Quantitative Risk Management in R

Skewness and kurtosis


● Skewness (b) is a measure of asymmetry
● Kurtosis (k) is a measure of heavy-tailedness
● Skewness and kurtosis of normal are 0 and 3, respectively
Pn 3
1 t=1 (Xt µ̂)
b= 3
nP ˆ
n 4
1 t=1 (Xt µ̂)
k= 4
n ˆ
Quantitative Risk Management in R

Skewness and kurtosis (II)


> library(moments)

> skewness(ftse)
[1] -0.01187921

> kurtosis(ftse)
[1] 7.437121
Quantitative Risk Management in R

The Jarque-Bera test


● Compares skewness and kurtosis of data with theoretical
normal values (0 and 3)
● Detects skewness, heavy tails, or both
1 2 1 2
T = 6 n b + 4 (k 3)

> jarque.test(ftse)

Jarque-Bera Normality Test

data: ftse
JB = 428.23, p-value < 2.2e-16
alternative hypothesis: greater
Quantitative Risk Management in R

Longer-interval and overlapping returns


● Daily returns are usually very non-normal
● What about longer-intervals returns?
● Weekly, monthly, quarterly returns obtained by summation
● Recall CLT - suggests they may be more normal
● Reduce quantity of data so tests are weaker
● Can also analyze overlapping or moving sums of returns
QUANTITATIVE RISK MANAGEMENT IN R

Let’s practice!
QUANTITATIVE RISK MANAGEMENT IN R

The Student t distribution


Quantitative Risk Management in R

The Student t distribution


⌫+1 ✓ 2
◆ ⌫+1

2 (x µ) 2

fX (x) = p ⌫ 1+ 2
⌫⇡ 2

● This distribution has three parameters: µ, , ⌫


● Small values of ⌫ give heavier tails
● As ⌫ gets larger the distribution tends to normal
Quantitative Risk Management in R

Fi!ing the Student t distribution


● Method of maximum likelihood (ML)
● fit.st() in QRM package
● Small ⌫ value (2.95) for FTSE log-returns from 2008-09
> library(QRM)

> tfit <- fit.st(ftse)


> tpars <- tfit$par.ests
> tpars
nu mu sigma
2.949514e+00 4.429863e-05 1.216422e-02

> nu <- tpars[1]


> mu <- tpars[2]
> sigma <- tpars[3]
Quantitative Risk Management in R

Displaying the fi!ed Student t distribution


> hist(ftse, nclass = 20, probability = TRUE)
> lines(ftse, dnorm(ftse, mean = mean(ftse), sd = sd(ftse)), col = "red")

> yvals <- dt((ftse - mu)/sigma, df = nu)/sigma


> lines(ftse, yvals, col = "blue")
QUANTITATIVE RISK MANAGEMENT IN R

Let’s practice!

You might also like