Download - Applied Statistics IV
vinz
jean
nin@
hotm
ail.c
om
Applied StatisticsVincent JEANNIN – ESGF 4IFM
Q1 2012
1
ESG
F 4I
FM Q
1 20
12
vinz
jean
nin@
hotm
ail.c
om
2
Summary of the session (est. 4.5h)
• Interim Exam Sum Up• Reminders of last session• Capital Asset Pricing Model• Thinking algorithmic
ESG
F 4I
FM Q
1 20
12
vinz
jean
nin@
hotm
ail.c
om
Interim Exam Sum-Up
3
ESG
F 4I
FM Q
1 20
12
𝑦=𝑎∗ ln (𝑥 )+𝑏+𝜀
1
vinz
jean
nin@
hotm
ail.c
om
4
ESG
F 5I
FM Q
1 20
12
Two parameters to estimate:• Intercept α• Gradient β
Minimising residuals
𝐸=∑𝑖=1
𝑛
𝜀𝑖❑2=∑
𝑖=1
𝑛
(𝑦 𝑖− (𝑎∗ ln (𝑥𝑖)+𝑏))2
When E is minimal?
When partial derivatives i.r.w. a and b are 0
Attention, logarithms are not additive!
vinz
jean
nin@
hotm
ail.c
om
5
ESG
F 5I
FM Q
1 20
12
ln (𝑎+𝑏 )≠ln (𝑎)+ ln (𝑏)
ln (∑ 𝑥𝑖 )≠𝑛 ln (𝑥 )Solution?
Change the variable Z=ln(X)
𝐸=∑𝑖=1
𝑛
𝜀𝑖❑2=∑
𝑖=1
𝑛
(𝑦 𝑖− (𝑎∗ 𝑧𝑖+𝑏))2
vinz
jean
nin@
hotm
ail.c
om
6
ESG
F 4I
FM Q
1 20
12
𝑎∗∑𝑖=1
𝑛
𝑧 𝑖+𝑛𝑏=∑𝑖=1
𝑛
𝑦 𝑖
Leads easily to the intercept
𝑎𝑛𝑧+𝑛𝑏=𝑛𝑦
𝑎𝑧+𝑏=𝑦
𝜕𝐸𝜕𝑏
𝑏=𝑦−𝑎𝑧
( 𝑦 𝑖−𝑎𝑥 𝑖−𝑏 )2=𝑦 𝑖2−2𝑎𝑧 𝑖 𝑦 𝑖−2𝑏𝑦 𝑖+𝑎
2𝑧 𝑖2+2𝑎𝑏𝑧 𝑖+𝑏
2
vinz
jean
nin@
hotm
ail.c
om
7
ESG
F 5I
FM Q
1 20
12
𝜕𝐸𝜕𝑎
=∑𝑖=1
𝑛
−2 𝑧𝑖 𝑦 𝑖+2𝑎𝑧𝑖❑2+2𝑏𝑧 𝑖=0
y=𝑎𝑧+ 𝑦−𝑎𝑧
y − 𝑦=𝑎(𝑧 −𝑧)
𝑏=𝑦−𝑎𝑧
∑𝑖=1
𝑛
𝑧 𝑖 (𝑦 𝑖−𝑎𝑧 𝑖❑−𝑏)=0
𝜕𝐸𝜕𝑏
=∑𝑖=1
𝑛
−2 𝑦 𝑖+2𝑏+2𝑎𝑧𝑖=0
∑𝑖=1
𝑛
𝑦 𝑖−𝑏−𝑎𝑧𝑖=0
∑𝑖=1
𝑛
𝑦 𝑖− 𝑦+𝑎𝑧−𝑎𝑧 𝑖=0
∑𝑖=1
𝑛
(𝑦 𝑖− 𝑦 )−𝑎(𝑧𝑖− 𝑧)=0
∑𝑖=1
𝑛
𝑧 𝑖 (𝑦 𝑖−𝑎𝑧 𝑖❑− 𝑦+𝑎𝑧 )=0
∑𝑖=1
𝑛
𝑧 𝑖(𝑦 𝑖−𝑦−𝑎 (𝑧 𝑖❑− 𝑧 ))=0
∑𝑖=1
𝑛
𝑧 (( 𝑦 𝑖− 𝑦 )−𝑎 (𝑧𝑖−𝑧 ))=0
vinz
jean
nin@
hotm
ail.c
om
8
ESG
F 5I
FM Q
1 20
12
∑𝑖=1
𝑛
𝑧 𝑖(𝑦 𝑖−𝑦−𝑎 (𝑧 𝑖❑− 𝑧 ))=0 ∑
𝑖=1
𝑛
𝑧 (( 𝑦 𝑖− 𝑦 )−𝑎 (𝑧𝑖−𝑧 ))=0
∑𝑖=1
𝑛
𝑧 𝑖(𝑦 𝑖−𝑦−𝑎 (𝑧 𝑖❑− 𝑧 ))=∑
𝑖=1
𝑛
𝑧 (( 𝑦 𝑖−𝑦 )−𝑎 ( 𝑧𝑖−𝑧 ))
∑𝑖=1
𝑛
𝑧 𝑖(𝑦 𝑖−𝑦−𝑎 (𝑧 𝑖❑− 𝑧 ))−∑
𝑖=1
𝑛
𝑧 (( 𝑦 𝑖− 𝑦 )−𝑎 (𝑧𝑖−𝑧 ))=0
∑𝑖=1
𝑛
(𝑧¿¿ 𝑖−𝑧)(𝑦 𝑖−𝑦−𝑎 (𝑧 𝑖❑− 𝑧 ))=0¿
𝑎=∑𝑖=1
𝑛
(𝑧¿¿ 𝑖− 𝑧)(𝑦 𝑖− 𝑦 )
∑𝑖=1
𝑛
(𝑧 ¿¿ 𝑖−𝑧)2¿¿
Finally…
We have
and
vinz
jean
nin@
hotm
ail.c
om
9
ESG
F 5I
FM Q
1 20
12
𝑎=∑𝑖=1
𝑛
(𝑧¿¿ 𝑖− 𝑧)(𝑦 𝑖− 𝑦 )
∑𝑖=1
𝑛
(𝑧 ¿¿ 𝑖−𝑧)2¿¿ 𝑏=𝑦−𝑎𝑧
Don’t forget…
Z=ln(X)
vinz
jean
nin@
hotm
ail.c
om
10
ESG
F 5I
FM Q
1 20
12
No forecast possible (one particular stock against the market)
Hedging is linear…
Accept or reject the regression?
Check correlation and R Squared
Check the normality of residuals
vinz
jean
nin@
hotm
ail.c
om
11
ESG
F 5I
FM Q
1 20
12
vinz
jean
nin@
hotm
ail.c
om
12
ESG
F 5I
FM Q
1 20
12
)-))2
𝑃 (𝑋 ≤−2.44 )=0.0073
𝑃 (𝑋 ≤2.44 )=0.9927
𝑃 (𝑋 ≥2.44 )=0.0073
𝑃 (𝑋 ≥−2.4 4 )=9927
N(0,1)
N(-1,2)
𝑌=𝑋+12
𝑃 (𝑋 ≤−2.44 )=𝑃 (𝑌 ≤−0.72 )
𝑃 (𝑋 ≤−2.44 )=0.2358
vinz
jean
nin@
hotm
ail.c
om
13
ESG
F 4I
FM Q
1 20
12
Let’s build a tree with 5 steps, with S=104.57, σ=10%, 1 year to maturity
104.57
𝑢=𝑒𝜎 √𝑡=𝑒0.1 √15=1.045736
𝑑=𝑒−𝜎 √𝑡=𝑒− 0.1√ 15=0.956264
3𝑑∗𝑢=1
109.35114.45
119.58125.05
130.77
10095.62
91.4487.44
83.62
104.57109.35
104.57109.35
100
114.45119.58
10095.62 91.44
vinz
jean
nin@
hotm
ail.c
om
14
ESG
F 4I
FM Q
1 20
12
130.77
83.62
109.35
100
119.58
91.44
20
19.58
5
5
0
0
Last node value
• Pay off capped to 20• Pay off between 100 inclusive and 109.35
inclusive: 5.00
𝑝=𝑒𝑟 𝑡−𝑑𝑢−𝑑
=0.741553
vinz
jean
nin@
hotm
ail.c
om
15
ESG
F 4I
FM Q
1 20
12
BV=
Final Value 12.50
vinz
jean
nin@
hotm
ail.c
om
16
ESG
F 4I
FM Q
1 20
12𝑑𝐶=𝐶+∆∗𝑑𝑆+12∗𝛾∗𝑑𝑆2
4
+16∗𝑆𝑝𝑒𝑒𝑑∗𝑑𝑆3
+124
∗𝐺𝑟𝑒𝑒𝑘4 h𝑡 ∗𝑑𝑆4
What is the new price of the Call (initial price $8.00) if S moves up $2.5 with delta=0.5525 and a gamma of 0.0222, volatility moves up 1.75 point with a 0.8422 Vega, r moves up 1.2 basis point with Rho=178.5448 and placing you 3 days after with a final Theta of -0.9723?
10.73
vinz
jean
nin@
hotm
ail.c
om
17
ESG
F 4I
FM Q
1 20
12
5
Random walk! Past series has no importance! Trial s Independents!
vinz
jean
nin@
hotm
ail.c
om
18
ESG
F 4I
FM Q
1 20
12
++…+
More than one explanatory variables
Reminder of the last session
Multiple regression
Extension
APT
+ “Pure” factors
R-Square is very often very poor
vinz
jean
nin@
hotm
ail.c
om
19
ESG
F 4I
FM Q
1 20
12
Ratio Investment / GDP , World Bank, developing countries
Let’s discuss…
• Corruption: current corruption• CorruptionPrediction: future corruption• School: level of education• GDP: GDP• Distortion: how badly policies are run
vinz
jean
nin@
hotm
ail.c
om
20
ESG
F 4I
FM Q
1 20
12
• General to specific: this starts off with a comprehensive model, including all the likely explanatory variables, then simplifies it.
• Specific to general: this begins with a simple model that is easy to understand, then explanatory variables are added to improve the model’s explanatory power.
How to find the right model?
Be logic
Have the best R-Squared
Not over complicate
vinz
jean
nin@
hotm
ail.c
om
21
ESG
F 4I
FM Q
1 20
12
3 steps
Identify
Fit
Forecast
𝑂𝑏𝑠=𝑀𝑜𝑑𝑒𝑙+𝜀 with being a white noise What is a model?
vinz
jean
nin@
hotm
ail.c
om
22
ESG
F 4I
FM Q
1 20
12
3 components
Trend
Seasonality
Residual
vinz
jean
nin@
hotm
ail.c
om
23
ESG
F 4I
FM Q
1 20
12
Variation (price or percentage is a differentiation)
Series with stationarity much easier to modelise
vinz
jean
nin@
hotm
ail.c
om
24
ESG
F 4I
FM Q
1 20
12
Once the series is stationary, look for autoccorrelation
Most cases you will find autocorrelation
On the values
On the residuals
vinz
jean
nin@
hotm
ail.c
om
25
ESG
F 5I
FM Q
1 20
12
𝑋 𝑡=𝑐+𝜑1𝑋 𝑡 −1+𝜑2𝑋 𝑡 −2+…+𝜑𝑛 𝑋 𝑡−𝑛+𝜀𝑡
𝜑𝑛Parameters of the model
𝜀𝑛White noise
Auto Regressive model
AR(n)
vinz
jean
nin@
hotm
ail.c
om
26
ESG
F 4I
FM Q
1 20
12
Small sample: Binomial Distribution
Large sample: Normal Distribution
)()1()!(!
!)( xnx pp
xnx
nxf
)1(, pnpnpN
n is the size of the sample, x, the number individuals with the particular characteristic
𝐸 ( 𝑋 )=𝑛𝑝𝑉 (𝑋 )=𝑛𝑝(1−𝑝)
Estimations
vinz
jean
nin@
hotm
ail.c
om
27
ESG
F 4I
FM Q
1 20
12
Binomial Distribution
𝐸 (𝑌 )=𝑝 𝑉 (𝑌 )=𝑝(1−𝑝)𝑛
Normal approximation
𝑌 𝑁 (𝑝 ,√𝑝 (1−𝑝 )𝑛 ) Standardisation possible
𝑌 ∗ 𝑁 (0,1 )
𝑌 ∗=𝑌 −𝑝
√𝑝 (1−𝑝 )𝑛
Normal approximation works only if
𝑛𝑝≥5 𝑛(1−𝑝)≥5
Estimate a proportion𝑌=𝑋𝑛
vinz
jean
nin@
hotm
ail.c
om
28
ESG
F 4I
FM Q
1 20
12
𝑃 (𝑝1<𝑝<𝑝2 )=0.95Let’s look for p with a 95% confidence interval
Easy solve!
𝑃 (𝜇−1.96∗𝜎 ≤ 𝑋≤𝜇+1.96∗𝜎 )=0.95
vinz
jean
nin@
hotm
ail.c
om
29
ESG
F 4I
FM Q
1 20
12
52 Heads out of 100 toss…
𝑌 𝑁 (0.52 ,0.04996 )
95% confidence interval
𝑝1=0.62
𝑌 𝑁 (? ,? )
𝑝2=0.42
vinz
jean
nin@
hotm
ail.c
om
30
ESG
F 4I
FM Q
1 20
12
Student’s Statistic
S
𝑃 (𝑥− 𝑆√𝑛
∗𝑡𝛼/2<𝜇<𝑥+𝑆√𝑛
∗𝑡𝛼 /2)=0.95
Degree of freedom
n-1
Mean estimation
Mean has a Student’s distribution
vinz
jean
nin@
hotm
ail.c
om
31
ESG
F 4I
FM Q
1 20
12
IPO PremiumsIPO1 / 12%IPO2 / 15%IPO3 / 13%IPO4 / 18%IPO5 / 20%IPO6 / 5%
SD: =4.81%
DF: =5
S: =5.27%
t: =2.571
: =19.36%
: =13.83%
: =8.30%
vinz
jean
nin@
hotm
ail.c
om
32
ESG
F 4I
FM Q
1 20
12
Is Martingale safe?
vinz
jean
nin@
hotm
ail.c
om
33
ESG
F 5I
FM Q
1 20
12
Capital Asset Pricing Model
Using Variance/Covariance Matrix to select the portfolio
Optimisation of either the risk or the return
5 stocks available
How many portfolio can be built?
How to chose the weights?
vinz
jean
nin@
hotm
ail.c
om
34
ESG
F 5I
FM Q
1 20
12
Infinite number of long only portfolios
vinz
jean
nin@
hotm
ail.c
om
35
ESG
F 5I
FM Q
1 20
12
Would you buy just Air Liquide?
vinz
jean
nin@
hotm
ail.c
om
36
ESG
F 5I
FM Q
1 20
12
You’d only invest on the so called Efficient Frontier
vinz
jean
nin@
hotm
ail.c
om
37
ESG
F 5I
FM Q
1 20
12
For a particular return, you take the lowest risk
For a particular risk, you take the highest return
vinz
jean
nin@
hotm
ail.c
om
38
ESG
F 5I
FM Q
1 20
12
Unless there’s a risk free rate
vinz
jean
nin@
hotm
ail.c
om
39
ESG
F 5I
FM Q
1 20
12
For a particular combination you need to calculate the expected return
𝐸 (𝑃 )=∑1
𝑛
𝑥𝑖 .𝐸(𝑅𝑛)
Straight forward, mean is linear, weighted average
vinz
jean
nin@
hotm
ail.c
om
40
ESG
F 5I
FM Q
1 20
12
For a particular combination you need to calculate the variance (or SD)
We already know
VAR
Not enough, need the general case for a bigger number of assets
vinz
jean
nin@
hotm
ail.c
om
41
ESG
F 5I
FM Q
1 20
12
Thinking Algorithmic
Millions of portfolio
No linear formula to select the good one
Need a computer and algorithms