Learn How to Program Stochastic ModelsHighly recommended, the best-selling first edition of Introduction to Scientific Programming and Simulation Using R was lauded as an excellent, easy-to-read introduction with extensive examples and exercises.
This second edition continues to introduce scientific programming and stochastic modelling in a clear, practical, and thorough way.
Readers learn programming by experimenting with the provided R code and data. The book's four parts teach:Core knowledge of R and programming conceptsHow to think about mathematics from a numerical point of view, including the application of these concepts to root finding, numerical integration, and optimisationEssentials of probability, random variables, and expectation required to understand simulationStochastic modelling and simulation, including random number generation and Monte Carlo integration In a new chapter on systems of ordinary differential equations (ODEs), the authors cover the Euler, midpoint, and fourth-order Runge-Kutta (RK4) schemes for solving systems of first-order ODEs.
They compare the numerical efficiency of the different schemes experimentally and show how to improve the RK4 scheme by using an adaptive step size.
Another new chapter focuses on both discrete- and continuous-time Markov chains.
It describes transition and rate matrices, classification of states, limiting behaviour, Kolmogorov forward and backward equations, finite absorbing chains, and expected hitting times.
It also presents methods for simulating discrete- and continuous-time chains as well as techniques for defining the state space, including lumping states and supplementary variables. Building readers' statistical intuition, Introduction to Scientific Programming and Simulation Using R, Second Edition shows how to turn algorithms into code.
It is designed for those who want to make tools, not just use them.
The code and data are available for download from CRAN.