Tudat/Mathematics/Statistics/multiVariateGaussianProbabilityDistributions.cpp
//! Function to evaluate pdf of Gaussian cupola distribution
Function to evaluate pdf of Gaussian cupola distribution
Function to evaluate pdf of Gaussian cupola distribution
double GaussianCopulaDistributionXd::evaluatePdf(
        const Eigen::VectorXd& independentVariables )
{
    double probabilityDensity = 0.0 ;
    int inBound = 0 ;
    for( int i = 0 ; i < dimension_ ; i++ )
    {
        if( independentVariables(i) > 0.0 && independentVariables(i) < 1.0 )
        {
            inBound++;
        }
    }
    if( inBound == dimension_ )
    {
        Eigen::VectorXd gaussianQuantiles( dimension_ ) ;
        boost::math::normal distribution( 0.0 , 1.0 );
        for( int i = 0 ; i < dimension_ ; i++ )
        {
            gaussianQuantiles( i ) = boost::math::quantile( distribution , independentVariables( i ) ); 
        }
        Eigen::MatrixXd location = - 0.5 * ( gaussianQuantiles.transpose() *
                       ( inverseCorrelationMatrix_ - Eigen::MatrixXd::Identity( dimension_ , dimension_ ) ) *
                                             gaussianQuantiles );
        probabilityDensity = ( ( 1.0 / ( std::sqrt( determinant_ ) ) ) * std::exp( location( 0, 0 ) ) ) ;
    }
    return probabilityDensity ;
}
double GaussianCopulaDistributionXd :: evaluatePdf ( const Eigen :: VectorXd & independentVariables ) { double probabilityDensity = 0.0 ; int inBound = 0 ; for ( int i = 0 ; i < dimension_ ; i ++ ) { if ( independentVariables ( i ) > 0.0 && independentVariables ( i ) < 1.0 ) { inBound ++ ; } } if ( inBound == dimension_ ) { Eigen :: VectorXd gaussianQuantiles ( dimension_ ) ; boost :: math :: normal distribution ( 0.0 , 1.0 ) ; for ( int i = 0 ; i < dimension_ ; i ++ ) { gaussianQuantiles ( i ) = boost :: math :: quantile ( distribution , independentVariables ( i ) ) ; } Eigen :: MatrixXd location = - 0.5 * ( gaussianQuantiles . transpose ( ) * ( inverseCorrelationMatrix_ - Eigen :: MatrixXd :: Identity ( dimension_ , dimension_ ) ) * gaussianQuantiles ) ; probabilityDensity = ( ( 1.0 / ( std :: sqrt ( determinant_ ) ) ) * std :: exp ( location ( 0 , 0 ) ) ) ; } return probabilityDensity ; }
Function to evaluate pdf of Gaussian cupola distribution
Function to evaluate pdf of Gaussian cupola distribution
// Check if vector independentVariables is inside [0,1] // If data is in bounds // Convert U[0,1] to N[0,1] using inverse CDF of standard normal distribution // Inverse cdf // Calculate probability density