QuantLib: a free/open-source library for quantitative finance
fully annotated source code - version 1.34
|
Cumulative (generalized) BehrensFisher distribution. More...
#include <convolvedstudentt.hpp>
Public Member Functions | |
CumulativeBehrensFisher (const std::vector< Integer > °reesFreedom=std::vector< Integer >(), const std::vector< Real > &factors=std::vector< Real >()) | |
const std::vector< Integer > & | degreeFreedom () const |
Degrees of freedom of the Ts involved in the convolution. More... | |
const std::vector< Real > & | factors () const |
Factors in the linear combination. More... | |
Probability | operator() (Real x) const |
Returns the cumulative probability of the resulting distribution. More... | |
Probability | density (Real x) const |
Returns the probability density of the resulting distribution. More... | |
Private Member Functions | |
std::vector< Real > | polynCharactT (Natural n) const |
Student t characteristic polynomials. More... | |
std::vector< Real > | convolveVectorPolynomials (const std::vector< Real > &v1, const std::vector< Real > &v2) const |
Private Attributes | |
std::vector< Integer > | degreesFreedom_ |
std::vector< Real > | factors_ |
std::vector< std::vector< Real > > | polynCharFnc_ |
std::vector< Real > | polyConvolved_ |
Real | a_ = 0. |
Real | a2_ |
Cumulative (generalized) BehrensFisher distribution.
Exact analitical computation of the cumulative probability distribution of the linear combination of an arbitrary number (not just two) of T random variables of odd integer order. Adapted from the algorithm in:
\todo Implement the series expansion solution for the addition of two Ts of even order described in: 'On the density of the sum of two independent Student t-random vectors' C.Berg, C.Vignat; June 2009; eprint arXiv:0906.3037
Definition at line 60 of file convolvedstudentt.hpp.
CumulativeBehrensFisher | ( | const std::vector< Integer > & | degreesFreedom = std::vector<Integer>() , |
const std::vector< Real > & | factors = std::vector<Real>() |
||
) |
degreesFreedom | Degrees of freedom of the Ts convolved. The algorithm is limited to odd orders only. |
factors | Factors in the linear combination of the Ts. |
Definition at line 30 of file convolvedstudentt.cpp.
const std::vector< Integer > & degreeFreedom | ( | ) | const |
Degrees of freedom of the Ts involved in the convolution.
Definition at line 72 of file convolvedstudentt.hpp.
const std::vector< Real > & factors | ( | ) | const |
Factors in the linear combination.
Definition at line 76 of file convolvedstudentt.hpp.
Student t characteristic polynomials.
Generates the polynomial coefficients defining the characteristic function of a T distribution \(T_\nu\) of odd order; \(\nu=2n+1\). In general the characteristic function is given by:
\[ \phi_{\nu}(t) = \varphi_{n}(t) \exp{-\nu^{1/2}|t|} ;\,where\,\nu = 2n+1 \]
where \( \varphi \) are polynomials that are computed recursively.
The convolved characteristic function is the product of the two previous characteristic functions and the problem is then the convolution (a product) of two polynomials.
@param n Natural number defining the order of the T for which the characteristic function is to be computed. The order of the T is then \f$ \nu=2n+1 \f$
Definition at line 72 of file convolvedstudentt.cpp.
Probability operator() | ( | Real | x | ) | const |
Returns the cumulative probability of the resulting distribution.
\[ \int_0^{\infty}x^n e^{-ax}sin(bx)dx = (-1)^n \Gamma(n+1) \frac{sin((n+1)arctg2(-b/a))} {(\sqrt{a^2+b^2})^{n+1}}; for\,a>0,\,b>0 \]
and for the first term I use:\[ \int_0^{\infty} \frac{e^{-ax}sin(bx)}{x} dx = arctg2(b/a) \]
The GP complex integration is simplified thanks to the symetry of the distribution.Definition at line 115 of file convolvedstudentt.cpp.
Probability density | ( | Real | x | ) | const |
Returns the probability density of the resulting distribution.
Definition at line 133 of file convolvedstudentt.cpp.
|
mutableprivate |
Definition at line 138 of file convolvedstudentt.hpp.
|
mutableprivate |
Definition at line 139 of file convolvedstudentt.hpp.
|
mutableprivate |
Definition at line 141 of file convolvedstudentt.hpp.
|
mutableprivate |
Definition at line 142 of file convolvedstudentt.hpp.
|
mutableprivate |
Definition at line 145 of file convolvedstudentt.hpp.
|
private |
Definition at line 145 of file convolvedstudentt.hpp.