<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Stand Alone Complex &#187; 技术</title>
	<atom:link href="http://ichentao.com/blog/archives/category/scinese/technique/feed/" rel="self" type="application/rss+xml" />
	<link>http://ichentao.com</link>
	<description>不存在的原创产生原创的拷贝</description>
	<lastBuildDate>Sun, 13 May 2012 22:09:23 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>Fixed Income Modeling Review 8</title>
		<link>http://ichentao.com/blog/archives/2161/</link>
		<comments>http://ichentao.com/blog/archives/2161/#comments</comments>
		<pubDate>Sat, 04 Feb 2012 23:19:17 +0000</pubDate>
		<dc:creator>Tao</dc:creator>
				<category><![CDATA[技术]]></category>
		<category><![CDATA[Fixed Income]]></category>
		<category><![CDATA[Mathematical Finance]]></category>

		<guid isPermaLink="false">http://ichentao.com/?p=2161</guid>
		<description><![CDATA[Feynman-Kac formula, named after Richard Feynman and Mark Kac, establishes a link between parabolic partial differential equations (PDEs) and stochastic processes. Suppose follows the stochastic process and if is defined as then satisfies , . The theorem... ]]></description>
			<content:encoded><![CDATA[<p>Feynman-Kac formula, named after Richard Feynman and Mark Kac, establishes a link between parabolic partial differential equations (PDEs) and stochastic processes. Suppose <img src="http://l.wordpress.com/latex.php?latex=S%28t%29&#038;bg=FFFFFF&#038;fg=000000&#038;s=0" title="S(t)" style="vertical-align:-20%;" class="tex" alt="S(t)" /> follows the stochastic process</p>

<p><img src="http://l.wordpress.com/latex.php?latex=dS%28t%29%3D%5Cmu%28t%2C%5Comega%29dt%2B%5Csigma%28t%2C%5Comega%29dW%28t%29&#038;bg=FFFFFF&#038;fg=000000&#038;s=0" title="dS(t)=\mu(t,\omega)dt+\sigma(t,\omega)dW(t)" style="vertical-align:-20%;" class="tex" alt="dS(t)=\mu(t,\omega)dt+\sigma(t,\omega)dW(t)" /></p>

<p>and if <img src="http://l.wordpress.com/latex.php?latex=V&#038;bg=FFFFFF&#038;fg=000000&#038;s=0" title="V" style="vertical-align:-20%;" class="tex" alt="V" /> is defined as</p>

<p><img src="http://l.wordpress.com/latex.php?latex=V%28t%2CS%28t%29%29%3DE%5EQ_t%5BH%28T%2CS%28T%29%29%5D&#038;bg=FFFFFF&#038;fg=000000&#038;s=0" title="V(t,S(t))=E^Q_t[H(T,S(T))]" style="vertical-align:-20%;" class="tex" alt="V(t,S(t))=E^Q_t[H(T,S(T))]" /></p>

<p>then <img src="http://l.wordpress.com/latex.php?latex=V&#038;bg=FFFFFF&#038;fg=000000&#038;s=0" title="V" style="vertical-align:-20%;" class="tex" alt="V" /> satisfies</p>

<p><img src="http://l.wordpress.com/latex.php?latex=%5Cfrac%7B%5Cpartial%20V%7D%7B%5Cpartial%20t%7D%2B%5Cmu%5Cfrac%7B%5Cpartial%20V%7D%7B%5Cpartial%20S%7D%2B%5Cfrac%7B1%7D%7B2%7D%5Csigma%5E2%5Cfrac%7B%5Cpartial%5E2%20V%7D%7B%5Cpartial%20S%5E2%7D%3D0&#038;bg=FFFFFF&#038;fg=000000&#038;s=0" title="\frac{\partial V}{\partial t}+\mu\frac{\partial V}{\partial S}+\frac{1}{2}\sigma^2\frac{\partial^2 V}{\partial S^2}=0" style="vertical-align:-20%;" class="tex" alt="\frac{\partial V}{\partial t}+\mu\frac{\partial V}{\partial S}+\frac{1}{2}\sigma^2\frac{\partial^2 V}{\partial S^2}=0" />, <img src="http://l.wordpress.com/latex.php?latex=V%28T%2CS%28T%29%29%3DH%28T%2CS%28T%29%29&#038;bg=FFFFFF&#038;fg=000000&#038;s=0" title="V(T,S(T))=H(T,S(T))" style="vertical-align:-20%;" class="tex" alt="V(T,S(T))=H(T,S(T))" />.</p>

<p>The theorem can be stated the other way around. Thus, Feynman-Kac formula could be applied to interest rate models, for example, under Hull-White model, zero coupon bond price <img src="http://l.wordpress.com/latex.php?latex=P%28t%2CT%29&#038;bg=FFFFFF&#038;fg=000000&#038;s=0" title="P(t,T)" style="vertical-align:-20%;" class="tex" alt="P(t,T)" /> satisfies</p>

<p><img src="http://l.wordpress.com/latex.php?latex=%5Cfrac%7B%5Cpartial%20P%7D%7B%5Cpartial%20t%7D%2B%28%5Ctheta%28t%29-ar%28t%29%29%5Cfrac%7B%5Cpartial%20P%7D%7B%5Cpartial%20r%7D%2B%5Cfrac%7B1%7D%7B2%7D%5Csigma%5E2%5Cfrac%7B%5Cpartial%5E2%20P%7D%7B%5Cpartial%20r%5E2%7D%3Dr%28t%29P&#038;bg=FFFFFF&#038;fg=000000&#038;s=0" title="\frac{\partial P}{\partial t}+(\theta(t)-ar(t))\frac{\partial P}{\partial r}+\frac{1}{2}\sigma^2\frac{\partial^2 P}{\partial r^2}=r(t)P" style="vertical-align:-20%;" class="tex" alt="\frac{\partial P}{\partial t}+(\theta(t)-ar(t))\frac{\partial P}{\partial r}+\frac{1}{2}\sigma^2\frac{\partial^2 P}{\partial r^2}=r(t)P" />, <img src="http://l.wordpress.com/latex.php?latex=P%28T%2CT%29%3D1&#038;bg=FFFFFF&#038;fg=000000&#038;s=0" title="P(T,T)=1" style="vertical-align:-20%;" class="tex" alt="P(T,T)=1" /></p>

<p>we can deduce the analytic solution for <img src="http://l.wordpress.com/latex.php?latex=P%28t%2CT%29&#038;bg=FFFFFF&#038;fg=000000&#038;s=0" title="P(t,T)" style="vertical-align:-20%;" class="tex" alt="P(t,T)" /> by using the theorem described above.</p>

<p>Another application of Feynman-Kac formula in finance is discretization: explicit schemes and implicit schemes. For explicit schemes, we use such discretization method:</p>

<p><img src="http://l.wordpress.com/latex.php?latex=%5Cleft%28%5Cfrac%7B%5Cpartial%20S%7D%7B%5Cpartial%20r%7D%5Cright%29_%7Bi%2Cj%7D%5Capprox%5Cfrac%7BS_%7Bi%2Cj%2B1%7D-S_%7Bi%2Cj-1%7D%7D%7B2%5CDelta%20r%7D&#038;bg=FFFFFF&#038;fg=000000&#038;s=0" title="\left(\frac{\partial S}{\partial r}\right)_{i,j}\approx\frac{S_{i,j+1}-S_{i,j-1}}{2\Delta r}" style="vertical-align:-20%;" class="tex" alt="\left(\frac{\partial S}{\partial r}\right)_{i,j}\approx\frac{S_{i,j+1}-S_{i,j-1}}{2\Delta r}" />,<br />
<img src="http://l.wordpress.com/latex.php?latex=%5Cleft%28%5Cfrac%7B%5Cpartial%5E2%20S%7D%7B%5Cpartial%20r%5E2%7D%5Cright%29_%7Bi%2Cj%7D%5Capprox%5Cfrac%7BS_%7Bi%2Cj%2B1%7D-2S_%7Bi%2Cj%7D%2BS_%7Bi%2Cj-1%7D%7D%7B%28%5CDelta%20r%29%5E2%7D&#038;bg=FFFFFF&#038;fg=000000&#038;s=0" title="\left(\frac{\partial^2 S}{\partial r^2}\right)_{i,j}\approx\frac{S_{i,j+1}-2S_{i,j}+S_{i,j-1}}{(\Delta r)^2}" style="vertical-align:-20%;" class="tex" alt="\left(\frac{\partial^2 S}{\partial r^2}\right)_{i,j}\approx\frac{S_{i,j+1}-2S_{i,j}+S_{i,j-1}}{(\Delta r)^2}" />,<br />
<img src="http://l.wordpress.com/latex.php?latex=%5Cleft%28%5Cfrac%7B%5Cpartial%20S%7D%7B%5Cpartial%20t%7D%5Cright%29_%7Bi%2Cj%7D%5Capprox%5Cfrac%7BS_%7Bi%2Cj%7D-S_%7Bi-1%2Cj%7D%7D%7B%5CDelta%20t%7D&#038;bg=FFFFFF&#038;fg=000000&#038;s=0" title="\left(\frac{\partial S}{\partial t}\right)_{i,j}\approx\frac{S_{i,j}-S_{i-1,j}}{\Delta t}" style="vertical-align:-20%;" class="tex" alt="\left(\frac{\partial S}{\partial t}\right)_{i,j}\approx\frac{S_{i,j}-S_{i-1,j}}{\Delta t}" /></p>

<p>substitute these into the PDE then the equation could be written as</p>

<p><img src="http://l.wordpress.com/latex.php?latex=S_%7Bi-1%2Cj%7D%3DA_%7Bi%2Cj%7DS_%7Bi%2Cj%2B1%7D%2BB_%7Bi%2Cj%7DS_%7Bi%2Cj%7D%2BC_%7Bi%2Cj%7DS_%7Bi%2Cj-1%7D&#038;bg=FFFFFF&#038;fg=000000&#038;s=0" title="S_{i-1,j}=A_{i,j}S_{i,j+1}+B_{i,j}S_{i,j}+C_{i,j}S_{i,j-1}" style="vertical-align:-20%;" class="tex" alt="S_{i-1,j}=A_{i,j}S_{i,j+1}+B_{i,j}S_{i,j}+C_{i,j}S_{i,j-1}" /></p>

<p>This kind of scheme has equivalence to trinomial tree valuation</p>

<p><img src="http://l.wordpress.com/latex.php?latex=S_%7Bi-1%2Cj%7D%3Dp_uS_%7Bi%2Cj%2B1%7D%2Bp_mS_%7Bi%2Cj%7D%2Bp_dS_%7Bi%2Cj-1%7D-r_j%5CDelta%20tS_%7Bi%2Cj%7D&#038;bg=FFFFFF&#038;fg=000000&#038;s=0" title="S_{i-1,j}=p_uS_{i,j+1}+p_mS_{i,j}+p_dS_{i,j-1}-r_j\Delta tS_{i,j}" style="vertical-align:-20%;" class="tex" alt="S_{i-1,j}=p_uS_{i,j+1}+p_mS_{i,j}+p_dS_{i,j-1}-r_j\Delta tS_{i,j}" /></p>

<p>and setting the size of rate step <img src="http://l.wordpress.com/latex.php?latex=%5CDelta%20r%3D%5Csigma%283%5CDelta%20t%29%5E%7B1%2F2%7D&#038;bg=FFFFFF&#038;fg=000000&#038;s=0" title="\Delta r=\sigma(3\Delta t)^{1/2}" style="vertical-align:-20%;" class="tex" alt="\Delta r=\sigma(3\Delta t)^{1/2}" /> leads to the most efficient approximation, under which the scheme becomes 4th order w.r.t. to <img src="http://l.wordpress.com/latex.php?latex=r&#038;bg=FFFFFF&#038;fg=000000&#038;s=0" title="r" style="vertical-align:-20%;" class="tex" alt="r" />.</p>

<p>While applying explicit finite difference methods, boundary conditions have very little effect. We need to have</p>

<p><img src="http://l.wordpress.com/latex.php?latex=%5Csigma%5E2_%7Bi%2Cj%7D%5Cfrac%7B%5CDelta%20t%7D%7B%5CDelta%20r%29%5E2%7D%5Cleq%5Cfrac%7B1%7D%7B2%7D&#038;bg=FFFFFF&#038;fg=000000&#038;s=0" title="\sigma^2_{i,j}\frac{\Delta t}{\Delta r)^2}\leq\frac{1}{2}" style="vertical-align:-20%;" class="tex" alt="\sigma^2_{i,j}\frac{\Delta t}{\Delta r)^2}\leq\frac{1}{2}" /></p>

<p>hold cause otherwise small numerical errors can grow uncontrollably.</p>

<p>For implicit scheme, we discretize the PDE like this:</p>

<p><img src="http://l.wordpress.com/latex.php?latex=%5Cleft%28%5Cfrac%7B%5Cpartial%20S%7D%7B%5Cpartial%20r%7D%5Cright%29_%7Bi%2Cj%7D%5Capprox%5Cfrac%7BS_%7Bi-1%2Cj%2B1%7D-S_%7Bi-1%2Cj-1%7D%7D%7B2%5CDelta%20r%7D&#038;bg=FFFFFF&#038;fg=000000&#038;s=0" title="\left(\frac{\partial S}{\partial r}\right)_{i,j}\approx\frac{S_{i-1,j+1}-S_{i-1,j-1}}{2\Delta r}" style="vertical-align:-20%;" class="tex" alt="\left(\frac{\partial S}{\partial r}\right)_{i,j}\approx\frac{S_{i-1,j+1}-S_{i-1,j-1}}{2\Delta r}" />,<br />
<img src="http://l.wordpress.com/latex.php?latex=%5Cleft%28%5Cfrac%7B%5Cpartial%5E2%20S%7D%7B%5Cpartial%20r%5E2%7D%5Cright%29_%7Bi%2Cj%7D%5Capprox%5Cfrac%7BS_%7Bi-1%2Cj%2B1%7D-2S_%7Bi-1%2Cj%7D%2BS_%7Bi-1%2Cj-1%7D%7D%7B%28%5CDelta%20r%29%5E2%7D&#038;bg=FFFFFF&#038;fg=000000&#038;s=0" title="\left(\frac{\partial^2 S}{\partial r^2}\right)_{i,j}\approx\frac{S_{i-1,j+1}-2S_{i-1,j}+S_{i-1,j-1}}{(\Delta r)^2}" style="vertical-align:-20%;" class="tex" alt="\left(\frac{\partial^2 S}{\partial r^2}\right)_{i,j}\approx\frac{S_{i-1,j+1}-2S_{i-1,j}+S_{i-1,j-1}}{(\Delta r)^2}" />,<br />
<img src="http://l.wordpress.com/latex.php?latex=%5Cleft%28%5Cfrac%7B%5Cpartial%20S%7D%7B%5Cpartial%20t%7D%5Cright%29_%7Bi%2Cj%7D%5Capprox%5Cfrac%7BS_%7Bi%2Cj%7D-S_%7Bi-1%2Cj%7D%7D%7B%5CDelta%20t%7D&#038;bg=FFFFFF&#038;fg=000000&#038;s=0" title="\left(\frac{\partial S}{\partial t}\right)_{i,j}\approx\frac{S_{i,j}-S_{i-1,j}}{\Delta t}" style="vertical-align:-20%;" class="tex" alt="\left(\frac{\partial S}{\partial t}\right)_{i,j}\approx\frac{S_{i,j}-S_{i-1,j}}{\Delta t}" /></p>

<p>then Feynman-Kac formula becomes</p>

<p><img src="http://l.wordpress.com/latex.php?latex=A_%7Bi%2Cj%7DS_%7Bi-1%2Cj%2B1%7D%2BB_%7Bi%2Cj%7DS_%7Bi-1%2Cj%7D%2BC_%7Bi%2Cj%7DS_%7Bi-1%2Cj-1%7D%3DS_%7Bi%2Cj%7D&#038;bg=FFFFFF&#038;fg=000000&#038;s=0" title="A_{i,j}S_{i-1,j+1}+B_{i,j}S_{i-1,j}+C_{i,j}S_{i-1,j-1}=S_{i,j}" style="vertical-align:-20%;" class="tex" alt="A_{i,j}S_{i-1,j+1}+B_{i,j}S_{i-1,j}+C_{i,j}S_{i-1,j-1}=S_{i,j}" /></p>

<p>It has a relationship to trinomial trees:</p>

<p><img src="http://l.wordpress.com/latex.php?latex=%281-r_j%5CDelta%20t%29S_%7Bi%2Cj%7D%5Capprox%20p_uS_%7Bi-1%2Cj%2B1%7D%2Bp_mS_%7Bi-1%2Cj%7D%2Bp_dS_%7Bi-1%2Cj-1%7D&#038;bg=FFFFFF&#038;fg=000000&#038;s=0" title="(1-r_j\Delta t)S_{i,j}\approx p_uS_{i-1,j+1}+p_mS_{i-1,j}+p_dS_{i-1,j-1}" style="vertical-align:-20%;" class="tex" alt="(1-r_j\Delta t)S_{i,j}\approx p_uS_{i-1,j+1}+p_mS_{i-1,j}+p_dS_{i-1,j-1}" /></p>

<p>Since we use time <img src="http://l.wordpress.com/latex.php?latex=i-1&#038;bg=FFFFFF&#038;fg=000000&#038;s=0" title="i-1" style="vertical-align:-20%;" class="tex" alt="i-1" /> value to calculate <img src="http://l.wordpress.com/latex.php?latex=S_%7Bi%2Cj%7D&#038;bg=FFFFFF&#038;fg=000000&#038;s=0" title="S_{i,j}" style="vertical-align:-20%;" class="tex" alt="S_{i,j}" />, then if we want to do pricing backward, we need to solve a system of linear equations. Also, we need to care about the boundary conditions where we usually set <img src="http://l.wordpress.com/latex.php?latex=r_0%3D0&#038;bg=FFFFFF&#038;fg=000000&#038;s=0" title="r_0=0" style="vertical-align:-20%;" class="tex" alt="r_0=0" /> and <img src="http://l.wordpress.com/latex.php?latex=r_M%3Dr_%5Cinfty&#038;bg=FFFFFF&#038;fg=000000&#038;s=0" title="r_M=r_\infty" style="vertical-align:-20%;" class="tex" alt="r_M=r_\infty" /> which is large enough. Hence, implicit scheme is slightly more difficult to implement than the explicit one. However, it is always stable and convergent. In practice, one method that is used very often is called Crank-Nicolson method which combines both explicit scheme and implicit scheme:</p>

<p><img src="http://l.wordpress.com/latex.php?latex=%5Cleft%28%5Cfrac%7B%5Cpartial%20S%7D%7B%5Cpartial%20r%7D%5Cright%29_%7Bi%2Cj%7D%5Capprox%281-%5Ctheta%29%5Cfrac%7BS_%7Bi%2Cj%2B1%7D-S_%7Bi%2Cj-1%7D%7D%7B2%5CDelta%20r%7D%2B%5Ctheta%20%5Cfrac%7BS_%7Bi-1%2Cj%2B1%7D-S_%7Bi-1%2Cj-1%7D%7D%7B2%5CDelta%20r%7D&#038;bg=FFFFFF&#038;fg=000000&#038;s=0" title="\left(\frac{\partial S}{\partial r}\right)_{i,j}\approx(1-\theta)\frac{S_{i,j+1}-S_{i,j-1}}{2\Delta r}+\theta \frac{S_{i-1,j+1}-S_{i-1,j-1}}{2\Delta r}" style="vertical-align:-20%;" class="tex" alt="\left(\frac{\partial S}{\partial r}\right)_{i,j}\approx(1-\theta)\frac{S_{i,j+1}-S_{i,j-1}}{2\Delta r}+\theta \frac{S_{i-1,j+1}-S_{i-1,j-1}}{2\Delta r}" />,<br />
<img src="http://l.wordpress.com/latex.php?latex=%5Cleft%28%5Cfrac%7B%5Cpartial%5E2%20S%7D%7B%5Cpartial%20r%5E2%7D%5Cright%29_%7Bi%2Cj%7D%5Capprox%281-%5Ctheta%29%5Cfrac%7BS_%7Bi%2Cj%2B1%7D-2S_%7Bi%2Cj%7D%2BS_%7Bi%2Cj-1%7D%7D%7B%28%5CDelta%20r%29%5E2%7D%2B%5Ctheta%20%5Cfrac%7BS_%7Bi-1%2Cj%2B1%7D-2S_%7Bi-1%2Cj%7D%2BS_%7Bi-1%2Cj-1%7D%7D%7B%28%5CDelta%20r%29%5E2%7D&#038;bg=FFFFFF&#038;fg=000000&#038;s=0" title="\left(\frac{\partial^2 S}{\partial r^2}\right)_{i,j}\approx(1-\theta)\frac{S_{i,j+1}-2S_{i,j}+S_{i,j-1}}{(\Delta r)^2}+\theta \frac{S_{i-1,j+1}-2S_{i-1,j}+S_{i-1,j-1}}{(\Delta r)^2}" style="vertical-align:-20%;" class="tex" alt="\left(\frac{\partial^2 S}{\partial r^2}\right)_{i,j}\approx(1-\theta)\frac{S_{i,j+1}-2S_{i,j}+S_{i,j-1}}{(\Delta r)^2}+\theta \frac{S_{i-1,j+1}-2S_{i-1,j}+S_{i-1,j-1}}{(\Delta r)^2}" />,<br />
<img src="http://l.wordpress.com/latex.php?latex=%5Cleft%28%5Cfrac%7B%5Cpartial%20S%7D%7B%5Cpartial%20t%7D%5Cright%29_%7Bi%2Cj%7D%5Capprox%281-%5Ctheta%29%5Cfrac%7BS_%7Bi%2Cj%7D-S_%7Bi-1%2Cj%7D%7D%7B%5CDelta%20t%7D%2B%5Ctheta%20%5Cfrac%7BS_%7Bi%2Cj%7D-S_%7Bi-1%2Cj%7D%7D%7B%5CDelta%20t%7D&#038;bg=FFFFFF&#038;fg=000000&#038;s=0" title="\left(\frac{\partial S}{\partial t}\right)_{i,j}\approx(1-\theta)\frac{S_{i,j}-S_{i-1,j}}{\Delta t}+\theta \frac{S_{i,j}-S_{i-1,j}}{\Delta t}" style="vertical-align:-20%;" class="tex" alt="\left(\frac{\partial S}{\partial t}\right)_{i,j}\approx(1-\theta)\frac{S_{i,j}-S_{i-1,j}}{\Delta t}+\theta \frac{S_{i,j}-S_{i-1,j}}{\Delta t}" /></p>

<p>Although Crank-Nicolson method is a little bit harder to implement than both the explicit and implicit scheme, it is as stable as the fully implicit method and is the second-order accurate w.r.t. time step which is better than explicit and implicit schemes.</p>
]]></content:encoded>
			<wfw:commentRss>http://ichentao.com/blog/archives/2161/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Fixed Income Modeling Review 7</title>
		<link>http://ichentao.com/blog/archives/2150/</link>
		<comments>http://ichentao.com/blog/archives/2150/#comments</comments>
		<pubDate>Sat, 04 Feb 2012 03:48:57 +0000</pubDate>
		<dc:creator>Tao</dc:creator>
				<category><![CDATA[技术]]></category>
		<category><![CDATA[Fixed Income]]></category>
		<category><![CDATA[Mathematical Finance]]></category>

		<guid isPermaLink="false">http://ichentao.com/?p=2150</guid>
		<description><![CDATA[In finance, there are two major applications of the Monte Carlo simulation: -- Generating stochastic paths for interest rates, exchange rates, and stock prices; -- Numerical valuation of derivative instruments; consider the risk-neutral pricing equation ... ]]></description>
			<content:encoded><![CDATA[<p>In finance, there are two major applications of the Monte Carlo simulation:</p>

<p>-- Generating stochastic paths for interest rates, exchange rates, and stock prices;<br />
-- Numerical valuation of derivative instruments;</p>

<p>consider the risk-neutral pricing equation for security S with payoff <img src="http://l.wordpress.com/latex.php?latex=H%28T%29&#038;bg=FFFFFF&#038;fg=000000&#038;s=0" title="H(T)" style="vertical-align:-20%;" class="tex" alt="H(T)" /></p>

<p><img src="http://l.wordpress.com/latex.php?latex=S%28t%29%3DE_t%5B%5Cexp%28-%5Cint%5ET_tr%28s%2C%5Comega%29ds%29H%28T%2C%5Comega%29%5D&#038;bg=FFFFFF&#038;fg=000000&#038;s=0" title="S(t)=E_t[\exp(-\int^T_tr(s,\omega)ds)H(T,\omega)]" style="vertical-align:-20%;" class="tex" alt="S(t)=E_t[\exp(-\int^T_tr(s,\omega)ds)H(T,\omega)]" /></p>

<p>we can generate a large number of equally probable sample paths then the security value at time <img src="http://l.wordpress.com/latex.php?latex=t%3D0&#038;bg=FFFFFF&#038;fg=000000&#038;s=0" title="t=0" style="vertical-align:-20%;" class="tex" alt="t=0" /> can be approximated as</p>

<p><img src="http://l.wordpress.com/latex.php?latex=S%280%29%3D%5Cfrac%7B1%7D%7BN%7D%5Csum%5EN_%7Bn%3D1%7D%5Cexp%28-%5Cint%5ET_tr%28s%2C%5Comega_n%29ds%29H%28T%2C%5Comega_n%29&#038;bg=FFFFFF&#038;fg=000000&#038;s=0" title="S(0)=\frac{1}{N}\sum^N_{n=1}\exp(-\int^T_tr(s,\omega_n)ds)H(T,\omega_n)" style="vertical-align:-20%;" class="tex" alt="S(0)=\frac{1}{N}\sum^N_{n=1}\exp(-\int^T_tr(s,\omega_n)ds)H(T,\omega_n)" />.</p>

<p>For rate process <img src="http://l.wordpress.com/latex.php?latex=dr%3D%5Cmu%28r%2Ct%29dt%2B%5Csigma%28r%2Ct%29dW%28t%29&#038;bg=FFFFFF&#038;fg=000000&#038;s=0" title="dr=\mu(r,t)dt+\sigma(r,t)dW(t)" style="vertical-align:-20%;" class="tex" alt="dr=\mu(r,t)dt+\sigma(r,t)dW(t)" />, path generation is straightforward:</p>

<p><img src="http://l.wordpress.com/latex.php?latex=r%28t_%7Bn%2B1%7D%29%3Dr%28t_n%29%2B%5Cmu%28r%28t_n%29%2Ct_n%29%5Ccdot%5CDelta%20t%2B%5Csigma%28r%28t_n%29%2Ct_n%29%5Ccdot%5Csqrt%7B%5CDelta%20t%7D%5Ccdot%20%5Cvarepsilon_%7Bn%2B1%7D&#038;bg=FFFFFF&#038;fg=000000&#038;s=0" title="r(t_{n+1})=r(t_n)+\mu(r(t_n),t_n)\cdot\Delta t+\sigma(r(t_n),t_n)\cdot\sqrt{\Delta t}\cdot \varepsilon_{n+1}" style="vertical-align:-20%;" class="tex" alt="r(t_{n+1})=r(t_n)+\mu(r(t_n),t_n)\cdot\Delta t+\sigma(r(t_n),t_n)\cdot\sqrt{\Delta t}\cdot \varepsilon_{n+1}" /></p>

<p>where <img src="http://l.wordpress.com/latex.php?latex=%5Cvarepsilon_n&#038;bg=FFFFFF&#038;fg=000000&#038;s=0" title="\varepsilon_n" style="vertical-align:-20%;" class="tex" alt="\varepsilon_n" /> is standard normal random number. For stochastic driver like this</p>

<p><img src="http://l.wordpress.com/latex.php?latex=r%28t%29%3DF%28%5Cvarphi%28t%29%2Bu%28t%29%29&#038;bg=FFFFFF&#038;fg=000000&#038;s=0" title="r(t)=F(\varphi(t)+u(t))" style="vertical-align:-20%;" class="tex" alt="r(t)=F(\varphi(t)+u(t))" /><br />
<img src="http://l.wordpress.com/latex.php?latex=du%3D%5Cmu%28t%2Cu%29dt%2B%5Csigma%28t%2Cu%29dW%28t%29&#038;bg=FFFFFF&#038;fg=000000&#038;s=0" title="du=\mu(t,u)dt+\sigma(t,u)dW(t)" style="vertical-align:-20%;" class="tex" alt="du=\mu(t,u)dt+\sigma(t,u)dW(t)" /></p>

<p>we sample <img src="http://l.wordpress.com/latex.php?latex=u%28t%29&#038;bg=FFFFFF&#038;fg=000000&#038;s=0" title="u(t)" style="vertical-align:-20%;" class="tex" alt="u(t)" /> first and set <img src="http://l.wordpress.com/latex.php?latex=r_n%28t%29%3DF%28%5Cvarphi%28t%29%2Bu_n%28t%29%29&#038;bg=FFFFFF&#038;fg=000000&#038;s=0" title="r_n(t)=F(\varphi(t)+u_n(t))" style="vertical-align:-20%;" class="tex" alt="r_n(t)=F(\varphi(t)+u_n(t))" />.</p>

<p>When compared to the lattice valuation method, Monte Carlo approach has two important advantages:</p>

<p>-- Monte Carlo method easily handles path dependent instruments<br />
-- Monte Carlo method is well suited to be used with multi-factor models</p>

<p>however, it also has drawbacks:</p>

<p>-- It is ill-suited for pricing interest rate derivatives with embedded exercise rights<br />
-- It converges to true value very slowly<br />
-- Longer rates along short rate paths cannot be implied from the paths<br />
-- It does not give the same result twice since its value is random<br />
-- Generating sample paths for high dimensional problems has considerable practical difficulties, which is an important feature of interest rate derivatives<br />
-- MC has the opposite problem of recombining lattice: the full future is inaccessible</p>

<p>To implement Monte Carlo method, first we generate uniform random numbers then use methods such as Box-Muller or inverse transform to get normal random numbers. Because of the perfect foresight problem, zero coupon bonds prices cannot be computed without the use of either analytic pricing formulas or interest rate trees. Although MC method will not be used to calibrate the model, MC paths should be calibrated on the top of model calibration to make sure they price zero coupon bonds correctly. Instead of the continuous sampling as described above, we could first discretize the underlying continuous short rate process by means of a short rate lattice and then sample the lattice instead, which is call discrete sampling. The advantage of discrete sampling is that longer yields are readily available at each MC node and we also have a complete view of the stochastic future at each node on a path.</p>

<p>We want to decease the error of MC method as much as possible. One way is to increase the number of paths, the other is variance reduction. There are also two ways to do variance reduction: control variates and improving the sampling quality. The latter's advantage is it does not depend on characteristics of each instrument as the first one does. To improve the sampling quality, there is no other way better than improving the quality of Brownian motion sampled. Since we generate uniform random numbers first, then we can apply an approach called stratified sampling to improve their uniformity by</p>

<p><img src="http://l.wordpress.com/latex.php?latex=u%5E%2A_n%3D%5Cfrac%7Bn-1%7D%7BN%7D%2B%5Cfrac%7Bu_n%7D%7BN%7D&#038;bg=FFFFFF&#038;fg=000000&#038;s=0" title="u^*_n=\frac{n-1}{N}+\frac{u_n}{N}" style="vertical-align:-20%;" class="tex" alt="u^*_n=\frac{n-1}{N}+\frac{u_n}{N}" /></p>

<p>Based on the fact that Brownian motion is perfectly symmetric about zero, we generate Wiener sample paths which are symmetric to each other w.r.t. zero:</p>

<p><img src="http://l.wordpress.com/latex.php?latex=W_%7B-n%7D%28t%29%3D-W_n%28t%29&#038;bg=FFFFFF&#038;fg=000000&#038;s=0" title="W_{-n}(t)=-W_n(t)" style="vertical-align:-20%;" class="tex" alt="W_{-n}(t)=-W_n(t)" /><br />
<img src="http://l.wordpress.com/latex.php?latex=V_%7BMC%7D%3D%5Cfrac%7B1%7D%7BN%7D%5Csum%5EN_%7Bn%3D1%7D%5Cfrac%7BV%28W_n%29%2BV%28W_%7B-n%7D%29%7D%7B2%7D&#038;bg=FFFFFF&#038;fg=000000&#038;s=0" title="V_{MC}=\frac{1}{N}\sum^N_{n=1}\frac{V(W_n)+V(W_{-n})}{2}" style="vertical-align:-20%;" class="tex" alt="V_{MC}=\frac{1}{N}\sum^N_{n=1}\frac{V(W_n)+V(W_{-n})}{2}" /></p>

<p>and this is called antithetic sampling. After the sample paths <img src="http://l.wordpress.com/latex.php?latex=W_n%28t_i%29&#038;bg=FFFFFF&#038;fg=000000&#038;s=0" title="W_n(t_i)" style="vertical-align:-20%;" class="tex" alt="W_n(t_i)" /> are generated, one can make a simple adjustment called moment matching to ensure the correct mean and standard deviation:</p>

<p><img src="http://l.wordpress.com/latex.php?latex=W%5E%2A_n%28t_i%29%3D%5Csqrt%7Bt_i%7D%5Ccdot%5Cfrac%7BW_n%28t_i%29-M_i%7D%7BS_i%7D&#038;bg=FFFFFF&#038;fg=000000&#038;s=0" title="W^*_n(t_i)=\sqrt{t_i}\cdot\frac{W_n(t_i)-M_i}{S_i}" style="vertical-align:-20%;" class="tex" alt="W^*_n(t_i)=\sqrt{t_i}\cdot\frac{W_n(t_i)-M_i}{S_i}" /></p>

<p>where <img src="http://l.wordpress.com/latex.php?latex=M_i&#038;bg=FFFFFF&#038;fg=000000&#038;s=0" title="M_i" style="vertical-align:-20%;" class="tex" alt="M_i" /> and <img src="http://l.wordpress.com/latex.php?latex=S_i&#038;bg=FFFFFF&#038;fg=000000&#038;s=0" title="S_i" style="vertical-align:-20%;" class="tex" alt="S_i" /> are the actual mean and standard deviation of the paths <img src="http://l.wordpress.com/latex.php?latex=W_n&#038;bg=FFFFFF&#038;fg=000000&#038;s=0" title="W_n" style="vertical-align:-20%;" class="tex" alt="W_n" /> at time <img src="http://l.wordpress.com/latex.php?latex=t_i&#038;bg=FFFFFF&#038;fg=000000&#038;s=0" title="t_i" style="vertical-align:-20%;" class="tex" alt="t_i" />.</p>
]]></content:encoded>
			<wfw:commentRss>http://ichentao.com/blog/archives/2150/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Fixed Income Modeling Review 6</title>
		<link>http://ichentao.com/blog/archives/2140/</link>
		<comments>http://ichentao.com/blog/archives/2140/#comments</comments>
		<pubDate>Sat, 04 Feb 2012 01:27:38 +0000</pubDate>
		<dc:creator>Tao</dc:creator>
				<category><![CDATA[技术]]></category>
		<category><![CDATA[Fixed Income]]></category>
		<category><![CDATA[Mathematical Finance]]></category>

		<guid isPermaLink="false">http://ichentao.com/?p=2140</guid>
		<description><![CDATA[To apply the theoretical models, let us first see how to use interest rate trees to price and calibrate. As mentioned in Review 5, markovian property of short rate models is needed to implement recombining lattice. Usually, a short rate model can be writ... ]]></description>
			<content:encoded><![CDATA[<p>To apply the theoretical models, let us first see how to use interest rate trees to price and calibrate. As mentioned in Review 5, markovian property of short rate models is needed to implement recombining lattice.</p>

<p>Usually, a short rate model can be written as</p>

<p><img src="http://l.wordpress.com/latex.php?latex=r%28t%29%3DF%28u%28t%29%2B%5Cvarphi%28t%29%29&#038;bg=FFFFFF&#038;fg=000000&#038;s=0" title="r(t)=F(u(t)+\varphi(t))" style="vertical-align:-20%;" class="tex" alt="r(t)=F(u(t)+\varphi(t))" /><br />
<img src="http://l.wordpress.com/latex.php?latex=du%28t%29%3D-au%28t%29dt%2B%5Csigma%20dW%28t%29.&#038;bg=FFFFFF&#038;fg=000000&#038;s=0" title="du(t)=-au(t)dt+\sigma dW(t)." style="vertical-align:-20%;" class="tex" alt="du(t)=-au(t)dt+\sigma dW(t)." /></p>

<p>Hence, we first discretize the process <img src="http://l.wordpress.com/latex.php?latex=u%28t%29&#038;bg=FFFFFF&#038;fg=000000&#038;s=0" title="u(t)" style="vertical-align:-20%;" class="tex" alt="u(t)" />. Typically, people use binomial tree and trinomial tree but for mean reverting model, binomial tree cannot be used. The time step <img src="http://l.wordpress.com/latex.php?latex=%5CDelta%20t&#038;bg=FFFFFF&#038;fg=000000&#038;s=0" title="\Delta t" style="vertical-align:-20%;" class="tex" alt="\Delta t" /> is arbitrary, the state step <img src="http://l.wordpress.com/latex.php?latex=%5CDelta%20u&#038;bg=FFFFFF&#038;fg=000000&#038;s=0" title="\Delta u" style="vertical-align:-20%;" class="tex" alt="\Delta u" /> and branch probabilities <img src="http://l.wordpress.com/latex.php?latex=p_u&#038;bg=FFFFFF&#038;fg=000000&#038;s=0" title="p_u" style="vertical-align:-20%;" class="tex" alt="p_u" />, <img src="http://l.wordpress.com/latex.php?latex=p_m&#038;bg=FFFFFF&#038;fg=000000&#038;s=0" title="p_m" style="vertical-align:-20%;" class="tex" alt="p_m" /> and <img src="http://l.wordpress.com/latex.php?latex=p_d&#038;bg=FFFFFF&#038;fg=000000&#038;s=0" title="p_d" style="vertical-align:-20%;" class="tex" alt="p_d" /> should be chosen in such a way that the discrete dynamics has the first few moments matched. Since we could solve</p>

<p><img src="http://l.wordpress.com/latex.php?latex=u%28t%2B%5CDelta%20t%29%3De%5E%7B-a%5CDelta%20t%7Du%28t%29%2B%5Csigma%5Cint%5E%7Bt%2B%5CDelta%20t%7D_te%5E%7B-a%5CDelta%20t%7DdW%28s%29&#038;bg=FFFFFF&#038;fg=000000&#038;s=0" title="u(t+\Delta t)=e^{-a\Delta t}u(t)+\sigma\int^{t+\Delta t}_te^{-a\Delta t}dW(s)" style="vertical-align:-20%;" class="tex" alt="u(t+\Delta t)=e^{-a\Delta t}u(t)+\sigma\int^{t+\Delta t}_te^{-a\Delta t}dW(s)" /></p>

<p>then by moment-matching, we can set</p>

<p><img src="http://l.wordpress.com/latex.php?latex=%5CDelta%20u%3D%5Csqrt%7B3V%7D&#038;bg=FFFFFF&#038;fg=000000&#038;s=0" title="\Delta u=\sqrt{3V}" style="vertical-align:-20%;" class="tex" alt="\Delta u=\sqrt{3V}" />, <img src="http://l.wordpress.com/latex.php?latex=V%3D%5Csigma%5E2%5Cfrac%7B1-%5Cexp%28-2a%5CDelta%20t%29%7D%7B2a%7D&#038;bg=FFFFFF&#038;fg=000000&#038;s=0" title="V=\sigma^2\frac{1-\exp(-2a\Delta t)}{2a}" style="vertical-align:-20%;" class="tex" alt="V=\sigma^2\frac{1-\exp(-2a\Delta t)}{2a}" /></p>

<p>and we select the middle branching node at next step to be the closest one to the mean of the continuous process:</p>

<p><img src="http://l.wordpress.com/latex.php?latex=k%3D%5Cint%5Bje%5E%7B-a%5CDelta%20t%7D%2B%5Cfrac%7B1%7D%7B2%7D&#038;bg=FFFFFF&#038;fg=000000&#038;s=0" title="k=\int[je^{-a\Delta t}+\frac{1}{2}" style="vertical-align:-20%;" class="tex" alt="k=\int[je^{-a\Delta t}+\frac{1}{2}" /></p>

<p>Branching probabilities are determined as</p>

<p><img src="http://l.wordpress.com/latex.php?latex=p_u%3D%5Cfrac%7B1%7D%7B6%7D%2B%5Cfrac%7B1%7D%7B2%7D%28%5Cbeta%5E2%2B%5Cbeta%29&#038;bg=FFFFFF&#038;fg=000000&#038;s=0" title="p_u=\frac{1}{6}+\frac{1}{2}(\beta^2+\beta)" style="vertical-align:-20%;" class="tex" alt="p_u=\frac{1}{6}+\frac{1}{2}(\beta^2+\beta)" /><br />
<img src="http://l.wordpress.com/latex.php?latex=p_m%3D%5Cfrac%7B2%7D%7B3%7D-%5Cbeta%5E2&#038;bg=FFFFFF&#038;fg=000000&#038;s=0" title="p_m=\frac{2}{3}-\beta^2" style="vertical-align:-20%;" class="tex" alt="p_m=\frac{2}{3}-\beta^2" /><br />
<img src="http://l.wordpress.com/latex.php?latex=p_d%3D%5Cfrac%7B1%7D%7B6%7D%2B%5Cfrac%7B1%7D%7B2%7D%28%5Cbeta%5E2-%5Cbeta%29&#038;bg=FFFFFF&#038;fg=000000&#038;s=0" title="p_d=\frac{1}{6}+\frac{1}{2}(\beta^2-\beta)" style="vertical-align:-20%;" class="tex" alt="p_d=\frac{1}{6}+\frac{1}{2}(\beta^2-\beta)" /><br />
<img src="http://l.wordpress.com/latex.php?latex=beta%3Dje%5E%7B-a%5CDelta%20t%7D-k&#038;bg=FFFFFF&#038;fg=000000&#038;s=0" title="beta=je^{-a\Delta t}-k" style="vertical-align:-20%;" class="tex" alt="beta=je^{-a\Delta t}-k" /></p>

<p>Once tree for the stochastic driver <img src="http://l.wordpress.com/latex.php?latex=u%28t%29&#038;bg=FFFFFF&#038;fg=000000&#038;s=0" title="u(t)" style="vertical-align:-20%;" class="tex" alt="u(t)" /> is built, we need to convert it to the short rate tree according to the functions:</p>

<p>normal: <img src="http://l.wordpress.com/latex.php?latex=r%28i%2Cj%29%3Dr_0%28i%29%2Bu%28i%2Cj%29&#038;bg=FFFFFF&#038;fg=000000&#038;s=0" title="r(i,j)=r_0(i)+u(i,j)" style="vertical-align:-20%;" class="tex" alt="r(i,j)=r_0(i)+u(i,j)" /><br />
lognormal: <img src="http://l.wordpress.com/latex.php?latex=r%28i%2Cj%29%3Dr_0%28i%29%5Ccdot%5Cexp%28u%28i%2Cj%29%29&#038;bg=FFFFFF&#038;fg=000000&#038;s=0" title="r(i,j)=r_0(i)\cdot\exp(u(i,j))" style="vertical-align:-20%;" class="tex" alt="r(i,j)=r_0(i)\cdot\exp(u(i,j))" /></p>

<p>where mean level vector <img src="http://l.wordpress.com/latex.php?latex=r_0%28i%29&#038;bg=FFFFFF&#038;fg=000000&#038;s=0" title="r_0(i)" style="vertical-align:-20%;" class="tex" alt="r_0(i)" /> is calibrated to the term structure of zero coupon bond prices.</p>

<p>Since trees represent discretization of the rate dynamics, then within each time step the evolution of short rate is not described by tree and thus needs to be specified. Usually we assume short rate is constant within each period. To price derivatives, we do backwards</p>

<p><img src="http://l.wordpress.com/latex.php?latex=S%28t%29%3DE%5EB_t%5B%5Cexp%28-%5Cint_t%5E%7Bt%2B%5CDelta%20t%7Dr%28s%29ds%29%28S%28t%2B%5CDelta%20t%29%2BCF%28t%2B%5CDelta%20t%29%29%5D&#038;bg=FFFFFF&#038;fg=000000&#038;s=0" title="S(t)=E^B_t[\exp(-\int_t^{t+\Delta t}r(s)ds)(S(t+\Delta t)+CF(t+\Delta t))]" style="vertical-align:-20%;" class="tex" alt="S(t)=E^B_t[\exp(-\int_t^{t+\Delta t}r(s)ds)(S(t+\Delta t)+CF(t+\Delta t))]" /></p>

<p>where <img src="http://l.wordpress.com/latex.php?latex=CF%28t%2B%5CDelta%20t%29&#038;bg=FFFFFF&#038;fg=000000&#038;s=0" title="CF(t+\Delta t)" style="vertical-align:-20%;" class="tex" alt="CF(t+\Delta t)" /> is the cash flow at time <img src="http://l.wordpress.com/latex.php?latex=t%2B%5CDelta%20t&#038;bg=FFFFFF&#038;fg=000000&#038;s=0" title="t+\Delta t" style="vertical-align:-20%;" class="tex" alt="t+\Delta t" />. And now the remaining problem is how to calibrate to get mean level vector <img src="http://l.wordpress.com/latex.php?latex=r_0%28i%29&#038;bg=FFFFFF&#038;fg=000000&#038;s=0" title="r_0(i)" style="vertical-align:-20%;" class="tex" alt="r_0(i)" />. Denote prices of zero coupon bonds with maturities <img src="http://l.wordpress.com/latex.php?latex=t_i%3Di%5CDelta%20t&#038;bg=FFFFFF&#038;fg=000000&#038;s=0" title="t_i=i\Delta t" style="vertical-align:-20%;" class="tex" alt="t_i=i\Delta t" /> by <img src="http://l.wordpress.com/latex.php?latex=P%28i%29&#038;bg=FFFFFF&#038;fg=000000&#038;s=0" title="P(i)" style="vertical-align:-20%;" class="tex" alt="P(i)" />, then apply the following iterative search process forward:</p>

<p>(1) Set <img src="http://l.wordpress.com/latex.php?latex=r_0%280%29%3D-%5Cln%28P%281%29%29%2F%5CDelta%20t&#038;bg=FFFFFF&#038;fg=000000&#038;s=0" title="r_0(0)=-\ln(P(1))/\Delta t" style="vertical-align:-20%;" class="tex" alt="r_0(0)=-\ln(P(1))/\Delta t" /><br />
(2) Search for the value of <img src="http://l.wordpress.com/latex.php?latex=r_0%281%29&#038;bg=FFFFFF&#038;fg=000000&#038;s=0" title="r_0(1)" style="vertical-align:-20%;" class="tex" alt="r_0(1)" /> such that lattice price of the zero coupon bond maturing at <img src="http://l.wordpress.com/latex.php?latex=t_2&#038;bg=FFFFFF&#038;fg=000000&#038;s=0" title="t_2" style="vertical-align:-20%;" class="tex" alt="t_2" /> equals <img src="http://l.wordpress.com/latex.php?latex=P%282%29&#038;bg=FFFFFF&#038;fg=000000&#038;s=0" title="P(2)" style="vertical-align:-20%;" class="tex" alt="P(2)" /><br />
(3) ...<br />
(4) Assuming <img src="http://l.wordpress.com/latex.php?latex=r_0%280%29%2C%5Cldots%2Cr_0%28i-1%29&#038;bg=FFFFFF&#038;fg=000000&#038;s=0" title="r_0(0),\ldots,r_0(i-1)" style="vertical-align:-20%;" class="tex" alt="r_0(0),\ldots,r_0(i-1)" /> are done, search for the value of <img src="http://l.wordpress.com/latex.php?latex=r_0%28i%29&#038;bg=FFFFFF&#038;fg=000000&#038;s=0" title="r_0(i)" style="vertical-align:-20%;" class="tex" alt="r_0(i)" /> to fit <img src="http://l.wordpress.com/latex.php?latex=P%28i%2B1%29&#038;bg=FFFFFF&#038;fg=000000&#038;s=0" title="P(i+1)" style="vertical-align:-20%;" class="tex" alt="P(i+1)" /><br />
(5) ...</p>

<p>We need to keep in mind that we always need to do numerical calibration for <img src="http://l.wordpress.com/latex.php?latex=r_0%28i%29&#038;bg=FFFFFF&#038;fg=000000&#038;s=0" title="r_0(i)" style="vertical-align:-20%;" class="tex" alt="r_0(i)" /> even when there are analytic formulas for the no-arbitrage drift because the use of trees alters the continuous dynamics. To be more specific about step (2) and step (4), we introduce Arrow-Debreu Security which pays 1$ once the node (i,j) is reached and pays nothing otherwise. Thus in trees we have</p>

<p><img src="http://l.wordpress.com/latex.php?latex=AD%28i%2B1%2Cj%29%3D%5Csum_k%20AD%28i%2Ck%29%5Cexp%28-r%28i%2Ck%29%5CDelta%20t%29P_%7Bi%2Ck%5Crightarrow%20i%2B1%2Cj%7D&#038;bg=FFFFFF&#038;fg=000000&#038;s=0" title="AD(i+1,j)=\sum_k AD(i,k)\exp(-r(i,k)\Delta t)P_{i,k\rightarrow i+1,j}" style="vertical-align:-20%;" class="tex" alt="AD(i+1,j)=\sum_k AD(i,k)\exp(-r(i,k)\Delta t)P_{i,k\rightarrow i+1,j}" /></p>

<p>One very useful property of Arrow-Debreu prices is that</p>

<p><img src="http://l.wordpress.com/latex.php?latex=P%280%2Ct_i%29%3D%5Csum_j%20AD%28i%2Cj%29&#038;bg=FFFFFF&#038;fg=000000&#038;s=0" title="P(0,t_i)=\sum_j AD(i,j)" style="vertical-align:-20%;" class="tex" alt="P(0,t_i)=\sum_j AD(i,j)" /></p>

<p>Recombining interest rate trees have a serious shortcoming that the rate history is totally lost and thus it is incompatible with any path dependent instrument. To overcome this problem, one can use the tower law and record the cash flows at the lattice nodes not when they are paid but rather when they are certain and express them with appropriate discounting.</p>
]]></content:encoded>
			<wfw:commentRss>http://ichentao.com/blog/archives/2140/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Fixed Income Modeling Review 5</title>
		<link>http://ichentao.com/blog/archives/2127/</link>
		<comments>http://ichentao.com/blog/archives/2127/#comments</comments>
		<pubDate>Fri, 03 Feb 2012 20:19:21 +0000</pubDate>
		<dc:creator>Tao</dc:creator>
				<category><![CDATA[技术]]></category>
		<category><![CDATA[科学人]]></category>
		<category><![CDATA[Fixed Income]]></category>
		<category><![CDATA[Mathematical Finance]]></category>

		<guid isPermaLink="false">http://ichentao.com/?p=2127</guid>
		<description><![CDATA[This topic is mainly about modeling of short rate which plays a central role in the theory and practice because zero coupon bonds can be priced as and so could discount factor. Assume there is only one source of uncertainty represented by a Brownian moti... ]]></description>
			<content:encoded><![CDATA[<p>This topic is mainly about modeling of short rate <img src="http://l.wordpress.com/latex.php?latex=r%28t%29&#038;bg=FFFFFF&#038;fg=000000&#038;s=0" title="r(t)" style="vertical-align:-20%;" class="tex" alt="r(t)" /> which plays a central role in the theory and practice because zero coupon bonds can be priced as</p>

<p><img src="http://l.wordpress.com/latex.php?latex=P%28t%2CT%29%3DE_t%5B%5Cexp%28-%5Cint%5ET_tr%28s%29ds%29%5D&#038;bg=FFFFFF&#038;fg=000000&#038;s=0" title="P(t,T)=E_t[\exp(-\int^T_tr(s)ds)]" style="vertical-align:-20%;" class="tex" alt="P(t,T)=E_t[\exp(-\int^T_tr(s)ds)]" /></p>

<p>and so could discount factor.</p>

<p>Assume there is only one source of uncertainty represented by a Brownian motion <img src="http://l.wordpress.com/latex.php?latex=W%28t%29&#038;bg=FFFFFF&#038;fg=000000&#038;s=0" title="W(t)" style="vertical-align:-20%;" class="tex" alt="W(t)" /> under the risk-neutral measure <img src="http://l.wordpress.com/latex.php?latex=Q&#038;bg=FFFFFF&#038;fg=000000&#038;s=0" title="Q" style="vertical-align:-20%;" class="tex" alt="Q" />. We want the stochastic process to be markovian which is referred to as path independence and hence allows for the use of recombining lattice. We don't want to use non-recombining lattice cause the number of nodes growing exponentially w.r.t. the number of time steps and thus is not practical. There are several important things we need to think about when choosing a model:</p>

<p>-- Does the dynamics guarantee positive rates?<br />
-- What distribution does the dynamics imply for the short rate?<br />
-- Can the model be calibrated to fit today's structure of zero coupon bond prices, how easy, and does the calibration stable?<br />
-- Are the zero bond prices computable by means of analytic formulas?<br />
-- Are there analytic pricing formulas available for call/put bond option?<br />
-- Is the model mean-reverting?<br />
-- How do the volatility structures implied by the model look like?<br />
-- How suited is the model for building recombining lattices?</p>

<p>If the parameters of a model are constant like <img src="http://l.wordpress.com/latex.php?latex=dr%3Da%28b-r%28t%29%29dt%2B%5Csigma%20dW&#038;bg=FFFFFF&#038;fg=000000&#038;s=0" title="dr=a(b-r(t))dt+\sigma dW" style="vertical-align:-20%;" class="tex" alt="dr=a(b-r(t))dt+\sigma dW" /> (Vasicek) then it is called equilibrium model. It's simple but could not be calibrated to fit the current term structure of rates. If we make the parameter of the drift term time dependent then we can overcome this problem and make the model no-arbitrage.</p>

<p>Based on empirical observation, people find that interest rates (unlike stock prices) tend to be pulled back to some mean level. So we want our model to be mean reverting; we also want to have the analytical formulas for zero coupon bond, call/put bond options, etc., and hence we require the model be affine which means the drift term is linear to short rate and square of the volatility is also linear to short rate. Regarding the volatility, typically we have two kinds of model for volatility: normal and lognormal. It is very hard to say which one is better, normal assumption results in analytic tractability and lognormal assumption leads to positive rates. Also, normal dynamics suit low rate environments and for lognormal, the other way around.</p>

<p>Several important models:</p>

<p>Ho-Lee: <img src="http://l.wordpress.com/latex.php?latex=dr%3D%5Ctheta%28t%29dt%2B%5Csigma%20dW&#038;bg=FFFFFF&#038;fg=000000&#038;s=0" title="dr=\theta(t)dt+\sigma dW" style="vertical-align:-20%;" class="tex" alt="dr=\theta(t)dt+\sigma dW" /><br />
Hull-White: <img src="http://l.wordpress.com/latex.php?latex=dr%3Da%28%5Ctheta%28t%29-r%29dt%2B%5Csigma%20dW&#038;bg=FFFFFF&#038;fg=000000&#038;s=0" title="dr=a(\theta(t)-r)dt+\sigma dW" style="vertical-align:-20%;" class="tex" alt="dr=a(\theta(t)-r)dt+\sigma dW" /><br />
CIR model: <img src="http://l.wordpress.com/latex.php?latex=dr%3Da%28%5Ctheta%28t%29-r%29dt%2B%5Csigma%5Csqrt%7Br%7DdW&#038;bg=FFFFFF&#038;fg=000000&#038;s=0" title="dr=a(\theta(t)-r)dt+\sigma\sqrt{r}dW" style="vertical-align:-20%;" class="tex" alt="dr=a(\theta(t)-r)dt+\sigma\sqrt{r}dW" /><br />
BDT model: <img src="http://l.wordpress.com/latex.php?latex=d%5Cln%28r%29%3D%28%5Ctheta%28t%29%2B%28%5Csigma%27%28t%29%2F%5Csigma%28t%29%29%5Cln%28r%29%29dt%2B%5Csigma%28t%29dW%28t%29&#038;bg=FFFFFF&#038;fg=000000&#038;s=0" title="d\ln(r)=(\theta(t)+(\sigma'(t)/\sigma(t))\ln(r))dt+\sigma(t)dW(t)" style="vertical-align:-20%;" class="tex" alt="d\ln(r)=(\theta(t)+(\sigma'(t)/\sigma(t))\ln(r))dt+\sigma(t)dW(t)" /></p>

<p>Among these models, Hull-White has a positive probability to generate negative rates but we can cut that and it does not affect pricing very much. CIR model is the only model with full analytic tractability which also has positive rates. While doing calibration, <img src="http://l.wordpress.com/latex.php?latex=%5Ctheta%28t%29&#038;bg=FFFFFF&#038;fg=000000&#038;s=0" title="\theta(t)" style="vertical-align:-20%;" class="tex" alt="\theta(t)" /> term in CIR must be solved for numerically. Under lognormal assumption, the total volatility is proportional to the rate level and thus it grows/declines with the rates, which produces rate path distribution skewed upward. Theoretically, we could deduce such equation under lognormal model:</p>

<p><img src="http://l.wordpress.com/latex.php?latex=E_0%5BB%28%5CDelta%20t%29%5D%3D%5Cinfty&#038;bg=FFFFFF&#038;fg=000000&#038;s=0" title="E_0[B(\Delta t)]=\infty" style="vertical-align:-20%;" class="tex" alt="E_0[B(\Delta t)]=\infty" /></p>

<p>therefore we can make infinite money in an arbitrary small time from $1 initial investment, however in numerical implementations of a short rate model on a tree this problem does not appear as the number of states is finite.</p>

<p>In order to make our models better, we could add a deterministic shift:</p>

<p><img src="http://l.wordpress.com/latex.php?latex=r%28t%29%3Dr_0%28t%29%2B%5Cvarphi%28t%29&#038;bg=FFFFFF&#038;fg=000000&#038;s=0" title="r(t)=r_0(t)+\varphi(t)" style="vertical-align:-20%;" class="tex" alt="r(t)=r_0(t)+\varphi(t)" /><br />
<img src="http://l.wordpress.com/latex.php?latex=dr_0%28t%29%3Da%28%5Ctheta%28t%29-r_0%29dt%2B%5Csigma%5Csqrt%7Br_0%7DdW%28t%29&#038;bg=FFFFFF&#038;fg=000000&#038;s=0" title="dr_0(t)=a(\theta(t)-r_0)dt+\sigma\sqrt{r_0}dW(t)" style="vertical-align:-20%;" class="tex" alt="dr_0(t)=a(\theta(t)-r_0)dt+\sigma\sqrt{r_0}dW(t)" />.</p>

<p>This kind of extension could preserve the tractability but not the positiveness of rates. Shifted CIR model could perfectly fit the market price of zero coupon bond and according to this:</p>

<p>when rates are low: <img src="http://l.wordpress.com/latex.php?latex=%5Csigma%28t%29%28r%28t%29%2B%5Calpha%29%5Capprox%5Csigma%28t%29%5Calpha&#038;bg=FFFFFF&#038;fg=000000&#038;s=0" title="\sigma(t)(r(t)+\alpha)\approx\sigma(t)\alpha" style="vertical-align:-20%;" class="tex" alt="\sigma(t)(r(t)+\alpha)\approx\sigma(t)\alpha" /><br />
when rates are high: <img src="http://l.wordpress.com/latex.php?latex=%5Csigma%28t%29%28r%28t%29%2B%5Calpha%29%5Capprox%5Csigma%28t%29r%28t%29&#038;bg=FFFFFF&#038;fg=000000&#038;s=0" title="\sigma(t)(r(t)+\alpha)\approx\sigma(t)r(t)" style="vertical-align:-20%;" class="tex" alt="\sigma(t)(r(t)+\alpha)\approx\sigma(t)r(t)" /></p>

<p>we know that shifted lognormal models capture the phenomenon that rates follow close-to-normal dynamics in low rate environments and close-to-lognormal one in high rate environments.</p>
]]></content:encoded>
			<wfw:commentRss>http://ichentao.com/blog/archives/2127/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Fixed Income Modeling Review 4</title>
		<link>http://ichentao.com/blog/archives/1987/</link>
		<comments>http://ichentao.com/blog/archives/1987/#comments</comments>
		<pubDate>Sat, 02 Jul 2011 15:33:26 +0000</pubDate>
		<dc:creator>Tao</dc:creator>
				<category><![CDATA[技术]]></category>
		<category><![CDATA[Fixed Income]]></category>
		<category><![CDATA[Mathematical Finance]]></category>

		<guid isPermaLink="false">http://ichentao.com/blog/archives/1987/</guid>
		<description><![CDATA[After reviewing Ito lemma and SDE, it is time to have a look at the standard market model which are forward contracts, future contracts, options on bond, interest rate caps, floors, collars and swaptions. Forward contracts and future contracts are simila... ]]></description>
			<content:encoded><![CDATA[<p>After reviewing Ito lemma and SDE, it is time to have a look at the standard market model which are forward contracts, future contracts, options on bond, interest rate caps, floors, collars and swaptions.</p>

<p>Forward contracts and future contracts are similar but there are also some crucial differences: forward contracts are over the counter and future contracts are traded on exchanges; future contracts are settled daily which reduces the credit risks, and after daily settlement future contracts is worth zero.</p>

<p>Forward price and future price are prices make the contracts worth zero at the beginning or the time after each settlement. Usually they are different but if the interest rates are deterministic, or more generally, the underlying asset price process is independent of the rate process then thery are the same.</p>

<p><img src="http://l.wordpress.com/latex.php?latex=Fwrd%28t%29%3D%5Cfrac%7BS%28t%29%7D%7BP%28t%2CT%29%7D%3D%5Cfrac%7BE%5EB_t%5BD%28t%2CT%29S%28T%29%5D%7D%7BE%5EB_t%5BD%28t%2CT%29%5D%7D%3DE%5EB_t%5BS%28T%29%5D%3DFut%28t%29&#038;bg=FFFFFF&#038;fg=000000&#038;s=0" title="Fwrd(t)=\frac{S(t)}{P(t,T)}=\frac{E^B_t[D(t,T)S(T)]}{E^B_t[D(t,T)]}=E^B_t[S(T)]=Fut(t)" style="vertical-align:-20%;" class="tex" alt="Fwrd(t)=\frac{S(t)}{P(t,T)}=\frac{E^B_t[D(t,T)S(T)]}{E^B_t[D(t,T)]}=E^B_t[S(T)]=Fut(t)" /></p>

<p>One more thing is that if the underlying asset price is positively correlated with the interest rates then the futures price will be higher than the forward price and this is why the rate implied from Eurodollar futures price is higher than the corresponding forward rate.</p>

<p>For options on futures we have Black's model which is completely consistent with the Black-Scholes formula for stock options. Black's model is so popular that the implied volatility from the option prices has become the way most popular options are quoted, and it has also become a popular pricing and quoting tool on fixed income markets thought it assumes deterministic interest rates.</p>

<p>There are two basic assumptions for Black's model:<br />
(1) The value V(T) of the option is lognormally distributed with the standard deviation of <img src="http://l.wordpress.com/latex.php?latex=%5Cln%28V%28T%29%29&#038;bg=FFFFFF&#038;fg=000000&#038;s=0" title="\ln(V(T))" style="vertical-align:-20%;" class="tex" alt="\ln(V(T))" /> equal to <img src="http://l.wordpress.com/latex.php?latex=%5Csigma%28T-t%29%5E%7B1%2F2%7D&#038;bg=FFFFFF&#038;fg=000000&#038;s=0" title="\sigma(T-t)^{1/2}" style="vertical-align:-20%;" class="tex" alt="\sigma(T-t)^{1/2}" />.<br />
(2) The expected value of V(T) is F(t) under T-forward measure.</p>

<p>And so the Black's formula becomes</p>

<p><img src="http://l.wordpress.com/latex.php?latex=Call%28t%29%3DP%28t%2CT%29%5BF%28t%29%5Ccdot%20N%28d_1%29-K%5Ccdot%20N%28d_2%29%5D&#038;bg=FFFFFF&#038;fg=000000&#038;s=0" title="Call(t)=P(t,T)[F(t)\cdot N(d_1)-K\cdot N(d_2)]" style="vertical-align:-20%;" class="tex" alt="Call(t)=P(t,T)[F(t)\cdot N(d_1)-K\cdot N(d_2)]" /><br />
<img src="http://l.wordpress.com/latex.php?latex=Put%28t%29%3DP%28t%2CT%29%5BK%5Ccdot%20N%28-d_2%29-F%28t%29%5Ccdot%20N%28-d_1%29%5D&#038;bg=FFFFFF&#038;fg=000000&#038;s=0" title="Put(t)=P(t,T)[K\cdot N(-d_2)-F(t)\cdot N(-d_1)]" style="vertical-align:-20%;" class="tex" alt="Put(t)=P(t,T)[K\cdot N(-d_2)-F(t)\cdot N(-d_1)]" /></p>

<p>Bond option is an option to buy or sell a particular bond by a certain date for a particular price. In addition to trading in the OTC market, bond options are often embedded in bonds when they are issued like callable bonds or puttable bonds. By assuming the bond price S(T) at the maturity of the option T is lognormally distributed with standard deviation of <img src="http://l.wordpress.com/latex.php?latex=%5Cln%28S%28T%29%29&#038;bg=FFFFFF&#038;fg=000000&#038;s=0" title="\ln(S(T))" style="vertical-align:-20%;" class="tex" alt="\ln(S(T))" /> equal to <img src="http://l.wordpress.com/latex.php?latex=%5Csigma%28T-t%29%5E%7B1%2F2%7D&#038;bg=FFFFFF&#038;fg=000000&#038;s=0" title="\sigma(T-t)^{1/2}" style="vertical-align:-20%;" class="tex" alt="\sigma(T-t)^{1/2}" /> we can apply the Black's model to compute the price of European call and put options.</p>

<p>Interest rate cap is an OTC floating rate contract which is a series of call options with the underlying being the market rate and the strikes equal to a fixed rate. Each of the call options is called a caplet. For floors and floorlets, they are similar, only with call options changed to put options.</p>

<p>Every caplet can also be seen as a bond option:</p>

<p><img src="http://l.wordpress.com/latex.php?latex=V_i%28t_%7Bi-1%7D%29%3DP%28t_%7Bi-1%7D%2Ct_i%29L%5Ctau%28t_%7Bi-1%7D%2Ct_i%29%5Cmax%5BR%28t_%7Bi-1%7D%2Ct_i%29-R_K%29%2C0%5D&#038;bg=FFFFFF&#038;fg=000000&#038;s=0" title="V_i(t_{i-1})=P(t_{i-1},t_i)L\tau(t_{i-1},t_i)\max[R(t_{i-1},t_i)-R_K),0]" style="vertical-align:-20%;" class="tex" alt="V_i(t_{i-1})=P(t_{i-1},t_i)L\tau(t_{i-1},t_i)\max[R(t_{i-1},t_i)-R_K),0]" /><br />
<img src="http://l.wordpress.com/latex.php?latex=%3D%5Cmax%5BL-L%281%2B%5Ctau%28t_%7Bi-1%7D%2Ct_i%29R_K%29P%28t_%7Bi-1%7D%2Ct_i%29%2C0%5D&#038;bg=FFFFFF&#038;fg=000000&#038;s=0" title="=\max[L-L(1+\tau(t_{i-1},t_i)R_K)P(t_{i-1},t_i),0]" style="vertical-align:-20%;" class="tex" alt="=\max[L-L(1+\tau(t_{i-1},t_i)R_K)P(t_{i-1},t_i),0]" /></p>

<p>Thus under the assumptions of Black's model we have the pricing formulas for caplets and floorlets:</p>

<p><img src="http://l.wordpress.com/latex.php?latex=Caplet_i%28t%29%3DL%5Ctau%28t_%7Bi-1%7D%2Ct_i%29P%28t%2Ct_i%29%5BF_t%28t%29%5Ccdot%20N%28d_1%29-R_k%5Ccdot%20N%28d_2%29%5D&#038;bg=FFFFFF&#038;fg=000000&#038;s=0" title="Caplet_i(t)=L\tau(t_{i-1},t_i)P(t,t_i)[F_t(t)\cdot N(d_1)-R_k\cdot N(d_2)]" style="vertical-align:-20%;" class="tex" alt="Caplet_i(t)=L\tau(t_{i-1},t_i)P(t,t_i)[F_t(t)\cdot N(d_1)-R_k\cdot N(d_2)]" />
<img src="http://l.wordpress.com/latex.php?latex=Floorlet_i%28t%29%3DL%5Ctau%28t_%7Bi-1%7D%2Ct_i%29P%28t%2Ct_i%29%5BR_K%5Ccdot%20N%28-d_2%29-F_i%28t%29%5Ccdot%20N%28-d_1%29%5D&#038;bg=FFFFFF&#038;fg=000000&#038;s=0" title="Floorlet_i(t)=L\tau(t_{i-1},t_i)P(t,t_i)[R_K\cdot N(-d_2)-F_i(t)\cdot N(-d_1)]" style="vertical-align:-20%;" class="tex" alt="Floorlet_i(t)=L\tau(t_{i-1},t_i)P(t,t_i)[R_K\cdot N(-d_2)-F_i(t)\cdot N(-d_1)]" /></p>

<p>In the formulas above we use different volatilities for each caplet and there is another approach which is to use the same volatility for one maturity. Volatility in the first approach is called spot volatilities and in the latter one it is called flat volatilities. In real market we usually use flat volatility for quoting.</p>

<p>European swaption is another OTC contract. It gives its holder the right to enter into a swap contract at a certain time in the future called exercise time. We could take a fixed-for-float swap to examine the nature of the contract. Since at the start of the contract the value of the floating leg is equal to the notional principle of the swap, the swaption could be seen as an option on a fixed rate bond with the strike being equal to the bond priciple.</p>

<p><img src="http://l.wordpress.com/latex.php?latex=Payoff%28T_%7BExe%7D%29%3D%5Cmax%5BR_K-R_%7Bswap%7D%28T_%7BExe%7D%2CT_%7BStl%7D%2CT_%7BMat%7D%29%2C0%5D%5Ccdot%20A%28t%2CT_%7BStl%7D%2CT_%7BMat%7D%29%5Ccdot%20L&#038;bg=FFFFFF&#038;fg=000000&#038;s=0" title="Payoff(T_{Exe})=\max[R_K-R_{swap}(T_{Exe},T_{Stl},T_{Mat}),0]\cdot A(t,T_{Stl},T_{Mat})\cdot L" style="vertical-align:-20%;" class="tex" alt="Payoff(T_{Exe})=\max[R_K-R_{swap}(T_{Exe},T_{Stl},T_{Mat}),0]\cdot A(t,T_{Stl},T_{Mat})\cdot L" /></p>

<p>We can easily calculate the swap rate by</p>

<p><img src="http://l.wordpress.com/latex.php?latex=R_%7BSwap%7D%28t%2CT_%7BStl%7D%2CT_%7BMat%7D%29%3D%5Cfrac%7BP%28t%2CT_%7BStl%7D%29-P%28t%2CT_%7BMat%7D%29%7D%7BA%28t%2CT_%7BStl%7D%2CT_%7BMat%7D%29%7D&#038;bg=FFFFFF&#038;fg=000000&#038;s=0" title="R_{Swap}(t,T_{Stl},T_{Mat})=\frac{P(t,T_{Stl})-P(t,T_{Mat})}{A(t,T_{Stl},T_{Mat})}" style="vertical-align:-20%;" class="tex" alt="R_{Swap}(t,T_{Stl},T_{Mat})=\frac{P(t,T_{Stl})-P(t,T_{Mat})}{A(t,T_{Stl},T_{Mat})}" /></p>

<p>then a pricing formula for the swaption is</p>

<p><img src="http://l.wordpress.com/latex.php?latex=ReceiverSwaption%28t%29%3DL%5Ccdot%20A%28t%2CT_%7BStl%7D%2CT_%7BMat%7D%29%5BR_K%5Ccdot%20N%28-d_2%29-R_%7BSwap%7D%28t%29%5Ccdot%20N%28-d_1%29%5D&#038;bg=FFFFFF&#038;fg=000000&#038;s=0" title="ReceiverSwaption(t)=L\cdot A(t,T_{Stl},T_{Mat})[R_K\cdot N(-d_2)-R_{Swap}(t)\cdot N(-d_1)]" style="vertical-align:-20%;" class="tex" alt="ReceiverSwaption(t)=L\cdot A(t,T_{Stl},T_{Mat})[R_K\cdot N(-d_2)-R_{Swap}(t)\cdot N(-d_1)]" /></p>

<p>Sometimes we need adjustments to price options on bond and they are convexity adjustment and timing adjustment. If the bond price is given in terms of the yield, then we could not simply assume that the forward price F(t) is equal to expected bond value and this is when convexity adjustments take place. If payment date is delayed until a later time <img src="http://l.wordpress.com/latex.php?latex=T%5E%2A%3ET&#038;bg=FFFFFF&#038;fg=000000&#038;s=0" title="T^*>T" style="vertical-align:-20%;" class="tex" alt="T^*>T" />, then in order to compute expectation of a variable at time T with respect to <img src="http://l.wordpress.com/latex.php?latex=T%5E%2A&#038;bg=FFFFFF&#038;fg=000000&#038;s=0" title="T^*" style="vertical-align:-20%;" class="tex" alt="T^*" /> forward measure, we need timing adjustments.</p>

<p><a href="http://ichentao.com/upload/HW4.docx">HW 4</a>, <a href="http://ichentao.com/upload/HW4_ChenTao.xlsx">My solution</a></p>
]]></content:encoded>
			<wfw:commentRss>http://ichentao.com/blog/archives/1987/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Box-Muller transform</title>
		<link>http://ichentao.com/blog/archives/1966/</link>
		<comments>http://ichentao.com/blog/archives/1966/#comments</comments>
		<pubDate>Mon, 30 May 2011 02:40:32 +0000</pubDate>
		<dc:creator>Tao</dc:creator>
				<category><![CDATA[技术]]></category>
		<category><![CDATA[Mathematical Finance]]></category>

		<guid isPermaLink="false">http://ichentao.com/blog/archives/1966/</guid>
		<description><![CDATA[蒙特卡罗方法在金融数学中有很重要的作用, 比如可以方便的处理与路径相关的金 融衍生品定价, 它的基本原理是生成随机数, 进而生成多个随机路径, 假设这些路 径具有相同的概率, 于是根据 ... ]]></description>
			<content:encoded><![CDATA[<p>蒙特卡罗方法在金融数学中有很重要的作用, 比如可以方便的处理与路径相关的金
融衍生品定价, 它的基本原理是生成随机数, 进而生成多个随机路径, 假设这些路
径具有相同的概率, 于是根据</p>

<p><img src="http://l.wordpress.com/latex.php?latex=V%280%29%3DE%5Be%5E%7B-rT%7DV%28T%29%5D&#038;bg=FFFFFF&#038;fg=000000&#038;s=0" title="V(0)=E[e^{-rT}V(T)]" style="vertical-align:-20%;" class="tex" alt="V(0)=E[e^{-rT}V(T)]" /></p>

<p>就可以通过对所有的路径取平均而得到 V(0), 即衍生品的价格. 它的一个缺点是计
算出来的 V(0) 取决于生成的随机数, 因为每次的随机数必不相同(几乎是几乎处处),
所以 V(0) 也互不相同.</p>

<p>可见如何生成随机数是蒙特卡罗方法的关键, 并且蒙特卡罗方法一般都是通过计算
机编程实现(很难想象进行手算蒙特卡罗的应用), 于是如何找到快速有效低耗的生
成随机数的方法就相当重要. 通常的步骤是: 生成伪随机数 --> 生成一致分布的随
机数 --> 生成正态分布的随机数. 所谓伪随机数就是一列整数 <img src="http://l.wordpress.com/latex.php?latex=I_n%5Cin%5B0%2CRAND%5C_MAX%5D&#038;bg=FFFFFF&#038;fg=000000&#038;s=0" title="I_n\in[0,RAND\_MAX]" style="vertical-align:-20%;" class="tex" alt="I_n\in[0,RAND\_MAX]" />, 可以通过 <img src="http://l.wordpress.com/latex.php?latex=u_n%3DI_n%2FRAND%5C_MAX&#038;bg=FFFFFF&#038;fg=000000&#038;s=0" title="u_n=I_n/RAND\_MAX" style="vertical-align:-20%;" class="tex" alt="u_n=I_n/RAND\_MAX" /> 转化为[0,1]一致分布
的随机数. 各个编程语言都提供了生成伪随机数的算法, 比如 Microsoft C++ 就
有一套令 RAND_MAX=32,767 的标准算法, 但这对于金融应用并不够, 比如要进行
一个360月的债券的定价, 在第91个路径之后随机数便开始重复了. Numerical
Recipes in C 这本书里据说讨论了一些非常好的随机数生成算法, 但是我还没看.</p>

<p>当获得了一致分布的随机数之后, 要将它们转化成正态分布 N(0,1), 这里有几个
方法:</p>

<p>(1) 最基本的是生成 <img src="http://l.wordpress.com/latex.php?latex=u_i%5Csim%20U%280%2C1%29%2Ci%3D1%2C2%2C...%2C12&#038;bg=FFFFFF&#038;fg=000000&#038;s=0" title="u_i\sim U(0,1),i=1,2,...,12" style="vertical-align:-20%;" class="tex" alt="u_i\sim U(0,1),i=1,2,...,12" />, 然后令
<img src="http://l.wordpress.com/latex.php?latex=%5Cepsilon%3D%5Csum%5E%7B12%7D_%7Bi%3D1%7Du_i-6&#038;bg=FFFFFF&#038;fg=000000&#038;s=0" title="\epsilon=\sum^{12}_{i=1}u_i-6" style="vertical-align:-20%;" class="tex" alt="\epsilon=\sum^{12}_{i=1}u_i-6" />. 这种方法简单而且快, 但缺点是不够准确.</p>

<p>(2) 一种非常常用的方法叫 Box-Muller 方法. 它的原理是假设有两个独立同分布
的 <img src="http://l.wordpress.com/latex.php?latex=U_1%2CU_2%5Csim%20U%280%2C1%29&#038;bg=FFFFFF&#038;fg=000000&#038;s=0" title="U_1,U_2\sim U(0,1)" style="vertical-align:-20%;" class="tex" alt="U_1,U_2\sim U(0,1)" />, 那么根据 <a href="http://en.wikipedia.org/wiki/Inverse_transform_sampling">Inverse transform sampling 定
理</a>,
<img src="http://l.wordpress.com/latex.php?latex=R%5E2%3D-2%5Cln%20U_1&#038;bg=FFFFFF&#038;fg=000000&#038;s=0" title="R^2=-2\ln U_1" style="vertical-align:-20%;" class="tex" alt="R^2=-2\ln U_1" /> 是指数分布, 同时也是 <img src="http://l.wordpress.com/latex.php?latex=%5Cmathcal%7BX%7D%5E2&#038;bg=FFFFFF&#038;fg=000000&#038;s=0" title="\mathcal{X}^2" style="vertical-align:-20%;" class="tex" alt="\mathcal{X}^2" /> 分布, 这也就是说它是一
个二维正态分布的范数的平方, 然后再通过极坐标投影,</p>

<p><img src="http://l.wordpress.com/latex.php?latex=Z_0%3DR%5Ccos%28%5Ctheta%29%2C%20Z_1%3DR%5Csin%28%5Ctheta%29&#038;bg=FFFFFF&#038;fg=000000&#038;s=0" title="Z_0=R\cos(\theta), Z_1=R\sin(\theta)" style="vertical-align:-20%;" class="tex" alt="Z_0=R\cos(\theta), Z_1=R\sin(\theta)" /></p>

<p>是两个独立标准正态分布, 其中 <img src="http://l.wordpress.com/latex.php?latex=%5Ctheta%3D2%5Cpi%20U_2&#038;bg=FFFFFF&#038;fg=000000&#038;s=0" title="\theta=2\pi U_2" style="vertical-align:-20%;" class="tex" alt="\theta=2\pi U_2" />. 这种方法还能进行转化,
令 <img src="http://l.wordpress.com/latex.php?latex=u%3DR%5Ccos%5Ctheta%2Cv%3DR%5Csin%5Ctheta&#038;bg=FFFFFF&#038;fg=000000&#038;s=0" title="u=R\cos\theta,v=R\sin\theta" style="vertical-align:-20%;" class="tex" alt="u=R\cos\theta,v=R\sin\theta" />, 那么</p>

<p><img src="http://l.wordpress.com/latex.php?latex=Z_0%3D%5Csqrt%7B-2%5Cln%20U_1%7D%5Ccos%282%5Cpi%20U_2%29%3Du%5Ccdot%5Csqrt%7B%5Cfrac%7B-2%5Cln%20s%7D%7Bs%7D%7D&#038;bg=FFFFFF&#038;fg=000000&#038;s=0" title="Z_0=\sqrt{-2\ln U_1}\cos(2\pi U_2)=u\cdot\sqrt{\frac{-2\ln s}{s}}" style="vertical-align:-20%;" class="tex" alt="Z_0=\sqrt{-2\ln U_1}\cos(2\pi U_2)=u\cdot\sqrt{\frac{-2\ln s}{s}}" /></p>

<p><img src="http://l.wordpress.com/latex.php?latex=Z_1%3D%5Csqrt%7B-2%5Cln%20U_1%7D%5Csin%282%5Cpi%20U_2%29%3Dv%5Ccdot%5Csqrt%7B%5Cfrac%7B-2%5Cln%20s%7D%7Bs%7D%7D&#038;bg=FFFFFF&#038;fg=000000&#038;s=0" title="Z_1=\sqrt{-2\ln U_1}\sin(2\pi U_2)=v\cdot\sqrt{\frac{-2\ln s}{s}}" style="vertical-align:-20%;" class="tex" alt="Z_1=\sqrt{-2\ln U_1}\sin(2\pi U_2)=v\cdot\sqrt{\frac{-2\ln s}{s}}" /></p>

<p>这种转化的好处是避免了在计算机中进行正弦, 余弦函数的运算. 最后是一段简单
的在 C++ 中通过 Box-Muller 方法生成正态分布随机数的代码</p>

<p><code>
double GetOneGaussianByBoxMuller()<br />
{<br />
double result;<br />
double x;<br />
double y;<br />
double sizeSquared;<br />
do<br />
{<br />
x = 2.0&#42;rand()/static_cast<double>(RAND_MAX)-1;<br />
y = 2.0&#42;rand()/static_cast<double>(RAND_MAX)-1;<br />
sizeSquared = x&#42;x + y&#42;y;<br />
}<br />
while<br />
( sizeSquared >= 1.0);<br />
result = x&#42;sqrt(-2&#42;log(sizeSquared)/sizeSquared);<br />
return result;<br />
}
</code></p>
]]></content:encoded>
			<wfw:commentRss>http://ichentao.com/blog/archives/1966/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Fixed Income Modeling Review 3</title>
		<link>http://ichentao.com/blog/archives/1958/</link>
		<comments>http://ichentao.com/blog/archives/1958/#comments</comments>
		<pubDate>Thu, 26 May 2011 13:13:41 +0000</pubDate>
		<dc:creator>Tao</dc:creator>
				<category><![CDATA[技术]]></category>
		<category><![CDATA[Fixed Income]]></category>
		<category><![CDATA[Mathematical Finance]]></category>

		<guid isPermaLink="false">http://ichentao.com/blog/archives/1958/</guid>
		<description><![CDATA[During the whole semester, topic 3 was probably the easiest. Because I have known the material of Ito integral and stochastic differential equation(SDE) in advance of the lecture. But it was still good as a complement to my knowledge. Everyone should kno... ]]></description>
			<content:encoded><![CDATA[<p>During the whole semester, topic 3 was probably the easiest. Because I have known the material of Ito integral and stochastic differential equation(SDE) in advance of the lecture. But it was still good as a complement to my knowledge.</p>

<p>Everyone should know what probability space, filtration, stochastic processes, adapted processes, martingale and Brownian motion are, cause these concepts are the very basics of mathematical finance. One should also know that Ito integrals are martingales and if the integrand is non-random then Ito integral and Stratonovich integral are the same thing, which means that the product rule for Riemann integral applies to Ito integral as well. Why do we choose Ito integral instead of Stratonovich integral given that Stratonovich integral preserves the product rule? The reason is when we construct Ito integral, we choose the left end points for the integrand so we don't look into the future, and this is essential to financial application.</p>

<p>One of the most important theory we need to use is Ito's lemma. It basically expands the concept of derivative we already know in calculus. We know the Taylor expansion:</p>

<p><img src="http://l.wordpress.com/latex.php?latex=df%28x%29%3Df%27%28x%29dx&#038;bg=FFFFFF&#038;fg=000000&#038;s=0" title="df(x)=f'(x)dx" style="vertical-align:-20%;" class="tex" alt="df(x)=f'(x)dx" /></p>

<p>and now for Ito integral we have</p>

<p><img src="http://l.wordpress.com/latex.php?latex=dg%28t%2CW%28t%29%29%3Dg_tdt%2Bg_xdW%28t%29%2B%5Cfrac%7B1%7D%7B2%7Dg_%7Bxx%7Ddt&#038;bg=FFFFFF&#038;fg=000000&#038;s=0" title="dg(t,W(t))=g_tdt+g_xdW(t)+\frac{1}{2}g_{xx}dt" style="vertical-align:-20%;" class="tex" alt="dg(t,W(t))=g_tdt+g_xdW(t)+\frac{1}{2}g_{xx}dt" /></p>

<p>so essentially we are using the fact that <img src="http://l.wordpress.com/latex.php?latex=dW%28t%29dW%28t%29%3Ddt&#038;bg=FFFFFF&#038;fg=000000&#038;s=0" title="dW(t)dW(t)=dt" style="vertical-align:-20%;" class="tex" alt="dW(t)dW(t)=dt" />.</p>

<p>In order to compare different securities and remove the price
appreciation due to the time value of money effect, we introduce the
concept of numeraire and prices divided by numeraire are called
dicounted prices. For any numeraire there exists a corresponding
martingale measure which is equivalent to the probability measure that
discounted prices are martingales under such measure. Actually this is
not precisely correct cause martingale measure does not always exist,
so this sentence I am saying is more with respect to change of
numeraire. That is if you change the numeraire then the martingale
measure changes and vice versa.</p>

<p>The first fundamental theory of asset pricing says if there exists a
martingale measure then there is no arbitrage in the market. The
converse is not true and you need to add another condition called no
free lunch with vanishing risk to ensure that martingale measure exists
given there isn't any arbitrage opportunity. One thing new I learnt from
this lecture is that if martingale measure exists for one numeraire then
for another numeraire we could also find martingale measure. The most
commonly used numeraire are banking account and zero coupon bond.</p>

<p>Change of measure is another important technique with respect to
mathematical finance. You first need to know what is Radon-Nikodym
derivative from real analysis. Then you should know the Girsanov's
Theorem:</p>

<p>If W is a Brownian motion under P, then for</p>

<p><img src="http://l.wordpress.com/latex.php?latex=dP%5E%2A%3D%5Crho%20dP&#038;bg=FFFFFF&#038;fg=000000&#038;s=0" title="dP^*=\rho dP" style="vertical-align:-20%;" class="tex" alt="dP^*=\rho dP" />,
<img src="http://l.wordpress.com/latex.php?latex=%5Crho%3D%5Cexp%5C%7B-%5Cint%5Et_0%5Ctheta%28s%29dW%28s%29-%5Cfrac%7B1%7D%7B2%7D%5Cint%5Et_0%5Ctheta%5E2%28s%29ds%5C%7D&#038;bg=FFFFFF&#038;fg=000000&#038;s=0" title="\rho=\exp\{-\int^t_0\theta(s)dW(s)-\frac{1}{2}\int^t_0\theta^2(s)ds\}" style="vertical-align:-20%;" class="tex" alt="\rho=\exp\{-\int^t_0\theta(s)dW(s)-\frac{1}{2}\int^t_0\theta^2(s)ds\}" /></p>

<p><img src="http://l.wordpress.com/latex.php?latex=dW%5E%2A%28t%29%3DdW%28t%29%2B%5Ctheta%28t%29dt&#038;bg=FFFFFF&#038;fg=000000&#038;s=0" title="dW^*(t)=dW(t)+\theta(t)dt" style="vertical-align:-20%;" class="tex" alt="dW^*(t)=dW(t)+\theta(t)dt" /> is a Brownian motion under <img src="http://l.wordpress.com/latex.php?latex=P%5E%2A&#038;bg=FFFFFF&#038;fg=000000&#038;s=0" title="P^*" style="vertical-align:-20%;" class="tex" alt="P^*" />.</p>

<p>Martingale measure according to banking account is called risk neutral
measure which is named after the fact that the market price of risk is
zero in this case. Under risk neutral measure, all the prices discounted by
momey market account are martingales and in case of random interest rate
model we often change the numeraire to forward measure because of
simplicity of calculation(this is not the only reason!). Forward measure
is the EMM with respect to zero coupon bond and one of the professors
said to us that if someone knows what forward measure is then he/she
could skip the course of Mathematical Finance I. Notably, forward price
is a martingale under forward measure.</p>

<p>In fixed income modeling, one rule I didn't know is that conditional
expectation of short rate is equal to the forward rate: <img src="http://l.wordpress.com/latex.php?latex=E%5ET_t%5Br%28T%29%5D%3Df%28t%2CT%29&#038;bg=FFFFFF&#038;fg=000000&#038;s=0" title="E^T_t[r(T)]=f(t,T)" style="vertical-align:-20%;" class="tex" alt="E^T_t[r(T)]=f(t,T)" />.</p>

<p><a href="http://ichentao.com/upload/HW3.doc">HW 3</a>, <a href="http://ichentao.com/upload/HW3_ChenTao.xlsx">My Solution</a></p>
]]></content:encoded>
			<wfw:commentRss>http://ichentao.com/blog/archives/1958/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Fixed Income Modeling Review 2</title>
		<link>http://ichentao.com/blog/archives/1911/</link>
		<comments>http://ichentao.com/blog/archives/1911/#comments</comments>
		<pubDate>Thu, 19 May 2011 05:52:03 +0000</pubDate>
		<dc:creator>Tao</dc:creator>
				<category><![CDATA[技术]]></category>
		<category><![CDATA[Fixed Income]]></category>
		<category><![CDATA[Mathematical Finance]]></category>

		<guid isPermaLink="false">http://ichentao.com/?p=1911</guid>
		<description><![CDATA[This review will concentrate on bond mathematics and yield curves. I have come up with typical assumptions in fixed income modeling last time now we first need to examine more detailed assmptions on zero-coupon bonds, which illustrate the differences bet... ]]></description>
			<content:encoded><![CDATA[<p>This review will concentrate on bond mathematics and yield curves. I have come up with typical assumptions in fixed income modeling last time now we first need to examine more detailed assmptions on zero-coupon bonds, which illustrate the differences between theoretical formulas and market reality.</p>

<p>-- Most of the bonds pay regular coupons<br />
-- Available bond maturities do not span the whole time axis<br />
-- Different bonds trade at different spreads to benchmark securities because of different credit quality and liquidity level<br />
-- Most corporate bonds are callable</p>

<p>After addressing the theoretical assumptions, we now turn to a very important concept in fixed-income: yield. Bond yield or yield to maturity can be defined as a constant discount rate through the whole life of a coupon bond. So we can see that the bond price is decreasing with respect to the yield. Furthermore, the bond price equals the principle if and only if yield equals the coupon rate. For short term bonds paying no coupon we define the discount yield which is a simply compounded rate. For government bonds we often have another quoting method called Bond Equivalent Yield (BEY) which is defined as a discounted rate semi-annually.</p>

<p>In my opinion, fixed-income market is a market of interest rate derivatives, so we definitely need to examine one derivative's interest rate risk. PVBP is one indicator to show a security's sensitivity to the change of interest rate. It is defined as</p>

<p><img src="http://l.wordpress.com/latex.php?latex=P%3D100%5B%5Csum%5EN_%7Bi%3D1%7D%5Cfrac%7Bc%2F2%7D%7B%281%2By%2F2%29%5Ei%7D%2B%5Cfrac%7B1%7D%7B%281%2By%2F2%29%5EN%7D%5D&#038;bg=FFFFFF&#038;fg=000000&#038;s=0" title="P=100[\sum^N_{i=1}\frac{c/2}{(1+y/2)^i}+\frac{1}{(1+y/2)^N}]" style="vertical-align:-20%;" class="tex" alt="P=100[\sum^N_{i=1}\frac{c/2}{(1+y/2)^i}+\frac{1}{(1+y/2)^N}]" /><br />
<img src="http://l.wordpress.com/latex.php?latex=P%5E%2B%3D100%5B%5Csum%5EN_%7Bi%3D1%7D%5Cfrac%7Bc%2F2%7D%7B%281%2B%28y%2B0.0001%29%2F2%29%5Ei%7D%2B%5Cfrac%7B1%7D%7B%281%2B%28y%2B0.0001%29%2F2%29%5EN%7D%5D&#038;bg=FFFFFF&#038;fg=000000&#038;s=0" title="P^+=100[\sum^N_{i=1}\frac{c/2}{(1+(y+0.0001)/2)^i}+\frac{1}{(1+(y+0.0001)/2)^N}]" style="vertical-align:-20%;" class="tex" alt="P^+=100[\sum^N_{i=1}\frac{c/2}{(1+(y+0.0001)/2)^i}+\frac{1}{(1+(y+0.0001)/2)^N}]" /><br />
<img src="http://l.wordpress.com/latex.php?latex=PVBP%3DP-P%5E%2B&#038;bg=FFFFFF&#038;fg=000000&#038;s=0" title="PVBP=P-P^+" style="vertical-align:-20%;" class="tex" alt="PVBP=P-P^+" />.</p>

<p>PVBP can also be approximately computed by <img src="http://l.wordpress.com/latex.php?latex=PVBP%3D-%5Cfrac%7B%5Cpartial%20P%7D%7B%5Cpartial%20y%7D0.0001&#038;bg=FFFFFF&#038;fg=000000&#038;s=0" title="PVBP=-\frac{\partial P}{\partial y}0.0001" style="vertical-align:-20%;" class="tex" alt="PVBP=-\frac{\partial P}{\partial y}0.0001" />.</p>

<p>Duration is a similar measure to PVBP but rather in a relative way: <img src="http://l.wordpress.com/latex.php?latex=D%3D-%5Cfrac%7B%5Cpartial%20P%7D%7B%5Cpartial%20y%7D%5Cfrac%7B1%2By%2Fk%7D%7BP%7D&#038;bg=FFFFFF&#038;fg=000000&#038;s=0" title="D=-\frac{\partial P}{\partial y}\frac{1+y/k}{P}" style="vertical-align:-20%;" class="tex" alt="D=-\frac{\partial P}{\partial y}\frac{1+y/k}{P}" />.</p>

<p>When <img src="http://l.wordpress.com/latex.php?latex=k%5Crightarrow%5Cinfty&#038;bg=FFFFFF&#038;fg=000000&#038;s=0" title="k\rightarrow\infty" style="vertical-align:-20%;" class="tex" alt="k\rightarrow\infty" />, we have <img src="http://l.wordpress.com/latex.php?latex=D%3D-%5Cfrac%7B%5Cpartial%20P%7D%7B%5Cpartial%20y%7D%5Cfrac%7B1%7D%7BP%7D&#038;bg=FFFFFF&#038;fg=000000&#038;s=0" title="D=-\frac{\partial P}{\partial y}\frac{1}{P}" style="vertical-align:-20%;" class="tex" alt="D=-\frac{\partial P}{\partial y}\frac{1}{P}" /> which is also defined as modified duration. One important property of duration is that duration can be expressed as a weighted average of cash flow times.</p>

<p><img src="http://l.wordpress.com/latex.php?latex=D%3D-%5Cfrac%7B%5Cpartial%20P%7D%7B%5Cpartial%20y%7D%5Cfrac%7B1%2By%2Fk%7D%7BP%7D%3D%5Csum%5EN_%7Bi%3D1%7D%5Cfrac%7B1%7D%7BP%7D%5Cfrac%7BCF%28t_i%29t_i%7D%7B%281%2By%2Fk%29%5E%7Bkt_i%7D%7D%3Dw_i%5Ccdot%20t_i&#038;bg=FFFFFF&#038;fg=000000&#038;s=0" title="D=-\frac{\partial P}{\partial y}\frac{1+y/k}{P}=\sum^N_{i=1}\frac{1}{P}\frac{CF(t_i)t_i}{(1+y/k)^{kt_i}}=w_i\cdot t_i" style="vertical-align:-20%;" class="tex" alt="D=-\frac{\partial P}{\partial y}\frac{1+y/k}{P}=\sum^N_{i=1}\frac{1}{P}\frac{CF(t_i)t_i}{(1+y/k)^{kt_i}}=w_i\cdot t_i" />.</p>

<p>PVBP and duration measure the first order sensitivity to the change of rate while convexity measures the second order sensitivity.</p>

<p><img src="http://l.wordpress.com/latex.php?latex=Cx%3D%5Cfrac%7B1%7D%7B2%7D%5Cfrac%7B%5Cpartial%5E2P%7D%7B%5Cpartial%20y%5E2%7D%5Cfrac%7B1%7D%7BP%7D&#038;bg=FFFFFF&#038;fg=000000&#038;s=0" title="Cx=\frac{1}{2}\frac{\partial^2P}{\partial y^2}\frac{1}{P}" style="vertical-align:-20%;" class="tex" alt="Cx=\frac{1}{2}\frac{\partial^2P}{\partial y^2}\frac{1}{P}" /></p>

<p>Hence we can hedge against small parallel shifts in yield curve by making portfolio's PVBP zero and hedge against large parallel shifts by making convexity zero.</p>

<p>We have seen the importance of zero coupon bond curve. We can and we have to use them to calculate the present value of a cash flow. In practical world, we often use a way called bootstraping-interpolation to strip the zero-coupon bond price out of market data. Basically, it is to solve linear equations of cash flows to get the zero bond price at every node. By using this way, we could not only calculate zero bond price but also continuous forward rate, continuous spot rate and discretely compounded yields.</p>

<p>The last thing for this review is how to interpolate zero coupon bonds. From my point of view, the most popular way and its special cases can be called polynomial spline, which briefly speaking is to assume the zero bond price between two different time nodes could be expressed as polynomials.</p>

<p><a href="http://ichentao.com/upload/HW2.doc">HW 2</a>, <a href="http://ichentao.com/upload/HW2_ChenTao.xlsx">My Solution</a></p>
]]></content:encoded>
			<wfw:commentRss>http://ichentao.com/blog/archives/1911/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Fixed Income Modeling Review 1</title>
		<link>http://ichentao.com/blog/archives/1896/</link>
		<comments>http://ichentao.com/blog/archives/1896/#comments</comments>
		<pubDate>Tue, 10 May 2011 19:22:56 +0000</pubDate>
		<dc:creator>Tao</dc:creator>
				<category><![CDATA[技术]]></category>
		<category><![CDATA[科学人]]></category>
		<category><![CDATA[Fixed Income]]></category>
		<category><![CDATA[Mathematical Finance]]></category>

		<guid isPermaLink="false">http://ichentao.com/?p=1896</guid>
		<description><![CDATA[Fixed income modeling is one of the major areas of mathematical finance, which is usually more complicated than stock market modeling. Not surprisingly, "Theory and Practice of Fixed Income Modeling" is among the core courses of our program. The lecturer... ]]></description>
			<content:encoded><![CDATA[<p>Fixed income modeling is one of the major areas of mathematical finance, which is usually more complicated than stock market modeling. Not surprisingly, "Theory and Practice of Fixed Income Modeling" is among the core courses of our program. The lecturer is Andrei Lyashenko who used to be a mathematics professor at UIC and now he is working at QRM as a quant. We were taught the theoretical part in class and our homework is done in excel as practitioners do in industry. I just finish this semester and if I let it go I would probably forget the details in 3 months. So it is better for me to have a whole review of this class.</p>

<p>The first thing is to justify all types of risks in fixed income market: credit risk, interest rate risk, liquidity risk, cash flow timing risk, cash flow amount risk, foreign exchange risk, inflation risk and taxation risk. Different products are exposed to different risks. For example, since the US government is unlikely to get default, the credit risk does not present for treasure bonds. However, for debt issued by corporations such as citigroup, credit risk does present. Callability, fixed or floating rate, a lot of aspects need to be taken into account as you consider the potential risk.</p>

<p>The very basic contract considered in fixed income modeling is zero-coupon bond and the first tricky question is does <img src="http://l.wordpress.com/latex.php?latex=P%28t%2CT%29%5Cleq%201&#038;bg=FFFFFF&#038;fg=000000&#038;s=0" title="P(t,T)\leq 1" style="vertical-align:-20%;" class="tex" alt="P(t,T)\leq 1" /> for any <img src="http://l.wordpress.com/latex.php?latex=t%3CT&#038;bg=FFFFFF&#038;fg=000000&#038;s=0" title="t<T" style="vertical-align:-20%;" class="tex" alt="t<T" />. While the first thought comes to most people is: if the market does not allow negative rates, then it is true. However, this question actually has not much to do with positive or negative rates. Since you can always hold 1 dollar instead of invest it by buying zero-coupon bond, then if the price of zero-coupon bond is higher than 1 such contract would not exist any more. So what are the assumptions when we think about fixed income modeling?</p>

<p>-- Zero bonds of all maturities are traded</p>

<p>-- No transaction cost</p>

<p>-- Securities are perfectly divisible</p>

<p>-- Short selling is permitted</p>

<p>-- No arbitrage</p>

<p>Because of no arbitrage, discount factor <img src="http://l.wordpress.com/latex.php?latex=D%28t%2CT%29&#038;bg=FFFFFF&#038;fg=000000&#038;s=0" title="D(t,T)" style="vertical-align:-20%;" class="tex" alt="D(t,T)" /> should equal the zero bond price <img src="http://l.wordpress.com/latex.php?latex=P%28t%2CT%29&#038;bg=FFFFFF&#038;fg=000000&#038;s=0" title="P(t,T)" style="vertical-align:-20%;" class="tex" alt="P(t,T)" />.</p>

<p>The next important thing is to clarify the kinds of rates:</p>

<p>-- Spot rate: is the constant rate that makes the investment of <img src="http://l.wordpress.com/latex.php?latex=P%28t%2CT%29&#038;bg=FFFFFF&#038;fg=000000&#038;s=0" title="P(t,T)" style="vertical-align:-20%;" class="tex" alt="P(t,T)" /> at current time become 1 unit of currency at maturity</p>

<p>-- Forward rate: is a generalization of spot rate. Only assume that the investment happens at a future time and the maturity is some time further. 3-months or 1/4-year forward rates are usually called Libor Rates. By examine the contract of FRA we can prove that <img src="http://l.wordpress.com/latex.php?latex=P%28t%2CT%29%5Ccdot%20P%28t%2CT%2CS%29%3DP%28t%2CS%29&#038;bg=FFFFFF&#038;fg=000000&#038;s=0" title="P(t,T)\cdot P(t,T,S)=P(t,S)" style="vertical-align:-20%;" class="tex" alt="P(t,T)\cdot P(t,T,S)=P(t,S)" />. There are also instantaneous forward rates defined as <img src="http://l.wordpress.com/latex.php?latex=F%28t%2CT%29%3D%5Clim_%7BT%5Crightarrow%20S%7DF%28t%2CT%2CS%29%3D-%5Cfrac%7B%5Cpartial%5Cln%28P%28t%2CT%29%29%7D%7B%5Cpartial%20T%7D&#038;bg=FFFFFF&#038;fg=000000&#038;s=0" title="F(t,T)=\lim_{T\rightarrow S}F(t,T,S)=-\frac{\partial\ln(P(t,T))}{\partial T}" style="vertical-align:-20%;" class="tex" alt="F(t,T)=\lim_{T\rightarrow S}F(t,T,S)=-\frac{\partial\ln(P(t,T))}{\partial T}" />, and it has nothing to do with day counts and compounding. Remember forward and short rate (<img src="http://l.wordpress.com/latex.php?latex=r%28t%29%3DF%28t%2Ct%29&#038;bg=FFFFFF&#038;fg=000000&#038;s=0" title="r(t)=F(t,t)" style="vertical-align:-20%;" class="tex" alt="r(t)=F(t,t)" />) are purely theoretical and are not observed on the market.</p>

<p>-- Par rate: is the bond coupon rate that makes its price equal to its principle. It can be explained as the weighted average of Libor rates.</p>

<p>At the same time, spot rate is an average of instantaneous forward rates. Actually, <img src="http://l.wordpress.com/latex.php?latex=F%28t%2CT%29%3D-%5Cfrac%7B%5Cpartial%5Cln%28P%28t%2CT%29%29%7D%7B%5Cpartial%20T%7D&#038;bg=FFFFFF&#038;fg=000000&#038;s=0" title="F(t,T)=-\frac{\partial\ln(P(t,T))}{\partial T}" style="vertical-align:-20%;" class="tex" alt="F(t,T)=-\frac{\partial\ln(P(t,T))}{\partial T}" /> implies that <img src="http://l.wordpress.com/latex.php?latex=%5Cint%5ET_t%20F%28t%2Cs%29ds%3D-%5Cln%28P%28t%2CT%29%29&#038;bg=FFFFFF&#038;fg=000000&#038;s=0" title="\int^T_t F(t,s)ds=-\ln(P(t,T))" style="vertical-align:-20%;" class="tex" alt="\int^T_t F(t,s)ds=-\ln(P(t,T))" />, and therefore, <img src="http://l.wordpress.com/latex.php?latex=R%28t%2CT%29%3D%5Cfrac%7B1%7D%7BT-t%7D%5Cint%5ET_t%20F%28t%2Cs%29ds&#038;bg=FFFFFF&#038;fg=000000&#038;s=0" title="R(t,T)=\frac{1}{T-t}\int^T_t F(t,s)ds" style="vertical-align:-20%;" class="tex" alt="R(t,T)=\frac{1}{T-t}\int^T_t F(t,s)ds" />.</p>

<p>Price of fixed income derivatives are often quoted by yield, and yield curve is a plot of rates against their maturities.</p>

<p>Last for review 1 is to introduce the fixed income derivatives:</p>

<p>-- Bonds</p>

<p>-- FRA: OTC, a rate decided ahead, lending and borrowing starting and ending in the future</p>

<p>-- Interest rate swap</p>

<p>-- Swaption: is an OTC contract giving its holder the right but not the obligation to enter into a swap contract</p>

<p>-- Caps and Floors: cash flows at one time is called caplet or floorlet and are defined as</p>

<p><img src="http://l.wordpress.com/latex.php?latex=CF%28T_i%29%3DL%5Ctau%28T_%7Bi-1%7D%2CT_i%29%5Cmax%5B0%2CR%28T_%7Bi-1%7D%2CT_i%29-R_K%5D&#038;bg=FFFFFF&#038;fg=000000&#038;s=0" title="CF(T_i)=L\tau(T_{i-1},T_i)\max[0,R(T_{i-1},T_i)-R_K]" style="vertical-align:-20%;" class="tex" alt="CF(T_i)=L\tau(T_{i-1},T_i)\max[0,R(T_{i-1},T_i)-R_K]" /></p>

<p>or</p>

<p><img src="http://l.wordpress.com/latex.php?latex=CF%28T_i%29%3DL%5Ctau%28T_%7Bi-1%7D%2CT_i%29%5Cmax%5B0%2CR_K-R%28T_%7Bi-1%7D%2CT_i%29%5D&#038;bg=FFFFFF&#038;fg=000000&#038;s=0" title="CF(T_i)=L\tau(T_{i-1},T_i)\max[0,R_K-R(T_{i-1},T_i)]" style="vertical-align:-20%;" class="tex" alt="CF(T_i)=L\tau(T_{i-1},T_i)\max[0,R_K-R(T_{i-1},T_i)]" />.</p>

<p><a href="http://ichentao.com/upload/HW_1.doc">HW 1</a>, <a href="http://ichentao.com/upload/HW1_ChenTao.xlsx">My Solution</a></p>
]]></content:encoded>
			<wfw:commentRss>http://ichentao.com/blog/archives/1896/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>G2 刷机笔记</title>
		<link>http://ichentao.com/blog/archives/1770/</link>
		<comments>http://ichentao.com/blog/archives/1770/#comments</comments>
		<pubDate>Sat, 22 May 2010 04:46:04 +0000</pubDate>
		<dc:creator>Tao</dc:creator>
				<category><![CDATA[技术]]></category>
		<category><![CDATA[极客]]></category>
		<category><![CDATA[Android]]></category>
		<category><![CDATA[G2]]></category>

		<guid isPermaLink="false">http://ichentao.com/?p=1770</guid>
		<description><![CDATA[虽然刷机已经很熟练了，但是有些命令并没有背下来，为了以后查找方便，决定写一篇日志，把要点记录下。 刷机刷的是 rom，但任何 rom 都有自己对应的 SPL 和 Radio，如果 rom 和 SPL 以及 Radio 不... ]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.flickr.com/photos/cherntodd/4626311501/" title="cj-deals-htc-magic by Todd - 魔群月光, on Flickr"><img src="http://farm5.static.flickr.com/4043/4626311501_1c8e963388_o.jpg" width="386" height="409" alt="cj-deals-htc-magic" /></a></p>

<p>虽然刷机已经很熟练了，但是有些命令并没有背下来，为了以后查找方便，决定写一篇日志，把要点记录下。</p>

<p>刷机刷的是 rom，但任何 rom 都有自己对应的 SPL 和 Radio，如果 rom 和 SPL 以及 Radio 不对应，那么是无法进入系统的，因此刷机的第一步是升级/降级 SPL 和 Radio。</p>

<p>这里略过 AndroidSDK 和驱动的安装问题。将要刷的 rom 拷进 sd 卡，在关机的情况下，同时按住电源和后退键，进入 fastboot 模式，然后将手机用数据线连接至电脑，接着要在电脑上输入如下命令行：</p>

<blockquote>
<p>fastboot flash radio Radio_HTC_PVT_32A_6.35.10.18.img<br />
fastboot flash hboot hboot-1.76.2007.img<br />
fastboot flash recovery recovery-RA-hero-v1.5.2.img<br />
fastboot erase system -w<br />
fastboot reboot-bootloader</p>
</blockquote>

<p>其中，可以将上面的命令替换成自己想刷的 Radio，hboot 和 recovery 的文件名。</p>

<p>到此为止，刷好了 SPL，Radio 和 recovery，可以刷 rom 了。但是有的时候，想刷的 rom 对应的是低版本的 SPL 和 Radio，这就需要降级。</p>

<p>我自己的理解是，在升级 SPL 和 Radio 时，是先刷 Radio 再刷 SPL，所以降级时先降 SPL 再降 Radio。</p>

<blockquote>
<p>
fastboot flash hboot xxxx.img<br />
fastboot flash radio xxxx.img<br />
fastboot erase system -w<br />
fastboot erase boot<br />
fastboot erase recovery<br />
fastboot flash recovery xxxx.img<br />
</p>
</blockquote>

<p>下面是关机，然后同时按住房子键和开关键，等到出现第一屏时松手，手机会进入 recovery 模式，wipe 之后就可以刷 rom 了。</p>
]]></content:encoded>
			<wfw:commentRss>http://ichentao.com/blog/archives/1770/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
	</channel>
</rss>

