ajdmom.ito_mom¶
Itô process moments under Single Square-Root Diffusion Process
The content has also been explained in Program Design page.
Insights¶
All \(\mathbb{E}[I\!E_{n-1,t}^{n_3}I_{n-1,t}^{n_4}I_{n-1,t}^{*n_5}|v_{n-1}]\) can be represented as a “Polynomial” of the following form
where \(b_{ijlopq}\) is the coefficient.
To facilitate the representation and corresponding operations, I designed
a new class Poly which is derived from
UserDict in the Python Standard Library
collections.
Integrals¶
The essential computation in recursive equation (3) of Theory is that of the following integral
For the indefinite integral, we have
where \(c_{nm0} \triangleq \frac{1}{n}\) and
The coefficient \(c_{nmi}\) is implemented in function
c_nmi() which returns a fractions.Fraction
instead of a decimal (float number).
For the definite integral,
where \(F(t) = \int e^{nkt} t^m dt\). The definite integral is implemented
in int_et().
Polynomial Representation¶
The result of the integral, returned by int_et(),
is represented as a “polynomial” of the following form
which is encoded in a Poly, derived from
collections.UserDict, with
keyfor = ('e^{k[t-(n-1)h]}','[t-(n-1)h]','k^{-}'),
key = \((i,j^{'},l)\) and value = \(c_{ij^{'}l}\).
Code Design¶
Itô process moment - I¶
With \(\mathbb{E}[I\!E_{n-1,t}^{n_3}I_{n-1,t}^{n_4}|v_{n-1}]\) represented as a “polynomial” of the following form
consequently, we have
Therefore, it’s profitable to consider the following generic integral
where
Implementation:
Function
int_e_poly()in moduleito_momis defined to accomplish the computation in equation (2) of Program Design.Function
recursive_IEII()in moduleito_momis defined to realize the recursive step in equation (3) of Theory.Function
moment_IEII()in moduleito_momis implemented to calculate \(\mathbb{E}[I\!E_n^{n_3}I_n^{n_4}I_{n-1,t}^{*n_5}|v_{n-1}]\).
For demonstration, I re-write the following initial three moments in Itô process Moments - I in Theory according to the “polynomial” representation
Functions
|
Coefficent \(c_{nmi}\) as in (1). |
|
Integral of \(c \times tp \times \int_{(n-1)h}^t e^{mks} poly ds\) |
|
\(\int_{(n-1)h}^{t} e^{ik[s-(n-1)h]}[s-(n-1)h]^jds\) |
|
\(\mathbb{E}[I\!E_{n-1,t}^{n_3}I_{n-1,t}^{n_4}I_{n-1,t}^{*n_5}|v_{n-1}]\) |
|
Moment of \(v_{n-1}\) as in equation (1) |
|
Convert a polynomial to numerical value |
|
Recursive step in equation (3) |