Multivariate Analysis Package
0.3
A multivariate distributions analysis package
|
Clayton Copula Distribution. More...
#include <ClaytonCopula.h>
Public Member Functions | |
ClaytonCopula (unsigned int Dimension) | |
Construct a Clayton copula with parameter 1. More... | |
ClaytonCopula (unsigned int Dimension, double theta) | |
Construct a Clayton copula with the given parameters. More... | |
double | GetKendallTau () const |
Get the implied Kendall's tau. More... | |
double | GetLowerTailDependence () const |
Get the implied Lower Tail Dependence. More... | |
Eigen::VectorXd | GetQuantile (double Prob) const |
Computes the inverse copula function in correspondence of the supplied probability. More... | |
bool | SetKendallTau (double t) |
Set the dependence parameter through the Kendall's tau. More... | |
bool | SetLowerTailDependence (double ltd) |
Set the dependence parameter through the Lower Tail Dependence. More... | |
bool | SetTheta (double t) |
Set the dependence parameter. More... | |
Public Member Functions inherited from Multivariate::AbstractArchimedean | |
Eigen::RowVectorXd | ExtractSample () const |
Generates a single simulation from the copula. More... | |
virtual Eigen::MatrixXd | ExtractSamples (unsigned int NumSamples) const |
Generates multiple simulations from the copula. More... | |
std::map< unsigned int, std::vector< double > > | ExtractSamplesMap (unsigned int NumSamples) const |
Generates multiple simulations from the copula. More... | |
std::vector< double > | ExtractSampleVector () const |
Generates a single simulation from the copula. More... | |
virtual double | GetCumulativeDesity (const Eigen::VectorXd &Coordinates) const |
Computes the copula function in correspondence of the supplied coordinates. More... | |
double | GetCumulativeDesity (const std::vector< double > &Coordinates) const |
Computes the copula function in correspondence of the supplied coordinates. More... | |
unsigned int | GetCurrentSeed () const |
Get the random number generator seed. More... | |
virtual double | GetDensity (const Eigen::VectorXd &Coordinates) const |
Computes the probability density function of the copula in correspondence of the supplied coordinates. More... | |
double | GetDensity (const std::vector< double > &Coordinates) const |
Computes the probability density function of the copula in correspondence of the supplied coordinates. More... | |
unsigned int | GetDimension () const |
Get the dimensionality of the copula. More... | |
std::vector< double > | GetQuantileVector (double Prob) const |
Computes the inverse copula function in correspondence of the supplied probability. More... | |
double | GetTheta () const |
Get the dependence parameter. More... | |
bool | IsValid () const |
Check if the copula is valid. More... | |
bool | SetDimension (unsigned int Dimension) |
Set the dimensionality of the copula. More... | |
void | SetRandomSeed (unsigned int NewSeed) |
Set the random number generator seed. More... | |
double * | GetQuantileArray (double Prob) |
Computes the inverse copula function in correspondence of the supplied probability. More... | |
double | GetCumulativeDesity (double *Coordinates) const |
Computes the copula function in correspondence of the supplied coordinates. More... | |
double | GetDensity (double *Coordinates) const |
Computes the probability density function of the copula in correspondence of the supplied coordinates. More... | |
double * | ExtractSampleArray () const |
Generates a single simulation from the copula. More... | |
double ** | ExtractSamplesMatix (unsigned int NumSamples) const |
Generates a single simulation from the copula. More... | |
Clayton Copula Distribution.
This class provides the functionality of calculating the probability density value, cumulative probability density value, inverse cumulative probability density and generate random samples from a Clayton copula.
Defining:
The Clayton copula funtion is defined as: \( C(x_1 , \cdots ,x_k )= \psi^{-1}( \psi(x_1) + \cdots + \psi(x_k)) \)
If you construct multiple instances of this class, to avoid the generated samples to be the same, you should supply a different seed. To do so, for example, you can call MyDistribution.SetRandomSeed(MyDistribution.GetCurrentSeed()+1U);
Please refer to the Examples page for usage examples.
ClaytonCopula::ClaytonCopula | ( | unsigned int | Dimension | ) |
Construct a Clayton copula with parameter 1.
Dimension | The dimensionality of the copula |
Construct a Clayton copula distribution with unitary dependence parameter
In case the Dimension is less than 2 the class will be considered invalid (it can be checked using IsValid()
) and won't produce any result until the problem is fixed.
ClaytonCopula::ClaytonCopula | ( | unsigned int | Dimension, |
double | theta | ||
) |
Construct a Clayton copula with the given parameters.
Dimension | The dimensionality of the copula |
theta | The dependence parameter. |
Construct a Clayton copula distribution with the dependence parameter theta.
\( \theta=\frac{2 \tau}{1- \tau} \) where \( \tau \) is the Kendall's tau statistic
In case:
The class will be considered invalid (it can be checked using IsValid()
) and won't produce any result until the problem is fixed.
|
inline |
Get the implied Kendall's tau.
This function returns the value of the Kendall's tau statistic implied by the dependence parameter according to the relation \( \tau = \frac{\theta}{2+ \theta} \)
If the distribution is invalid -1.0 is returned;
double ClaytonCopula::GetLowerTailDependence | ( | ) | const |
Get the implied Lower Tail Dependence.
This function returns the value of the Lower Tail Dependence statistic implied by the dependence parameter according to the relation \( \lambda_L = 2^{- \frac{1}{\theta} }\)
If the distribution is invalid -1.0 is returned;
|
virtual |
Computes the inverse copula function in correspondence of the supplied probability.
Prob | The probability for which the corresponding quantile must be found |
This function computes the inverse cumulative density function of the current distribution associated with the given probability.
The solution is not unique.
Generally the system of equations \( C^{-1}(Coordinates_1 \cdots Coordinates_k)=Prob \) has k-1 degrees of freedom, where k is the dimensionality of the distribution.
The additional restriction imposed to get to an unique solution is that all the coordinates must be equal.
If the coordinates supplied have any component that is greater than 1 or less than 0 or the distribution is invalid, an empty vector is returned.
Implements Multivariate::AbstractArchimedean.
bool ClaytonCopula::SetKendallTau | ( | double | t | ) |
Set the dependence parameter through the Kendall's tau.
t | The Kendall's tau statistic |
This function tries to set \( \theta \), the dependence parameter of the distribution, according to \( \theta = \frac{2 \tau}{1- \tau}\)
If the parameter tau is not within the interval (0,1) the function will return false and the parameter will not be changed.
bool ClaytonCopula::SetLowerTailDependence | ( | double | ltd | ) |
Set the dependence parameter through the Lower Tail Dependence.
ltd | The Lower Tail Dependence statistic |
This function tries to set \( \theta \), the dependence parameter of the distribution, according to \( \theta =- \frac{ln(2)}{ln(\lambda_U)}\)
If the parameter is not within the interval [0,1] the function will return false and the parameter will not be changed.
|
inlinevirtual |
Set the dependence parameter.
t | The new dependence parameter |
This function tries to set the dependence parameter of the distribution to the new value
If the parameter is less or equal to 0 the function will return false and the parameter will not be changed.
Reimplemented from Multivariate::AbstractArchimedean.