From mailer@stamper.itconsult.co.uk Sun Nov 13 23:17:36 2005 Return-Path: Received: from m13.itconsult.net (m13.itconsult.net [193.201.42.13]) by mail.info-bazar.net (8.13.5/8.13.5) with ESMTP id jADFHYG1022050 for ; Sun, 13 Nov 2005 23:17:35 +0800 Received: from stamper.itconsult.co.uk (stamper.itconsult.co.uk [193.201.42.31]) by m13.stamper.itconsult.co.uk (GMS 11.01.3365/NT8923.00.5408c509) with SMTP id yvjqiiaa for josh@mail.info-bazar.net; Sun, 13 Nov 2005 15:17:29 +0000 From: Stamper To: josh@mail.info-bazar.net Subject: Clear Stamped 0306530:no subject (file transmission) Message-Id: <0306530.a@stamper.itconsult.co.uk> Date: Sun, 13 Nov 2005 15:17:29 +0000 Status: RO Stamper is a service provided free of charge to Internet users. You are very welcome to use Stamper, but you may only do so if you have first read our Terms of use, which exclude liability on our part and which provide for you to indemnify us against any potential liability arising from your use of Stamper. By using Stamper you warrant that you have read and accept the Terms. The Terms of use are available by sending email to info@stamper.itconsult.co.uk or from the web page http://www.itconsult.co.uk/stamper.htm. -----BEGIN PGP SIGNED MESSAGE----- ######################################################## # # The text of this message was stamped by # stamper.itconsult.co.uk with reference 0306530 # at 15:17 (GMT) on Sunday 13 November 2005 # # For information about the Stamper service see # http://www.itconsult.co.uk/stamper.htm # ######################################################## - -----BEGIN PGP SIGNED MESSAGE----- = Multi-Dimension Margrabe Formula = == Abstract == Margrabe formula (1978), used in many financial engineering literature. Originally, it is to solve E[Exp[ax], {ax+by<=k}] where x and y is a binormal distribution, k is a constant. This article presents a multi-dimension version, which is used in some term structure model. == Sol == /The C# source code for this calculation is in the/ SourceCodeRepository. We want to calculate the integration over n-dimension spaceˇG E[Exp[A.X], {B.X<=k}] where A is of 1 by n matrix, B is of 1 by n matrix, X is of n by 1 matrix and entries of X is a multi-normal distribution with mean M, of n by 1 matrix, and covariance matrix S, of n by n matrix. By elementary math, the moment generating function of X is Exp[T.M + 1/2 T.S.Transpose[T]] where T is of 1 by n matrix. The key of this calculation is to change the variable X to another set of variable Y which are independent. Suppose Y=C.X where C is of n by n matrix. By elementary math, the moment generating function of Y is Exp[T.N + 1/2 T.D.Transpose[T]] where N=C.M D=C.S.Transpose[C] Since all entries of Y are independent, it means D is of diagonal. The C can be set up in this way that the first row of C is B. Once this C is found, denote A.Inverse[C] by R i-th row of Y by yi i-th column of R by ri i-th row of N by Ni (i-th, i-th) entry of D by Di standard normal accumulated distribution function by Normal we haveˇG ˇ@E[Exp[A.X], {B.X<=k}] = E[Exp[R.Y], {y1<=k}] = E[Exp[r1.y1], {y1<=k}]E[Exp[r2.y2]]E[Exp[r3.y3]]...E[Exp[rn.yn]] = Normal[(k-(N1+D1.r1))/Sqrt[D1]].Exp[N1.r1 + 1/2 r1^2.D1].Exp[N2.r2 + 1/2 r2^2.D2]...Exp[Nn.rn + 1/2 rn^2.Dn] = Normal[(k-(N1+D1.r1))/Sqrt[D1]].Exp[(N1.r1 + N2.r2 + .. + Nn.rn) + 1/2 (r1^2.D1 + r2^2.D2 + .. + rn^2.Dn)] = Normal[(k-(N1+D1.r1))/Sqrt[D1]].Exp[R.N + 1/2 R.D.Transpose[R]] = Normal[(k-(N1+D1.r1))/Sqrt[D1]].Exp[A.Inverse[C].C.M + 1/2 A.Inverse[C].C.S.Transpose[C].Transpose[A.Inverse[C]]] = Normal[(k-(N1+D1.r1))/Sqrt[D1]].Exp[A.M + 1/2 A.S.Transpose[A]] We are done. == How to find C == First, start from S, we first change variable Z=V.X in this way z1=B.X, z2=x2, z3=x3,... , zn=xn. Denote covariance of Z by G, we have G=V.S.Transpose[V] Second, use the LowerUpperTriangleDecomposition algorithm on G, we have a lower triangle matrix L whose diagonal is 1 and a diagonal matrix D such that: D=L.G.Transpose[L] Therefore, D=L.G.Transpose[L] =L.V.S.Transpose[V].Transpose[L] =LV.S.Transpose[LV] LV is the C we want. == Example == We want to calculate E[Exp[(x1-x2+x3+x4], {x1+x2+x3-x4<=k}] where mean and covariance of x1, x2, x3, x4 is |1| |2| |3| |4| and |1|0.1|0.1|0.1| |0.1|1|0.1|0.1| |0.1|0.1|1|0.1| |0.1|0.1|0.1|1| By the above notation, we have: M= |1| |2| |3| |4| S= |1|0.1|0.1|0.1| |0.1|1|0.1|0.1| |0.1|0.1|1|0.1| |0.1|0.1|0.1|1| A= |1|-1|1|1| B= |1|1|1|-1| Therefore, V= |1|1|1|-1| |0|1|0|0| |0|0|1|0| |0|0|0|1| G= |4|1.1|1.1|-0.7| |1.1|1|0.1|0.1| |1.1|0.1|1|0.1| |-0.7|0.1|0.1|1| L= |1|0|0|0| |-0.275|1|0|0| |-0.35483871|0.290322581|1|0| |0.5|-0.590909091|-0.590909091|1| C=LV= |1|1|1|-1| |-0.275|0.725|-0.275|0.275| |-0.35483871|-0.064516129|0.64516129|0.35483871| |0.5|-0.090909091|-0.090909091|0.5| D= |4|0|0|0| |0|0.6975|0|0| |0|0|0.638709677|0| |0|0|0|0.531818182| R= |0.1|-1.161290323|1.181818182|2| N= |2| |1.45| |2.870967742| |2.045454545| Therefore, N1=2, D1=4, R1=0.1, A.M=6, A.S.Transpose[A]=4 And the answer is Normal[(k-(N1+D1.r1))/Sqrt[D1]].Exp[A.M + 1/2 A.S.Transpose[A]] =Normal[k/2-1.2].Exp[8] - -----BEGIN PGP SIGNATURE----- Version: PGP 7.0.4 iQB1AwUBQ3dY8VY6lNZmmS4NAQH9GQL/U7p0sZzFcLU2Wt8SJp2ytJpvoUH19YQ0 3kCE/3OAr8PVdJFj6/j4ss9CFHIQpxFamD858P+iaIX7gjj0yWOA/tHNJgazZYYv gFKf2MM5qN0NyVlR57CRz+xoOND+Ew/1 =Qv2F - -----END PGP SIGNATURE----- -----BEGIN PGP SIGNATURE----- Version: 2.6.3i Charset: noconv Comment: Stamper Reference Id: 0306530 iQEVAgUBQ3dZCIGVnbVwth+BAQHr9Af9GTF2iTXNfIqN9Flh7UJ/N7tUyoevLf8r 95BNJ3eVzMLNiU63v6kqLNxgJM9V9F0vZsG49+SpHJ/bA7uOEuJ9IIjMMsTnpihb aDyqrPF6aBMn/N8YCcg9vN7biql/RN1Q3Fmglbe9Rmx8yvj6JFMVVIof3H0MWxzT KjXbzwl1PFIDIRlAw1//+oNGJ0/au6wTD+LtdsDB2A24RcgaP2PIgAJRQan4KWDW ae43hycuVK/LDKB/FMxr7wHgK2V8meSdWf8tPMA0vrwI8HWRUg/pZDh1t1zWHXxr wxgRK3J88RMHvKLNkhc82AKktw0d181I5ET0nBKzC2OPPaqnz62tDA== =U+se -----END PGP SIGNATURE-----