d G = a ( G , t ) d t + b ( G , t ) d X dG = a(G,t) \ dt + b(G,t) \ dX dG=a(G,t) dt+b(G,t) dX
称为 G G G的随机微分方程或者 d G dG dG的随机游走,由两部分组成:
资产价格和几何布朗运动
d S = μ S d t + σ d X (1) dS=\mu S dt + \sigma dX \tag{1} dS=μSdt+σdX(1)
这个随机过程叫几何布朗运动Geometric Brownian Motion(GMB)或指数布朗运动Exponential Brownian Motion(EMB),广泛用于资产定价
期权价格
d f = f ( X + d X ) − f ( x ) = d f d X d X + 1 2 d 2 f d X 2 d t (2) df = f(X+dX)-f(x) = \frac{df}{dX} dX + \frac{1}{2} \frac{d^2f}{dX^2} dt \tag{2} df=f(X+dX)−f(x)=dXdfdX+21dX2d2fdt(2)
其中用到 l i m d t → 0 d X 2 = d t lim_{dt \to 0} dX^2 = dt limdt→0dX2=dt
重写公式 ( 1 ) (1) (1)为 d S S = μ d t + σ d X \begin{aligned} \frac{dS}{S} = \mu dt + \sigma dX \end{aligned} SdS=μdt+σdX
期权价格是随机过程的函数 V ( S ) V(S) V(S), 进行泰勒展开得到 d V = d V d S d S + 1 2 d 2 V d S 2 d S 2 \begin{aligned} dV=\frac{dV}{dS} dS + \frac{1}{2} \frac{d^2V}{dS^2} dS^2 \end{aligned} dV=dSdVdS+21dS2d2VdS2
忽略 d t 3 2 , d t 2 dt^\frac{3}{2}, dt^2 dt23,dt2等高阶无穷小, 得到 d S 2 = σ 2 S 2 d t dS^2=\sigma ^2 S^2 dt dS2=σ2S2dt,带入得到
d V = ( μ S d V d S + 1 2 σ 2 S 2 d 2 V d S 2 ) d t + ( σ S d V d S ) d X (3) \begin{aligned} dV = (\mu S \frac{dV}{dS} + \frac{1}{2} \sigma^2 S^2 \frac{d^2V}{dS^2})dt + (\sigma S \frac{dV}{dS})dX \end{aligned} \tag{3} dV=(μSdSdV+21σ2S2dS2d2V)dt+(σSdSdV)dX(3)
这是一个新的随机微分方程,同样包括确定性部分和随机部分
实例1:对数
由于几何布朗运动的右侧有S,无法直接通过积分求解,定义中间函数 V ( S ) = l o g S V(S)=logS V(S)=logS,有
d V d S = 1 S d 2 V d S 2 = − 1 S 2 \begin{aligned} & \frac{dV}{dS} = \frac{1}{S} \\ & \frac{d^2V}{dS^2} = - \frac{1}{S^2} \\ \end{aligned} dSdV=S1dS2d2V=−S21
由公式 ( 3 ) (3) (3)得到
d ( l o g S ) = ( μ − 1 2 σ 2 ) d t + σ d X d(logS) = (\mu - \frac{1}{2} \sigma ^2)dt + \sigma dX d(logS)=(μ−21σ2)dt+σdX
两边积分,得到
∫ 0 t d ( l o g S ) = ∫ 0 t ( μ − 1 2 σ 2 ) d τ + ∫ 0 t σ d X = ( μ − 1 2 σ 2 ) t + σ ( X ( t ) − X ( 0 ) ) \begin{aligned} \int_0^t d(logS) &= \int_0^t(\mu - \frac{1}{2} \sigma ^2)d\tau + \int_0^t \sigma dX \\ &= (\mu - \frac{1}{2} \sigma ^2)t + \sigma (X(t) - X(0)) \end{aligned} ∫0td(logS)=∫0t(μ−21σ2)dτ+∫0tσdX=(μ−21σ2)t+σ(X(t)−X(0))
假设 X ( 0 ) = 0 , S ( 0 ) = S 0 X(0) = 0, S(0) = S_0 X(0)=0,S(0)=S0,
S ( t ) = S 0 e ( μ − 1 2 σ 2 ) t + σ X ( t ) = S 0 e ( μ − 1 2 σ 2 ) t + σ ϕ t \begin{aligned} S(t) &= S_0 e^{(\mu - \frac{1}{2} \sigma ^2)t + \sigma X(t)} &=S_0 e^{(\mu - \frac{1}{2} \sigma ^2)t + \sigma \phi \sqrt{t}} \end{aligned} S(t)=S0e(μ−21σ2)t+σX(t)=S0e(μ−21σ2)t+σϕt
实例2:均值复归
考察 d r = γ ( r ˉ − r ) d t + σ d X dr = \gamma(\bar{r} - r)dt + \sigma dX dr=γ(rˉ−r)dt+σdX
这个微分方程同样无法直接通过积分求解 r r r,令 u = r − r ˉ u = r - \bar{r} u=r−rˉ, 两边同时乘以 e γ t e^{\gamma t} eγt, 使用乘法法则,得到 d ( u e γ t ) = σ e γ t d X d(ue^{\gamma t}) = \sigma e^{\gamma t} dX d(ueγt)=σeγtdX, 两边积分得到
u ( t ) = u ( 0 ) e − γ t + σ ∫ 0 t e γ ( s − t ) d X s = u ( 0 ) e − γ t + σ ( X ( t ) − γ ∫ 0 t X ( s ) e γ ( s − t ) d s ) \begin{aligned} u(t) &= u(0)e^{-\gamma t} + \sigma \int_0^t e^{\gamma (s-t)} dX_s \\ &= u(0)e^{-\gamma t} + \sigma (X(t) - \gamma \int_0^t X(s)e^{\gamma (s-t)} ds) \end{aligned} u(t)=u(0)e−γt+σ∫0teγ(s−t)dXs=u(0)e−γt+σ(X(t)−γ∫0tX(s)eγ(s−t)ds)
d y = A ( y , t ) d t + B ( y , t ) d X dy = A(y, t)dt + B(y, t)dX dy=A(y,t)dt+B(y,t)dX
注意概率密度函数 p ( y , t ; y ′ , t ′ ) p(y,t;y',t') p(y,t;y′,t′)的定义
P r o b ( a < y ′ < b a t t i m e t ′ ∣ y a t t i m e t ) = ∫ a b p ( y , t ; y ′ , t ′ ) d y ′ \begin{aligned} Prob(a
已知:当前时刻 t t t的值为 y y y
求解:未来时刻 t ′ t' t′的值为 y ′ y' y′的概率(分布)
通过三叉树思想可以得到前向方程和反向方程, 参考泰勒级数和转移概率密度函数
∂ p ∂ t ′ = 1 2 ∂ 2 ∂ y ′ 2 ( B ( y ′ , t ′ ) 2 p ) − ∂ ∂ y ′ ( A ( y ′ , t ′ ) p ) \begin{aligned} \frac{\partial p}{\partial t'} = \frac{1}{2} \frac{\partial ^2}{\partial {y'}^2}(B(y',t')^2 p) - \frac{\partial}{\partial y'}(A(y',t')p) \end{aligned} ∂t′∂p=21∂y′2∂2(B(y′,t′)2p)−∂y′∂(A(y′,t′)p)
这个方程称为Fokker–Planck或者forward Kolmogorov方程
d S = μ S d t + σ S d X dS=\mu S dt + \sigma S dX dS=μSdt+σSdX
前向方程变为
∂ p ∂ t ′ = 1 2 ∂ 2 ∂ y ′ 2 ( σ 2 S ′ 2 p ) − ∂ ∂ y ′ ( μ S ′ p ) \begin{aligned} \frac{\partial p}{\partial t'} = \frac{1}{2} \frac{\partial ^2}{\partial {y'}^2}(\sigma ^ 2 {S'}^2 p) - \frac{\partial}{\partial y'}(\mu S' p) \end{aligned} ∂t′∂p=21∂y′2∂2(σ2S′2p)−∂y′∂(μS′p)
求解得到
p ( S , t ; S ′ , t ′ ) = 1 σ S ′ 2 π ( t ′ − t ) e − ( l o g ( S / S ′ ) + ( μ − 1 2 σ 2 ) ( t ′ − t ) ) 2 / 2 σ 2 ( t ′ − t ) \begin{aligned} p(S, t; S', t') = \frac{1}{\sigma S' \sqrt{2 \pi (t' - t)}} e^{-(log(S/S')+(\mu - \frac{1}{2}\sigma^2)(t'-t))^2/2\sigma ^ 2(t'-t)} \end{aligned} p(S,t;S′,t′)=σS′2π(t′−t)1e−(log(S/S′)+(μ−21σ2)(t′−t))2/2σ2(t′−t)
当 t ′ → ∞ t' \to \infty t′→∞时, p ( y , t ; y ′ , t ′ ) p(y, t; y', t') p(y,t;y′,t′)与初始时刻 t t t的状态 y y y无关。
稳态分布 p ∞ ( y ′ ) p_{\infty}(y') p∞(y′)满足微分方程
1 2 d 2 d y ′ 2 ( B 2 p ∞ ) − d d y ′ ( A p ∞ ) = 0 \begin{aligned} \frac{1}{2} \frac {d^2}{{dy'}^2}(B^2 p_{\infty}) - \frac{d}{dy'}(Ap_{\infty}) = 0 \end{aligned} 21dy′2d2(B2p∞)−dy′d(Ap∞)=0
Vasicek model
d r = γ ( r ˉ − r ) d t + σ d X dr = \gamma(\bar{r} - r)dt + \sigma dX dr=γ(rˉ−r)dt+σdX
带入稳态分布的微分方程
1 2 σ 2 d 2 p ∞ d y ′ 2 − γ d d r ′ ( ( r ˉ − r ′ ) p ∞ ) = 0 \begin{aligned} \frac{1}{2} \sigma ^2 \frac {d^2 p_{\infty}}{{dy'}^2} - \gamma \frac{d}{dr'}((\bar{r}-r')p_{\infty}) = 0 \end{aligned} 21σ2dy′2d2p∞−γdr′d((rˉ−r′)p∞)=0
解方程得到
p ∞ = 1 σ γ π e − γ ( r ˉ − r ′ ) 2 σ 2 \begin{aligned} p_{\infty} = \frac{1}{\sigma} \sqrt{\frac{\gamma}{\pi}} e^{-\frac{\gamma(\bar{r} - r')^2}{\sigma ^2}} \end{aligned} p∞=σ1πγe−σ2γ(rˉ−r′)2
说明利率
r ∼ N ( r ˉ , σ 2 2 γ ) r \sim N(\bar{r}, \frac{\sigma^2}{2 \gamma}) r∼N(rˉ,2γσ2)
TODO: 疑问: Vasicek模型本身满足稳态分布,还是假设他满足稳态分布
backward Kolmogorov equation
∂ p ∂ t + 1 2 B ( y , t ) 2 ∂ p ∂ y 2 + A ( y , t ) ∂ p ∂ y = 0 \begin{aligned} \frac{\partial p}{\partial t} + \frac{1}{2} B(y,t)^2 \frac {\partial ^ p} {\partial y ^ 2} + A(y, t) \frac {\partial p} {\partial y} = 0 \end{aligned} ∂t∂p+21B(y,t)2∂y2∂p+A(y,t)∂y∂p=0
d S = μ S d t + σ S d X dS=\mu S dt + \sigma S dX dS=μSdt+σSdX
变换为离散时间
S i + 1 = S i ( 1 + μ δ t + σ ϕ δ 1 / 2 ) \begin{aligned} S_{i+1} = S_i (1+\mu \delta t + \sigma \phi \delta ^ {1/2}) \end{aligned} Si+1=Si(1+μδt+σϕδ1/2)
Euler method 用电子表格软件仿真这个模型
输入参数
标准正态分布发生器 ϕ \phi ϕ
在Excel中,
仿真其他随机游走
基本思路都是先离散化,再用正态分布随机数发生器产生数据
生成不相关的随机数
独立正态分布 X i ∼ N ( μ i , σ i 2 ) Xi \sim N(\mu_i, \sigma_i^2) Xi∼N(μi,σi2)的加权和满足正态分布
∑ i = 1 n ω i X i ∼ N ( ∑ i = 1 n ω i μ i , ∑ i = 1 n ω i 2 σ i 2 ) \begin{aligned} \sum_{i=1}^{n} \omega_i X_i \sim N(\sum_{i=1}^{n} \omega_i \mu_i, \sum_{i=1}^{n} \omega_i ^2 \sigma_i ^ 2) \end{aligned} i=1∑nωiXi∼N(i=1∑nωiμi,i=1∑nωi2σi2)
以上几个结论都可以通过独立分布的相关性/协方差为0证明