Monte_Carlo蒙特卡洛算法模拟
合集下载
相关主题
- 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
- 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
- 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。
2
3
4
ห้องสมุดไป่ตู้
5
6
Xianhua Peng (HKUST)
Monte Carlo Simulation
Fall 2014
12 / 59
The Monte Carlo Framework and Output Analysis
The Monte Carlo Framework
Suppose we want to estimate some quantity θ = E [h(X )], where X = (X1 , X2 , . . . , Xn )T is a random vector in Rn h(x ) is a function from Rn to R Note that probability P (h(X ) ∈ A) can be represented as expectation P (h(X ) ∈ A) = E [1A(h(X ))], where 1A (x ) is the indicator function: 1A (x ) := For example, P (a < h(X ) ≤ b ) = E [1(a,b] (h(X ))]
2
3
4
5
6
Xianhua Peng (HKUST)
Monte Carlo Simulation
Fall 2014
2 / 59
Generating Multivariate Normal and t Random Vectors
Outline
1
Generating Multivariate Normal and t Random Vectors Simulating Stock Price Under Black-Scholes Model The Monte Carlo Framework and Output Analysis Calculating VaR via Simulation Importance Sampling Relative Errors
d
σ2 2 )t1
+ σ X1 ), where
Sequentially simulate Sti , i = 2, 3, . . ., by
Sti = Sti −1 exp((µ−
σ2 d )(ti −ti −1 )+σ Xi ), Xi ∼ N (0, ti −ti −1 ), i = 2, 3, . . . , 2
Spectral Decomposition of Σ
Spectral decomposition of real-valued symmetric matrix Σ: Σ = ΓΛΓT , where Λ = diag{λ1 , . . . , λn } A can be chosen to be A = Γdiag{ λ1 , . . . , λn }
Xianhua Peng (HKUST) Monte Carlo Simulation Fall 2014 6 / 59
Generating Multivariate Normal and t Random Vectors
Generate Multivariate t Random Vectors
Xianhua Peng (HKUST)
Monte Carlo Simulation
Fall 2014
5 / 59
Generating Multivariate Normal and t Random Vectors
Cholesky Decomposition of Σ
Cholesky decomposition: any positive semi-definite symmetric matrix Σ can be decomposed into Σ = AAT , where A is a lower triangular matrix with all elements above diagonal being zero. The 3-dimensional case: a11 0 0 a11 a21 a31 σ11 σ12 σ13 σ21 σ22 σ23 = a21 a22 0 0 a22 a32 0 0 a33 σ31 σ32 σ33 a31 a32 a33 Matlab function for Cholesky decomposition: chol Be careful! If C = chol(Σ), then Σ = C T C ! Matlab function for simulating Nn (µ, Σ): mvnrnd
Monte Carlo Simulation
Fall 2014
1 / 59
Outline
1
Generating Multivariate Normal and t Random Vectors Simulating Stock Price Under Black-Scholes Model The Monte Carlo Framework and Output Analysis Calculating VaR via Simulation Importance Sampling Relative Errors
Monte Carlo Simulation Fall 2014 10 / 59
Xianhua Peng (HKUST)
Simulating Stock Price Under Black-Scholes Model
Simulate Stock Prices Under Black-Scholes Model
Stationary increments: for any s > 0 and t > 0, the distribution of Wt +s − Ws does not depend on s. Normal distribution: for any s ≥ 0 and t > 0,
d
Wt +s − Ws ∼ N (t µ, t σ 2 )
Given S0 , how to simulate the future stock price at time t1 < t2 < · · · < tn under the Black-Scholes model?
1
2
X1 = Wt1 ∼ N (0, t1 )
Simulate St1 = S0 exp((µ −
2
3
4
5
6
Xianhua Peng (HKUST)
Monte Carlo Simulation
Fall 2014
8 / 59
Simulating Stock Price Under Black-Scholes Model
Brownian Motion
A stochastic process {Wt , t ≥ 0} is a called a Brownian motion with drift µ and volatility σ , if it has the following properties W0 = 0 Independent increments: for any 0 < t1 < t2 < · · · < tn , Wt1 , Wt2 − Wt1 , . . ., and Wtn − Wtn−1 are independent.
d
If we find A such that AAT = Σ, then we obtain µ + AZ ∼ Nn (µ, Σ).
d
Xianhua Peng (HKUST)
Monte Carlo Simulation
Fall 2014
4 / 59
Generating Multivariate Normal and t Random Vectors
Xianhua Peng (HKUST)
Monte Carlo Simulation
Fall 2014
9 / 59
Simulating Stock Price Under Black-Scholes Model
Black-Scholes Model of Stock Prices
Black-Scholes model: stock price at time t is σ2 )t + σ Wt ), for all t , 2 where Wt is a standard Brownian motion. Overall log return over [0, t ] is a Brownian motion: St = S0 exp((µ − log σ2 σ2 St d = (µ − )t + σ Wt ∼ N (t (µ − ), t σ 2 ) S0 2 2
The random vector X has a multivariate t distribution with dof ν (denoted by tn (ν, µ, Σ)), if X =µ+
d d
H V /ν
, where
H ∼ Nn (0, Σ)
X can be simulated by simulating H and V respectively. Matlab function: mvtrnd
Logarithm of stock price is a constant plus a Brownian motion: σ2 )t + σ Wt , for all t 2 Log return of the stock from time s to time s + t : log St = log S0 + (µ − log σ2 σ2 S s +t d = (µ − )t + σ (Ws+t − Ws ) ∼ N ((µ − )t , σ 2 t ) Ss 2 2
We want to simulate X = (X1 , . . . , Xn )T ∼ Nn (µ, Σ)
d
d
Let Z = (Z1 , . . . , Zn )T ∼ Nn (0, In ). We know how to simulate Z . Let A ∈ Rn×n . We know µ + AZ ∼ Nn (µ, AAT ) How to find such a A?
V ∼ χ2 ν and V is independent of Z
Xianhua Peng (HKUST)
Monte Carlo Simulation
Fall 2014
7 / 59
Simulating Stock Price Under Black-Scholes Model
Outline
1
Generating Multivariate Normal and t Random Vectors Simulating Stock Price Under Black-Scholes Model The Monte Carlo Framework and Output Analysis Calculating VaR via Simulation Importance Sampling Relative Errors
2
3
4
5
6
Xianhua Peng (HKUST)
Monte Carlo Simulation
Fall 2014
3 / 59
Generating Multivariate Normal and t Random Vectors
Generate Multivariate Normal Random Vectors
Xianhua Peng (HKUST)
Monte Carlo Simulation
Fall 2014
11 / 59
The Monte Carlo Framework and Output Analysis
Outline
1
Generating Multivariate Normal and t Random Vectors Simulating Stock Price Under Black-Scholes Model The Monte Carlo Framework and Output Analysis Calculating VaR via Simulation Importance Sampling Relative Errors
Monte Carlo Simulation
FE5107 Risk Analysis and Management
Instructor: Xianhua Peng Department of Mathematics HKUST maxhpeng@ust.hk
Fall 2014
Xianhua Peng (HKUST)