User:Liuyingzhao

= Test =

= Math =

Expectation Value : http://mathworld.wolfram.com/ExpectationValue.html

Central Limit Theorem : http://mathworld.wolfram.com/CentralLimitTheorem.html

Integer Optimisation : levenberg marquardt

= Random Number Generator =

Normal Deviates
We have two independent uniform numbers x_1, x_2, Use Box-Muller transformation to transform them into two independent random numbers with a Gaussian(Normal) distribution.


 * $$ y_1 = \sqrt {-2 \ln x_1 } \cos (2 \pi x_2) $$
 * $$ y_2 = \sqrt {-2 \ln x_1 } \sin (2 \pi x_2) $$

Link: http://www.taygeta.com/random/gaussian.html

A good uniform random number generator - Mersenne twister.

= Stochastic Processes =

Wiener Process
Property 1. The change ΔW during a small period of time Δt is
 * $$\Delta W = \epsilon \sqrt {\Delta t}, \epsilon \sim \mathbf N(0,1)$$.

Property 2. The values of ΔW for any short intervals of time Δt are independent.
 * $$ W_t - W_s \sim  \mathbf N(0, \sqrt {t - s}), t > s > 0 $$

Paths of Wiener process are not differentiable functions. Wiener process is also random walk.

Ito's Integral

 * $$I(t) = I(0) + \int_{0}^{T} \Delta (t) \, \mathrm{d} W_t$$

We can see $$\Delta (t) $$ as the trading position, then Ito's integral is defined as the gain from tradng in the martingale W(t).

Properties
Let T be a positive constant and let $$\Delta (t), 0 \le t \le T $$, be an adapted stochastic process tha satisfies $$ \mathbb E \int_0^T \Delta ^2 (t) \, \mathrm d t < \infty $$. Then $$ I(t) = \int_0^T \Delta (u) \, \mathrm d W(u) $$ has the following properties:


 * Continuity - As a functionof the upper limit of integration t, the paths of I(t) are continuous.


 * Adaptivity - For each t, I(t) is F(t)-measurable.


 * Linearity - If $$ I(t) = \int_0^T \Delta (u) \, \mathrm d W(u) $$ and $$ J(t) = \int_0^T \Gamma (u) \, \mathrm d W(u) $$, then $$ I(t) \pm J(t) = \int_0^T (\Delta (u) \pm \Gamma (u)) \, \mathrm d W(u) $$. Furthermore, for every constant c, $$ c I(t) = \int_0^T c \Delta (u) \, \mathrm d W(u) $$


 * Martingale I(t) is a martingale.


 * Ito isometry $$ \mathbb E I^2(t) = \mathbb E \int_0^T \Delta ^2(u) \, \mathrm d u $$


 * Quadratic variation $$ [I,I](t) = \int_0^T \Delta ^2(u) \, \mathrm d u $$

Example

 * $$ \int_0^T W (t) \, \mathrm d W(t) = \frac 12 W^2(T) - \frac 12 [W,W](T) = \frac 12 W^2(T) - \frac 12 T $$

If g is a differentiable function with g(0) = 0, then


 * $$ \int_0^T g (t) \, \mathrm d g(t) = \frac 12 g^2(T) $$

The extra term $$ - \frac 12 T $$ comes from teh nonzero quadratic variation of Brownian motion and the way when constructed the Ito integral, always evaluating the integrand at the eft-hand endpoint of the subinterval. If we evaluate at the midpoint insted, we will not have this term. The integral obtained from this is called Stratonovich integral. However, it is inappropriate or finance, because in finance, the position in an asset is decided at the begining of the time interval, but not in the middle.

Generalized Wiener Process

 * $$dx = a dt + b dW $$

Integrating with respect to time,


 * $$ X_t - X_0 = a t + b W_t $$

Ito Process

 * $$ dX = a(x, t) dt + b(x, t) dW $$

Ito's Lemma

 * $$ d f(X,t) = \frac{\partial f}{\partial t} \ dt +  \frac{\partial f}{\partial X} \ dX + \frac 1 2 \frac{\partial ^2 f}{\partial X^2} \ dX dX $$

Stock prices

 * $$ dS = \mu S dt + \sigma S dW $$

Using Ito's lemma, we get the log difference following log normal distribution.
 * $$ d ln S = (\mu - \frac 12 \sigma ^ 2) dt + \sigma d W $$

Integrating it with respect to time,
 * $$ S_t - S_0 = (\mu - \frac 12 \sigma ^ 2) t + \sigma W_t $$

Correlated stock prices
Suppose


 * $$ \frac {d S_1(t)}{S_1(t)} = \alpha _1 dt + \sigma _1 d W_1(t) $$,


 * $$ \frac {d S_2(t)}{S_2(t)} = \alpha _2 dt + \sigma _2 [\rho d W_1(t) + \sqrt {1 - \rho ^2} d W_2(t)] $$,

to analyze teh second stock process, we define


 * $$ d W_3(t) = \rho d W_1(t) + \sqrt {1 - \rho ^2} d W_2(t) $$,

then $$ d W_3(t) $$ is a continuous martingale and $$ d W_3(t) d W_3(t) = $$...(substitute by the above equation)...$$ = dt $$. Hence $$ d W_3 (t) $$ is a Brownian moion.

Brownian Bridge
From 0 to 0,


 * $$ X(t) = W(t) - \frac tT W(T), 0 \le t \le T $$

From a to b,


 * $$ X(t) = a + \frac {(b-a)t}{T} + W(t) - \frac tT W(T), 0 \le t \le T $$

= Interest Rate Models =

Change of Numeraire
Radon–Nikodym Theorem : http://mathworld.wolfram.com/Radon-NikodymTheorem.html

Zero-coupon bond
The price of a zero-coupon bond at time t for Maturity T is
 * $$P(t,T) = E_t\{e^{-\int_t^Tr(s)\,ds}\}$$.

If we can characterize the distribution of $$e^{-\int_t^Tr(s)\,ds}$$ in terms of a chosen dynamics for r, conditional on the information available on t, we'll be able to compute bond price P.

Market price of risk
Market price of risk is defined as "excess return with respect to a risk-free investment per unit of risk".
 * $$ \lambda (t) = \frac {\mu (t,r(t)) - r(t) P(t,T)} {\sigma (t,r(t))}$$

Two-factors short-rate models
= Curve Building = $$df_{t,T} = e ^ {- r_{t,T} (T-t) } $$

Fixed three factors representing term structure (CreditDelta's curve factors).


 * $$e1(t) = 1 $$
 * $$e2(t) = -2.273801+32.73801 \ \frac {1-e^{-0.1t}} {t} $$
 * $$e3(t) = 0.991674 - 22.05661 \ \frac {1-e^{-0.1t}} {t} + 2.213987 \ \frac {1-e^{-t}} {t} $$

= Statistics =

EWMA
 * $$ S_t = (1-\lambda) x_t + \lambda S_{t-1} = (1-\lambda) ( x_t + \lambda x_{t-1} + \lambda^2 x_{t-2} + ...) $$

half life
 * $$ \lambda^n = 0.5, n = \frac {\ln 0.5}{\ln \lambda} $$

covariance matrix
 * $$ \Sigma \approx \mathrm X ^T \mathrm X $$

= Useful Info = c# compiler under unix: http://mono-project.com/Main_Page