不好意思,第一次发帖,不知道规矩,呵呵。我把contents贴出来了
0 Aims, objectives, and organisation of course vi
1 Linear models and Matlab 1
1.1 Matrix computations in Matlab . . . . . . . . . . . . . . . . . 1
1.2 Non-negative matrices: modeling growth . . . . . . . . . . . . 4
1.2.1 Models with an age profile . . . . . . . . . . . . . . . . 4
1.2.2 The asymptotic behaviour depends on age-structure . . 6
1.3 Markov Models . . . . . . . . . . . . . . . . . . . . . . . . . . 8
1.3.1 The Cox-Ross-Rubinstein model as a special Markov
model . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
1.3.2 Another Markov model: a random walk on a graph . . 10
1.4 SVD or Principal Components . . . . . . . . . . . . . . . . . . 11
1.4.1 Stability of eigenvalues . . . . . . . . . . . . . . . . . . 11
1.4.2 Singular values . . . . . . . . . . . . . . . . . . . . . . 12
1.4.3 Application of the singular value decomposition to solving
linear equations . . . . . . . . . . . . . . . . . . . . 14
1.4.4 Least square methods . . . . . . . . . . . . . . . . . . . 17
1.5 Ill-conditioned systems . . . . . . . . . . . . . . . . . . . . . . 18
1.6 Numerical computations with matrices . . . . . . . . . . . . . 20
1.7 Project for the first day . . . . . . . . . . . . . . . . . . . . . 22
1.7.1 A quick introductory session in Matlab . . . . . . . . . 22
1.7.2 A warm-up session with Matlab . . . . . . . . . . . . . 23
1.7.3 Plotting pictures . . . . . . . . . . . . . . . . . . . . . 23
1.7.4 Do loops . . . . . . . . . . . . . . . . . . . . . . . . . . 24
1.7.5 Crucial remark on speeding up Matlab code . . . . . . 24
1.8 Matlab Project for Week 2 . . . . . . . . . . . . . . . . . . . . 25
i
2 Monte Carlo Method I 26
2.1 A revision of the basics . . . . . . . . . . . . . . . . . . . . . . 26
2.2 Random variables and laws of large numbers . . . . . . . . . . 31
2.3 Central Limit Theorem . . . . . . . . . . . . . . . . . . . . . . 32
2.4 Application: Monte Carlo Methods for integration . . . . . . . 34
2.5 The Central Limit Theorem and the CRR model . . . . . . . 36
2.6 Non-stationary and non-independent random variables . . . . 38
2.6.1 Markov chains . . . . . . . . . . . . . . . . . . . . . . . 38
2.6.2 A surprising example: Parrando’s paradox . . . . . . . 39
2.6.3 Non-independent variables . . . . . . . . . . . . . . . . 41
2.6.4 Arch random variables and fat tails . . . . . . . . . . . 43
2.7 Quasi-random Number Generators . . . . . . . . . . . . . . . 43
2.7.1 Quasi-random number generating uniformly distributed
numbers . . . . . . . . . . . . . . . . . . . . . . . . . . 44
2.7.2 Gaussian random generators . . . . . . . . . . . . . . . 47
2.7.3 The inversion method . . . . . . . . . . . . . . . . . . 48
2.7.4 Discrete random variables . . . . . . . . . . . . . . . . 48
2.8 Projects . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 49
2.8.1 Project 1 . . . . . . . . . . . . . . . . . . . . . . . . . 49
2.8.2 Project 2 . . . . . . . . . . . . . . . . . . . . . . . . . 50
2.8.3 Project 3 . . . . . . . . . . . . . . . . . . . . . . . . . 51
3 Monte Carlo Method II 52
3.1 The Gambler’s Ruin Problem . . . . . . . . . . . . . . . . . . 52
3.2 Gambling with the possibility of infinite gains . . . . . . . . . 55
3.3 Random walks: the reflection principle . . . . . . . . . . . . . 56
3.4 Stochastic processes in continuous time . . . . . . . . . . . . . 58
3.4.1 Poisson process . . . . . . . . . . . . . . . . . . . . . . 59
3.4.2 Brownian motion . . . . . . . . . . . . . . . . . . . . . 61
3.4.3 Brownian Bridge . . . . . . . . . . . . . . . . . . . . . 63
3.5 Projects . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 66
3.5.1 Project 1 . . . . . . . . . . . . . . . . . . . . . . . . . 66
3.5.2 Project 2 . . . . . . . . . . . . . . . . . . . . . . . . . 67
3.5.3 Project 3 . . . . . . . . . . . . . . . . . . . . . . . . . 67
3.5.4 Project 4 . . . . . . . . . . . . . . . . . . . . . . . . . 67
ii
4 Monte Carlo methods III: improvements 68
4.1 The basic method . . . . . . . . . . . . . . . . . . . . . . . . . 68
4.1.1 Illustrated for European options . . . . . . . . . . . . . 68
4.1.2 Other options . . . . . . . . . . . . . . . . . . . . . . . 71
4.2 Variance reduction techniques . . . . . . . . . . . . . . . . . . 72
4.2.1 Antithetic reduction methods . . . . . . . . . . . . . . 72
4.2.2 Stratified sampling . . . . . . . . . . . . . . . . . . . . 74
4.2.3 Importance sampling . . . . . . . . . . . . . . . . . . . 75
4.2.4 Using the same random numbers several times . . . . . 75
4.2.5 Control variates . . . . . . . . . . . . . . . . . . . . . . 76
4.3 Pseudo Random Numbers . . . . . . . . . . . . . . . . . . . . 77
4.3.1 Halton sequences . . . . . . . . . . . . . . . . . . . . . 77
4.3.2 Sobol’s sequences . . . . . . . . . . . . . . . . . . . . . 79
4.4 Projects . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 79
4.4.1 Project 1: Value at Risk for an Arch Process . . . . . . 79
4.4.2 Project 2: Comparing accuracies . . . . . . . . . . . . 80
4.4.3 Motivating Brownian motion . . . . . . . . . . . . . . . 80
4.4.4 Simulating Brownian motions: midpoint displacement . 81
5 (Stochastic) Differential Equations 82
5.1 ODE’s . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 82
5.1.1 Existence and Uniqueness . . . . . . . . . . . . . . . . 82
5.1.2 Linear ODE’s . . . . . . . . . . . . . . . . . . . . . . . 83
5.1.3 Non-linear differential equations . . . . . . . . . . . . . 85
5.1.4 Numerical methods: Runge-Kutta methods . . . . . . . 91
5.1.5 Predictor-Corrector methods . . . . . . . . . . . . . . . 93
5.1.6 Instability of numerical schemes . . . . . . . . . . . . . 93
5.1.7 Stiffness of ODE’s . . . . . . . . . . . . . . . . . . . . . 94
5.1.8 Implementations . . . . . . . . . . . . . . . . . . . . . 94
5.2 Stochastic Differential Equations . . . . . . . . . . . . . . . . 95
5.2.1 Numerical schemes for solving SDE’s . . . . . . . . . . 96
5.2.2 Examples of solving SDE’s with Matlab . . . . . . . . 98
5.3 Some examples of stochastic differential equations . . . . . . . 100
5.3.1 Predator-Prey differential equation . . . . . . . . . . . 100
5.3.2 Tlhe Lorenz equations . . . . . . . . . . . . . . . . . . 103
5.4 Discontinuous shocks . . . . . . . . . . . . . . . . . . . . . . . 103
5.5 Projects . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 103
iii
5.5.1 Analyse some simple differential equations and their
stochastic counterparts . . . . . . . . . . . . . . . . . . 103
5.5.2 Analyse model suggested by Kloeden et al for stochastic
volatility . . . . . . . . . . . . . . . . . . . . . . . . 104
5.5.3 Extend this model . . . . . . . . . . . . . . . . . . . . 106
5.5.4 The Lorenz equation (for bonus marks) . . . . . . . . . 106
6 Dynamical systems: theory and numerics 107
6.1 Examples of dynamical systems appearing in economics and
finance . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 107
6.1.1 Endogenous discrete dynamical models in economics . 107
6.1.2 The cobweb model in economics . . . . . . . . . . . . . 107
6.1.3 Adaptive Rational Equilibrium . . . . . . . . . . . . . 109
6.1.4 Routes to chaos in a simple asset pricing model . . . . 113
6.2 Analysis at fixed points of discrete systems . . . . . . . . . . . 116
6.2.1 Bifurcations . . . . . . . . . . . . . . . . . . . . . . . . 117
6.2.2 The logistic system . . . . . . . . . . . . . . . . . . . . 117
6.3 Prediction methods . . . . . . . . . . . . . . . . . . . . . . . . 121
6.3.1 Linear prediction . . . . . . . . . . . . . . . . . . . . . 121
6.3.2 Prediction in non-linear dynamics: Takens embedding
method . . . . . . . . . . . . . . . . . . . . . . . . . . 122
6.4 Project . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 124
6.4.1 Project 1 . . . . . . . . . . . . . . . . . . . . . . . . . 124
6.4.2 Project 2 . . . . . . . . . . . . . . . . . . . . . . . . . 124
7 Further numerical algorithms: root finding and splines 125
7.1 Root finding . . . . . . . . . . . . . . . . . . . . . . . . . . . . 125
7.1.1 Bisection method . . . . . . . . . . . . . . . . . . . . . 125
7.1.2 Newton iteration . . . . . . . . . . . . . . . . . . . . . 127
7.2 Numerical integration . . . . . . . . . . . . . . . . . . . . . . . 128
7.3 Polynomial interpolation . . . . . . . . . . . . . . . . . . . . . 129
7.3.1 Lagrange interpolation . . . . . . . . . . . . . . . . . . 129
7.3.2 Cubic splines . . . . . . . . . . . . . . . . . . . . . . . 132
7.3.3 Bezier curves and B-splines . . . . . . . . . . . . . . . 134
7.3.4 Prediction of population . . . . . . . . . . . . . . . . . 136
iv
8 Some more Matlab 137
8.1 Output . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 137
8.2 Input . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 138
8.2.1 User input on keyboard . . . . . . . . . . . . . . . . . 138
8.2.2 Input from file . . . . . . . . . . . . . . . . . . . . . . . 138
8.2.3 Input with fopen . . . . . . . . . . . . . . . . . . . . . 139
8.2.4 User input with mouse . . . . . . . . . . . . . . . . . . 139
8.3 Output . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 139
8.4 Debugging . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 140
9 Further numerical methods II 141
9.1 Fourier transform . . . . . . . . . . . . . . . . . . . . . . . . . 141
9.1.1 Fourier transforms in the continuous case . . . . . . . . 141
9.1.2 Fourier transforms in the discrete case . . . . . . . . . 142
9.1.3 Fast Fourier Transform (FFT) . . . . . . . . . . . . . . 143
9.1.4 Applications . . . . . . . . . . . . . . . . . . . . . . . . 143
9.1.5 Examples . . . . . . . . . . . . . . . . . . . . . . . . . 143
9.2 Principal Component Analysis (PCA) also called Singular Value
Decomposition (SVD) . . . . . . . . . . . . . . . . . . . . . . 145
10 Predictability of Asset Returns 146
10.1 The random walk hypothesis . . . . . . . . . . . . . . . . . . . 146
10.2 Testing the random walk hypothesis . . . . . . . . . . . . . . . 147
10.2.1 Sequences and reversals . . . . . . . . . . . . . . . . . 147
10.2.2 Autocorrelation coefficients and the Q-statistic . . . . . 148
10.2.3 Fat Tails . . . . . . . . . . . . . . . . . . . . . . . . . . 149
10.2.4 Arch models (and so on) . . . . . . . . . . . . . . . . . 150
10.2.5 Correlation integral, and the BDS statistic . . . . . . . 151
10.3 Monte Carlo Methods . . . . . . . . . . . . . . . . . . . . . . 152
10.4 Examples of Monte Carlo simulations with the BDS statistic . 153
10.5 Appendix: the readme file for the BDS statistic . . . . . . . . 154
11 Modeling 156
11.1 Some examples how to model with probabilities . . . . . . . . 157
11.1.1 Bayesian probabilities . . . . . . . . . . . . . . . . . . 157
11.1.2 Job interviews: another example of computation of expected
values . . . . . . . . . . . . . . . . . . . . . . . 158