Numerical Methods in Finance. Part A. (2008-2009)Numerical Methods in Finance. Part A. (2008-2009)...

23
Numerical Methods in Finance. Part A. (2008-2009) Paul Clifford, Sebastian Van Strien and Oleg Zaboronski 1 October 2, 2008 1 [email protected]

Transcript of Numerical Methods in Finance. Part A. (2008-2009)Numerical Methods in Finance. Part A. (2008-2009)...

Page 1: Numerical Methods in Finance. Part A. (2008-2009)Numerical Methods in Finance. Part A. (2008-2009) Paul Clifford, Sebastian Van Strien and Oleg Zaboronski 1 October 2, 2008 1olegz@maths.warwick.ac.uk

Numerical Methods in Finance. Part A.(2008-2009)

Paul Clifford, Sebastian Van Strien and Oleg Zaboronski1

October 2, 2008

[email protected]

Page 2: Numerical Methods in Finance. Part A. (2008-2009)Numerical Methods in Finance. Part A. (2008-2009) Paul Clifford, Sebastian Van Strien and Oleg Zaboronski 1 October 2, 2008 1olegz@maths.warwick.ac.uk

Contents

0 Preface iv0.1 Aims, objectives, and organisation of the course. . . . . . . . . iv

1 Linear models: growth and distribution 21.1 Matrix computations in Matlab . . . . . . . . . . . . . . . . . 21.2 Non-negative matrices: modeling growth . . . . . . . . . . . . 6

1.2.1 Models with an age profile . . . . . . . . . . . . . . . . 61.2.2 The asymptotic behaviour depends on age-structure. . 8

1.3 Markov Models . . . . . . . . . . . . . . . . . . . . . . . . . . 121.3.1 Mood fluctuations of a Markovian market . . . . . . . 121.3.2 Another Markov model: a random walk on a graph . . 151.3.3 Matlab Project for week 2. . . . . . . . . . . . . . . . . 17

2 Linear models: stability and redundancy 182.1 SVD or Principal Components . . . . . . . . . . . . . . . . . . 18

2.1.1 Stability of eigenvalues . . . . . . . . . . . . . . . . . . 182.1.2 Singular value decomposition. . . . . . . . . . . . . . . 202.1.3 Application of the singular value decomposition to solv-

ing linear equations . . . . . . . . . . . . . . . . . . . . 232.1.4 Least square methods . . . . . . . . . . . . . . . . . . . 262.1.5 Further applications of SVD: Principle Component Anal-

ysis . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 262.1.6 Pairs trade by exploiting correlations in the stock market. 27

2.2 MATLAB exercises for Week 3. . . . . . . . . . . . . . . . . . 292.2.1 Lesley Matrices . . . . . . . . . . . . . . . . . . . . . . 292.2.2 Markov matrices . . . . . . . . . . . . . . . . . . . . . 302.2.3 Solving equations . . . . . . . . . . . . . . . . . . . . . 30

2.3 Ill-conditioned systems: general theory. . . . . . . . . . . . . . 31

i

Page 3: Numerical Methods in Finance. Part A. (2008-2009)Numerical Methods in Finance. Part A. (2008-2009) Paul Clifford, Sebastian Van Strien and Oleg Zaboronski 1 October 2, 2008 1olegz@maths.warwick.ac.uk

2.4 Numerical computations with matrices . . . . . . . . . . . . . 342.5 Matlab project for week 4 (Linear Algebra) . . . . . . . . . . . 38

2.5.1 Ill posed systems . . . . . . . . . . . . . . . . . . . . . 382.5.2 Sparse matrices . . . . . . . . . . . . . . . . . . . . . . 382.5.3 Solving Ax = b by iteration . . . . . . . . . . . . . . . 39

3 Gambling, random walks and the CLT 403.1 Random variables and laws of large numbers . . . . . . . . . . 40

3.1.1 Useful probabilistic tools. . . . . . . . . . . . . . . . . 413.1.2 Weak law of large numbers. . . . . . . . . . . . . . . . 413.1.3 Strong law of large numbers. . . . . . . . . . . . . . . . 42

3.2 Central Limit Theorem . . . . . . . . . . . . . . . . . . . . . . 443.3 The simplest applications of CLT and the law of large numbers. 47

3.3.1 Monte Carlo Methods for integration . . . . . . . . . . 473.3.2 MATLAB exercises for Week 5. . . . . . . . . . . . . . 483.3.3 Analysing the value of the game. . . . . . . . . . . . . 493.3.4 Portfolio optimization via diversification. . . . . . . . . 51

3.4 Risk estimation and the theory of large deviations. . . . . . . 573.4.1 Week 6 MATLAB exercises. . . . . . . . . . . . . . . . 603.4.2 An example of numerical investigation of CLT and the

law of large numbers for independent Bernoulli trials. . 603.5 The law of large numbers for Markov chains . . . . . . . . . . 64

3.5.1 The Markov model for crude oil data. . . . . . . . . . . 653.6 FTSE 100: clustering, long range correlations, GARCH. . . . . 67

3.6.1 Checking the algebraic tails conjecture numerically. . . 743.6.2 MATLAB exercises for week 7. . . . . . . . . . . . . . 75

3.7 The Gambler’s Ruin Problem . . . . . . . . . . . . . . . . . . 773.7.1 Nidhi’s game. . . . . . . . . . . . . . . . . . . . . . . . 84

3.8 Cox-Ross-Rubinstein model and Black-Scholes pricing formulafor European options. . . . . . . . . . . . . . . . . . . . . . . . 853.8.1 The model. . . . . . . . . . . . . . . . . . . . . . . . . 853.8.2 Solving the discrete BS equation using binomial trees. . 903.8.3 The continuous limit of CRR model. . . . . . . . . . . 913.8.4 Matlab Exercises for Weeks 8, 9. . . . . . . . . . . . . 97

4 Numerical schemes for solving Differential and StochasticDifferential Equations 984.1 Systems of ODE’s. . . . . . . . . . . . . . . . . . . . . . . . . 98

ii

Page 4: Numerical Methods in Finance. Part A. (2008-2009)Numerical Methods in Finance. Part A. (2008-2009) Paul Clifford, Sebastian Van Strien and Oleg Zaboronski 1 October 2, 2008 1olegz@maths.warwick.ac.uk

4.1.1 Existence and Uniqueness. . . . . . . . . . . . . . . . . 984.1.2 Autonomous linear ODE’s . . . . . . . . . . . . . . . . 1004.1.3 Examples of non-linear differential equations . . . . . . 1044.1.4 Numerical methods for systems of ODE’s. . . . . . . . 111

4.2 Stochastic Differential Equations . . . . . . . . . . . . . . . . 1224.2.1 Black-Scholes SDE and Ito’s lemma. . . . . . . . . . . 1224.2.2 The derivation of Black-Scholes pricing formula as an

exercise in Ito calculus. . . . . . . . . . . . . . . . . . . 1254.2.3 Numerical schemes for solving SDE’s . . . . . . . . . . 1264.2.4 Numerical example: the effect of stochastic volatility. . 1304.2.5 Some popular models of stochastic volatility . . . . . . 134

iii

Page 5: Numerical Methods in Finance. Part A. (2008-2009)Numerical Methods in Finance. Part A. (2008-2009) Paul Clifford, Sebastian Van Strien and Oleg Zaboronski 1 October 2, 2008 1olegz@maths.warwick.ac.uk

Chapter 0

Preface

0.1 Aims, objectives, and organisation of the

course.

The aim of this module is to learn to think about modeling in finance. Topractice thinking about what is driving cause and effect in some simple mod-els.

In order to do this we shall have the following objectives. We shall learn(something about)

• how to use Matlab to explore with models;

• something about Monte Carlo simulations;

• which time series are generated by which models (for example possibleways of modeling fat tails and so on);

• statistical tests which pick out some charateristics of various models (todistinguish random time series from those coming from deterministicsystems);

• mathematical models describing business cycles in economics (overlap-ping generation models)

• how to vary models, and to investigate the sensitive models are tovariations in parameters;

• numerical iteration schemes.

iv

Page 6: Numerical Methods in Finance. Part A. (2008-2009)Numerical Methods in Finance. Part A. (2008-2009) Paul Clifford, Sebastian Van Strien and Oleg Zaboronski 1 October 2, 2008 1olegz@maths.warwick.ac.uk

The course has been originally written by Sebastian van Strien and com-pletely redesigned in 2007 by Oleg Zaboronski. Paul Clifford made a signif-icant contribution to designing the course project. We shall use mainly thefollowing texts, and you will not regret buying the first two.

• W.H. Press, S.A. Teukolsky, W.T. Vetterling and B.P. Flannery, Nu-merical Recipes in C, Cambridge (1992)

• D.J. Higham and N.J. Higham, Matlab Guide SIAM Society for Indus-trial & Applied Mathematics (2005)

• P. Brandimarte Numerical methods in finance: a MATLAB-based in-troduction John Wiley & Sons, New York, (2001)

• D. Higham, An Introduction to Financial Option Valuation: Mathe-matics, Stochastics and Computation, Cambridge University Press Pa-perback, (2004)

The following could be useful as background reading:

• G.R. Grimmett and D.R. Stirzaker, Probability and random processes,Oxford Science Publications, (1992).

• Ya.G. Sinai, Probability Theory, Springer Textbook, (1991).

• P.E. Kloeden, E. Platen and H. Schurz, Numerical solutions of SDEthrough computer experiments, Springer 1997

• E. Prisman, Pricing derivative securities, an interative dynamical en-vironment using maple and matlab, Academic Press

• B. Ripley, Stochastic simulation, Wiley

• H.G. Schuster, Deterministic Chaos: an introductions, Physic Verlag1988.

• Part-Enander, Sjoberg, Melin and Isaksson, The Matlab handbook’,Addison-Wesley.

v

Page 7: Numerical Methods in Finance. Part A. (2008-2009)Numerical Methods in Finance. Part A. (2008-2009) Paul Clifford, Sebastian Van Strien and Oleg Zaboronski 1 October 2, 2008 1olegz@maths.warwick.ac.uk

• J.Y. Cambell, A.W. Lo and A.C. MacKinlay, The econometrics of fi-nancial markets, Princeton 1997.

Notes will be handed out during each teaching session. At some pointthe notes for will also become available on the web site:

http://www.warwick.ac.uk/~mascy/

The organisation of the course if follows. Each Thursday you will begiven a 2-hour long lecture with a 5 minutes break in the middle. EachWednesday afternoon 14:00- 16:00 you will have a computer session in whichwe will learn to programme in Matlab, followed by a C ++ tutorial at 16:00-18:00. For this you need to have your university computer account nameand password. So you will NOT be using your WBS computer account onWednesday. The material for these computer sessions will be at the end ofthe handout which you will normally given out during the Thursday lecture.You will find that the exercises in this text will help you to get familiarwith the material. The projects will not cost you a huge amount of time,especially if you do them during the practice session. The matlab part ofthe course is assessed by saving a number of small projects. You may geta small class test lasting perhaps 5 to 10 minutes, usually consisting of theprevious exercises. There will also be a project contributing 50% towardsthe final mark for this component of the course. More details on how theentire project mark will count towards the total mark can be found in thehand-book. IMPORTANT NOTE: you are allowed to discuss your projectwith a friend. However, you must hand in YOUR OWN work. This meansyou must be able to defend and explain what is written, and why you havewritten it like that. All projects must be clearly written by you. Copyingis not allowed. Please remember that university rules about plagiarism areextremely strict.

1

Page 8: Numerical Methods in Finance. Part A. (2008-2009)Numerical Methods in Finance. Part A. (2008-2009) Paul Clifford, Sebastian Van Strien and Oleg Zaboronski 1 October 2, 2008 1olegz@maths.warwick.ac.uk

Chapter 1

Linear models: growth anddistribution

The purpose of this chapter to give a first introduction into Matlab, and toexplain why it is in particular useful when considering linear models (so forexample, a vector describing a portfolio)1.

1.1 Matrix computations in Matlab

Matlab Examples.

Let us show how to use Matlab to do matrix multiplications. Enter thematrices in the following way

> A= [ 1, 2; 3, 4 ] , B=[1, 1; 1, 1];

A=

1 2

3 4

Note that the semi-colon after the last command suppresses the output. Nowuse ∗ for multiplication of the two matrices.

1Portfolio: a collection of investments held by an institution or a private individual(Wikipedia)

2

Page 9: Numerical Methods in Finance. Part A. (2008-2009)Numerical Methods in Finance. Part A. (2008-2009) Paul Clifford, Sebastian Van Strien and Oleg Zaboronski 1 October 2, 2008 1olegz@maths.warwick.ac.uk

> A * B - B*A

-1 -3

3 1

Square matrices can be iterated, but not necessarily inverted:

> A^2*B

17 17

37 37

> det(B), B^(-1)

0

Inf Inf

Inf Inf

As you know, a matrix is invertible iff its determinant is not equal tozero.

Many important properties of linear models are determined by eigenvaluesof matrices. Take a square n × n matrix A. A real or complex number t iscalled an eigenvalue of A if there exists a vector v ∈ C

n so that

Av = tv and v 6= 0

or equivalently if(A − tI)v = 0

where I is the identity matrix (v is called the eigenvector associated to t).Eigenvalues and eigenvectors in general need not be real. For the equation

(A − tI)v = 0

to hold, the matrix A − tI must be degenerate, hence

det(A − tI) = 0,

which is an algebraic equation of degree n for eigenvalues of matrix A (char-acteristic equation). Therefore, there are always n eigenvalues (counted with

3

Page 10: Numerical Methods in Finance. Part A. (2008-2009)Numerical Methods in Finance. Part A. (2008-2009) Paul Clifford, Sebastian Van Strien and Oleg Zaboronski 1 October 2, 2008 1olegz@maths.warwick.ac.uk

multiplicities), but a matrix does not necessarily have n linearly independenteigenvectors (if some of the eigenvalues appear with multiplicity).

Matlab can easily compute the eigenvalues of a matrix:

> A=[5,-1;3,1]; eig(A)

4

2

Eigenvectors together with the corresponding eigenvalues can be computedas follows:

> [V,D]=eig(A)

V =

0.7071 0.3162

0.7071 0.9487

D =

4 0

0 2

The terms in the diagonal of the matrix D are the eigenvalues of A, whileV gives the eigenvectors (the first column of V gives the first eigenvector andso on):

> A *[0.7071;0.7071]

2.8284

2.8284

which is 4 times the initial vector (0.7071, 07071). The 2nd eigenvector ismapped to 2 times itself. N. B. Matlab always normalises eigenvectors tohave unit L2 norm,

k | vk |2= 1. Such a normalisation is not necessarilythe best choice in the context of stochastic matrices, see below.

Equation Avk = tkvk for k = 1, 2, . . . n can be written in the matrix form:

AV = V D,

where where D has on its diagonal the eigenvalues of A and V is an n × nmatrix the columns of which are the eigenvectors of A. If eigenvectors of A

4

Page 11: Numerical Methods in Finance. Part A. (2008-2009)Numerical Methods in Finance. Part A. (2008-2009) Paul Clifford, Sebastian Van Strien and Oleg Zaboronski 1 October 2, 2008 1olegz@maths.warwick.ac.uk

are linearly independent, matrix V is invertible and we have the followingmatrix decomposition

A = V DV −1

Note that even if matrix elements of A are real, its eigenvalues can be com-plex, in which case V and D are complex. If A does not have a basis ofeigenvectors (which can happen if several eigenvalues coincide) then one hasto allow D to be of a more general (Jordan) form (Jordan decompositiontheorem). D will then have a block-diagonal form. Diagonal entries of theJordan block are equal to an eigenvalue of A, the superdiagonal consists of1’s, the rest of matrix elements are zero.

The expression A = V DV −1 implies

An = V DnV −1.

But since D is such a special matrix, it is easy to compute its powers, andfrom this we can prove the theorem below.

Theorem 1.1.1. If the norm of each eigenvalue of the diagonalisable matrixA is < 1 then for each vector v one has Anv → 0 as n → ∞.

If there is an eigenvalue of A with norm > 1 then for ‘almost all’ vec-tors v (i.e., for all vectors which do not lie in the span of the eigenspacescorresponding to the eigenvalues with norm ≤ 1) one has |Anv| → ∞ asn → ∞.

If A has an eigenvalue equal to one, then different things can happendepending on the matrix.

Idea of the proof (part 1): Let λmax be an eigenvalue of A with thelargest norm, ||lambdamax|| < 1. For v 6= 0,

||Anv|| = ||v|| ·||Anv||

||v||≤ ||v|| · ||An|| ≤ ||v|| · ||V || · ||V −1|| · ||Dn||

≤ ||v|| · ||V || · ||V −1|| · |λmax|n → 0, n → ∞.

Important remarks:

• If A is a symmetric n× n square matrix (for example a covariance matrix) thenit always has n real eigenvalues and a basis of n real eigenvectors which form anorthogonal basis. So in that case we could choose V so that its columns forman orthogonal basis (the eigenvectors of A) and so in that case V −1 is equal to V tr.

5

Page 12: Numerical Methods in Finance. Part A. (2008-2009)Numerical Methods in Finance. Part A. (2008-2009) Paul Clifford, Sebastian Van Strien and Oleg Zaboronski 1 October 2, 2008 1olegz@maths.warwick.ac.uk

• Eigenvectors of a non-symmetric matrix do not necessarily form a basis. For

example, the non-symmetric matrix A =

(

1 10 1

)

has only 1 as an eigenvalue,

and A has only one eigenvector. Even if A has a basis of eigenvectors, they donot need be orthogonal, and so in general V −1 is definitely not equal to V tr.

In this chapter we shall discuss in particular two types of square matriceswith non-negative entries:

• General non-negative matrices;

• Stochastic matrices

1.2 Non-negative matrices: modeling growth

1.2.1 Models with an age profile

We shall now discuss a simple model that can be used to predict the size of apopulation, the size of a portfolio and so on. To keep it simple, let us consideran example of a portfolio of highly risky stocks2. Very similar models can beused to model the size of human population, of the spread of some disease(say mad cow disease), your clients who recommend your services to othersbut who can go out of business. In general, think of a situation where one hasan age profile, with a birth and death rate. (Often there are non-linearities,but in these models we shall ignore them.)

Let us make it simple and assume that we are venture capitalists investingin high-tech start-up companies. We insist that all companies we invest inhave an exit strategy for the end of the third year. We also immediatelyre-invest all the returns into the new start-ups.

Let N0(n) be the amount of capital3 we invest in the new companies inyear n, N1(n) the amount of capital tied in the one-year old companies inyear n and, finally, N2(n) the amount of capital tied in the ‘old’ companiesin year n. (For definiteness, let us use US dollars to measure the amount ofcapital.)

2In financial markets, stock capital raised by a corporation or joint-stock companythrough the issuance and distribution of shares (Wikipedia)

3In finance and accounting, capital generally refers to financial wealth, especially thatused to start or maintain a business (Wikipedia)

6

Page 13: Numerical Methods in Finance. Part A. (2008-2009)Numerical Methods in Finance. Part A. (2008-2009) Paul Clifford, Sebastian Van Strien and Oleg Zaboronski 1 October 2, 2008 1olegz@maths.warwick.ac.uk

Suppose that on average 3/4 of the investment into the new companies islost due to bankruptcy in the first year. Suppose also that 1/2 of the capitaltied in the one-year old companies is lost due to bankruptcy in their secondyear of operation. Then N1(n + 1) = N0(n)/4 and N2(n + 1) = N1(n)/2.

Assume that the return from one-year old companies due to an earlyexit is 2N1(n) dollars in year n, whereas the return from the two-year oldcompanies which must exit in the end of their third year of operation is4N2(n) dollars. Then the total amount we re-invest in new companies in theend of year n is N0(n + 1) = 2N1(n) + 4N2(n) dollars. In matrix form

N0(n + 1)N1(n + 1)N2(n + 1)

=

0 2 41/4 0 00 1/2 0

N0(n)N1(n)N2(n)

. (1.2.1)

This transformation determines the ‘age structure’ of the population inyear n+1 once it is known what it is in year n. Let us give the above matrixa name:

L =

0 2 41/4 0 00 1/2 0

.

Iterating expression (1.2.1) we get

N(n + 1) = LN(n) and N(n) = LnN(0)

where N(n) is the column vector [N0(n), N1(n), N2(n)]′. Vector N(0) de-scribes the initial distribution of the capital between the start-ups we manage.For example, the vector N(0) = [C, 0, 0]′ corresponds to our fund investingC dollars in new start-ups.

So what is the growth-rate associated to this model? If this year thetotal capital tied in the start-ups is N0(n) + N1(n) + N2(n) dollars, thenit is 2N1(n) + 4N2(n) + (1/4)N0(n) + (1/2)N1(n) dollars next year. So thegrowth-rate is

2N1(n) + 4N2(n) + (1/4)N0(n) + (1/2)N1(n)

N0(n) + N1(n) + N2(n).

The survival of our investment fund depends on whether this rate is less orbigger than one. Unfortunately the answer is not obvious from the aboveformula. We will develop the machinery needed for answering such questionsin the next section.

7

Page 14: Numerical Methods in Finance. Part A. (2008-2009)Numerical Methods in Finance. Part A. (2008-2009) Paul Clifford, Sebastian Van Strien and Oleg Zaboronski 1 October 2, 2008 1olegz@maths.warwick.ac.uk

Notice that one can also use similar models to predict the age structure ofpeople in a country (the prediction that in the West in the next few decadesthe average age of the population will continue to grow is based on similarmodels. In this case the model specifies reproduction and death rates foreach age group of the population.).

1.2.2 The asymptotic behaviour depends on age-structure.

Simulations with Matlab indicate that for n large (say n > 30) the matrixLn is approximately equal to

0.4 1.6 1.60.1 0.4 0.40.05 0.2 0.2

.

First we should note that this limit matrix has columns which are all multiplesof each other, i.e., all are some constant times

821

.

But there is something else which is important: The size of your total capitalin the future depends on the age structure4 of the companies you own now,not just the total capital. For example,

L100

100100800

=

1480370185

while L100

800100100

=

64016080

and therefore the total capital in the first case is equal to 2035 million dollarsas opposed to 880 million dollars in the second case, even though in bothcases you initial investment was 1 billion dollars. (Of course, if we take ourexample seriously, it may well be that the only starting point available to usis N(0) = [C, 0, 0]′, in which case we will loose half of the money in the longrun:

∑3k=1(L

100N0)k = 0.55C. Who said being a venture capitalist is easy?)

4By the age structure we understand the distribution of capital between different com-panies.

8

Page 15: Numerical Methods in Finance. Part A. (2008-2009)Numerical Methods in Finance. Part A. (2008-2009) Paul Clifford, Sebastian Van Strien and Oleg Zaboronski 1 October 2, 2008 1olegz@maths.warwick.ac.uk

Moreover, since in the limit each of the columns is a multiple of

821

the sizes of the age groups is eventually approximately in this proportion. Soin these models one can only make predictions if one knows the age structureof the population, not just its size.

Why do you get this limit, and why are all the columns of the matrixmultiples of each other? This is easy to explain by writing the matrix interms of its basis of eigenvalues:

[V,D]=eig(L)

V =

-0.9631 0.9177 0.9177

-0.2408 -0.2294 - 0.2294i -0.2294 + 0.2294i

-0.1204 -0.0000 + 0.2294i -0.0000 - 0.2294i

D =

1.0000 0 0

0 -0.5000 + 0.5000i 0

0 0 -0.5000 - 0.5000i

Since L = V DV −1, Ln = V DnV −1 and since Dn tends to

1 0 0

0 0 0

0 0 0

and so for n large V Dn is approximately the matrix −0.1204 times

8 0 0

2 0 0

1 0 0

(the resulting first column is the first eigenvector of A). This implies thatfor each v, lim V DnV −1v is a multiple of the vector [8, 2, 1]′. From this weobtain the special structure of the limit matrix. So the key point here is thatthere is precisely one eigenvalue which dominates all the others. In this situ-ation it is possible to answer all sorts of questions about the model, including

9

Page 16: Numerical Methods in Finance. Part A. (2008-2009)Numerical Methods in Finance. Part A. (2008-2009) Paul Clifford, Sebastian Van Strien and Oleg Zaboronski 1 October 2, 2008 1olegz@maths.warwick.ac.uk

the question about the growth rate posed in the end of the previous section:If n → ∞, N(n) ≈ w(N(0))v, where v = [8, 2, 1]′ is an eigenvector corre-sponding to the eigenvalue λ = 1 and w(N(0)) is the scalar which dependson the initial vector. Therefore, the total growth rate is asymptotically 1(the largest eigenvalue), i. e. there is no growth. However, the total growthachieved by some large time n is

Γ =

k(LnN0)k

C=

k

(Ln[p0, p1, p2]′)k,

where C is the total initial investment, pi is the share of the investment intothe companies which are i years old. As it is easy to see from the limitingform of Ln, Γ = 0.55 is minimal for p0 = 1, p1 = 0, p2 = 0, and Γ = 2.2 ismaximal for p0 = 0, p1 + p2 = 1.

Our analysis was very easy at it happened that matrix L had a real eigen-value the norm of which was larger than the norm of any other eigenvalue.As a result we didn’t really have to calculate large powers of L explicitly.Were we particularly lucky or is this situation generic? The answer is ’Thelatter’ given that we are dealing with irreducible matrices.

We say that a non-negative matrix P is irreducible if there exists aninteger k ≥ 1 so that P k has only strictly positive coefficients.

Theorem 1.2.1. If P is an irreducible non-negative matrix, then:(1) There is one real positive eigenvalue > 0 which is larger in norm

than all others.(2) If > 1 then for almost all vectors v one gets that |P nv| → ∞ as

n → ∞;(3) If ∈ (0, 1) then for all vectors v, P nv → 0 as n → ∞;(4) If = 1 then P n tends to a matrix Q for which each column of Q

is some multiple of one column vector w with positive entries. The columnvector w is the eigenvector of P associated with eigenvalue 1.

The matrix L from this section is irreducible: L5 > 0. So Ln convergesto a non-zero matrix because the largest eigenvalue (largest in norm) of L isequal to one. If instead of L we would consider another irreducible matrix

> A=[0,2,3;1/4,0,0;0,1/2,0]

0 2 3

1/4 0 0

0 1/2 0

10

Page 17: Numerical Methods in Finance. Part A. (2008-2009)Numerical Methods in Finance. Part A. (2008-2009) Paul Clifford, Sebastian Van Strien and Oleg Zaboronski 1 October 2, 2008 1olegz@maths.warwick.ac.uk

then because the eigenvalue of A with the largest norm is 0.9466, the matrixAn tends to zero as n → ∞ with this rate.

Such a remarkable statement as 1.2.1 deserves some comments. Parts (2)and (3) follow easily from Theorem 1.1.1. Parts (1) and (4) are a consequenceof the famous Perron-Frobenius Theorem:

Theorem 1.2.2. Let A = (aij) be a real n × n matrix with positive entriesaij > 0. Then the following statements hold:

(1) There is a positive real eigenvalue r of A: any other eigenvalue λsatisfies |λ| < r.

(2) The eigenvalue r is simple: r is a simple root of the characteristicpolynomial of A. In particular, both the right and the left eigenspaces asso-ciated with r are one-dimensional.

(3) There are left and right eigenvectors associated with r which havepositive entries.

(4) minj

i aij ≤ r ≤ maxj

i aij.

For the proof of Perron-Frobenius (PF) theorem, see the extra handoutsfor this Lecture. Let us show how parts (1), (4) of Theorem 1.2.1 follow fromTheorem 1.2.2. Let k: matrix Ak has only positive entries. As A has onlynon-negative entries and is irreducible, Ak+1 has only positive entries. Thelargest in norm eigenvalues of Ak and Ak+1 have the form rk, rk+1, where r isan eigenvalue of A. By PF theorem, rk and rk+1 are real positive. Therefore,r is real positive. Also, any other eigenvalue λ of A satisfies |λ|k < rk by PFapplied to Ak. Therefore, r > |λ| where λ is an arbitrary eigenvalue of Adistinct from r. Part (1) is proved.

To prove part (4), we notice that by Jordan decomposition theorem, thereis a basis in which matrix A has the following form:

A =

(

1 0T

0 A0,

)

where all eigenvalues of A0 lie inside the unit circle. Hence in virtue of Thm.1.1.1,

limk→0

Ak =

(

1 0T

0 0.

)

In the arbitrary basis

limk→0

Ak = V

(

1 0T

0 0.

)

V −1,

11

Page 18: Numerical Methods in Finance. Part A. (2008-2009)Numerical Methods in Finance. Part A. (2008-2009) Paul Clifford, Sebastian Van Strien and Oleg Zaboronski 1 October 2, 2008 1olegz@maths.warwick.ac.uk

which is rank-1 matrix whose columns are proportional to the eigenvectorassociated with the eigenvalue 1. Part (4) is proved.

1.3 Markov Models and stochastic matrices

1.3.1 Mood fluctuations of a Markovian market

Let us introduce a linear model for the ‘mood of the stock-market’ and studyits behavior using the methods we have just learned. Suppose that on a givenday the market can either move ’up’ or ’down’. Let o(n) be the probabilitythat on the n-th day the market is moving up (the market is ’optimistic’).Let p(n) be the probability that on the n-th day the market is moving down(the market is ’pessimistic’). Now assume that probability distribution ofthe market’s mood on the n-th day depends only on the market’s state onthe (n− 1)-st day. In other words, assume that the fluctuations in the moodof the market are Markovian. Assume also that this dependence is alsostationary, i. e. independent of the day n. Then the model is specifiedcompletely by stating 4 conditional probabilities:(

o(n)p(n)

)

=

(

Pr(Mn =↑| Mn−1 =↑) Pr(Mn =↑| Mn−1 =↓)Pr(Mn =↓| Mn−1 =↑) Pr(Mn =↓| Mn−1 =↓)

)(

o(n − 1)p(n − 1)

)

(1.3.2)

The above expression constitutes a well known probabilistic sum rule con-veniently re-written in the matrix form. In order to be definite, we assumethat after an optimistic day with probability 2/3 and 1/3 respectively an op-timistic or pessimistic day follows. After a pessimistic day these probabilitiesare 1/4 respectively 3/4. The transition matrix of our Markov model of themood of the market takes the form

P =

(

2/3 1/41/3 3/4

)

Matrix P is also called a Markov or a stochastic matrix. This term is usedfor non-negative matrices such that the sum of the coefficients of each columnis equal to one. It is easy to see that matrix P built out of conditional isstochastic. We want to compute the probability that the stock market is ina certain state on day n. These probabilities can be denoted by the numberso(n) and p(n). Since these are probabilities, o(n) + p(n) = 1 and each of

12

Page 19: Numerical Methods in Finance. Part A. (2008-2009)Numerical Methods in Finance. Part A. (2008-2009) Paul Clifford, Sebastian Van Strien and Oleg Zaboronski 1 October 2, 2008 1olegz@maths.warwick.ac.uk

these numbers is greater or equal to zero. The vector

(

o(n)p(n)

)

also is called

a probability vector . Can you check that our model is consistent, in thesense that stochastic matrix maps stochastic vector to a stochastic vector?

Iterating (1.3.2) we get

(

o(n)p(n)

)

= P n

(

o(0)p(0)

)

.

To study stochastic matrices we need the following Corollary of Perron-Frobenius Theorem 1.2.2

Theorem 1.3.1. If P is an irreducible stochastic matrix, then precisely oneof the eigenvalues of P is equal to 1 and all others have norm < 1. Asn → ∞ the matrices P n converge to a matrix Q whose columns are all thesame. This column vector is the eigenvector w corresponding to eigenvalue1. Its coefficients are positive and add up to 1. (A stochastic vector.) Eachcolumn of Q is equal to w.

Firstly, we have to prove is that the largest eigenvalue of P is equal to 1.This follows from part (4) of PF theorem, as for any stochastic matrix

mini

j

pij = maxi

j

pij = 1.

Secondly, we need to verify that all columns of the limiting matrix is notjust proportional but equal to the (stochastic) eigenvector associated witheigenvalue 1. This is true as the limiting matrix is also stochastic, thereforematrix elements in each column must sum to 1.

Matrix P is irreducible as every matrix element is positive. As we havejust proved, limn→∞ P nv → w, for each probability vector v, where w isthe stochastic eigenvector associated with eigenvalue 1. They say that wdescribes the equilibrium state, which is unique for irreducible stochastic ma-trices. So, for large n, P nv does not depend much on the initial probabilityvector v. How fast P n → Q essentially is determined by the eigenvalue(s) of

P which is/are closest to the unit circle. For example, if P =

(

0.99 0.010.01 0.99

)

then P 10 =

(

0.9 0.10.1 0.9

)

is still far from stationary. (The eigenvalues of P

13

Page 20: Numerical Methods in Finance. Part A. (2008-2009)Numerical Methods in Finance. Part A. (2008-2009) Paul Clifford, Sebastian Van Strien and Oleg Zaboronski 1 October 2, 2008 1olegz@maths.warwick.ac.uk

are 0.98 and 1.) Note that irreducibility of P is crucial for the uniqueness

of equilibrium state. If for example, P =

1 0 00 0.9 00 0.1 1

then limn→∞ P n =

1 0 00 0 00 1 1

, and so in particular, limn→∞ P nv does seriously depend on v.

Note that in the example from the beginning of this section, P is irre-ducible, and so P n tends to a matrix with all column the same. In fact,

P^10 is roughly equal to the stationary matrix:

Q= 0.4286 0.4286

0.5714 0.5714

Hence for the example at hand, the market in its equilibrium state is goesup with probability 0.4286 and down with probability 0.5714.

It is often convenient to describe Markov models using trellis diagrams:

Down Down

Up Up 2/3

1/3

3/4

1/4

Remark. The discussed ’market mood’ model is a projection of thecelebrated Cox-Ross-Rubinstein (or binomial )model used to estimate theprice of American options.5. In the simplest version of the model a value ofan asset on the day n may go up by the factor of u > 1 with probability p ordown by the factor of d = 1/u with probability 1− p. Therefore, the pay-offfor the American call option6 on the n-th day is max(0, S0 ·u

Nu(n)−Nd(n)−K),

5An option is called ”American” if it may be exercised at any time before the expirydate.(Wikipedia)

6A call option is a contract which gives its owner the right to purchase a prescribedasset in the future at an agreed price (exercise or strike price).

14

Page 21: Numerical Methods in Finance. Part A. (2008-2009)Numerical Methods in Finance. Part A. (2008-2009) Paul Clifford, Sebastian Van Strien and Oleg Zaboronski 1 October 2, 2008 1olegz@maths.warwick.ac.uk

where S0 is the initial value of the asset, K is the exercise price, Nu(n) is thenumber of upward (’optimistic’) days among n days, Nd(n) is the number of’pessimistic’ days. The model can be generalized by allowing the probabilityof the move on the day n to depend on what has happened in the previousday. We see that the pay-off depends on the number of ’ups’ and ’downs’only. These are exactly the quantities the statistics of which we studied inthe ’market mood’ model.

1.3.2 Another Markov model: a random walk on agraph

Consider n states, and the graph connecting these n states. Let us say thatthe probability of moving from state i to state j is given by pji, i.e. onthe i-th column and the j-th row entry), from a matrix P . If v describesa probability vector associating a mass to each of the n states, then P kv isthe mass you have after k steps. Using the sum rule it is easy to check that(in general) the ji-th entry of P k gives the transition probability of movingfrom i to j in precisely k steps. For example, take n = 5 and the transitionmatrix

P =

1/2 0 0 0 00 1/2 0 1/3 1/40 0 1/2 0 1/40 1/2 0 1/3 1/4

1/2 0 1/2 1/3 1/4

.

(Actually, many people prefer to define the transition as the transpose ofwhat is done here, and one has to make some minor changes.) We canvisualize the model using the state diagram shown on the next page.

The transition matrix is actually not irreducible. This statement is dif-ficult to prove using MATLAB (Can you see why?). The state diagrammakes it easy: as it is impossible to get to site 1 from any other site,P n(0, v2, v3, v4, v5)

T = 0 for any vector with v1 = 0. Hence, the first rowof any power of P must have the form ((P n)11, 0, 0, 0, 0).

The sub-matrix which you get by ignoring the 1st state is irreducible. Sowhat can be said about the probability distribution of the walker after manysteps?

An interpretation one could have in mind is five investment funds wherethe Markov matrix describes the proportion in which they invest in each

15

Page 22: Numerical Methods in Finance. Part A. (2008-2009)Numerical Methods in Finance. Part A. (2008-2009) Paul Clifford, Sebastian Van Strien and Oleg Zaboronski 1 October 2, 2008 1olegz@maths.warwick.ac.uk

1

2

3

4

5

other. The matrix describing to transition from time zero to time k (with ksay 20) is

0.0000 0 0 0 0

0.3332 0.3334 0.3332 0.3333 0.3333

0.1112 0.1111 0.1112 0.1111 0.1111

0.3332 0.3334 0.3332 0.3333 0.3333

0.2223 0.2222 0.2223 0.2222 0.2222

So regardless of how we structure our initial investment (described by aprobability vector v), the eventual return would be the same. But the firstfund dies out, because there are no transfer into this funds. The dyingout of the first fund is only possible due to irreducibility: as it is easy tocheck, the vector (0, 0.33, .011, 0.33, 0.22)T is an eigenvector of P associatedwith eigenvalue 1. For the irreducible stochastic matrix such an eigenvectorwould have only positive coefficients due to Theorem 1.3.1.

What happens if the coefficient on the left top is replaced by 0.6? (Thetransition matrix is no longer stochastic, but we can still use our investmentfunds analogy to say that the first fund gets a constant injection of extracash.) Simulating shows that (for k roughly 20) the transition matrix fromtime 0 to time k is given by

0.0000 0 0 0 0

0.4164 0.3334 0.3332 0.3333 0.3333

0.1391 0.1111 0.1112 0.1111 0.1111

0.4164 0.3334 0.3332 0.3333 0.3333

0.2779 0.2222 0.2223 0.2222 0.2222

16

Page 23: Numerical Methods in Finance. Part A. (2008-2009)Numerical Methods in Finance. Part A. (2008-2009) Paul Clifford, Sebastian Van Strien and Oleg Zaboronski 1 October 2, 2008 1olegz@maths.warwick.ac.uk

So in this case, it would be best to put all your money in the first fund,despite the fact that eventually this fund dies out. It is the first fund thatactually makes money, because the sum of the elements of the first columnis > 1 (the sum of the first column is 1.1, while the sum of the others is 1).This last example can serve as a light-hearted description of the economyof the former Soviet Union. The government subsidizes the industry. Thesubsidies get stolen and moved abroad. The state eventually collapses.

Further in the course we shall discuss Monte-Carlo methods, and see whythe fact that one of the other eigenvalues of P could be close to 1, could playa role: because of this P n is not that close to the limit Q even for n large,which leads to slow convergence of the Monte-Carlo-based numerical scheme.

1.3.3 Matlab Project for week 2.

During the Matlab Project in week 2 you will do the sections ’Basic syn-tax and command-line exercises’ and ’Basic array exercises’ of the exercisesfrom http://www.facstaff.bucknell.edu/maneval/help211/exercises.html An-swers are also given on this website, which might give you some tips, but youneed to go through these exercises yourself. To test whether you have man-aged to get through this material, you will get a class test at the beginningof the Thursday lecture of week 2.

17