Numerical methods and optimization in finance manfred gilli - Quickly download the ebook to read any

Page 1


Numerical Methods and Optimization in Finance Manfred

Visit to download the full and correct content document: https://textbookfull.com/product/numerical-methods-and-optimization-in-finance-manfr ed-gilli/

More products digital (pdf, epub, mobi) instant download maybe you interests ...

Optimization Methods in Finance Gerard Cornuéjols

https://textbookfull.com/product/optimization-methods-in-financegerard-cornuejols/

Optimization methods in finance Second Edition Cornuejols

https://textbookfull.com/product/optimization-methods-in-financesecond-edition-cornuejols/

Recent Advances in Computational Optimization: Results of the Workshop on “Computational Optimization” and “Numerical Search and Optimization” 2018 Stefka Fidanova

https://textbookfull.com/product/recent-advances-incomputational-optimization-results-of-the-workshop-oncomputational-optimization-and-numerical-search-andoptimization-2018-stefka-fidanova/

Numerical and Evolutionary Optimization – NEO 2017 Leonardo Trujillo

https://textbookfull.com/product/numerical-and-evolutionaryoptimization-neo-2017-leonardo-trujillo/

Advances

in Numerical Methods in Geotechnical Engineering Hany Shehata

https://textbookfull.com/product/advances-in-numerical-methodsin-geotechnical-engineering-hany-shehata/

Numerical Partial Differential Equations in Finance Explained: An Introduction to Computational Finance 1st Edition Karel In 'T Hout (Auth.)

https://textbookfull.com/product/numerical-partial-differentialequations-in-finance-explained-an-introduction-to-computationalfinance-1st-edition-karel-in-t-hout-auth/

Practical

Numerical C Programming: Finance, Engineering, and Physics Applications Philip Joyce

https://textbookfull.com/product/practical-numerical-cprogramming-finance-engineering-and-physics-applications-philipjoyce/

Numerical Methods in Physics with Python 1st Edition Alex Gezerlis

https://textbookfull.com/product/numerical-methods-in-physicswith-python-1st-edition-alex-gezerlis/

NUMERICAL

METHODS IN ENGINEERING WITH PYTHON 1st Edition Kiusalaas Jaan

https://textbookfull.com/product/numerical-methods-inengineering-with-python-1st-edition-kiusalaas-jaan/

Numerical Methods and Optimization in Finance

Second Edition

NumericalMethodsandOptimization inFinance

NumericalMethods andOptimizationin Finance

SecondEdition

ManfredGilli

GenevaSchoolofEconomicsandManagement UniversityofGeneva Geneva,Switzerland

SwissFinanceInstitute Zürich,Switzerland

DietmarMaringer

FacultyofBusinessandEconomics UniversityofBasel Basel,Switzerland

GenevaSchoolofEconomicsandManagement UniversityofGeneva Geneva,Switzerland

EnricoSchumann

FacultyofBusinessandEconomics UniversityofBasel

Basel,Switzerland

AcademicPressisanimprintofElsevier 125LondonWall,LondonEC2Y5AS,UnitedKingdom 525BStreet,Suite1650,SanDiego,CA92101,UnitedStates 50HampshireStreet,5thFloor,Cambridge,MA02139,UnitedStates TheBoulevard,LangfordLane,Kidlington,OxfordOX51GB,UnitedKingdom

Copyright©2019ElsevierInc.Allrightsreserved.

MATLAB® isatrademarkofTheMathWorks,Inc.andisusedwithpermission. TheMathWorksdoesnotwarranttheaccuracyofthetextorexercisesinthisbook. Thisbook’suseordiscussionofMATLAB® softwareorrelatedproductsdoesnotconstituteendorsementorsponsorship byTheMathWorksofaparticularpedagogicalapproachorparticularuseoftheMATLAB® software.

Nopartofthispublicationmaybereproducedortransmittedinanyformorbyanymeans,electronicormechanical, includingphotocopying,recording,oranyinformationstorageandretrievalsystem,withoutpermissioninwritingfrom thepublisher.Detailsonhowtoseekpermission,furtherinformationaboutthePublisher’spermissionspoliciesandour arrangementswithorganizationssuchastheCopyrightClearanceCenterandtheCopyrightLicensingAgency,canbe foundatourwebsite: www.elsevier.com/permissions

ThisbookandtheindividualcontributionscontainedinitareprotectedundercopyrightbythePublisher(otherthanas maybenotedherein).

Notices

Knowledgeandbestpracticeinthisfieldareconstantlychanging.Asnewresearchandexperiencebroadenour understanding,changesinresearchmethods,professionalpractices,ormedicaltreatmentmaybecomenecessary.

Practitionersandresearchersmustalwaysrelyontheirownexperienceandknowledgeinevaluatingandusingany information,methods,compounds,orexperimentsdescribedherein.Inusingsuchinformationormethodstheyshould bemindfuloftheirownsafetyandthesafetyofothers,includingpartiesforwhomtheyhaveaprofessionalresponsibility. Tothefullestextentofthelaw,neitherthePublishernortheauthors,contributors,oreditors,assumeanyliabilityforany injuryand/ordamagetopersonsorpropertyasamatterofproductsliability,negligenceorotherwise,orfromanyuseor operationofanymethods,products,instructions,orideascontainedinthematerialherein.

LibraryofCongressCataloging-in-PublicationData

AcatalogrecordforthisbookisavailablefromtheLibraryofCongress

BritishLibraryCataloguing-in-PublicationData

AcataloguerecordforthisbookisavailablefromtheBritishLibrary

ISBN:978-0-12-815065-8

ForinformationonallAcademicPresspublications visitourwebsiteat https://www.elsevier.com/books-and-journals

Publisher: CandiceJanco

AcquisitionEditor: CandiceJanco

EditorialProjectManager: KelseyConnors

ProductionProjectManager: BharatwajVaratharajan

Designer: VictoriaPearson

TypesetbyVTeX

Listoffigures

PartI

Fundamentals

1.Introduction

2.Numericalanalysisina

2.1Computerarithmetic

basiclinearalgebraoperations 30

3.LinearequationsandLeast Squaresproblems

3.1Directmethods 32

3.1.1Triangularsystems 32

3.1.2LUfactorization 33

3.1.3Choleskyfactorization 35

3.1.4QRdecomposition 37

3.1.5Singularvalue decomposition 37 3.2Iterativemethods 38

3.2.1Jacobi,Gauss–Seidel,and SOR 39 Successiveoverrelaxation 40

3.2.2Convergenceofiterative methods 41

3.2.3Generalstructureof algorithmsforiterative methods 42

3.2.4Blockiterativemethods 44 3.3Sparselinearsystems 45

3.3.1Tridiagonalsystems 45

3.3.2Irregularsparsematrices 47

3.3.3Structuralpropertiesof sparsematrices 48

3.4TheLeastSquaresproblem 50

3.4.1Methodofnormal equations 51

3.4.2LeastSquaresviaQR factorization 54

3.4.3LeastSquaresviaSVD decomposition 55

3.4.4Finalremarks 56

Thebackslashoperatorin MATLAB 56 Appendix3.ASolvinglinear systemsinR 56 solve 57 LeastSquares 58

4.Finitedifferencemethods

4.1Anexampleofanumerical solution 61 Afirstnumerical approximation 62 Asecondnumerical approximation 63

4.2Classificationofdifferential equations 64

4.3TheBlack–Scholesequation 65

4.3.1Explicit,implicit,and θ -methods 67

4.3.2Initialandboundary conditionsanddefinition ofthegrid 67

4.3.3Implementationofthe θ -methodwithMATLAB 71

4.3.4Stability 73

4.3.5Coordinatetransformation ofspacevariables 76

4.4Americanoptions 79 Appendix4.AAnoteonMATLAB’s function spdiags 86

5.Binomialtrees

5.1Motivation 89 Matchingmoments 89

5.2Growingthetree 90

5.2.1Implementingatree 91

5.2.2Vectorization 92

5.2.3Binomialexpansion 93

5.3Earlyexercise 95

5.4Dividends 95

5.5TheGreeks 97 Greeksfromthetree 97

PartII Simulation

6.Generatingrandom numbers

6.1MonteCarlomethodsand sampling 103

6.1.1Howitallbegan 103

6.1.2Financialapplications 104

6.2Uniformrandomnumber generators 104

6.2.1Congruentialgenerators 104

6.2.2MersenneTwister 107

6.3Nonuniformdistributions 107

6.3.1Theinversionmethod 107

6.3.2Acceptance–rejection method 109

6.4Specializedmethodsfor selecteddistributions 111

6.4.1Normaldistribution 111

6.4.2Higherordermoments andtheCornish–Fisher expansion 113

6.4.3Furtherdistributions 114

6.5Samplingfromadiscreteset 116

6.5.1Discreteuniformselection 116

6.5.2Roulettewheelselection 117

6.5.3Randompermutationsand shuffling 118

6.6Samplingerrors—andhowto reducethem 118

6.6.1Thebasicproblem 118

6.6.2Quasi-MonteCarlo 119

6.6.3Stratifiedsampling 120

6.6.4Variancereduction 121

6.7Drawingfromempirical distributions 122

6.7.1Datarandomization 122

6.7.2Bootstrap 122

6.8Controlledexperimentsand experimentaldesign 127

6.8.1Replicabilityand ceteris paribus analysis 127

6.8.2Availablerandomnumber generatorsinMATLAB 128

6.8.3Uniformrandomnumbers fromMATLAB’s rand function 128

6.8.4Gaussianrandomnumbers fromMATLAB’s randn function 129

6.8.5Remedies 131

7.Modelingdependencies

7.1Transformationmethods 133

7.1.1Linearcorrelation 133

7.1.2Rankcorrelation 138

7.2Markovchains 144

7.2.1Concepts 144

7.2.2TheMetropolisalgorithm 146

7.3Copulamodels 148

7.3.1Concepts 148

7.3.2Simulationusingcopulas 150

8.Agentleintroduction tofinancialsimulation

8.1Settingthestage 153

8.2Single-periodsimulations 154

8.2.1Terminalassetprices 154

8.2.21-over-N portfolios 155

8.2.3Europeanoptions 157

8.2.4VaRofacoveredput portfolio 159

8.3Simplepriceprocesses 161

8.4Processeswithmemoryinthe levelsofreturns 163

8.4.1Efficientversusadaptive markets 163

8.4.2Movingaverages 163

8.4.3Autoregressivemodels 164

8.4.4Autoregressivemoving average(ARMA)models 165

8.4.5SimulatingARMAmodels 166

8.4.6Modelswithlong-term memory 167

8.5Time-varyingvolatility 169

8.5.1Theconcepts 169

8.5.2Autocorrelated time-varyingvolatility 170

8.5.3SimulatingGARCH processes 173

8.5.4Selectedfurther autoregressivevolatility models 175

8.6Adaptiveexpectationsand patternsinpriceprocesses 178

8.6.1Price–earningsmodels 178

8.6.2Modelswithlearning 179

8.7Historicalsimulation 180

8.7.1Backtesting 180

8.7.2Bootstrap 181

8.8Agent-basedmodelsand complexity 185

9.Financialsimulationat work:somecasestudies

9.1Constantproportionportfolio insurance(CPPI) 189

9.1.1Basicconcepts 189

9.1.2Bootstrap 191

9.2VaRestimationwithExtreme ValueTheory 192

9.2.1Basicconcepts 192

9.2.2Scalingthedata 193

9.2.3UsingExtremeValue Theory 193

9.3Optionpricing 195

9.3.1Modelingprices 196

9.3.2Pricingmodels 199

9.3.3Greeks 208

9.3.4Quasi-MonteCarlo 210

PartIII Optimization

10.Optimizationproblemsin

finance

10.1Whattooptimize? 219 10.2Solvingthemodel 220

10.2.1Problems 220

10.2.2Classicalmethodsand heuristics 222

10.3Evaluatingsolutions 222 10.4Examples 224 Portfoliooptimization withalternativerisk measures 224 Modelselection 225 Robust/resistant regression 225 Agent-basedmodels 226 Calibrationof option-pricingmodels 226 Calibrationofyield structuremodels 227 10.5Summary 228

11.Basicmethods

11.1Findingtherootsof f(x) = 0 229

11.1.1Anaïveapproach 229 Graphicalsolution 230 Randomsearch 231

11.1.2Bracketing 231

11.1.3Bisection 232

11.1.4Fixedpointmethod 233 Convergence 235

11.1.5Newton’smethod 238 Comments 240

11.2Classicalunconstrained optimization 241 Convergence 242

11.3Unconstrainedoptimization inonedimension 243

11.3.1Newton’smethod 243

11.3.2Goldensectionsearch 244 11.4Unconstrainedoptimization inmultipledimensions 245 11.4.1Steepestdescent method 245

11.4.2Newton’smethod 247

11.4.3Quasi-Newtonmethod 248 11.4.4Directsearchmethods 250

11.4.5Practicalissueswith MATLAB 254

11.5NonlinearLeastSquares 256

11.5.1Problemstatementand notation 256

11.5.2Gauss–Newton method 257

11.5.3Levenberg–Marquardt method 258

11.6Solvingsystemsofnonlinear equations F(x) = 0 260

11.6.1Generalconsiderations 260

11.6.2Fixedpointmethods 262

11.6.3Newton’smethod 263

11.6.4Quasi-Newton methods 268

11.6.5Furtherapproaches 269

11.7Synopticviewofsolution methods 270

12.Heuristicmethodsina nutshell

12.1Heuristics 273 Whatisaheuristic? 274 Iterativesearch 275

12.2Single-solutionmethods 276

12.2.1StochasticLocal Search 276

12.2.2SimulatedAnnealing 277

12.2.3ThresholdAccepting 278

12.2.4TabuSearch 279

12.3Population-basedmethods 279

12.3.1GeneticAlgorithms 279

12.3.2DifferentialEvolution 280

12.3.3ParticleSwarm Optimization 281

12.3.4AntColony Optimization 282

12.4Hybrids 282

12.5Constraints 284

12.6Thestochasticsofheuristic search 285

12.6.1Stochasticsolutions andcomputational resources 285

12.6.2Anillustrative experiment 287

12.7Generalconsiderations 289

12.7.1Whattechniqueto choose? 289

12.7.2Efficient implementations 289

12.7.3Parametersettings 293

12.8Outlook 294 Appendix12.AImplementing heuristicmethodswith MATLAB 294

12.A.1Theproblems 296

12.A.2ThresholdAccepting 298

12.A.3GeneticAlgorithm 303

12.A.4DifferentialEvolution 306

12.A.5ParticleSwarm Optimization 308

Appendix12.BParallel computationsinMATLAB 309

12.B.1Parallelexecutionof restartloops 311

Appendix12.CHeuristicmethods inthe NMOF package 314

12.C.1LocalSearch 314

12.C.2SimulatedAnnealing 315

12.C.3ThresholdAccepting 315

12.C.4GeneticAlgorithm 315

12.C.5DifferentialEvolution 316

12.C.6ParticleSwarm Optimization 316

12.C.7Restarts 317

13.Heuristics:atutorial

13.1OnOptimization 319

13.1.1Models 319 13.1.2Methods 320

13.2Theproblem:choosingfew frommany 320

13.2.1Thesubset-sum problem 320

13.2.2Representinga solution 321

13.2.3Evaluatingasolution 321

13.2.4Knowingthesolution 322

13.3Solutionstrategies 323

13.3.1Beingthorough 323

13.3.2Beingconstructive 324 13.3.3Beingrandom 325

13.3.4Gettingbetter 327

13.4Heuristics 330

13.4.1Onheuristics 330

13.4.2LocalSearch 331

13.4.3ThresholdAccepting 336 13.4.4Settings,or:how(long) torunanalgorithm 340

13.4.5StochasticsofLSand TA 340

13.5Application:selecting variablesinaregression 342

13.5.1Linearmodels 342

13.5.2Fastleastsquares 343 13.5.3Selectioncriterion 344 13.5.4Puttingitalltogether 345

13.6Application:portfolio selection 347

13.6.1Models 347

13.6.2Local-Search algorithms 348

14.Portfoliooptimization

14.1Theinvestmentproblem 355

14.2Mean–varianceoptimization 357 14.2.1Themodel 357

14.2.2Solvingthemodel 358

14.2.3Examplesof mean–variancemodels 358

14.2.4True,estimated,and realizedfrontiers 366

14.2.5Repairingmatrices 368

14.3Optimizationwithheuristics 377

14.3.1Assetselectionwith LocalSearch 377

14.3.2ScenarioOptimization withThreshold Accepting 383

14.3.3Portfoliooptimization withTA:examples 392

14.3.4Diagnosticsfor techniquesbasedon LocalSearch 411

14.4Portfoliosunder Value-at-Risk 413

14.4.1WhyValue-at-Risk matters 413

14.4.2Settingupexperiments 414

14.4.3Numericalresults 415 Appendix14.AComputing returns 419

Appendix14.BMore implementationissuesinR 420

14.B.1ScopingrulesinRand objectivefunctions 420

14.B.2Vectorizedobjective functions 422

Appendix14.CAneighborhood forswitchingelements 424

15.Backtesting

15.1Whatis(theproblemwith) backtesting? 427

15.1.1Theugly:intentional overfitting 428

15.1.2Thebad:unintentional overfittingandother difficulties 434

15.1.3Thegood:getting insights(and confidence)in strategies 436

15.2Dataandsoftware 437

15.2.1Whatdatatouse? 437

15.2.2Designingbacktesting software 439

15.2.3The btest function 439

15.3Simplebacktests 440

15.3.1 btest:atutorial 440

15.3.2RobertShiller’s Irrational-Exuberance data 450

15.4Backtestingportfolio strategies 459

15.4.1KennethFrench’sdata library 459

15.4.2Momentum 464

15.4.3Portfoliooptimization 470 Appendix15.APricesin btest 479 Appendix15.BNoteson zoo 479 Appendix15.CParallel computationsinR 480

15.C.1Distributedcomputing 480

15.C.2Loopsand apply functions 481

15.C.3Distributingdata 482

15.C.4Distributingdata, continued 484

15.C.5Otherfunctionsinthe parallel package 486

15.C.6Parallelcomputations inthe NMOF package 486

16.Econometricmodels

16.1Termstructuremodels 487

16.1.1Yieldcurves 487

16.1.2TheNelson–Siegel model 492

16.1.3Calibrationstrategies 496

16.1.4Experiments 518

16.2Robustandresistant regression 522

16.2.1Theregressionmodel 525

16.2.2Estimation 527

16.2.3Anexample 532

16.2.4Numerical experiments 535

16.2.5Finalremarks 540

16.3EstimatingTimeSeries Models 542

16.3.1Adventureswithtime seriesestimation 542

16.3.2ThecaseofGARCH models 543

16.3.3Numerical experimentswith DifferentialEvolution 545 Appendix16.AMaximizingthe Sharperatio 549

17.Calibratingoptionpricing models

17.1Impliedvolatilitywith Black–Scholes 552 Thesmile 554

17.2Pricingwiththecharacteristic function 555

17.2.1Apricingequation 555

x Contents

17.2.2Numericalintegration 560

17.3Calibration 580

17.3.1Techniques 580

17.3.2Organizingthe problemand implementation 582

17.3.3Twoexperiments 589

17.4Finalremarks 593

Appendix17.AQuadraturerules forinfinity 594 A.The NMOF package

A.3Usingthepackage

Listoffigures

Fig.1.1 AmapofthebeautifulcountrycalledSwitzerland. 4

Fig.1.2 Left:TheS&P500in2009.Right:Annualreturnsafterjackknifingtwoobservations.Thevertical linegivestherealizedreturn. 13

Fig.1.3 Payoffofreplicatingportfolioswithdeltatodoubleprecision(left),anddeltatotwodigits(right). 15

Fig.2.1 Function f(x) = cos(x x ) sin(e x ) (leftpanel)andrelativeerrorofthenumericalapproximationof thederivativeat x = 1 5forforwarddifference(thickline)andcentraldifference(thinline). 24

Fig.2.2 Leftpanel:graphicalsolutionoflinearsystem(2.4).Rightpanel:detailsaroundthecoordinate ( 3, 4 54) ofthestraightlinesdefiningthelinearsystem. 26

Fig.2.3 Operationcountforalgorithm A1 (triangles)and A2 (circles).

29

Fig.3.1 LUfactorization. 33

Fig.3.2 Gridsearchforoptimal ω 43

Fig.3.3 Exampleofadecomposablematrix(left)anditsblocktriangularform(right). 49

Fig.3.4 Exampleofamatrixoforder8withstructuralrank6andthecorresponding6 × 4zerosubmatrix (rightpanel).

Fig.4.1 Graphoffunction f(x) = 2/x .

Fig.4.2 Numericalapproximationwiththeexplicitmethod(circles)ofthedifferentialequationdefinedin Eq.(4.1)for N = 10(leftpanel)and N = 30(rightpanel).

Fig.4.3 Numericalapproximationwiththeimplicitmethod(circles)ofthedifferentialequationdefinedin Eq.(4.1)for xN = 30and N = 30(leftpanel)and xN = 100and N = 80(rightpanel).

50

62

63

64

Fig.4.4 Priceofcalloption(leftpanel)andpriceofputoption(rightpanel)for X = 20, r = 0 10, q = 0and σ = 0 60. 66

Fig.4.5 Finitedifferencegridwithterminalconditions(darkcircles)andboundaryconditions(graycircles).

Fig.4.6 Fourpointsinvolvedinthenumericalapproximationofthederivativesof vij

Fig.4.7 Explicitmethod(left)andimplicitmethod(right).

68

68

71

Fig.4.8 M = 30(leftpanel)and M = 500(rightpanel).Commonparameters: N = 100, σ = 0.20, r = 0.05, q = 0, X = S = 10. 74

Fig.4.9 σ = 0 20(leftpanel)and σ = 0 40(rightpanel).Commonparameters: N = 100, M = 30, r = 0 05, q = 0, X = S = 10. 74

Fig.4.10 N = 310(leftpanel)and N = 700(rightpanel).Commonparameters: M = 30, σ = 0.20, r = 0.05, q = 0, X = 10. 74

Fig.4.11 N = 700, M = 30, σ = 0 50, r = 0 05, X = 10. 75

Fig.4.12 Priceofdown-and-output(lowerline)andEuropeanput(upperline)asafunctionofthepriceofthe underlyingatthebeginningoftheoption’slife. 76

Fig.4.13 Coordinatetransformationsfor N = 29and X = 20.Leftpanel:Hyperbolicsinefunctionwith λ = 10and p = 0 4.Rightpanel:Logarithmictransformationwith I = 2. 78

Fig.4.14 Absoluteerrorsforthehyperbolicsinetransformation(circles)andthelogarithmictransformation (plussigns).

Fig.4.15 Finitedifferencegridfor Smin = 0, Smax = 80, N = 40, M = 50,and θ = 1 2 .Leftpanel:Darknodes indicateoptionpricegreaterthanpayoff.Rightpanel:Optionpricesandearlyexerciseboundary.

Fig.4.16 Earlyexerciseboundary(samesettingasinFig. 4.15).

Fig.4.17 Leftpanel:Gridnodesusedforinterpolation.Rightpanel:Earlyexerciseboundaryresultingfrom interpolationofthesolutionsobtainedwiththeexplicitpayoutmethod.

Fig.4.18 Computationofearlyexerciseboundarieswithfinergrid(Smax = 150, N = 300,and M = 50). PSOR(leftpanel)andEP(rightpanel).

Fig.4.19 GridsearchfortheoptimalomegainthePSORalgorithm.

Fig.4.20 PriceofAmericanstrangle(dashedlineisthepayoff).

Fig.6.1 Randomnumbersfromthe randu function,where ui = (65,539 ui 1 ) mod231

Fig.6.2 Confidencebandsandprobabilitiesforrealizationswithinaregion (x ,xh )

Fig.6.3 Inversionprinciple.

78

81

82

82

83

83

86

106

108

108

Fig.6.4 Numberswithintheunitsquarebefore(toppanel)andafter(bottompanel)Box–Muller transformation.

Fig.6.5 Requiredskewness(leftpanel)andkurtosis(rightpanel),andsamplemomentswith500 observationspersample.

Fig.6.6 Gaussiankerneldensityestimateswithsmoothingparameters h = 0 025,0 1,and0 5,respectively (darkerlinesforlarger h).

Fig.6.7 SamplesgeneratedwiththeTaylor–Thompsonalgorithm;originalobservations(circles)froma (0, 1) Gaussiandistribution.

Fig.6.8

FirstuniformPRNdrawnfordifferentseedsandRNGs.

Fig.6.9 ScatterplotsforfirstuniformPRNsdrawnfromseeds s and s + 1.

Fig.6.10

Fig.6.11

FirstnormalPRN(polar)drawnforseeds s = 1,..., 10,000.

FirstnormalPRN(ziggurat)drawnforseeds s = 1,..., 600,000.

Fig.6.12 Scatterplotfirstdrawsfromthreesubsequentseeds s = 1,..., 5000.

Fig.6.13 FirstPRNdrawnforseeds s = 1,..., 1000, x1,s plottedagainst x1,s +d with d = 100,1000and 10,000(lefttoright)forthepolar(toppanel)andziggurat(bottompanel)RNGs.

Fig.6.14

101stPRNdrawnforseeds s = 1,..., 1000, x101,s fortheuniform(toppanel)andnormal(bottom panel)RNGs.

Fig.7.1 Left:scatterplotofthreeuncorrelatedGaussianvariates.Right:scatterplotofthreeGaussian variateswith ρ = 0 7.

Fig.7.2 Bivariatenormalsamples,generatedwiththeMetropolisalgorithm. Leftpanel: metropolisMVNormal(2000,2,0.2,0.75) (s = 0 2). Rightpanel: metropolisMVNormal(2000,2,1.0,0.75) (s = 1 0).

111

114

126

127

129

129

130

130

130

131

131

135

147

Fig.7.3 Densitiesfor u and x (undertheassumptionofGaussianmarginals)and500samples. 151

Fig.8.1 Simulatedreturnsandstockpricesfor100(left)and10,000samples(right).Whitecirclesare theoreticalquantilesandblackonesaretheirempiricalcounterparts.Theoreticalandempirical meansarewhiteandblackstars,respectively.

Fig.8.2 Returnsforportfoliosconsistingof N equallyweightedassets(“1-over-N ”).

Fig.8.3 Histogramsforthevalueofastock(toppanel)andaportfolioconsistingofthestockplusone Europeanput(bottompanel)attimes τ

Fig.8.4 Leftpanel:Value-at-Riskforstock(dottedlines)andportfolio(solidline)for1%,5%,and10% quantiles(lighttodark).Rightpanel:5%,25%,50%,75%,and95%percentilesoflogreturnsfor stock(dotted)andportfolio(solidline).

Fig.8.5 ReturnsandpricesfordifferentAR,MA,andARMAmodels.

Fig.8.6 Scaledwhitenoise;darklinesindicate ±σt

Fig.8.7 Dailyreturns(graylines)and μ ± 2σt confidencebands(darklines)(leftpanel)fordifferent combinationsof α1 + β1 = 0 95andprices(rightpanel)forGARCH(1, 1) processes.

Fig.8.8

Fig.8.9

Fig.8.10

ActualdailylogreturnsfortheFTSEandS&P500fortheperiodJan2000toDec2009and ±2√ht (toppanel),andinnovationsstandardizedusingtime-varyingvolatility, √ht ,asfittedwitha GARCH(1, 1) (bottompanel).

ActualFTSEdailylogreturnsforJuly2004toJune2010(left)andtwosimulationsbasedona GARCHmodelfittedonactualdata(centerandright;2525observationseach;seedsfixedwith randn(’seed’,10) and randn(’seed’,50),respectively).

Kerneldensitiesforcumulatedreturns(250days;leftpanel)andprices(rightpanel)wheredaily returnsfollowa GARCH(1, 1) processwith α1 ∈{0 05, 0 20 350 95} and β1 = 0 95 α1 (darker linesindicatelower α1 ).

Fig.8.11 StockpricesunderrationalexpectationsfromtheTimmermann(1993)model(n = 25, μ = 0 01, σ = 0 05).Rationalexpectationprices(thingrayline)andfundamentalpriceswithknown parameters(thickgrayline).

Fig.8.12 BootstrapsamplesforFTSEdata.

Fig.8.13 Momentsofabuy-and-holdportfolio(thickgraylines)anditsconstituents(thinblacklines;FTSE, DAX,andEuroStoxx)overdifferentlengthsofinvestmenthorizons(x -axis: T =1,5,21,62days; correspondingto1day,1week,1month,1quarter);basedonoriginaldataAugust2005toJuly 2010and1,000,000bootstraps.Toppanel,blocklength b = 1;centerpanel,blocklength b = 5;and bottompanel,blocklength b = T

155

157

161

161

168

170

171

173

174

175

180

182

184

Fig.8.14 Pricechanges(toppanel)andfractionoffundamentalistsinthemarket(bottompanel)froman agent-basedsimulation(Algorithm 27). 187

Fig.9.1 CPPIcompositionfortwosamplepriceprocessesanddifferentmultiplierstimetomaturityof2 yearsanddailyreadjustment(“nogaprisk”)andquarterlyreadjustment(rightmost;“withgaprisk”). Lightgray:safeasset, Bt ;darkgray:exposure, Et ;whiteline:floor, Ft .

191

Fig.9.2 FTSEtimeseries,10-blockbootstrapsforriskyassetandtrajectoriesforCPPI. 192

Fig.9.3 TerminalvalueofCPPIwithFTSEas T = 1year,multiplier m = 4,anddifferentgaplengths, simulatedwithblockbootstrap(right). 192

Fig.9.4 MedianofratiosVaRHill /VaRtheo fordifferentunderlyingdistributions(panels)anddifferent fractionsofdataused, m/N (lines). 196

Fig.9.5 20pathsofgeometricBrownianmotion. 199

Fig.9.6 FivepathsofageometricBrownianbridge,startingat100andendingat103. 199

Fig.9.7 SpeedofconvergenceforMonteCarlopricing. S0 = 50, X = 50, r = 0 05, √v = 0 30,and τ = 1. ThetrueBlack–Scholespriceis7.12. 202

Fig.9.8 ForwarddifferenceforGreeks:BoxplotsforDeltaestimateswith M = 1and N = 100,000for differentvaluesof h (y -axis).Parametersare S = 100, X = 100, τ = 1, r = 0.03, q = 0,and σ = 0.2.

ThesolidhorizontallineisthetrueBSDeltaof0.60;thedottedlinesgiveDelta ±0 05. 209

Fig.9.9 ForwarddifferenceforGreeks:BoxplotsforDeltaestimateswith M = 1and N = 100,000for differentvaluesof h (y -axis),butusingcommonrandomvariates.Parametersare S = 100, X = 100, τ = 1, r = 0 03, q = 0,and σ = 0 2.ThesolidhorizontallineisthetrueBSDeltaof0.60;thedotted linesgiveDelta ±0 05. 210

Fig.9.10 Topleft:scatterof500against500pointsgeneratedwith MATLAB’s rand.Topright:scatterof500 against 500generatedwithHaltonsequences(bases2and7).Bottomleft:scatterof500against500 generatedwithHaltonsequences(bases23and29).Bottomright:scatterof500against500 generatedwithHaltonsequences(bases59and89). 214

Fig.9.11 Convergenceofpricewithquasi-MC(function callBSMQMC).Thelightgraylinesshowthe convergencewithstandardMCapproach. 215

Fig.9.12 Threepathsgeneratedwithbases3,13,and31. 215

Fig.10.1 ObjectivefunctionforValue-at-Risk.

Fig.10.2 LMSobjectivefunction.

Fig.10.3 SimulatedobjectivefunctionforKirman’smodelfortwoparameters.

Fig.10.4 Leftpanel:Hestonmodelobjectivefunction.Rightpanel:Nelson–Siegel–Svenssonmodelobjective function.

Fig.11.1 Synopticviewofmethodspresentedinthechapter.

Fig.11.2 Leftpanel:iterationfunction g1 .Rightpanel:iterationfunction g2

Fig.11.3 Leftpanel:iterationfunction g3 .Rightpanel:iterationfunction g4

Fig.11.4 Leftpanel:iterationfunctionsatisfies g (x)< 1.Rightpanel:iterationfunctionsatisfies 1 <g (x)< 0.

Fig.11.5 Shapeoffunction ρk (leftpanel)andshapeoffunction ρk (s)φ(s) (rightpanel).

Fig.11.6 BehavioroftheNewtonmethodfordifferentstartingvalues.Upperleft: x 0 = 2 750and x sol = 2 4712.Upperright: x 0 = 0 805and x sol = 2 4712.Lowerleft: x 0 = 0 863and x sol = 1.4512.Lowerright: x 0 = 1.915andalgorithmdiverges.

Fig.11.7 Minimizationof f(x1 ,x2 ) = exp 0 1 (x2 x 2 1 )2 + 0 05 (1 x1 )2 withthesteepestdescent method.Rightpanel:minimizationof α forthefirststep(α ∗ = 5 87).

Fig.11.8 Minimizationof f(x1 ,x2 ) = exp 0 1 (x2 x 2 1 )2 + 0 05 (1 x1 )2 withNewton’smethod.Contour plotsofthelocalmodelforthefirstthreesteps.

Fig.11.9 Nonconvexlocalmodelforstartingpoint(leftpanel)andconvexlocalmodelbutdivergenceofthe step(rightpanel).

225

226

227

228

230

234

235

236

237

240

247

248

249

Fig.11.10 ComparisonofthefirstsevenNewtoniterations(circles)withthefirstfiveBFGSiterations(triangles). 250

Fig.11.11 EvolutionofstartingsimplexintheNelder–Meadalgorithm.

Fig.11.12 Detailedstartingsimplexandtworeflections.

Fig.11.13 Leftpanel:Plotofobservations,modelfor x1 = 2 5, x2 = 2 5andresiduals.Rightpanel:plotofsum ofsquaredresiduals g(x)

Fig.11.14 Startingpoint(bullet),onestep(circle)andcontourplotsoflocalmodelsforNewton(upperright), Gauss–Newton(lowerleft)andLevenberg–Marquardt(lowerright).

Fig.11.15 Solutionsforvaryingvaluesofparameter c ofthesystemsoftwononlinearequations.

Fig.11.16 Stepsofthefixedpointalgorithmforthestartingsolution y 0 =[ 15 ]

Fig.11.17 Oscillatorybehaviorofthefixedpointalgorithmforthestartingsolution y 0 =[ 20 ]

Fig.11.18 StepsoftheNewtonalgorithmforstartingsolution y 0 =[ 15]

Fig.11.19 StepsoftheBroydenalgorithmforstartingpoint y 0 =[5/2 1] andidentitymatrixfor B (0)

Fig.11.20 StepsoftheBroydenalgorithmforstartingpoint y 0 =[5/2 1] andJacobianmatrixevaluatedatthe startingpointfor B (0)

Fig.11.21 Objectivefunctionminimizing F(y) 2 forthesolutionofthesystemofnonlinearequationsdefined inExample 11.4

Fig.11.22 Synopticviewofsolutionmethodsforsystemsoflinearandnonlinearequations.

Fig.12.1 Schemeforpossiblehybridizations.

Fig.12.2 Shekelfunction.Forbettervisibility f hasbeenplotted.

Fig.12.3 Shekelfunction.Empiricaldistributionofsolutions.

Fig.12.4 Shekelfunction.Leftpanel:Thresholdsequence.Rightpanel:Objectivefunctionvaluesoverthe6 roundsofthe5threstart.

251

251

259

260

261

264

264

266

268

269

270

271

283

297

301

301

Fig.12.5 Subsetsumproblem.Leftpanel:Thresholdsequence.Rightpanel:Objectivefunctionvaluesover the6roundsofthe5threstart.

Fig.12.6 Subsetsumproblem:Evolutionofthefittestsolutioninrestart3.Thealgorithmstopsatgeneration6.

Fig.12.7 DifferentialEvolutionoptimization.Leftpanel:Empiricaldistributionofsolutions.Rightpanel:Best valueovergenerationsofrestart3.

Fig.12.8 ParticleSwarmoptimization.Leftpanel:Empiricaldistributionofsolutions.Rightpanel:Bestvalue overgenerationsofrestart1.

Fig.12.9 Code DCex.m.Theoreticalspeedupandefficiencyasafunctionofprocessors.Dotsrepresent computedvalues.

Fig.13.1 Theupperpanelshowsthelefttailofthedistributionofobjectivefunctionvaluesforasampleof randomsolutions.Wesampleuniformly,andthusthedistributionfunctionresemblesastraightline. Thelowerpanelshowsthedistributionforthebest100oftheonemillionrandomsolutions.

Fig.13.2 Distributionsofobjectivefunctionvaluesofbest100randomsolutionsand100greedysolutions. Bestpossiblesolutionwouldbezero.

Fig.13.3 Objectivefunctionvaluesofanunguided(random)walkthroughthesearchspace.

Fig.13.4 Distributionsofchangesinobjectivefunctionvalueswhen1(darkgray),5(gray),and10(lightgray) elementsarechanged.

Fig.13.5 Nostructureintheobjectivefunction.InsearchspacessuchastheonespicturedaLocalSearchwill fail,becausetheobjectivefunctionhasnolocalstructure,i.e.itprovidesnoguidance.Beingcloseto agoodsolutioncannotbeexploitedbythealgorithm.

Fig.13.6 ObjectivefunctionvaluefortworunsofLocalSearchover50,000iterations(logscale).

Fig.13.7 Distributionsofobjectivefunctionvaluesofbest100randomsolutions,100greedysolutions,100 solutionsobtainedbyLocalSearchand100solutionsobtainedbyThresholdAccepting.Best possiblesolutionwouldbezero.

Fig.14.1 Truefrontierandestimatedandrealizedfrontiers(noshortsales, nA is25, nS is100).

Fig.14.2 Portfolioreturndistributions:theinfluenceof rd

Fig.14.3 In-sampleversusout-of-sampledifferences.Left:in-sampledifferenceofasolutionpair(QPminus TA)againsttheassociatedout-of-sampledifference.Right:same,butonlyforportfoliosforwhich thein-sampledifferenceislessthanonebasispoint.

Fig.14.4 In-sampleversusout-of-sampledifferencedependingonthenumberofiterations.

Fig.14.5 Squaredreturns(leftpanel)andratioofconditionalmoments(rightpanel)fordifferentportfolio weights.

Fig.14.6 Distributionsofobjectivefunctionvaluesforrandomportfolios(lightgray)andsolutionsofTAopt andLSopt(darkergray).ThereislittledifferencebetweenLocalSearchandThresholdAccepting.

Fig.14.7 Distributionsofobjectivefunctionvalueswith500,1000and2000iterations.Thelighter-graylines belongto TAopt,thedarker-grayonesto LSopt.Thereisvirtuallynodifferencebetweenthelines forLocalSearchandThresholdAcceptingwith2000iterations;bothmethodsconvergequicklyon thesameportfolio.

Fig.14.8 Distributionofend-of-horizonwealthinaVaRsetting.

Fig.15.1 DailyreturnsoftheS&P500,includingOctober1987.

Fig.15.2 S&P500without10bestand10worstdays.

303

305

307

309

311

327

330

333

333

334

336

342

367

387

398

399

402

411

411

416

428

428

Fig.15.3 Arandomseriescreatedwithfunction randomPriceSeries 430

Fig.15.4 DistributionofdifferenceinfinalprofitsMA-crossoverstrategyvsbuy-and-hold.Apositivenumber meansthatMA-crossoveroutperformedtheunderlyingasset.Thedistributionissymmetricabout zero,whichindicatesthatthereisnosystematicadvantagetothecrossoverstrategy.

431

Fig.15.5 FinalprofitsofMA-crossoverstrategyvsresultofbuy-and-holdofthesameunderlyingseries. 432

Fig.15.6 Equitycurvesofoptimizedbacktests.

Fig.15.7 Distributionofin-sampleexcessprofitsforoptimizedMAcrossoverstrategy.Apositivenumber meansthatMAcrossoveroutperformedtheunderlyingasset.

Fig.15.8 ObservationalEquivalence:EUROSTOXXTotalMarketandEUROSTOXXBanks.

Fig.15.9 Mechanicsofawalk-forward.

433

434

435

437

Fig.15.10 Survivorshipbiaswhenusingcurrentcomponentsofanindex 438

Fig.15.11 S&PstockmarketindexsinceJanuary1871 452

Fig.15.12 CAPEratio

Fig.15.13 Resultsofavoidinghighvaluation.TheS&Pindexisshowninblack;thestrategyingray. 455

Fig.15.14 ResultsofavoidinghighvaluationcomparedwithS&P500.

Fig.15.15 Performanceofstrategyfordifferentvaluesof q.TheS&Pindexisshowninblack;thestrategy variationsingray.

Fig.15.16 PerformanceofindustryportfoliosasprovidedbyKennethFrench’sdatalibrary,January1990to May2018.Time-seriesarecomputedfromdailyreturns.

Fig.15.17 Fanplotoftheindustrytime-seriesshowninFig. 15.16

Fig.15.18 Correlationsofmonthlyreturns.

455

457

462

462

463

Fig.15.19 Benchmarks:Performanceofmarketportfolioandofequallyweightedportfolio.Thegrayshades arethesameasinFig. 15.17 andindicatetherangeofperformanceofthedifferentindustries. 464

Fig.15.20 Benchmarks:Outperformanceofmarketversusequallyweightedportfolio.Arisinglineindicates theoutperformanceofthemarketportfolio,andviceversa. 464

Fig.15.21 Performanceofmomentumstrategy.Theverticalaxisusesalogscale. 466

Fig.15.22 Performanceofmomentumstrategy.Theverticalaxisusesalogscale.Thegraylineshowsthe absoluteperformanceofthemarket.Theblacklineshowstherelativeperformanceofmomentum comparedwiththemarket,i.e.arisinglineindicatesanoutperformanceofmomentum. 467

Fig.15.23 Resultsfromsensitivitycheck:Fanplotsofpathswithfrequentrebalancing(theupperband)andless frequentrebalancing(thelowerband). 469

Fig.15.24 Resultsfromsensitivitycheck:TheratioofthemedianpathsofthefanplotsinFig. 15.23.The steadilyrisinglineindicatesthatfrequentrebalancingoutperformslessfrequentrebalancing. 470

Fig.15.25 Resultsfromsensitivitychecks:densitiesofannualizedreturnsofthefanplotsinFig. 15.23.The distributiontotherightbelongstothepathswithmorefrequentrebalancing. 470

Fig.15.26 Performanceofthelong-onlyminimum-varianceportfolio(gray)vsmarket(black).OnNov19, 1999,bothserieshaveavalueof100(theMVtime-seriesstartslaterbecauseofitsburn-inof 10years). 472

Fig.15.27 Performanceof100walk-forwardswithrandomrebalancingperiods.Theportfoliosarecomputed withQP.Allrandomnessintheresultscomesthroughdifferencesinthesetup;thereisnonumeric randomness. 475

Fig.15.28 Correlationofdailyreturnswhenportfoliosarerebalancedatrandomtimestamps. 476

Fig.15.29 Positionsinasingleindustryacrossfourbacktestvariations.Thebacktestsdifferonlyintheir rebalancingschedules;hencethepositionsareverysimilar. 477

Fig.15.30 Performanceof100walk-forwardswithfixedrebalancingperiods.Theportfoliosarecomputedwith LocalSearch.AllvariationsintheresultsstemfromtherandomnessinherentinLocalSearch (thoughitisbarelyvisible);therearenootherelementsofchanceinthemodel.Comparewith Fig. 15.27. 478

Fig.16.1 Interpolationandapproximation.Thepanelsshowasetofmarketrates.Left:weinterpolatethe points.Right:weapproximatethepoints. 490

Fig.16.2 Thematrix C forthecashflowsofthe44bondsin bundData,eachsquarerepresentsanonzero entry.Eachrowgivesthecashflowsofonebond,eachcolumnisassociatedwithonepaymentdate. 492

Fig.16.3 Level.Theleftpanelshows y(τ) = β1 = 3.Therightpanelshowsthecorrespondingyieldcurve,in thiscasealso y(τ) = β1 = 3.Theinfluenceof β1 isconstantforall τ 493

Fig.16.4 Short-endshift.Theleftpanelshows y(τ) = β2 1 exp( τ/λ1 ) τ/λ1 for β2 =−2.Therightpanelshows theyieldcurveresultingfromtheeffectsof β1 and β2 ,thatis, y(τ) = β1 + β2 1 exp( τ/λ1 ) τ/λ1 for β1 = 3, β2 =−2.Theshortendisshifteddownby2%,butthenthecurvegrowsbacktothelong-run levelof3%. 493

Fig.16.5 Hump.Theleftpanelshows β3 1 exp( τ/λ1 ) τ/λ1 exp( τ/λ1 ) for β3 = 6.Therightpanelshowsthe yieldcurveresultingfromallthreecomponents.Inallpanels, λ1 is2. 493

Fig.16.6 Nelson–Siegel–Svensson:Thethreepanelsshowthecorrelationbetweenthesecondandthethird, thesecondandthefourth,andthethirdandthefourthregressorsinEqs.(16.10)fordifferent λ-values(the x -and y -axesshow λ1 and λ2 between0and25).

Fig.16.7 Distributionsofestimatedparameters.Thetrueparametersare4, 2,and2.

Fig.16.8 NegativeinterestrateswithNelson–Siegelmodeldespiteparameterrestrictions.

496

498

499

Fig.16.9 ResultsforCase2,Nelson–Siegel(NS)model:Truemodelyields,yieldcurvesfittedwith DEopt, andyieldcurvesfittedwith nlminb.Plottedaretheresultsof5restartsforbothmethods,though for DEopt itisimpossibletodistinguishbetweenthedifferentcurves. 507

Fig.16.10 ResultsforCase2,Nelson–Siegel–Svensson(NSS)model:Truemodelyields,yieldcurvesfitted with DEopt,andyieldcurvesfittedwith nlminb.Plottedaretheresultsof5restartsforboth methods,thoughfor DEopt itisimpossibletodistinguishbetweenthedifferentcurves.Compare withFig. 16.9:ifanything,theresultsfor nlminb areworse.

509

Fig.16.11 ResultsforCase3,Nelson–Siegel–Svensson(NSS)model:Truemodelyields,yieldcurvesfitted with DEopt,andyieldcurvesfittedwith nlminb.Plottedaretheresultsof5restartsforboth methods,thoughfor DEopt itisimpossibletodistinguishbetweenthedifferentcurves. 512

Fig.16.12 ResultsforCase4,Nelson–Siegel–Svensson(NSS)model:Truemodelyields,yieldcurvefittedwith DEopt,andyieldcurvefittedwith nlminb.Plottedaretheresultsof5restartsforbothmethods, thoughfor DEopt itisimpossibletodistinguishbetweenthedifferentcurves.

517

Fig.16.13 Left:Convergenceofsolutions.Eachdistributionfunctionshowstheobjectivefunctionvalueofthe bestpopulationmemberfrom1000runsof DEopt.Asthenumberofgenerationsincreases,the distributionsbecomesteeperandmovetotheleft(zeroistheoptimalobjectivefunctionvalue). Right:Convergenceofpopulation,i.e.objectivefunctionvaluesacrossmembersattheendof DEopt run.Thelight-graydistributionsarefromrunswith100generations;thedarker(andsteeper) onescomefrom500generations.Thoselatterdistributionstypicallyconverge:allsolutionsinthe populationarethesame. 518

Fig.16.14 OFovertime.TheleftpanelshowsF = 0.5,CR = 0.99.Forthesameproblem,therightpanelshows F = 0.9,CR = 0.5. 520

Fig.16.15 Thetruevalueof β1 is5.Left:withoutconstraint(penaltyweightiszero).Right:withconstraint β1 ≤ 4. 522

Fig.16.16 Theeffectsofasingleoutlier.On6June2006,Adidas,alargeGermanproducerofclothingand shoes,madeastocksplit4-for-1.Thedatawasobtainedfrom www.yahoo.com inApril2009. Accordingto www.yahoo.com theseriesintheupperpanelissplitadjusted.Itisironicthatthisis eventrue:butthepricewasadjustedtwice,whichresultedinthepricejumpinJune2006(topmost panel). 526

Fig.16.17 Objectivefunctionvaluesobtainedwith lqs withincreasingnumberofsamples(seecodeexample). 535

Fig.16.18 True θ2 iszero.Theoutliersleadtoabiasedvalueof0.9.

Fig.16.19 True θ2 iszero.Theoutliersleadtoabiasedvalueof1.5.

Fig.16.20 ReportedparametersfortheGARCH(1,1)estimatesfromdifferentrestarts,allwithidentical (optimal)loglikelihoodof 1106.60788104129. 547

Fig.17.1 ImpliedvolatilitiesforoptionsontheS&P500(left)andDAX(right)asof28October2010. 554

Fig.17.2 Hestonmodel:re-creatingtheimpliedvolatilitysurface.ThegraphicsshowtheBS-implied volatilitiesobtainedfrompricesundertheHestonmodel.Thepanelsontherightshowtheimplied volatilityofATMoptions. 567

Fig.17.3 Batesmodel:re-creatingtheimpliedvolatilitysurface.ThegraphicsshowtheBS-impliedvolatilities obtainedfrompricesundertheBatesmodel.Thepanelsontherightshowtheimpliedvolatilityof ATMoptions. 568

Fig.17.4 Mertonmodel:re-creatingtheimpliedvolatilitysurface.ThegraphicsshowtheBS-implied volatilitiesobtainedfrompricesundertheMertonmodel.Thepanelsontherightshowtheimplied volatilityofATMoptions.Importantly,jumpsneedtobevolatiletogetasmile(i.e., vJ ≥ 30%). 569

Fig.17.5 Relative(left)andabsolute(right;incents)priceerrorsforBSwithdirectintegrationwith25nodes (comparedwithanalyticalsolution).

Fig.17.6 Relative(left)andabsolute(right;incents)priceerrorsforBSwithdirectintegrationwith50nodes (comparedwithanalyticalsolution).

579

580

Fig.17.7 OperationsofNelder–Mead. 581

Fig.17.8 AbsoluteerrorsforGauss–LegendreandGauss–Laguerrecomparedwith normcdf foran increasingnumberofnodes.Errorsareplottedonthe y axis;the x axisshowsthenumberofnodes. 595

Listoftables

Table1.1 YearlyreturnsofS&P5001987–2017. 14

Table6.1 SeriesofpseudorandomnumbersfromalinearcongruentialRNG,where ui = (aui 1 ) mod7and u0 = 1anddifferentmultipliers a 106

Table6.2 Popularkernels, K(y),forkerneldensityestimation. 125

Table9.1 Thefirst10VDCnumbersinbase2. 213

Table9.2 Primenumberssmallerthan1000. 214

Table14.1 Averageexceedanceofout-of-sampleshortfallprobabilitiescomparedtothetarget α (in-sample shortfallprobability).Firstcolumnisthenumberofassets,whilevaluesinitalicsarethosethatdo notdiffersignificantlyfrom0(5%confidencelevel). 418

Table15.1 Statisticsoftheindustryseries.Returnsareannualized,inpercent.Volatilityiscomputedfrom monthlyreturnsandalsoannualized. 460

Table16.1 AsampledatasetofGermangovernmentbonds.Pricesasof31May2010. 491

Table16.2 Errorsin%for NSS modelfordifferentparametersof DE .Eachblockcorrespondsto F ∈{0 1, 0 3, 0 5, 0 7, 0 9} foragiven F.FEstandsforobjectivefunctionevaluations. 521

Table16.3 ParametersensitivityDE. 537

Table16.4 ParametersensitivityPSOfor δ = 1. 538

Table16.5 ParametersensitivityPSOfor δ = 0 5. 538

Table16.6 ParametersensitivityPSOfor δ = 0 75. 539

Table16.7 ParametersensitivityPSOfor δ = 0.9. 539

Table16.8 Medianreportedloglikelihoodsfor100runswithdifferentnumbersofgenerations(nG)and populationsize nP.(Inbrackets:Numberoftimestheoveralloptimumhasbeenfound.) 547

Table16.9 EstimatedGARCH(1,1)parametersfortheDEM2GBPtimeseriesanddifferentmodelsettings. Fixedvaluesinbrackets:inmodelsBandC, y = E(y);inmodelsAandB s 2 = E((y −ˆμ)2 ) 548

Listofalgorithms

Algorithm9 Factorizationoftridiagonalmatrix.

Algorithm10 Forwardandback-substitutionfortridiagonalsystem.

\ worksin MATLAB

Projectedsuccessiveoverrelaxation(PSOR).

Algorithm15 Explicitpayoutmethod(EP).

Algorithm16 Europeancallfor S , X , r , σ , T ,and M timesteps.

Algorithm17 Testingforearlyexercise:AnAmericanput.

Algorithm18 Americancallfor S , X , r , σ , T , TD , D and M timesteps.

Algorithm19 Linearcongruentialrandomnumbergenerator.

Algorithm20 Simplifiedacceptance–rejectionforstandardnormalvariates.

Algorithm21 Taylor–Thompsonalgorithm. 126

Algorithm22 Generatevariateswithspecificrankcorrelation. 141 Algorithm23 Metropolisalgorithm. 146 Algorithm24 Metropolis–Hastings. 148 Algorithm25 Directsampling. 152 Algorithm26 MonteCarlosimulationforaEuropeancalloption. 158

Algorithm27 Agent-basedsimulationofpricesinamarketwithchartistsandfundamentalists. 187 Algorithm28 One-passalgorithmforcomputingthevariance. 202 Algorithm29 Bracketing. 231

Algorithm30 Bisection. 232 Algorithm31 Fixedpointiteration. 233 Algorithm32 Newton’smethodforzerofinding. 239 Algorithm33 Newton’smethodforunconstrainedoptimization. 243 Algorithm34 Goldensectionsearch. 245 Algorithm35 Steepestdescentmethod. 246

Algorithm36 Newton’smethodforunconstrainedoptimizationin n dimensions. 247 Algorithm37 Quasi-Newtonforunconstrainedoptimizationin n dimensions. 249

Algorithm38 Nelder–Meadsimplexdirectsearch. 253

Algorithm39 Gauss–Newtonmethod. 257 Algorithm40 Levenberg–Marquardtmethod. 258

Algorithm41 Jacobi,Gauss–Seidel,andSORfornonlinearsystems. 262

Algorithm42 Newton’smethodfornonlinearsystems. 265 Algorithm43 Broyden’smethodfornonlinearsystems. 268

Algorithm44 LocalSearch. 277

Algorithm45 SimulatedAnnealing. 277 Algorithm46 ThresholdAccepting. 278

Algorithm47 TabuSearch. 279

Algorithm48 GeneticAlgorithm. 280

Acknowledgments

Thisbookwouldnothavebeenpossiblewithoutthehelpofmanypeople.First,wethankPeter Winkerwhowasateachertoallofus(inonewayoranother).PetercoordinatedtheCOMISEF (ComputationalOptimizationinStatistics,EconometricsandFinance)project;muchoftheresearchdescribedinthisbookhasgrownoutofthisproject.WearegratefultotheEUforhaving financedCOMISEF(ProjectMRTN-CT-2006-034270).Also,wewouldliketothankallthemembersofCOMISEFforprovidingafruitfulnetwork.

Next,thereisKarenMaloneyfromElsevierwhoinitiatedthisendeavor.Withouther,thebook wouldneverhavebeenwritten.ManythanksalsogotoScottBentleyformanagingourproject. Then,thereisEvisKëllezi,whohasbeencontributingformanyyearstotheresearchthatwentinto thisbook,and,notleast,shereadandcommentedonmanydrafts.

Therearemanyotherpeoplewhomwewanttothank.Theycontributedinmanyways:critical suggestionsandcomments,moralsupport,patienttechnicalhelp,inspiration,andproofreading. ThanksgotoTorstenvonBartenwerffer,GerdaCabej,BenCraig,GiacomodiTollo,AlainDubois, StefanGroße,BenoîtGuilleminot,MarcHofmann,HildaHysi,SusanKriete-Dodds,YvanLengwiler,RedLaviste,JonelaLula,AlfioMarazzi,ChristianOesch,IlirRoko,SandraPaterlini,Giorgio Pauletto,EvdoxiaPliota,TikeshRamtohul,GregorReich,JinZhang,HeinzZimmermann,and manymore.

Andfinally,oneoftheauthorswouldliketothankCarolineandWalter,whoallowedhimto workintheinspiringenvironmentofChaletDagobertinVerbierfromwhichthebookgreatly benefitted.

ManfredGilli DietmarMaringer EnricoSchumann

Geneva,Basel,Lucerne December2018

Forewordtothesecondedition

Wheneverasecondeditionofabookiswrittenandpublished,theauthorsareexpectedtosummarizewhatisnew,andwhythisneweditionisbetterthanthefirst.Startwithwhathasnotchanged: thespiritofthebook.Thatspiritwasandisthati)computationalmethodsarepowerfultoolsin finance,butii)thesemethodsmustbeappliedwithcareandthought.Numbersmaybeprecise,but whatultimatelymattersisthethingsthatarebeingdonewiththesenumbers.

Whathaschangedinthefinancialworldsincethefirstedition?Themost-glaringchangeshave beenbroughtaboutbythefinancialcrises2007–08andthecrisisoftheeuroarea,thelatterstill ongoingatthetimeofwriting.Oneconsequencewasthatquantapproachesfellintodisrepute, thoughthisdentinpopularitywasshort-lived.Deservedlyso:thecrisisdidnothappenbecauseof models.Thatbeingsaid,themethodsdescribedinthefirsteditionremainvalid,thoughsometimes minorupdateswerenecessary.Forinstance,interestratescouldbecomenegativeafterall.

Amorelastingchangehasbeenthegrowthinregulation.Unlessyouareintocompliance, workhasbecomelessfun.Butnotallisbad:onepotentiallypositiveeffectistheincreasein transparencyandavailabledata.(Wesaypotentiallybecauseitistooearlytotellifitreallyhasthe desiredeffect.)Bythiswemeanthatmoretradingispushedtoexchanges;andmoredataarebeing collected,notablyinareassuchasbondtradingandOTCderivatives,whichmaybecomeavailable forresearch,e.g.intomarketmicrostructure.

Thefinancialcrisishashadeffectsonconsumerbehaviortoo.Orrather,consumerperception. Beforethecrisis,peoplethoughtthattechnologyfirmsposingasbankscouldnotbetrusted:they mightbefrauds,theremightbesecurityproblems,andwhoknewwhetherafirmwouldbearound ayearlater?Andtobesure:alltheseriskswereandstillarereal.Whatthefinancialcrisesshowed, however,wasthatsuchrisksarerealfortraditionalbanks,too.Asaresult,financialtechnology becamemorewidelyaccepted.

Ofcourse,manytechnologiesthatarebrandedFinTech,TechFin,RoboAdvice,orwhatevertoday,arejusthype.Butsuchtechnologiesdoofferthegenuinepossibilityforbetterfinance,with lowercosts,fewermiddlemen,andmoreefficiency.Here,thesimulationandoptimizationtechniqueswediscussinParts II and III ofthebookgainevenmorerelevance.Letusprovideaspecific example:financialportfoliosareoftenrepresentedasweightsinsteadofactual(integer)positions, becausethatmakesthemmoretractableforclassicaloptimizationtechniques.Thisisoftendeclared harmlessbecauseforinstitutionalinvestors,whorunlargeportfolios,thedifferencesbetweenusing decimalnumbersandintegerswillbesmall.1 Butthatdoesnotholdforaninvestorwhoseportfolioisofonlymoderatesizeof20,000dollars,say(Maringer, 2005b,Chapters3and4).Butsuch investorsareexactlythosethatshouldbenefitfromthenewfinancialtechnologies.

Sinceweareattechnology,whatelsehaschanged?Computershavebecomeevenfaster,and evenmoredataarestored,oftendirectlyattechnologyfirmslargeandsmall(thesecompanies alsodomuchmoreresearch).Andartificialintelligenceandmachinelearningareseeinganother spring.Hereagain,Parts II and III aredirectlyapplicable,inparticulartheoptimizationtechniques wediscuss:afterall,machinelearningisinessencesettingupamodelandsolvingit(Goodfellow etal., 2016,Chapter5).

1.WeshouldstressthatsuchaclaimcouldonlybeempiricallyverifiedbyusingsuchmethodsaswedescribeinPart III of thebook.

Soletuscomebacktothebook.Aswesaid,wedidnottouchthespiritofthebook:computationalmethodsarepowerfultools,andtheymustbeappliedwithcareandthought.Butwehave addedquiteabitofnewmaterial:

• Thereisanewtutorialchapteronusingheuristicoptimization.

• Thereisanewchapteronbacktestinginvestmentstrategies.

• The NMOF packagehassubstantiallyexpandedsincethefirstedition:therearenowfunctions forgeneticalgorithms,gridsearch,optionpricingandmuchmore;manyofthesefunctionsare describedintheneweditionofthebook.

• Thechapteronportfoliooptimizationhasbeenexpanded,andseveralcodeexampleshavebeen improved.

• Materialonparallelcomputingwithboth MATLAB® and R hasbeenadded.

• Materialonsolvinglinearsystemswith R hasbeenadded.

• Manyoftheexisting R exampleshavebeenrewrittenwith Sweave (Leisch, 2002),makingthem completelyreproducible.Thenewchaptersarewrittenwith Sweave too.

AboutRcode

Most R functionsthatweredescribedinthefirsteditionareincludedinthe NMOF package,which hasgrownquiteabitovertheyears.Nevertheless,all R codeexamplesfromthefirsteditionstill workwiththecurrentversionof R andthepackage(thoughseveralexampleshavebeenimproved inthisedition).

Mostoftheold R codeandallnewly-added R codehasnowbeenpreparedwith Sweave;so codeforgraphics,tables,etc.isdirectlyembeddedinthesourcedocument.Thatdoesnotmean thatallcodeisalwaysshowninthebook:itwouldbetiresomehavingtoreadthesamecode forplottingaresult,say,overandoveragain.However,thecompletecodeistangledandcanbe accessedonthebook’swebsite http://www.nmof.info.Itisalsocontainedinthepackage(seethe function showExample).Forthosepartsthatuse Sweave,allcodeforasinglechapteriscollected inone R sourcefile.Tomakeiteasiertonavigatethesefiles,manycodechunkshavenames,which areprintedinthemargin,asinthefollowingsnippet.

>1+1 [one-plus-one]

Inthe R file,youmaythenlookforthechunk’sname:

###################################################

###codechunknumber1:one-plus-one ###################################################

1+1

Whenfunctionsareshownwhosecodeisincludedinthe NMOF package,wetypicallyhave thecodedirectlytakenfromthepackage.Forthis,thepackagewasbuiltandinstalledwith -with-keep.source.Whenerrorsareintended,theyarewrappedinto try

PartI Fundamentals

Chapter1 Introduction

1.1Aboutthisbook

“Ithinkthereisaworldmarketformaybefivecomputers.”Sosaid,allegedly,ThomasJ.Watson, thenchairmanof IBM ,in1943.Itwouldtakeanothertenyears,until1953,before IBM delivered itsfirstcommercialelectroniccomputer,the701.

Storiesandquotationslikethisabound:peoplemakepredictionsaboutcomputingtechnology thatturnouttobespectacularlywrong.1 Tobefair,Watsonprobablynevermadethatstatement; mostofsuchinfamousforecastsareeithermadeuportakenoutofcontext.

Butinanycase,Watson’sallegedstatementreflectsthespiritofthetime,andreadingittoday plainlyshowstheextenttowhichcomputingpowerhasbecomeavailable:nowadaysineveryone’s pocket,therearedevicesthatperformmillionsoftimesfasterthan IBM ’s701.

Thegrowthofcomputingpower

Manyexampleshavebeenmadetoillustratethisgrowth;2 letusprovideonethatstartsintheSwiss cityofGeneva,wherethisbookoriginated.IncaseyoudonotknowSwitzerland,Fig. 1.1 showsa map.

ImagineyoustandatthewonderfullakefrontofGeneva,withaviewonMontBlanc.Youdecide totakearuntoLakeZurich.Weadmitthisisunlikely,giventhedistanceof250km.Butitisonly anexample,sopleasebearwithus.Assumeyoucouldrunthewholedistancewithaspeedof20km perhour,whichisaboutthespeedthataworld-classmarathonrunnercouldmanage.(Weignore thefactthatSwitzerlandisarathermountainouscountry.)Itwouldtakeyoumorethan12hours toarriveinZurich.Now,insteadofrunning,supposeyoutookaplanewithanaveragespeedof 800kmperhour.Thisisabout40timesfaster,andyouwouldarriveinlessthanhalfanhour. Whatisthepointoftheexample?Forone,fewpeoplewouldrunfromGenevatoZurich.Butmore importantly,wewantedtogiveyouanideaofspeedup.Itisjust40inthiscase,notalargenumber, butitmakesahugedifference,anditmakesthingspossiblewhichotherwisewouldnotbe.

Thisbookisnotabouttraveling.Itisaboutcomputationalmethodsinfinance.Quantitative methodsandtheirimplementationinsoftwareformhavebecomeevermoreimportantinscientific researchandtheindustryoverthelastdecades,andmuchhaschanged.Ononehand,evermore dataiscollectedandstoredtoday,waitingtobeanalyzed.Atthesametime,computingpowerhas increasedbeyondimagination.Ifwemeasurethespeedofacomputerbythenumberofoperations itcanperforminasecond,thencomputershaveimprovedbyafactorofperhaps1,500,000since

1.Thisappliesaswelltopredictionsabouttechnologyandtopredictionsingeneral.See,forinstance,predictionson TV at http://www.elon.edu/e-web/predictions/150/1930.xhtml

2.OneofourfavoritesisfromDongarraetal.(1998):“Indeed,ifcarshadmadeequalprogress[asmicroprocessors],you couldbuyacarforafewdollars,driveitacrossthecountryinafewminutes,and‘park’thecarinyourpocket!”Ifapplied tocomputingpoweringeneral,thatisanunderstatement:itwouldnowtakefractionsofacenttobuyacar,lessthana secondtocrossthecountry–andyoumightneedmagnifyingglassestoevenfindyourcar.

NumericalMethodsandOptimizationinFinance. https://doi.org/10.1016/B978-0-12-815065-8.00011-X Copyright©2019ElsevierInc.Allrightsreserved.

FIGURE1.1 AmapofthebeautifulcountrycalledSwitzerland. theearly1980s.3 Iftravelinghadmatchedthisspeedup,wecouldgofromGenevatoZurichin 3/100 ofasecond.Betteryet,wearenottalkingaboutsupercomputers,butaboutthekindofcomputers wehaveonourdesktops.Andinanycase,inthepast,thepowerofsupercomputersatonepointin timewasavailableforprivateusejustafewyearslater.

Ofcourse,itisnotonlyhardwarethathasimproved,butsoftware,too.Ifpeoplestilloperatedon terminalsorhadtousepunch-cardsforstoringprograms,computingwouldbemuchlesspowerful today.Thisbookisaboutusingthismassively-increasedcomputingpowerinfinance.Indeed,this evolution,whichtookplaceinroughlyaman’swork-life,hasledtoseveralconsequences.

Lessdivision-of-labor. Becausecomputershavebecomesofastandeasytouse,peopleinmany disciplinescanturnfromspecialistsintopolymaths.Or,toputitdifferently,theybecome specialistsinmore-broadly-definedfields.Weseethishappeningnotonlyinfinance;but alsoinstatisticsanddataanalysis,whereoftenasinglepersonprepares,processes,andanalyzesdata,estimatesmodels,runssimulations,andmore(muchhelpedbythefactthatmany suchtaskscanbeautomated).Orthinkofpublishing.Moderncomputersandsoftwarehave enabledpeopletonotonlywritepapersandbooks,buttoactuallyproducethem,i.e.,create artworkorgraphics,definethelayoutandsoon.4

Portablesoftware. Softwareandcomputingmodelsthatrelyonspecifichardwarearchitectures losetheirappeal.Forinstance,parallelcomputationsthatexploitspecificcommunication channelsinhardwarehavebecomelessattractive.Insteadofspendingthenextyearwith rewritingtheirprogramsforthelatestsupercomputerarchitecture,peoplecanandshould nowusetheirtimetothinkabouttheirapplicationsandwriteusefulsoftware.(Then,aftera year,theycanbuyabetter,fastermachine.)

Interpretedlanguages. Inthepast,implementingalgorithmsoftenmeantcreatingprototypesina higher-levellanguageandthenrewritingsuchprototypesinlow-levellanguagessuchas C. Today,prototypeswritteninlanguagessuchas MATLAB® , R, Python, Julia or Lua areso fastthatareimplementationisrarelyneeded.Asaconsequence,implementationtimeshave decreased,andwecanmuchfasterexplorenewideasandadaptexistingprograms.

Computationalfinance

Computationalfinanceisnotawell-defineddiscipline.Itistheintersectionoffinancialeconomics, scientificcomputing,econometrics,softwareengineering,andmanyotherfields.Itsgoalistobetterunderstandpricesandmarkets—ifyouareanacademic—,andtomakemoney—ifyouare

3.Thefirst IBM personalcomputerintheearly1980sdidabout10or20kFLOPS(oneFLOPisonefloatingpointoperation persecond,seepage 29).Andthespeedupdoesnottakeintoaccountimprovementsinalgorithms.

4.Curiouslyenough,thathadactuallybeenthestateofaffairsbefore,asJanTschichold(1971)observed:“Inderfrühzeit desbuchdruckswarendruckerundverlegereineunddieselbeperson.Derdruckerwählteselberdiewerkeaus,dieer verlegenwollte;oftwarerselberentwerferundherstellerdertypen,mitdenenerdruckte;erbeaufsichtigteselberden satzundsetztevielleichtselbermit.Danndruckteerdensatz,unddaseinzige,wasernichtselberlieferte,wardaspapier. Nachherbenötigteervielleichtnochdenrubrikator,derdieinitialeneinzuschreibenhatte,undeinenbuchbinder,fallserdas werkgebundenaufdenmarktbrachte.”[NotethatthecapitalizationisTschichold’s.]

Another random document with no related content on Scribd:

saw a multitude of Tomts come, each bearing a stalk of rye, among them one not larger than a man’s thumb, bearing a straw upon his shoulders.

“Why do you puff so hard?” said the farmer from his hiding-place, “your burden is not so great.”

“His burden is according to his strength, for he is but one night old,” answered one of the Tomts, “but hereafter you shall have less.”

From that day all luck disappeared from the farmer’s house, and finally he was reduced to beggary.

In many districts it has been the custom to set out a bowl of mush for the fairies on Christmas eve.

In the parish of Nyhil there are two estates lying near each other, and both called Tobo. On one was a Tomt, who, on Christmas eve, was usually entertained with wheaten mush and honey. One time the mush was so warm when it was set out that the honey melted. When the Tomt came to the place and failed to find his honey as heretofore, he became so angry that he went to the stable and choked one of the cows to death. After having done this he returned and ate the mush, and, upon emptying the dish, found the honey in the bottom. Repenting his deed of a few minutes before, he carried the dead cow to a neighboring farm and led therefrom a similar cow with which to replace the one he had killed. During his absence the women had been to the barn and returned to the house, where the loss was reported to the men, but when the latter arrived at the cowshed the missing [125]cow had apparently returned. The next day they heard of the dead cow on the adjoining farm, and understood that the Tomts had been at work.

In one place, in the municipality of Ydre, a housewife remarked that however much she took of meal from the bins there seemed to be no diminution of the store, but rather an augmentation. One day when she went to the larder she espied, through the chinks of the door, a little man sifting meal with all his might.

Noticing that his clothes were very much worn, she thought to reward him for his labor and the good he had brought her, and made him a new suit, which she hung upon the meal bin, hiding herself to see what he would think of his new clothes. When the Tomt came again he noticed the new garments, and at once exchanged his tattered ones for the better, but when he began to sift and found that the meal made his fine clothes dusty he threw the sieve into the corner and said:

“Junker

Grand is dusting himself. He shall sift no more.” [126]

The belief in Tomts has been handed down to us through many generations, and is widespread in Sweden In the opinion [123]of the writer they are nothing more or less than an inheritance from the classical past and a remnant of the domestic worship which the ancients bestowed upon their family gods Legends similar to this are related in Norway, where the spirit is called Topvette or Tomlevette and Gardos; also in Faroe Islands, where they are called Niagriusar, and in Germany, where they are called Kobolde, etc. ↑

[Contents]

T

C N.1

On the estate of Norrhult, in the parish of Rumskulla, the people in olden times were very much troubled by Trolls and ghosts. The disturbances finally became so unbearable that they were compelled to desert house and home, and seek an asylum with their neighbors. One old man was left behind, and he, because he was so feeble that he could not move with the rest.

Some time thereafter, there came one evening a man having with him a bear, and asked for lodgings for himself and companion. The old man consented, but expressed doubts about his guest being able to endure the disturbances that were likely to occur during the night.

The stranger replied that he was not afraid of noises, and laid himself down, with his bear, near the old man’s bed.

Only a few hours had passed, when a multitude of Trolls came into the hut and began their usual clatter. Some of them built the fire in the fireplace, others set the kettle upon the fire, and others again put into the kettle a mess of filth, such as lizards, frogs, worms, etc.

When the mess was cooked, the table was laid and the Trolls sat down to the repast. One of them threw a worm to the bear, and said:

“Will you have a fish, Kitty?” [127]

Another went to the bear keeper and asked him if he would not have some of their food. At this the latter let loose the bear, which struck about him so lustily that soon the whole swarm was flying through the door.

Some time after, the door was again opened, and a Troll with mouth so large that it filled the whole opening peeked in. “Sic him!” said the bear keeper, and the bear soon hunted him away also.

In the morning the stranger gathered the people of the village around him and directed them to raise a cross upon the estate, and to engrave a prayer on Cross Mountain, where the Trolls dwelt, and they would be freed from their troublesome visitors.

Seven years later a resident of Norrhult went to Norrköping. On his way home he met a man who asked him where he came from, and, upon being informed, claimed to be a neighbor, and invited the peasant to ride with him on his black horse. Away they went at a lively trot along the road, the peasant supposed, but in fact high up in the air. When it became quite dark the horse stumbled so that the peasant came near falling off.

“It is well you were able to hold on,” said the horseman. “That was the point of the steeple of Linköping’s cathedral that the horse stumbled against. Listen!” continued he. “Seven years ago I visited Norrhult. You then had a vicious cat there; is it still alive?”

“Yes, truly, and many more,” said the peasant.

After a time the rider checked his horse and bade [128]the peasant dismount. When the latter looked around him he found himself at Cross Mountain, near his home.

Some time later another Troll came to the peasant’s cottage and asked if that great savage cat still lived.

“Look out!” said the peasant, “she is lying there on the oven, and has seven young ones, all worse than she.”

“Oh!” cried the Troll, and rushed for the door. From that time no Trolls have ever visited Norrhult. [129]

1

Not longer than thirty years ago a cross, said to be the one raised on this occasion, was still standing in Norrhult ↑

[Contents]

L B B.1

On the estate of Brokind, in the parish of Vardsnäs, dwelt, in days gone by, a rich and distinguished [130]lady named Barbro, who was so hard-hearted and severe with her dependents that for the least transgression they were bound, their hands behind their backs, and cast into prison, where, to add to their misery, she caused a table, upon which a bountiful supply of food and drink was placed, to be spread before them, which, of course, bound as they were, they could not reach. Upon complaint being made to her that the prisoners were perishing from hunger and thirst, she would reply, laughingly: “They have both food and drink; if they will not partake of it the fault is theirs, not mine.”

Thus the prison at Brokind was known far and wide, and the spot where it stood is to this day called Kisthagen, in memory of it.

When Lady Barbro finally died she was buried in the grave with her forefathers, in the cathedral of Linköping, but this was followed by such ghostly disturbances that it became necessary to take her body up, when it was interred in the churchyard of Vardsnäs.

Neither was she at rest here, whereupon, at the suggestion of one of the wiser men of the community, her body was again taken up, and, drawn by a yoke of twin oxen, was conveyed to a swamp, where it was deposited and a pole thrust through both coffin and corpse. Ever after, at nightfall, an unearthly noise was heard in the swamp, and the cry of “Barbro, pole! Barbro, pole!”

The spirit was, for the time being, quieted, but, as with ghosts in all old places, it returned after a time, and often a light is seen in the large, uninhabited building at Brokind. [131]

1 This story was found, after his death, among the papers of the lecturer, J. Vallman The estate of Brokind, before it came into the possession of the family of Count Falkenberg, was owned, for about two centuries, by the family of Night and Day. It is probable that the Lady Barbro wrought into this legend is Lady Barbro, Erik’s daughter, wife of Senator Mons, Johnson Night and Day, though how she was made to play a part in the narrative is not known, as her body was not impaled in a swamp, but rests peacefully in an elegant grave in the cathedral of Linköping ↑

[Contents]

T U N W.1

From the point where the river Bulsjö empties into Lake Sommen, extending in a northerly direction for about eight miles, bordering the parishes of North Wij and Asby, nearly up to a point called Hornäs, stretches the principal fjord, one of several branching off from the large lake.

Near Vishult, in the first named of these parishes, descending to the lake from the elevation that follows its west shores, is a wall-like precipice, Urberg, which, from the lake, presents an especially magnificent view, as well in its height and length, and in its woodcrowned top, as in the wild confusion of rocks at its base, where, among the jumble of piled-up slabs of stones, gape large openings, into which only the imagination dares to intrude.

From this point the mountain range extends southward toward Tulleram, and northward, along the shore of Lake Sjöhult, under the name of Tjorgaberg, until it ends in an agglomeration of rocks called Knut’s Den.

In this mountain dwells the Urko, a monster cow of traditionary massiveness, which, in former times, when she was yet loose, plowed the earth, making what is now Lake Sommen and its many fjords. At last [132]she was captured and fettered by a Troll man from Tulleram, who squeezed a horseshoe around the furious animal’s neck and confined her in Urberg. For food she has before her a large cow-hide from which she may eat a hair each Christmas eve, but when all the hairs are consumed, she will be liberated and the destruction of Ydre and all the world is to follow.

But even before this she will be liberated from her prison if Ydre is crossed by a king whom she follows and kills if she can catch him before he has crossed to the confines of the territory.

It happened one time that a king named Frode, or Fluga, passed through Ydre, and, conscious of the danger, hurried to reach the boundaries, but, believing he had already passed them, he halted on the confines at Fruhammer, or, as the place was formerly called, Flude, or Flugehammer, where he was overtaken and gored to death by the monster. In confirmation of this incident, his grave, marked by four stones, is to this day pointed out.

Another narrative, which, however, is known only in the southeastern part of the territory, relates that another king, unconscious of the danger accompanying travel in the neighborhood, passed unharmed over the border, and had reached the estate of Kalleberg, when he heard behind him the dreadful bellowing of the monster in full chase after him. The king hastened away as speedily as possible. The cow monster, unable to check its mad gallop at the border, rushed over some distance to the place where the king first paused, where, in the gravel-mixed field, she pawed up a round [133]hole of several hundred feet in breadth, which became a bog, whose border, especially upon the north side, is surrounded by a broad wall of the upheaved earth.

Still, at times, especially preceding a storm, the Urko is heard rattling its fetters in the mountain, and both upon the mountain and down near the shore of the lake by times.

Extraordinary things are said to happen. One and another of the residents thereabouts assert even that they have seen the Urko in her magnificent rooms and halls, which the neighbors do not for a moment doubt. [134]

1 This legend doubtless grew out of the story of the flood, in this form relating how the mighty waters burst their bounds and were in time again imprisoned in their beds ↑

[Contents]

T T S.

Near Kölefors, in the jurisdiction of Kinda, lived, a long time ago, an old woman, who, as the saying goes, was accustomed, during Easter week, to go to Blåkulla.

Late one Passion Wednesday evening, as was usual with witches, she lashed her pack in readiness for the night, to follow her comrades in their wanderings. In order that the start should be accompanied by as few [135]hindrances as possible, she had greased her shoes and stood them by the fireplace to dry.

In the dusk of the evening there came to her hut another old woman, tired and wet through from the rain, and asked permission to remain over night. To this the witch would not consent, but agreed to allow the woman to remain until she had dried her soggy shoes before the fire, while she, unwilling to be under the same roof with her guest, remained outside.

After a time the fire died out, and it became so dark in the hut that when the stranger undertook to find her shoes, in order to continue her journey, she got and put on the witch’s shoes instead. Hardly had she passed out through the door when the shoes jerked her legs up into the air and stood her head downward, without, however, lifting her into the air and carrying her away as would have been if the witch’s broom had been in her hand.

In this condition the old woman and the shoes struggled through the night. Now the shoes stood her on her head and dragged her along the ground, now the woman succeeded in grasping a bush or root, and was able to regain her feet again for a time.

In the end, near morning, a man walking past, noticed her and hastened to her relief. Answering her earnest pleading the man poked off one of the shoes with a stick, whereupon, instantly, shoe and stick flew into the air and vanished in the twinkling of an eye. After the adventures of the night the old Troll woman was so weakened that she fell into a hole, which is pointed out to this day, and is called “The Troll Woman’s Pit.” [136]

[Contents]

T W S N.1

Both wood nymphs and sea nymphs belong to the giant family, and thus are related.

They often hold communication with each other, although the wood nymphs always hold themselves a little above their cousins, which frequently occasions differences between them.

A peasant, lying in the woods on the shores of Lake Ömmeln, heard early one morning voices at the lake side engaged in vehement conversation. Conjecturing that it was the wood nymphs and sea nymphs quarreling, he crept through the underbrush to a spot near where they sat, and listened to the following dialogue:

Sea Nymph—“You shall not say that you are better than I, for I have five golden halls and fifty silver cans in each hall.”

Wood Nymph—“I have a mountain which is three miles long and six thousand feet high, and under that mountain is another, ten times higher and formed entirely of bones of the people I have killed.”

When the peasant heard this he became so alarmed [137]that he ran a league away, without stopping. Thus he did not learn which was victorious, but it was the wood nymphs without doubt, as they have always been a little superior to the others. [138]

The wood nymph dwells in large forests, and is described as a beautiful young woman, when seen face to face; but if her back be turned to one it is hollow, like a dough-trough, or resembles a block stub Sometimes, instead of a hollow back, she is adorned with a bushy fox tail The sea nymph dwells, as indicated by the name, at the bottom of seas and lakes, and is clad in a skirt so snow-white that it sparkles in the sunlight. Over the skirt she wears a light blue jacket. Usually her

Turn static files into dynamic content formats.

Create a flipbook
Issuu converts static files into: digital portfolios, online yearbooks, online catalogs, digital photo albums and more. Sign up and create your flipbook.
Numerical methods and optimization in finance manfred gilli - Quickly download the ebook to read any by Ebook Home - Issuu