Monte Carlo Simulation

Monte Carlo Simulation_第1张图片
Monte Carlo Simulation_第2张图片
simulation codes
  • rand follows uniform distribution between [0,1], randn follows normal distribution between [0,1].

  • rand(2,1), rand(2)

  • his(rand(100000,1))

  • icdf

  • icdf('Normal', rand(100000,1), 0.3,0.4)

  • A=icdf('exp', rand(100000,1), 0.5)
    hist(A)

Monte Carlo Simulation_第3张图片
Multivariate Random Number
  • mvnrnd([2;4][2 1;1 3])
  • mvnrnd([2;4][2 1;1 3],5)
  • A=mvnrnd([2;4][2 1;1 3],50000)
    plot(A(:,1), A(:,2),'d')

** Simulating period by period**


Monte Carlo Simulation_第4张图片
Monte Carlo Simulation_第5张图片
Code
Monte Carlo Simulation_第6张图片
  • Path is a matrix, in the last command, do remember to write "." after the Path(;,i), or Matlab will think it as a whole matrix transform, rather than for each element specified.
  • "Nsim" is number of simulation

** The simulated discounted present value **


Monte Carlo Simulation_第7张图片

Statistic Inference

Monte Carlo Simulation_第8张图片

Monte Carlo Simulation_第9张图片

Exercise

Monte Carlo Simulation_第10张图片

Monte Carlo Simulation_第11张图片

Variance Reduction

  • Antithetic Algorithm
Monte Carlo Simulation_第12张图片

Example

Monte Carlo Simulation_第13张图片
Monte Carlo Simulation_第14张图片
  • Control Variable
Monte Carlo Simulation_第15张图片
Monte Carlo Simulation_第16张图片
Monte Carlo Simulation_第17张图片
Monte Carlo Simulation_第18张图片
Monte Carlo Simulation_第19张图片

你可能感兴趣的:(Monte Carlo Simulation)