Multivariate Analysis Package
0.3
A multivariate distributions analysis package
|
Archimedean Copulas base class. More...
#include <AbstarctArchimedeanCopula.h>
Public Member Functions | |
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... | |
virtual Eigen::VectorXd | GetQuantile (double Prob) const =0 |
Computes the inverse copula function in correspondence of the supplied probability. 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... | |
virtual bool | SetTheta (double t) |
Set the dependence parameter. More... | |
Unsafe Methods | |
The methods in this group use unsafe memory access or return arrays allocated on the heap that must be manually deleted. These functions are normally not compiled for safety reasons. To use them, the mvPackageUnsafeMethods symbol must be defined at compile time | |
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... | |
Archimedean Copulas base class.
Class that works as an interface to Archimedean copulas.
An Archimedean copula of dimension k is defined as:
\( C(u_1 , \cdots , u_k ; \theta)=\psi^{-1}(\psi(u_1 ; \theta)+ \cdots + \psi(u_k ; \theta); \theta) \)
where \( \theta \) is the dependence parameter ruling the distribution and \( \psi(.) \) is the generator function.
To generate samples a boost::random::mt19937 random number generator is used and seeded with std::time(NULL).
If you construct multiple instances of derived classes, 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);
|
inline |
Generates a single simulation from the copula.
This is equal to calling ExtractSamples(1U)
double * AbstractArchimedean::ExtractSampleArray | ( | ) | const |
Generates a single simulation from the copula.
This is equivalent to ExtractSample() but returns an array intead of an Eigen::RowVectorXd. If it can't be calculated, NULL is returned
|
virtual |
Generates multiple simulations from the copula.
NumSamples | The number of simulation to run |
This function uses the algorithm described by Albert W. Marshall and Ingram Olkin, Families of Multivariate Distributions, Journal of the American Statistical Association, Vol. 83, No. 403 (Sep., 1988), pp. 834-841 to sample from the copula distribution.
If NumSamples is less than 1 or the distribution is invalid, an empty matrix will be returned
std::map< unsigned int, std::vector< double > > AbstractArchimedean::ExtractSamplesMap | ( | unsigned int | NumSamples | ) | const |
Generates multiple simulations from the copula.
NumSamples | The number of simulation to run |
This function generates NumSamples simulation from the current copula and returns them in a map form.
If NumSamples is 0 or the distribution is invalid, an empty map is returned
double ** AbstractArchimedean::ExtractSamplesMatix | ( | unsigned int | NumSamples | ) | const |
Generates a single simulation from the copula.
NumSamples | The number of simulation to run |
This is equivalent to ExtractSamples() but returns a matrix intead of an Eigen::MatrixXd. If it can't be calculated, NULL is returned
std::vector< double > AbstractArchimedean::ExtractSampleVector | ( | ) | const |
Generates a single simulation from the copula.
This is equivalent to ExtractSample() but returns an std::vector intead of an Eigen::RowVectorXd
|
virtual |
Computes the copula function in correspondence of the supplied coordinates.
Coordinates | A vector containing the coordinates of the point for which the cdf should be computed |
This is a pure virtual function. Refer to child documentation for specific implementation details
double AbstractArchimedean::GetCumulativeDesity | ( | const std::vector< double > & | Coordinates | ) | const |
Computes the copula function in correspondence of the supplied coordinates.
Coordinates | A vector containing the coordinates of the point for which the cdf should be computed |
This is an overloaded version of GetCumulativeDesity(const Eigen::VectorXd&, bool, unsigned int)const
double AbstractArchimedean::GetCumulativeDesity | ( | double * | Coordinates | ) | const |
Computes the copula function in correspondence of the supplied coordinates.
Coordinates | An array containing the coordinates of the point for which the cdf should be computed |
This is an overloaded version of GetCumulativeDesity(const Eigen::VectorXd& Coordinates, bool UseGenz, unsigned int NumSimul)
|
inline |
Get the random number generator seed.
This function return the seed that was used to initialize the random number generator.
|
virtual |
Computes the probability density function of the copula in correspondence of the supplied coordinates.
Coordinates | A vector containing the coordinates of the point for which the pdf should be computed |
This is a pure virtual function. Refer to child documentation for specific implementation details
double AbstractArchimedean::GetDensity | ( | const std::vector< double > & | Coordinates | ) | const |
Computes the probability density function of the copula in correspondence of the supplied coordinates.
Coordinates | A vector containing the coordinates of the point for which the pdf should be computed |
This is an overloaded version of GetDensity(const Eigen::VectorXd& Coordinates, bool GetLogDensity)const
double AbstractArchimedean::GetDensity | ( | double * | Coordinates | ) | const |
Computes the probability density function of the copula in correspondence of the supplied coordinates.
Coordinates | An array containing the coordinates of the point for which the pdf should be computed |
This is an overloaded version of GetDensity(const Eigen::VectorXd&, bool)
|
inline |
Get the dimensionality of the copula.
|
pure virtual |
Computes the inverse copula function in correspondence of the supplied probability.
Prob | The probability for which the corresponding quantile must be found |
This is a pure virtual function. Refer to child documentation for specific implementation details
Implemented in Multivariate::ClaytonCopula, and Multivariate::GumbelCopula.
double * AbstractArchimedean::GetQuantileArray | ( | double | Prob | ) |
Computes the inverse copula function in correspondence of the supplied probability.
This is equivalent to GetQuantile() but returns an array intead of an Eigen::VectorXd. If it can't be calculated, NULL is returned
std::vector< double > AbstractArchimedean::GetQuantileVector | ( | double | Prob | ) | const |
Computes the inverse copula function in correspondence of the supplied probability.
This is equivalent to GetQuantile() but returns an std::vector intead of an Eigen::VectorXd
|
inline |
Get the dependence parameter.
This function returns the value of the parameter \( \theta \) that governs the dependence
|
inline |
Check if the copula is valid.
If this function returns false the structure of the copula is meaningless and no result will be produced until the invalid parameters are cured.
|
inline |
Set the dimensionality of the copula.
Dimension | the new dimensionality of the copula |
This function will try to change the dimensionality of the copula (e.g. 2 for bivariate, 3 for trivariate, etc.)
If the argument passed is less than 2 the dimensionality will not be changed and the function will return false
void AbstractArchimedean::SetRandomSeed | ( | unsigned int | NewSeed | ) |
Set the random number generator seed.
NewSeed | the new random seed |
|
inlinevirtual |
Set the dependence parameter.
This function sets the value of the parameter \( \theta \) that governs the dependence
This implementation won't perform any check on \( \theta \). See the derived class documentation for specific restrictions
Reimplemented in Multivariate::ClaytonCopula, and Multivariate::GumbelCopula.