Scenario Generation Algortihm using R (without optimization)

4 downloads 14281 Views 1MB Size Report
(without optimization). 26.12.2016. Scenario Generation Algorithm using R. 1 ... Microeconomics and Business Analytics. I'm also interested in Computer.
Scenario Generation Algorithm using R (without optimization) Ashu Prakash

Dr Mikhail Semenov

Indian Institute of Technology Kanpur, India

Tomsk Polytechnic University, Russia

[email protected]

[email protected]

26.12.2016

Ашу Пракаш | Семенов Михаил Евгеньевич Vu Pham

Scenario Generation Algorithm using R

1

A little about myself 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)

26.12.2016

Ашу Пракаш | Семенов Михаил Евгеньевич Vu Pham

Scenario Generation Algorithm using R

2

Scenario Generation I worked on an algorithm for moment-matching scenario generation. I tried to produce scenarios and probability weights that match different moments. In this approach, the statistical properties of the joint distribution are specified in terms of moments, basically including the covariance matrix. Optimisation is not employed in this scenario generation process and thus this method is computationally more advantageous than previous approaches. The algorithm is used for generating scenarios in a mean-CVaR portfolio optimisation model. This method is proposed in the paper "An algorithm for moment-matching scenario generation with application to financial portfolio optimisation" by Ponomareva, Roman, Date, (Published 2015)

26.12.2016

Ашу Пракаш | Семенов Михаил Евгеньевич Vu Pham

Scenario Generation Algorithm using R

3

Scenario Generation I also worked on the paper “Generating Scenario Trees for Multistage Decision Problems” by Høyland and Wallace, (Published 2001) This paper deals with Tree Scenario Generation for multistage decision problems with approximating the uncertainties by a limited number of discrete outcomes. The motivation for developing the method presented in this paper is the implementation of a stochastic multistage asset allocation model. There is a different paper which is actually a comment on this paper, by Klaassen. "Comment on Generating Scenario Trees for Multistage Decision Problems" by Pieter Klaassen, (Published 2002). This deals with removal of arbitrage opportunities.

26.12.2016

Ашу Пракаш | Семенов Михаил Евгеньевич Vu Pham

Scenario Generation Algorithm using R

4

Scenario Generation Algorithm I have used the programming language R for all the statistical coding for the generation of proposed algorithms. My code followed the paper "An algorithm for moment-matching scenario generation with application to financial portfolio optimisation" by Ponomareva, Roman, Date, (Published 2015). I tried to generate probabilities associated with the moment-matching scenario generation. Mean, Variance, Skewness, Kurtosis are matched in the proposed algorithm. The input of the algorithm follows a covariance matrix, mean vector, skewness and kurtosis. The aim was to generate a vector of positive probabilities.

26.12.2016

Ашу Пракаш | Семенов Михаил Евгеньевич Vu Pham

Scenario Generation Algorithm using R

5

Scenario Generation Algorithm 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: µ: ∑: kj : ƺj :

target mean vector target covariance matrix (positive definite) marginal third central moment (skewness) of rj, j = 1, 2, 3, … , N marginal fourth central moment (kurtosis) of rj, j = 1, 2, 3, … , N

We denote the average marginal moments as 1 Mean skewness : k’ = σ𝑁 𝑗=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 26.12.2016

Ашу Пракаш | Семенов Михаил Евгеньевич Vu Pham

Scenario Generation Algorithm using R

6

Scenario Generation Algorithm 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 ∑

26.12.2016

Ашу Пракаш | Семенов Михаил Евгеньевич Vu Pham

Scenario Generation Algorithm using R

7

Scenario Generation Algorithm 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.

26.12.2016

Ашу Пракаш | Семенов Михаил Евгеньевич Vu Pham

Scenario Generation Algorithm using R

8

Scenario Generation Algorithm One method to generate pi is such that it satisfies 𝑠 1 𝑠 pi = + ( − ) U , where U ∈ 0,1 is a uniformly generated random 𝑁𝛾

2𝑁𝑠

𝑁𝛾

variable where 𝛾 is defined as 𝑁ƺ’ − 𝛾 = 2𝑠2

3 𝑁 4 σ 4 𝑗=1 𝑍 𝑗

𝑁k' 𝑁 σ𝑗=1 𝑍3𝑗

2

σ𝑙 σ𝑘 𝐿4𝑙𝑘

Another method of generating pi is from gamma distribution. We generate U 1 in between ( , 1 ) by gamma distribution, and taking pi = loge(U). In this 𝑒 method, we must normalise the weights. 𝑝𝑖 p𝑖′ = 𝑁𝑠(2 σ 𝑝𝑖 + max(𝑝𝑖))

26.12.2016

Ашу Пракаш | Семенов Михаил Евгеньевич Vu Pham

Scenario Generation Algorithm using R

9

Scenario Generation Algorithm Now, after finding pi’s we must check that the following two conditions are satisfied. 1 1 σ𝑠𝑖=1 < 𝛾 if 𝛾 𝑖𝑠 𝑢𝑠𝑒𝑑 1.) σ𝑠𝑖=1 𝑝𝑖 < 2.) 2𝑁

𝑝𝑖

We define a new element in the vector p, ps+1 = 1 – 2N σ𝑠𝑖=1 𝑝𝑖 Now we will define 𝜑1 𝑎𝑛𝑑 𝜑2 which will be used to find probabilities. 𝜑1 =

𝑁𝑘 ′ ps 1 + 3 σ𝑁 𝑍 𝑗=1 𝑗

and

𝜑2 = ps+1

𝑁ƺ’ −

1 𝑠 1 4 2 σ𝑙 σ𝑘 𝐿 𝑙𝑘 (σ𝑖=1 ) 2𝑠 𝑝𝑖 𝑁 4 σ𝑗=1 𝑍 𝑗

After determining the above values, we’ll find 𝛼 and 𝛽.

26.12.2016

Ашу Пракаш | Семенов Михаил Евгеньевич Vu Pham

Scenario Generation Algorithm using R

10

Scenario Generation Algorithm We define 𝛼 and 𝛽 as follows : 1 1 𝛼 = + 𝜑1 + 2 2 𝛽=−

1 2

𝜑1 +

4𝜑2 − 3𝜑12

1 2

4𝜑2 − 3𝜑12

In our algorithm, we must have 4𝜑2 − 3𝜑12 ≥ 0 We define w1, w2 and w0 . 1 1 w1 = , w2 = and w0 = 1 𝛼(𝛼+𝛽)

𝛽(𝛼+𝛽)

1 𝛼𝛽

Observe that w1 + w2 + w0 = 1

26.12.2016

Ашу Пракаш | Семенов Михаил Евгеньевич Vu Pham

Scenario Generation Algorithm using R

11

Scenario Generation Algorithm 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.

26.12.2016

Ашу Пракаш | Семенов Михаил Евгеньевич Vu Pham

Scenario Generation Algorithm using R

12

Implementation of Algorithm in R My code in R Initialising inputs for the algorithm.

26.12.2016

Ашу Пракаш | Семенов Михаил Евгеньевич Vu Pham

Scenario Generation Algorithm using R

13

Implementation of Algorithm in R 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

26.12.2016

Ашу Пракаш | Семенов Михаил Евгеньевич Vu Pham

Scenario Generation Algorithm using R

14

Implementation of Algorithm in R My code in R (Loop is used to find the vector P with only positive elements)

26.12.2016

Ашу Пракаш | Семенов Михаил Евгеньевич Vu Pham

Scenario Generation Algorithm using R

15

Implementation of Algorithm in R My code in R 𝛼, 𝛽, 𝑤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

26.12.2016

Ашу Пракаш | Семенов Михаил Евгеньевич Vu Pham

Scenario Generation Algorithm using R

16

Implementation of Algorithm in R 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.

26.12.2016

Ашу Пракаш | Семенов Михаил Евгеньевич Vu Pham

Scenario Generation Algorithm using R

17

Internship at TPU 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.

26.12.2016

Ашу Пракаш | Семенов Михаил Евгеньевич Vu Pham

Scenario Generation Algorithm using R

18

IITK & TPU Collaboration 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

26.12.2016

Ашу Пракаш | Семенов Михаил Евгеньевич Vu Pham

Scenario Generation Algorithm using R

19

References Ponomareva, Roman, Date, “An algorithm for moment-matching scenario generation with application to financial portfolio optimisation”. (European Journal of Operational Research, 2015) Høyland and Wallace, “Generating Scenario Trees for Multistage Decision Problems”. (Norwegian University of Science and Technology, 2001) Pieter Klaassen, Comment on “Generating Scenario Trees for Multistage Decision Problems”. (The Netherlands, Vrije Universiteit, 2002) Hoffman, “Combinatorial optimization: Current successes and directions for the future”. (Journal of Computational and Applied Mathematics 124 (2000) 341-360) Mico Loretan, “Generating market risk scenarios using principal components analysis: methodological and practical considerations”. (Federal Reserve Board, March 1997) Wurtz, Chalabi, Chen, Ellis, “Portfolio Optimization with R/Rmetrics”. (Zurich, Rmetrics Association & Finance Online, May 2009) 26.12.2016

Ашу Пракаш | Семенов Михаил Евгеньевич Vu Pham

Scenario Generation Algorithm using R

20

Thank You !

СПАСИБО

26.12.2016

Ашу Пракаш | Семенов Михаил Евгеньевич Vu Pham

Scenario Generation Algorithm using R

21

Suggest Documents