MATH4061-matlab代写
时间:2023-03-13
ADVANCED FINANCIAL MATHEMATICS University of Nottingham
MATH4061 2022/23 SCHOOL OF MATHEMATICAL SCIENCES
——————————————————————————————————————————————
Monte Carlo technique: Project B
1 Outline Brief
The Monte Carlo method was proposed as a tool for evaluating high-dimensional integrals by John von
Neumann and Stanislaw Ulam in March 1947 when they worked on the thermonuclear bomb in Los Alamos
(US). The name ‘Monte Carlo’ for this statistical sampling technique was coined by Nicholas Metropolis –
a friend and collaborator of von Neumann and Ulam. This name was related to the fact that Ulam had
an uncle who was a gambler and would borrow money from relatives because he “just had to go to Monte
Carlo” – a reference to the Monte Carlo Casino in Monaco [13]. See an account of these days by their direct
participant in [10]. The Monte Carlo method owes its birth not only to the nuclear arms race and genius
of von Neumann and Ulam but also and essentially to the appearance of the first computers in 1940s. It
should be also noted that random methods in computation can be traced back to the earliest pioneers of
Probability theory, and perhaps the earliest example of ‘Monte Carlo’ is Buffon’s needle problem of 1777
[1, 2].
The Monte Carlo technique (in its huge varieties) is widely used in a large number of applications. It
started from application in physics and it is still one of the important computational tools in physics. With
enormous computational power available now (distributed computer systems, parallel computers, clusters,
GPUs), the Monte Carlo technique is becoming more and more practical. E.g., it is used in molecular
dynamics simulations, including simulation of complex biomolecules, and in statistical physics. Monte Carlo
methods are also widely used in Statistics/Data Science. It comes as no surprise that the Monte Carlo
technique is a natural computational tool in Financial Engineering and Actuarial Science, which is routinely
and commonly used in the financial sector. The main aim of this mini-project is for you to get some basic
understanding of and experience with this important numerical approach. This is also an opportunity to
enhance your programming skills, to practice report writing, and to experience intensive group working.
2 Tasks
The project is split into the following tasks:
1. It is expected that the group will not know much (possibly nothing) about the Monte Carlo technique.
An important first task is to learn about this technique and how to apply it to problems related to
Financial Engineering. A good starting point is Section 1.1 and Appendix A.2 in [4] and also Chapter 9
of [8] and Chapter 15 of [6], but many other sources can be found by yourself. In the report you will
need to have a chapter on basics of the Monte Carlo method (its main principles and error analysis,
including its practical aspects).
2. Implementation of Monte Carlo algorithms requires a source of “randomness”. Typically, random
numbers are approximated by pseudorandom ones which are generated via iterative deterministic
algorithms. These algorithms simulate a sequence of numbers which are in fact not random at all.
The program that produces a sequence of pseudorandom numbers is called pseudorandom number
generator or, for simplification, random number generator (RNG). To read on this topic you can use
Chapter 2 of [4], Chapter 9 of [8], Section 2.6 in [11] or the book [3] dedicated to RNGs. You are not
required to learn about RNGs in detail, but you need to find a suitable RNG for the task (you may use
any publicly available code1) and know how to use it. Some reflection on RNGs, especially reasoning
behind your choice of RNG, should be included in the report, but not in depth.
3. More complex models of underliers than GBM need to be approximated, i.e., we need to consider
numerical methods for SDEs. One can consider this topic as a generalisation of numerical schemes
for (deterministic) ordinary differential equations which you studied, in particular, in MATH4064
1Please don’t forget to acknowledge the source if you take somebody’s code.
1
and/or MATH2019. Of course, the SDEs case is more complicated. Dependence of SDEs’ solution
X(t) = X(t;ω) on ω (“randomness”) raises the question how to measure closeness between the exact
solution and its approximation. This can be done in various ways and the answer to this question
largely depends on what you would like to compute. Another problem we face here in comparison
with deterministic ODEs is that trajectories X(t) are not differentiable. In the deterministic numerical
analysis (like MATH4064 and/or MATH2019) you relied on smoothness of ODEs solutions to prove a
convergence order of a numerical scheme. Consequently, the deterministic numerical analysis results
are no longer applicable here. Since in the majority of financial engineering problems we need to
compute some expectations of a functional of solutions to SDEs only, it is sufficient for the purpose
of this project to consider only so-called weak approximation. In the report you will need to have a
chapter on basics of stochastic numerics, paying special attention to the weak approximation. It is
sufficient to consider Euler-type schemes. For this purpose, you can e.g. use [4, 9, 11].
4. [computational task ] Consider a European put and assume that the price process is described by GBM.
Choose any set of the parameters.
(a) Apply a weak Euler-type scheme to the SDE corresponding to GBM (there is more than one way
to do it; which way is better?).
(b) Simulate the approximate price of the option at time t = 0.
(c) Study convergence both of the Euler scheme and of the Monte Carlo technique. Compare with
the theoretical predictions. You may use the exact option price for this study.
Note that in practice we, of course, do not need to simulate the SDE corresponding to GBM as we
can find the exact solution. The aim of the task 4 is to learn about the Monte Carlo technique and
stochastic numerics, and for this purpose it is, as usual, useful to know the exact solution. Also, in
practice exact solutions are used for code debugging.
5. [computational task ] Consider a European put and assume that the price process is described by the
Heston model [5] (see also e.g. [4] and [14]). Choose any set of the parameters so that the volatility
process remains strictly positive (no proof is required).
(a) Apply the weak Euler scheme to the corresponding SDE. Does it always work? If not, what are
alternatives (see e.g. [14, Chapter 7] and also [12, Section 8.4])? For debugging, you can use the
parameters and price values from [12, Section 8.4].
(b) Simulate the approximate price of the option at time t = 0 and study convergence both of the
Euler scheme and of the Monte Carlo technique.
(c) Plot implied vol for European puts with different strikes, when the underlier is modelled by the
Heston model. Explain what you observe. Experiment with different values of parameters of the
Heston model: vol-vol, mean reversion, etc. It is sufficient to consider only such parameters that
the stochastic volatility remains strictly positive. Remark: implied vol is computed as usual via
inverting the BS formula. To compute implied vol, you either can program it yourself (see e.g.
[7]) or use a publicly available code (please do not forget to cite it) or a related function in e.g.
R or MatLab.
Note that this is, to some extent, an open ended project as the tasks are free to your interpretation.
3 Deliverables
The project deliverables should illustrate the group’s competence in financial modelling, numerical analysis,
basics of stochastic analysis, algorithmic thinking, facilitation of informative quantitative decision making,
ability to self-study, and programming at the level expected of a recent MSc/MMath graduate.
The Group should provide:
1. A substantial project report covering all 5 tasks. The report is expected to be a maximum of 20 pages
of text, i.e., not counting figures, tables, appendices or table of contents, it should be single-spaced in
12pt font (see further details in the document ‘Effective Written Reports’).
2
2. A working piece of software in any programming language. E.g. the core can be written in C++ (but
not required) and for visualisation, e.g. Excel can be used calling functions using a DLL written in
C++ or any other suitable tools (R, Python, MatLab, etc.). The software should be accompanied by a
one-page of user guide as an Appendix to the project report which should explain how to compile and
run the code. The user guide should specify all the details (e.g. all packages needed to run the software,
version of the programming environment used, etc.) allowing the assessors to test the software.
Electronic copies of software and written report together with a completed submission sheet are required
by 3pm on Friday 31st March to be emailed to michael.tretyakov@nottingham.ac.uk.
Any collaboration between the groups is not permitted, and, if discovered, it will be punished similarly
to plagiarism.
References
[1] G. Buffon. Editor’s note concerning a lecture given 1733 by Mr. Le Clerc de Buffon to the Royal Academy
of Sciences in Paris. Histoire de l’Acad. Roy. des Sci., 1733, 43-45.
[2] G. Buffon. Essai d’arithme´tique morale. Histoire naturelle, ge´ne´rale er particulie`re, Supple´ment 4, 1777,
46-123.
[3] J.E. Gentle. Random number generation and Monte Carlo methods. Springer, 2003. [available in G.
Green library]
[4] P. Glasserman. Monte Carlo Methods in Financial Engineering. Springer, 2003. [available online via
UoN library and in UoN libraries]
[5] S.L. Heston. A closed-form solution for options with stochastic volatility with applications to
bonds and currency options. The Review of Financial Studies 6 (1993), 327-343.[available online at
https://doi.org/10.1093/rfs/6.2.327 with UoN IP address, e.g. via VPN] [Accessed 15/02/23]
[6] D.J. Higham. An Introduction to Financial Option Valuation. Cambridge University Press, 2004. [avail-
able in G. Green library]
[7] P. Jackel. Let’s be rational (2016) at http://www.jaeckel.org/LetsBeRational.pdf [Accessed 13/02/23]
[8] D. Lamberton, B. Lapeyre. Introduction to Stochastic Calculus Applied to Finance. Chapman & Hall,
2008.[available in G. Green library]
[9] P.E. Kloeden, E. Platen. Numerical Solution of Stochastic Differential Equations. Springer, 1992. [avail-
able in G. Green library]
[10] N. Metropolis. The beginning of the Monte Carlo method. Los Alamos Science Special Issue, 1987,
125-130. Available at http://library.lanl.gov/cgi-bin/getfile?00326866.pdf [Accessed 13/02/23]
[11] G.N. Milstein, M.V. Tretyakov. Stochastic Numerics for Mathematical Physics. Springer, 2004.[available
online via UoN library and in G. Green]
[12] G.N. Milstein, M.V. Tretyakov. Numerical analysis of Monte Carlo evaluation of
Greeks by finite differences. J. Comp. Finance. 8 (2005), no. 3, 1–33. Available at:
https://www.maths.nottingham.ac.uk/plp/pmzmt/jcf05.pdf [Accessed 13/02/23]
[13] Monte-Carlo Casino official web-site http://en.montecarloresort.com/Casino-de-Monte-Carlo,507.html
[Accessed 13/02/23]
[14] F.D. Rouah. The Heston model and its extensions in Matlab and C#. John Wiley & Sons, 2013. [available
online via UoN library]
essay、essay代写