Upload
ashu-prakash
View
75
Download
0
Embed Size (px)
Citation preview
Vu Pham
Scenario Generation Algorithm using R(without optimization)
26.12.2016 Scenario Generation Algorithm using R 1Ашу Пракаш | Семенов Михаил Евгеньевич
Ashu Prakash
Indian Institute of Technology Kanpur, India
Dr Mikhail Semenov
Tomsk Polytechnic University, Russia
Vu Pham
I’m a third-year undergraduate student majoring in 4 year bachelorship programme of Mathematics and Scientific Computing in the Department of Mathematics and Statistics at the Indian Institute of Technology Kanpur, India
My research area includes parts of Applied Mathematics, Finance, Microeconomics and Business Analytics. I’m also interested in Computer Programming and Multivariable Calculus.
I worked as an intern under Prof Mikhail Semenov, Tomsk Polytechnic University, Russia. My project was to generate scenarios for stock markets using different techniques (mainly without using optimisation)
A little about myself
26.12.2016 Scenario Generation Algorithm using R 2Ашу Пракаш | Семенов Михаил Евгеньевич
Vu Pham
I worked on an algorithm for moment-matching scenario generation. I triedto produce scenarios and probability weights that match different moments.
In this approach, the statistical properties of the joint distribution arespecified in terms of moments, basically including the covariance matrix.
Optimisation is not employed in this scenario generation process and thusthis method is computationally more advantageous than previousapproaches. The algorithm is used for generating scenarios in a mean-CVaRportfolio optimisation model.
This method is proposed in the paper "An algorithm for moment-matchingscenario generation with application to financial portfolio optimisation" byPonomareva, Roman, Date, (Published 2015)
Scenario Generation
26.12.2016 Scenario Generation Algorithm using R 3Ашу Пракаш | Семенов Михаил Евгеньевич
Vu Pham
I also worked on the paper “Generating Scenario Trees for MultistageDecision Problems” by Høyland and Wallace, (Published 2001)
This paper deals with Tree Scenario Generation for multistage decisionproblems with approximating the uncertainties by a limited number ofdiscrete outcomes.
The motivation for developing the method presented in this paper is theimplementation of a stochastic multistage asset allocation model.
There is a different paper which is actually a comment on this paper, byKlaassen. "Comment on Generating Scenario Trees for Multistage DecisionProblems" by Pieter Klaassen, (Published 2002). This deals with removal ofarbitrage opportunities.
Scenario Generation
26.12.2016 Scenario Generation Algorithm using R 4Ашу Пракаш | Семенов Михаил Евгеньевич
Vu Pham
I have used the programming language R for all the statistical coding for thegeneration of proposed algorithms.
My code followed the paper "An algorithm for moment-matching scenariogeneration with application to financial portfolio optimisation" byPonomareva, Roman, Date, (Published 2015).
I tried to generate probabilities associated with the moment-matchingscenario generation. Mean, Variance, Skewness, Kurtosis are matched in theproposed algorithm.
The input of the algorithm follows a covariance matrix, mean vector,skewness and kurtosis. The aim was to generate a vector of positiveprobabilities.
Scenario Generation Algorithm
26.12.2016 Scenario Generation Algorithm using R 5Ашу Пракаш | Семенов Михаил Евгеньевич
Vu Pham
Let us assume we have an N – variate random vector r = (r1, r2, r3, … , rN)T
We know the distribution of this random vector in terms of following:
µ : target mean vector∑ : target covariance matrix (positive definite)kj : marginal third central moment (skewness) of rj, j = 1, 2, 3, … , Nƺj : marginal fourth central moment (kurtosis) of rj, j = 1, 2, 3, … , N
We denote the average marginal moments as
Mean skewness : k’ = 1
𝑁σ𝑗=1𝑁 kj
Mean kurtosis : ƺ’ = 1
𝑁σ𝑗=1𝑁 ƺj
An even number of scenarios, 2Ns, proportional to the vector’s dimension, are generated such that they match the first and second moments. These scenarios are symmetrically distributed around the expected value such that the variance–covariance matrix is matched
Scenario Generation Algorithm
26.12.2016 Scenario Generation Algorithm using R 6Ашу Пракаш | Семенов Михаил Евгеньевич
Vu Pham
Three additional scenarios are generated in order to match the average marginal skewness and the average marginal kurtosis of each individual component of the random vector r.
Parameters for Scenario Generation
We have the inputs µ, ∑, kj , ƺj . Our programme must choose an arbitrary positive integer s, an arbitrary nonzero deterministic vector Z, such that ∑ - ZZT > 0, and a scalar ρ ϵ 0,1
We randomly generate a ρ using a normal distribution.
Also, Z is generated using this ρ . We take Zj = ρ σjj (ρ = 0.45, in my case)Here ∑jj = vector corresponding to the diagonal elements of ∑
Scenario Generation Algorithm
26.12.2016 Scenario Generation Algorithm using R 7Ашу Пракаш | Семенов Михаил Евгеньевич
Vu Pham
The next part is to find L. In the paper, L is defined as a positive definite matrix such that LLT = ∑ - ZZT . We may use Cholesky decomposition method on ∑ - ZZT to find L.
Now we generate a random natural number ‘s’ after which we can find the probability weights. Let pi’s be real scalars such that pi ∈ 0,1 . There are many ways for generating pi’s.
Note that number of scenarios are independent on the dimension of the random vector r as ‘s’ is a randomly generated positive integer.
pi’s can be generated by sampling from a uniform distribution or gamma distribution method. The detailed explanation is provided in the next slide.
Scenario Generation Algorithm
26.12.2016 Scenario Generation Algorithm using R 8Ашу Пракаш | Семенов Михаил Евгеньевич
Vu Pham
One method to generate pi is such that it satisfies
pi = 𝑠
𝑁𝛾+ (
1
2𝑁𝑠−
𝑠
𝑁𝛾) U , where U ∈ 0,1 is a uniformly generated random
variable where 𝛾 is defined as
𝛾 = 2𝑠2𝑁ƺ’ − 3
4σ𝑗=1𝑁 𝑍4
𝑗
𝑁k'σ𝑗=1𝑁 𝑍3
𝑗
2
σ𝑙σ𝑘 𝐿4𝑙𝑘
Another method of generating pi is from gamma distribution. We generate U
in between (1
𝑒, 1 ) by gamma distribution, and taking pi = loge(U). In this
method, we must normalise the weights.
p𝑖′ =𝑝𝑖
𝑁𝑠(2σ𝑝𝑖 +max(𝑝𝑖))
Scenario Generation Algorithm
26.12.2016 Scenario Generation Algorithm using R 9Ашу Пракаш | Семенов Михаил Евгеньевич
Vu Pham
Now, after finding pi’s we must check that the following two conditions are satisfied.
1.) σ𝑖=1𝑠 𝑝𝑖 <
1
2𝑁2.) σ𝑖=1
𝑠 1
𝑝𝑖
< 𝛾 if 𝛾 𝑖𝑠 𝑢𝑠𝑒𝑑
We define a new element in the vector p, ps+1 = 1 – 2N σ𝑖=1𝑠 𝑝𝑖
Now we will define 𝜑1 𝑎𝑛𝑑 𝜑2which will be used to find probabilities.
𝜑1 =𝑁𝑘′ p
s+1
σ𝑗=1𝑁 𝑍3
𝑗
and 𝜑2 = ps+1
𝑁ƺ’ − 1
2𝑠2σ𝑙 σ𝑘 𝐿
4𝑙𝑘(σ𝑖=1
𝑠 1
𝑝𝑖
)
σ𝑗=1𝑁 𝑍4
𝑗
After determining the above values, we’ll find 𝛼 and 𝛽.
Scenario Generation Algorithm
26.12.2016 Scenario Generation Algorithm using R 10Ашу Пракаш | Семенов Михаил Евгеньевич
Vu Pham
We define 𝛼 and 𝛽 as follows :
𝛼 = +1
2𝜑1+
1
24𝜑2 − 3𝜑1
2
𝛽 = −1
2𝜑1+
1
24𝜑2 − 3𝜑1
2
In our algorithm, we must have 4𝜑2 − 3𝜑12 ≥ 0
We define w1, w2 and w0 .
w1 = 1
𝛼(𝛼+𝛽), w2 =
1
𝛽(𝛼+𝛽)and w0 = 1 -
1
𝛼𝛽
Observe that w1 + w2 + w0 = 1
Scenario Generation Algorithm
26.12.2016 Scenario Generation Algorithm using R 11Ашу Пракаш | Семенов Михаил Евгеньевич
Vu Pham
After finding these values, our aim is to find the probability weights P.
We define, S = 2Ns + 3. Given p1, p2, … , ps+1 and w0 , w1, w2 from previous steps. Vector P is formed as follows :
𝑃 = 𝑝1, 𝑝2, … , 𝑝𝑠, 𝑝1, 𝑝2, … , 𝑝𝑠, … , 𝑝𝑠 + 1𝑤0, 𝑝𝑠 + 1𝑤1, 𝑝𝑠 + 1𝑤2
All the elements of P must be non-negative. Also, σ𝑃 = 1
Note that there is no optimisation involved in this whole algorithm.
Since there is no algorithm involved in this method, it’s the fastest way for the moment-matching scenario generation.
My code in R is described in coming slides.
Scenario Generation Algorithm
26.12.2016 Scenario Generation Algorithm using R 12Ашу Пракаш | Семенов Михаил Евгеньевич
Vu Pham
My code in R
Initialising inputs for the algorithm.
Implementation of Algorithm in R
26.12.2016 Scenario Generation Algorithm using R 13Ашу Пракаш | Семенов Михаил Евгеньевич
Vu Pham
My code in R
We randomly generate ‘s’ (an integer ranging between 1 and 10000)L is generated using Cholesky decomposition method. Note: L must be positive definite
Implementation of Algorithm in R
26.12.2016 Scenario Generation Algorithm using R 14Ашу Пракаш | Семенов Михаил Евгеньевич
Vu Pham
My code in R (Loop is used to find the vector P with only positive elements)
Implementation of Algorithm in R
26.12.2016 Scenario Generation Algorithm using R 15Ашу Пракаш | Семенов Михаил Евгеньевич
Vu Pham
My code in R
Implementation of Algorithm in R
26.12.2016 Scenario Generation Algorithm using R 16Ашу Пракаш | Семенов Михаил Евгеньевич
𝛼, 𝛽, 𝑤1, 𝑤2 𝑎𝑛𝑑 𝑤0 𝑎𝑟𝑒 𝑑𝑒𝑓𝑖𝑛𝑒𝑑
Vector P with S = 2Ns + 3
elements is formed
For loop is created so that only
elements with positive values are in the
output result.
This code also checks
4𝜑2 − 3𝜑12 ≥ 0
Vu Pham
My code in R (Finalising the code)
The main loop is closed. In the output vector P, sum of all the elements must be 1. sum(P) = 1 ??? Yes
Finally we can get the value of ‘s’ at which the loop terminated.
Implementation of Algorithm in R
26.12.2016 Scenario Generation Algorithm using R 17Ашу Пракаш | Семенов Михаил Евгеньевич
Vu Pham
I also did some works with Prof Semenov. I tried to understand one of his research paper on Options Portfolio.
I’m still working with an algorithm in that paper and like to work further in the future.
I read some more research papers on Stock Market Scenario Generation.
I thank Prof Mikhail Semenov for mentoring me in this one month project. I learned a lot during this time period.
I also thank National Research Tomsk Polytechnic University, Russia for giving this research internship opportunity.
Internship at TPU
26.12.2016 Scenario Generation Algorithm using R 18Ашу Пракаш | Семенов Михаил Евгеньевич
Vu Pham
IIT Kanpur and TPU has an agreement on academic research collaboration which was signed on 06.07.2015
IITK and TPU have many areas of common interest in education and research.
This collaborative agreement has programmes like a) Faculty/Scientist/Staff exchanges b) Student exchanges (at both UG and PG level)
TPU is the only university in Russia with which IITK has a collaboration.Our agreement is valid up to 06.07.2020
IITK & TPU Collaboration
26.12.2016 Scenario Generation Algorithm using R 19Ашу Пракаш | Семенов Михаил Евгеньевич
Vu Pham
Ponomareva, Roman, Date, “An algorithm for moment-matching scenariogeneration with application to financial portfolio optimisation”. (EuropeanJournal of Operational Research, 2015)
Høyland and Wallace, “Generating Scenario Trees for Multistage DecisionProblems”. (Norwegian University of Science and Technology, 2001)
Pieter Klaassen, Comment on “Generating Scenario Trees for MultistageDecision Problems”. (The Netherlands, Vrije Universiteit, 2002)
Hoffman, “Combinatorial optimization: Current successes and directions forthe future”. (Journal of Computational and Applied Mathematics 124 (2000)341-360)
Mico Loretan, “Generating market risk scenarios using principal componentsanalysis: methodological and practical considerations”. (Federal ReserveBoard, March 1997)
Wurtz, Chalabi, Chen, Ellis, “Portfolio Optimization with R/Rmetrics”.(Zurich, Rmetrics Association & Finance Online, May 2009)
References
26.12.2016 Scenario Generation Algorithm using R 20Ашу Пракаш | Семенов Михаил Евгеньевич