程序代写 FIGURES 11

Tools from Stochastic Analysis for Mathematical Finance: A Gentle Introduction
1 2 May 23, 2018
1Faculty of Finance, School, City University London, UK; Email: :
2Faculty of Finance, School, City University London, UK; Email: Experts: , and Dipartimento SEI, Universita` del , Novara, Italy; Email: Upobook:

Copyright By PowCoder代写 加微信 powcoder

I A Gentle Introduction to Stochastic Calculus in Continuous Time 3
2 The Brownian motion 9
2.1 DefiningtheBrownianMotion ………………………………………… 10 2.1.1 TheoddpropertiesoftheBrownianMotion ……………………………… 10 2.1.2 DensityoftheBrownianMotionatdifferentTimeHorizons……………………… 11 2.1.3 The(auto)-covariancefunction …………………………………….. 12 2.1.4 CorrelatedBrownianmotions……………………………………… 13 2.1.5 Martingaleproperty ………………………………………….. 14 2.1.6 Scalingproperty ……………………………………………. 15 2.1.7 Markovproperty……………………………………………. 16 2.1.8 SimulationofBrowniansamplepaths…………………………………. 17 2.1.9 TotalVariation……………………………………………… 17 2.1.10 QuadraticVariation ………………………………………….. 19 2.1.11 PropertiesoftheIncrementsoftheBM ………………………………… 23

CONTENTS 5
3 The Stochastic Integral and Stochastic Differential Equations 25
3.1 Introduction………………………………………………….. 26 3.2 DefiningtheStochasticIntegral………………………………………… 26 3.3 The Ito stochastic integral as a meanRsquare limit of suitable Riemann-Stieltjes sums . . . . . . . . . . . . . . . . . 27
3.4 Amotivatingexample:CompRuting 0tW(s)dW(s) ………………………………. 28
3.4.1 Example:Computing 0tW(s)dW(s)bysimulation ………………………….. 28 3.5 PropertiesoftheStochasticIntegral………………………………………. 28 3.6 StochasticintegralsasTimeChangedBrownianMotions …………………………… 32 3.7 ItoprocessandStochasticDifferentialEquations ……………………………….. 36 3.8 ABMwithdeterministicvolatility……………………………………….. 36
3.8.1 Matlab:SimulatingtheArithmeticBrownianMotion …………………………. 39 3.9 SolvingStochasticIntegralsand/orStochasticDifferentialEquations . . . . . . . . . . . . . . . . . . . . . . . . . . 42 3.9.1 Deterministicvs.StochasticDifferentialEquations…………………………… 43 3.9.2 Examplesofstochasticdifferentialequations……………………………… 45 3.9.3 Existenceanduniquenessofthesolution ……………………………….. 45
4 Introducing Ito’s formula 47
4.1 Afactfromordinarycalculus………………………………………….. 48
4.2 4.3 4.4 4.5
Itoˆ’sformulawhenY=g(X),g(X)2C2 ………………………………….. 49 Guidingprinciple……………………………………………….. 50 Itoˆ’sformulawhenY(t)=g(t,X),g(t,X)2C1,2 ………………………………. 50 TheLampertitransformation …………………………………………. 52 4.5.1 Example………………………………………………… 53 TheMultivariateIto’slemmawhenZ=g(t,X,Y). ……………………………… 54 4.6.1 Examples ……………………………………………….. 56
5 Important SDEs 58
5.1 TheGeometricBrownianMotionGBM(μ,s) …………………………………. 60 5.1.1 SolvingtheODEdX(t)=μX(t)dt …………………………………… 61

CONTENTS 6
5.1.2 SolvingtheSDEdX=μXdt+sXdW …………………………………. 61 5.1.3 MatlabImplementation:SimulatingGBM……………………………….. 64 5.1.4 Remark.GBMwithdeterministicdriftandvolatility …………………………. 68
5.2 TheVasicekMean-Revertingprocess……………………………………… 75 5.2.1 ANote:TheOrdinaryDifferentialEquationdx(t)=a(μx(t))dt. . . . . . . . . . . . . . . . . . . . . . . 76 5.2.2 SolvingtheSDEdX(t)=a(μX(t))dt+sdW(t) ………………………….. 79 5.2.3 The(auto)-covariancefunction …………………………………….. 80 5.2.4 Matlab:SimulationoftheVasicekmodel ……………………………….. 81 5.2.5 Extension:MRwithdeterministicvolatility………………………………. 87
5.3 TheCox-Ingersoll-Ross(CIR)model ………p……………………………… 89 5.3.1 SolvingtheSDEdX(t)=a(μX(t))dt+s X(t)dW(t) ………………………. 89 5.3.2 ComputingtheexpectationoftheCIRmodel……………………………… 90 5.3.3 ComputingthevarianceoftheCIRmodel ………………………………. 91 5.3.4 Againoncomputingthevarianceandtheauto-covarianceoftheCIRmodel. . . . . . . . . . . . . . . . . . 92 5.3.5 ThedistributionoftheshortrateintheCIRmodel…………………………… 94 5.3.6 TheExtended-CIRmodel ……………………………………….. 97 5.3.7 SimulatingtheCIRmodel……………………………………….. 100
5.4 TheConstantElasticityofVariance(CEV)model……………………………….. 106
5.5 CIR,CEVandtheBesselProcess ……………………………………….. 116
5.6 TheBrownianBridge……………………………………………… 118
5.6.1 ANote:TheOrdinaryDifferentialEquationdx(t)=(bx(t))/(Tt)dt. . . . . . . . . . . . . . . . . . . . 118 5.6.2 SolvingtheSDEdXt=(bX(t))/(Tt)dt+dW(t)…………………………. 119 5.6.3 MatlabImplementation:SimulatingBrownianmotions(part2) . . . . . . . . . . . . . . . . . . . . . . . . . 121
5.7 TheHestonStochasticVolatilitymodel ……………………………………. 126 5.7.1 Thecharacteristicfunctionofthelog-price ………………………………. 128 5.7.2 Hestonmodel:MonteCarloSimulation………………………………… 134 5.7.3 Recovering the density function in the Heston model via inversion of the characteristic function . . . . . . 138 5.7.4 Hestonmodelandoptionpricing……………………………………. 144 5.7.5 Hestonmodelandoptionpricing:Mainfindings …………………………… 147

CONTENTS 7 5.8 TheHestonapp………………………………………………… 152
6 Stochastic Processes with Jumps 155
6.1 Preliminaries………………………………………………….. 156 6.1.1 ThePoissonprocess ………………………………………….. 156 6.1.2 TheCompoundPoissonprocess ……………………………………. 158 6.1.3 TheGammaprocess ………………………………………….. 159 6.1.4 SimulationofJumpProcesses……………………………………… 160
6.2 JumpDiffusion(JD)processes…………………………………………. 163 6.2.1 TheMertonJumpDiffusionProcess ………………………………….. 163 6.2.2 TheKouprocess ……………………………………………. 173
6.3 SubordinatedBrownianmotions ……………………………………….. 176 6.3.1 TheVariance(VG)Gammaprocess…………………………………… 177
6.4 FinalRemark:Le ́vyprocesses…………………………………………. 184
6.5 JumpsversusStochasticVolatility……………………………………….. 185
7 Changes of Measure 191
7.1 Preliminaries………………………………………………….. 192 7.2 GirsanovTheoremforBrownianmotions …………………………………… 196 7.2.1 Application1:Riskneutralmeasures …………………………………. 198 7.2.2 Application2:TheNume ́rairePair…………………………………… 200
8 References 213
9 Matlab LiveScripts 216
II Appendix 218 10 A Quick Review of Distributions Relevant in Finance 219

CONTENTS 8
10.1TheNormalDistribution……………………………………………. 221 10.2TheLognormaldistribution………………………………………….. 221 10.3TheChi-Squaredistribution………………………………………….. 227 10.4Thenoncentralchi-squareddistribution……………………………………. 229 10.5ThePoissondistribution……………………………………………. 233 10.6TheExponentialdistribution …………………………………………. 234 10.7TheGammadistribution……………………………………………. 238 10.8ThemultivariateGaussiandistribution…………………………………….. 241
10.8.1 ThebivariateNormaldistribution …………………………………… 242 10.9SimulatingRandomVariables…………………………………………. 250 10.9.1 Example:SamplingfromtheNormalDistribution…………………………… 252 10.9.2 Example:SamplingfromtheLognormalDistribution…………………………. 255 10.9.3 Example:SamplingfromthePoissonDistribution…………………………… 256 10.9.4 Example:SamplingfromtheGammaDistribution…………………………… 256 10.9.5 Example:SamplingfromtheChi-SquareDistribution…………………………. 256 10.9.6 Example:SamplingfromtheNon-CentralChi-SquareDistribution . . . . . . . . . . . . . . . . . . . . . . . 256 10.9.7 Example:SamplingfromtheMultivariateNormalDistribution . . . . . . . . . . . . . . . . . . . . . . . . . 258
11 Quadrature Methods 262
11.1QuadratureRules……………………………………………….. 262 11.2Newton-Cotesintegration …………………………………………… 263 11.2.1 RectangleandMid-PointRule …………………………………….. 264 11.2.2 TrapezoidRule …………………………………………….. 266 11.2.3 Erroranalysisforpolynomialrateofconvergence …………………………… 267 11.2.4Anexample………………………………………………. 268 11.2.5 Newton-Cotesintegration……………………………………….. 269 11.2.6 LimitsofNewton-Cotesrules……………………………………… 270 11.3GaussianQuadratureFormulae………………………………………… 272 11.4AdaptiveQuadrature……………………………………………… 273

CONTENTS 9
11.5Anexample ………………………………………………….. 275 11.5.1 Newton-Cotesintegration……………………………………….. 275 11.6Gaussianquadrature……………………………………………… 277 11.6.1 AdaptiveQuadrature …………………………………………. 279
12 Inversion of the characteristic function and the COS method 281
12.1Characteristicfunctionanddensityfunction …………………………………. 281 12.2Characteristicfunctionandoptionpricing…………………………………… 282 12.2.1 FFTmethodinMATLAB®Algorithms…………………………………. 287 12.2.2 InversionofthecharacteristicfunctionandtheCOSmethod……………………… 291

LIST OF FIGURES
2.1 DensityoftheBrownianMotionatdifferenttimehorizons…………………………… 12 2.2 SimulatingtheBrownianMotion:Excelexample………………………………… 18 2.3 SimulatedPathsoftheBrownianMotion. …………………………………… 19 2.4 MovieofsimulatedvarianceintheHestonmodel……………………………….. 20 2.5 TotalandQuadraticVariationofBrownianmotions ……………………………… 22
3.1 ComputingbysimulationthestochasticintegralR0tW(s)dW(s) ……………………….. 29 3.2 SimulatedsamplepathsoftheABM(0.2,0.3). …………………………………. 42 3.3 Simulated and theoretical expected value of X(t) of the ABM(0.2,0.3) at different horizons. . . . . . . . . . . . . . 42 3.4 SimulatedandtheoreticalvarianceoftheABM(0.2,0.3)atdifferenthorizons.. . . . . . . . . . . . . . . . . . . . . . 43 3.5 Simulated and theoretical standard deviation of the ABM(0.2,0.3) at different horizons. . . . . . . . . . . . . . . . 43 3.6 SimulateddistributionoftheABM(0.2,0.3)atdifferenthorizons………………………… 44 3.7 TimeevolutionoftheexactdistributionoftheABM(0.2,0.3). …………………………. 44
5.1 SamplePathsoftheGBM(0.2,0.3). ………………………………………. 68 5.2 DensityoftheGBM(0.2,0.3)atdifferenthorizons………………………………… 68 5.3 Theoretical and Monte Carlo estimated expected value of the GBM(0.2,0.3) at different horizons. . . . . . . . . . . 69 5.4 Theoretical and Monte Carlo estimated variance of the GBM(0.2,0.3) at different horizons. . . . . . . . . . . . . . . 69 5.5 TheoreticalandestimatemeanoftheGBM(0.2,0.3)atdifferenthorizons. . . . . . . . . . . . . . . . . . . . . . . . . 70 5.6 TheoreticalandestimatevarianceoftheGBM(0.2,0.3)atdifferenthorizons. . . . . . . . . . . . . . . . . . . . . . . 70 5.7 SimulatedGBMpathsfittinginaveragethetermstructureoffuturesprices . . . . . . . . . . . . . . . . . . . . . . 75

LIST OF FIGURES 11
5.8 Meanreversionandexpectedchangeinthestatevariable(hereaninterestrate). . . . . . . . . . . . . . . . . . . . 77 5.9 Convergencetothelong-runvalueofamean-revertingprocess ……………………….. 78 5.10TheVasicekmodel:sampletrajectories…………………………………….. 82 5.11Meanrevertingprocesses:densities ……………………………………… 83 5.12 MoviewithsimulatedpathsoftheVasicekmodelstartingabovethelongtermlevel. . . . . . . . . . . . . . . . . . 85 5.13 MoviewithsimulatedpathsoftheVasicekmodelstartingatthelongtermlevel. . . . . . . . . . . . . . . . . . . . 86 5.14 MoviewithsimulatedpathsoftheVasicekmodelstartingbelowthelongtermlevel. . . . . . . . . . . . . . . . . . 87 5.15CIRmodel:densities ……………………………………………… 97 5.16AsymptoticdensityintheCIRmodel …………………………………….. 98 5.17ViolationoftheFellercondition:densityoftheCIRprocess………………………….. 98 5.18CIRprocess:sampletrajectoriesviaEulerscheme ………………………………. 103 5.19CIRprocess:sampletrajectoriesviaexactmoments ……………………………… 104 5.20 CIR process: sample trajectories via sampling from non-central chi-square distribution . . . . . . . . . . . . . . . 105 5.21DensityfunctionoftheCEVmodel………………………………………. 112 5.22Densityfunctionoflog-returnsintheCEVmodel ………………………………. 112 5.23ImpliedVolatilityintheCEVmodelfordifferentvaluesofb………………………….. 114 5.24SimulatedPathsoftheBrownianmotionviaBrownianBridge…………………………. 123 5.25ScenarioGenerationviaBrownianbridge …………………………………… 124 5.26 Mean, standard deviation, skewness and kurtosis of the Heston model varying the correlation coefficient r . . . . 133 5.27 Term structure of skewness in the Heston model for different values of the correlation coefficient r . . . . . . . . . 134 5.28 Term structure of kurtosis in the Heston model for different values of the correlation coefficient r . . . . . . . . . 134 5.29 SkewnessintheHestonmodelfordifferentvaluesofthevol-volparameter# . . . . . . . . . . . . . . . . . . . . . 135 5.30 KurtosisintheHestonmodelfordifferentvaluesofthevol-volparameter# . . . . . . . . . . . . . . . . . . . . . . 135 5.31 Mean, standard deviation, skewness and kurtosis of the Heston model varying the volatility coefficient # . . . . . 136 5.32MoviecomparingtheEulerandtheexactscheme. ………………………………. 139 5.33Movieofsimulatedlog-returnsintheHestonmodel. …………………………….. 140 5.34MovieofsimulatedvarianceintheHestonmodel……………………………….. 141 5.35HestonvsBlack-Scholes:comparingdensities ………………………………… 145 5.36HestonPDFchangingr ……………………………………………. 149

LIST OF FIGURES 12
5.37HestonPDFchanging#…………………………………………….. 149 5.38HestonPDFchangingk ……………………………………………. 149 5.39HestonPDFchangingq ……………………………………………. 149 5.40ImpliedVolatilityasafunctionofrintheHestonmodel …………………………… 150 5.41ImpliedVolatilityasafunctionofeintheHestonmodel …………………………… 150 5.42ImpliedVolatilityasafunctionofqintheHestonmodel …………………………… 151 5.43ImpliedVolatilityasafunctionofkintheHestonmodel …………………………… 151 5.44 Theappcanbedownloadedfromherehttps://sites.google.com/uniupo.it/stochasticcalculus/download-apps.
ItsfunctioninghasbeencheckedonWindows64bit………………………………. 154
6.1 ABMvsJD:sampletrajectories ………………………………………… 157
6.2 Poisson,CompoundPoissonandGammaprocesses:sampletrajectories . . . . . . . . . . . . . . . . . . . . . . . . 162
6.3 MertonJD:sampletrajectories…………………………………………. 170
6.4 MertonJDvstheBrownianmotion:densityandreturns …………………………… 171
6.5 VG:termstructureofskewnessandexcesskurtosis ……………………………… 180
6.6 VGvsBrownianmotion:densities ………………………………………. 181
6.7 VGprocess:sampletrajectories………………………………………… 182
6.8 ImpliedVolatilityasafunctionofqintheVGmodel……………………………… 188
6.9 VGPDFchangingq………………………………………………. 188 6.10ImpliedVolatilityasafunctionofkintheVGmodel……………………………… 188 6.11VGPDFchangings………………………………………………. 188 6.12ImpliedVolatilityasafunctionofsintheVGmodel……………………………… 189 6.13VGPDFchangingk………………………………………………. 189 6.14ConvergenceofLe ́vyprocessestotheBrownianmotion……………………………. 190
7.1 Girsanovtheorem:Densitiesanddistributionunderchangeofmeasure . . . . . . . . . . . . . . . . . . . . . . . . 211 7.2 Girsanovtheorem:simulatedpathsunderchangesofmeasure………………………… 212
10.1 DensityandCumulativeDistributionoftheGaussianrandomvariable. . . . . . . . . . . . . . . . . . . . . . . . . 223 10.2DensitiesoftheGaussianandoftheLognormalrandomvariables. ……………………… 223

LIST OF FIGURES 13
10.3 DensityandCumulativeDistributionoftheLognormalrandomvariable. . . . . . . . . . . . . . . . . . . . . . . . 226 10.5DensityoftheChi-Squarerandomvariablevaryingn……………………………… 228 10.4 Density and Cumulative Distribution of the Chi-Square random variable with n = 20 degrees of freedom. . . . . 229 10.6 DensityandCDFofthenoncentralchi-squareddistributionwithn=5andd=2. . . . . . . . . . . . . . . . . . . 231 10.7 Density of the non-central chi-square distribution varying the parameter of non centrality d. . . . . . . . . . . . . 232 10.8DensityandCDFofthePoissondistributionwithl=5……………………………. 234 10.9 PDF(top)andCDF(bottom)ofthePoissondistributionvaryingtherateofarrivall. . . . . . . . . . . . . . . . . . 235 10.10DensityandCDFoftheExponentialdistributionwithl=1.5…………………………. 237 10.11DensityandCDFoftheGammadistributionwitha=5,l=0.5. ………………………. 239 10.12PDF and CDF of the Gamma distribution varying the shape parameter a and the rate parameter l . . . . . . . . . 240 10.13BivariatestandardGaussiandistributionandcontourlevels.r=0.9 . . . . . . . . . . . . . . . . . . . . . . . . . . 245 10.14BivariatestandardGaussiandistributionandcontourlevels.r=0.0 . . . . . . . . . . . . . . . . . . . . . . . . . . 246 10.15BivariatestandardGaussiandistributionandcontourlevels.r=0.9 . . . . . . . . . . . . . . . . . . . . . . . . . 247 10.16Jointly simulated standard Gaussian random variables with different correlation . . . . . . . . . . . . . . . . . . . 248 10.17Gaussianmargins,nonGaussianjoint

程序代写 CS代考 加微信: powcoder QQ: 1823890830 Email: powcoder@163.com