対数正規分布と伊藤の補助定理

最近伊藤過程から関数の期待値と変動率の計算を考えています。It is well-documented (eg Hull) that, starting with the diffusion process for a stock price S as geometric Brownian motion, one can find the diffusion process for ln(S) via Ito's lemma.  The diffusion process for S is dS = mu*S*dt+ sigma*S*dW.  Ito's lemma is used to derive the diffusion process for dln(S).  This value is normally distributed with mean (mu-sigma^2/2)t and variance sigma^2*t.  However, it does not seem possible to work in the opposite direction, starting with dx = dW and then deriving the diffusion process for f(x) = exp(alpha+beta*x).  This seems to be a contradiction in Ito's lemma.  Firstly, consider the first and second derivatives of f with respect to x, df/dx = beta*f, and d^2f/dx^2=beta^2*f.  df/dt = 0.  Ito's lemma indicates the following (given a diffusion process dx = mu*dt+sigma*dz):  df = (df/dt + mu*(df/dx)+0.5*sigma^2*d^2f/dx^2)dt+sigma*(df/dx)*dW.  Thus, for f(x) = exp(alpha+beta*x), we set sigma=1, mu=0, df = (0+0+0.5*(beta^2f))dt+beta*f*dW.  This would imply a mean of (0.5*beta^2f)T, which differs markedly from the lognormal mean value of exp(alpha+0.5*beta^2).  However, some other sources seem to show comparable derivations of a diffusion using Ito's lemma (cf NYU stochastic calculus (2013) lecture notes by Goodman) without comparing the mean or variance with that of the lognormal distribution which uses similar first and second order derivatives of the exponential.  It may be that it is necessary to write the alpha value above in terms of the time variable t.  This would enable the time derivative to be non-zero also.  However, it is unclear how the beta multiplier outside of the exponential would be nullified and an additive sigma^2/2 term be moved into the exponential.  In fact, setting alpha=(r-beta^2/2)*t ,which is the expected rate of return over time t for a lognormal random variable with growth rate r, means that df/dt = (-0.5*beta^2)*f.  In addition, rather than use the form of Ito's lemma above, which assumes a geometric Brownian motion for x, we use the Taylor series expansion (2nd order in x, 1st order in time) for df = (df/dt)dt+(df/dx)dx+(1/2)(d^2f/(dx)^2)(dx)^2, where dx=dW and (dx)^2=dt.  Thus, the (0.5*beta^2)f terms drop out.  We are left with df = r*f*dt+beta*f*dW.  Note that "f" appears in both terms, making this a geometric Brownian motion.  Differential equation theory would indicate that this yields E(f) = E(S)= exp(rt), which is equivalent to exp(alpha+0.5*beta^2).  The variance would be based on the notion that (E(f))^2 = exp(2*alpha+beta^2) and var(f) = E(f^2)-(E(f))^2.  Assuming that the probability distribution can be used to show E(f^2) = exp(2*alpha+2*beta^2), we have solved for the lognormal variance of exp(2*alpha+beta^2)*(exp(beta^2)-1).

Thus, there does seem to be a way to derive the lognormal diffusion, mean, and variance via Ito's lemma starting from a standard normal arithmetic Brownian motion diffusion dx = dW.  However, the intuition to set f(x) = exp((r-0.5*beta^2)t+beta*x) is not easy to see.

動的計画法、モジュラ計算、再帰の関数

最近コードフオースのの問題を解くために三つのテーマがある苦しい所を見ています。 A dynamic programming approach mapping the number of bits set in a number to its transforms to 1, the computation of a quotient mod m, and the ability to obtain recursive behavior without exhausting the stack are concerns. 再帰の数が多くてスタック空間が足りない心配があるがもっと効果的なアルゴリズムを考えられません。それ以外、モジュラに関わる割る処分がちょっと手数になる。The modular division operation requires the modular multiplicative inverse, which can be output by the extended Euclidean algorithm. This algorithm outputs gcd(a,b), which in this case will be the divisor k and the modular operand m. However, it also outputs x and y such that ax+by=gcd. As k and m are relatively prime, this simplifies to kx+ym = 1. Then, taking both sides mod m yields kx mod m + ym mod m = 1 (mod m). bm mod m is trivially 0. Thus, the equation is simply kx=1 mod m, so, given x from the algorithm, the modular multiplicative inverse of k is known. Then, to find (a/k)%m, take (a*x)%m.
参照
以下のサイトの説明に詳細が書かれています。
https://www.geeksforgeeks.org/multiplicative-inverse-under-modulo-m/
https://www.geeksforgeeks.org/modular-division/
The intuition behind the algorithm is a pair of recurrence relations and induction.
デバッグ用のログからのユークリッド計算の例を貼り付けます。calling exteuc on 8, 1000000007
extEuc end, retV 1, a 8, b 1000000007, x 125000001, y -1, rdr 0, quot 7
exteuc outputs jmodinv 125000001
calling exteuc on 9, 1000000007
extEuc end, retV 1, a 9, b 1000000007, x 111111112, y -1, rdr 0, quot 8
exteuc outputs jmodinv 111111112
もう一つの難しいところがあった。001の場合に一ビットがありますが変換の数がゼロだからこのケースを変換一の合計から引くのが必要です。

クレジット・デフォルト・スワップの値

最近ブリゴ氏とアルフォンセィの論文
を読んでいるけどよく分からない。the author's discuss a Poisson process for defaults and then bring up a variable "uppercase gamma", which seems to represent the number of defaults up to t. However, exp(-(G(u)-G(t))) seems to be used as both the probability and discount factor, and accounts for cases where the default time tai occurs after u.

確率微分方程式とオプション値計算

最近確立過程とSDEを学びながら停止時間と到達時間の計算式を見ています。難しい所は複数ありますが特に偏微分方程式の作り方とコロモゴロフの前向きと後ろ向き方程式の使い方が問題点だった。それ以外はPx,0(tau>T)=x/sqrt(2*pi*T)はよく分からない。N(0) = 1/2 and N'(0) = 1/sqrt(2pi). Here, though, it would seem that the derivative element of N'(0) is not the time derivative but the position derivative. In addition, there seems to be no relationship between the N(0), N'(0), and Px,t(tau>T)=1-2N(-x/sqrt(T-t)). Actually, though, the argument inside the normal CDF goes to 0 as T->infinity. たぶん微分に間違いが入っている。N'(0) = 1/sqrt(2*pi*T). Thus, the x/sqrt(2*pi*T) value is likely the one term Taylor series about x.