-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
1. add generalized Beta' distribution
- Loading branch information
1 parent
9fcbd1f
commit 1f7ae62
Showing
9 changed files
with
640 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,7 +6,7 @@ | |
# @author Vanya BELYAEV [email protected] | ||
# @date 2011-07-25 | ||
# ============================================================================= | ||
"""A set of various smooth shapes and PDFs | ||
""" A set of various smooth shapes and PDFs | ||
- GammaDist_pdf : Gamma-distributuon in shape/scale parameterization | ||
- GenGammaDist_pdf : Generalized Gamma-distribution | ||
|
@@ -15,6 +15,7 @@ | |
- Log10GammaDist_pdf : Gamma-distributuon in shape/scale parameterization | ||
- LogGamma_pdf : Log-Gamma distribution | ||
- BetaPrime_pdf : Beta-prime distribution | ||
- GenBetaPrime_pdf : generalized Beta-prime distribution | ||
- Landau_pdf : Landau distribution | ||
- Argus_pdf : ARGUS distribution | ||
- GenArgus_pdf : Generalized ARGUS distribution | ||
|
@@ -45,6 +46,7 @@ | |
'Log10GammaDist_pdf' , ## Gamma-distributuon in shape/scale parameterization | ||
'LogGamma_pdf' , ## Log-Gamma distribution | ||
'BetaPrime_pdf' , ## Beta-prime distribution | ||
'GenBetaPrime_pdf' , ## generalized Beta-prime distribution | ||
'Landau_pdf' , ## Landau distribution | ||
'Argus_pdf' , ## ARGUS distribution | ||
'GenArgus_pdf' , ## Generalized ARGUS distribution | ||
|
@@ -58,7 +60,7 @@ | |
'Hagedorn_pdf' , ## Hagedorn PDF | ||
'Tsallis2_pdf' , ## 2D Tsallis PDF | ||
'GenPareto_pdf' , ## Generalised Pareto distribution | ||
'ExGenPareto_pdf' , ## Exponentiatd Generalised Pareto distribution | ||
'ExGenPareto_pdf' , ## Exponentiated Generalised Pareto distribution | ||
'Benini_pdf' , ## Benini distribution | ||
'GEV_pdf' , ## Generalised Extreme Value distribution | ||
'MPERT_pdf' , ## Modified PERT distribution | ||
|
@@ -693,6 +695,90 @@ def delta ( self , value ) : | |
self.set_value ( self.__delta , value ) | ||
|
||
models.append ( BetaPrime_pdf ) | ||
|
||
# ============================================================================= | ||
## @class GenBetaPrime_pdf | ||
# Generalized beta'-distribution | ||
# http://en.wikipedia.org/wiki/Beta_prime_distribution | ||
# @author Vanya BELYAEV [email protected] | ||
# @date 2013-05-11 | ||
# @see Ostap::Models::GenBetaPrime | ||
# @see Ostap::Math::GenBetaPrime | ||
# @see Ostap::Models::BetaPrime | ||
# @see Ostap::Math::BetaPrime | ||
class GenBetaPrime_pdf(BetaPrime_pdf) : | ||
"""Beta-prime disribution | ||
- http://en.wikipedia.org/wiki/Beta_prime_distribution | ||
""" | ||
## constructor | ||
def __init__ ( self , | ||
name , ## the name | ||
xvar , ## the variable | ||
alpha = None , ## alpha-parameter | ||
beta = None , ## beta-parameter | ||
p = 1 , ## p-parameter, p>0 | ||
q = 1 , ## q-parameter, q>0 | ||
scale = 1 , ## scale-parameter | ||
delta = 0 ) : ## shift-parameter | ||
|
||
## inialize the base | ||
BetaPrime_pdf.__init__ ( self , | ||
name , | ||
alpha = alpha , | ||
beta = beta , | ||
scale = scale , | ||
delta = delta ) | ||
|
||
self.__p = self.make_var ( p , | ||
'p_%s' % name , | ||
'p_{#beta#prime}(%s)' % name , | ||
None , 1 , 1.e-3 , 1000 ) | ||
self.__q = self.make_var ( q , | ||
'q_%s' % name , | ||
'q_{#beta#prime}(%s)' % name , | ||
None , 1 , 1.e-3 , 1000 ) | ||
|
||
self.pdf = Ostap.Models.GenBetaPrime ( | ||
self.roo_name ( 'genbetap_' ) , | ||
'gen-Beta-prime %s' % self.name , | ||
self.x , | ||
self.alpha , | ||
self.beta , | ||
self.p , | ||
self.q , | ||
self.scale , | ||
self.delta ) | ||
|
||
## save the configuration: | ||
self.config = { | ||
'name' : self.name , | ||
'xvar' : self.xvar , | ||
'alpha' : self.alpha , | ||
'beta' : self.beta , | ||
'p' : self.p , | ||
'q' : self.q , | ||
'scale' : self.scale , | ||
'delta' : self.delta , | ||
} | ||
|
||
@property | ||
def p ( self ) : | ||
"""`p'-parameter of gen-Beta' distribution (p>0)""" | ||
return self.__p | ||
@p.setter | ||
def p ( self , value ) : | ||
self.set_value ( self.__p , value ) | ||
|
||
@property | ||
def q ( self ) : | ||
"""`q'-parameter of gen-Beta' distribution (q>0)""" | ||
return self.__p | ||
@p.setter | ||
def q ( self , value ) : | ||
self.set_value ( self.__q , value ) | ||
|
||
models.append ( GenBetaPrime_pdf ) | ||
|
||
# ============================================================================= | ||
## @class Landau_pdf | ||
# http://en.wikipedia.org/wiki/Landau_distribution | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1005,8 +1005,8 @@ namespace Ostap | |
* @param shift shift-parameter | ||
*/ | ||
BetaPrime | ||
( const double alpha = 3 , | ||
const double beta = 3 , | ||
( const double alpha = 1 , | ||
const double beta = 5 , | ||
const double scale = 1 , | ||
const double shift = 0 ) ; | ||
/// destructor | ||
|
@@ -1058,17 +1058,107 @@ namespace Ostap | |
// ====================================================================== | ||
private: | ||
// ====================================================================== | ||
double m_alpha ; | ||
double m_beta ; | ||
double m_scale ; | ||
double m_shift ; | ||
double m_alpha { 1 } ; | ||
double m_beta { 5 } ; | ||
double m_scale { 1 } ; | ||
double m_shift { 0 } ; | ||
// ====================================================================== | ||
private: | ||
// ====================================================================== | ||
/// auxillary intermediate parameter | ||
double m_aux { 1 } ; // auxillary intermediate parameter | ||
// ====================================================================== | ||
} ; | ||
// ======================================================================== | ||
/** @class GenBetaPrime | ||
* Generalized BetaPrime distribution | ||
* http://en.wikipedia.org/wiki/Beta_prime_distribution | ||
* @author Vanya BELYAEV [email protected] | ||
* @date 2013-05-11 | ||
*/ | ||
class GenBetaPrime | ||
{ | ||
public: | ||
// ====================================================================== | ||
/** constructor with all parameters | ||
* @param alpha \f$\alpha\f$-parameter | ||
* @param beta \f$\beta\f$-parameter | ||
* @param scale scale-parameter | ||
* @param shift shift-parameter | ||
*/ | ||
GenBetaPrime | ||
( const double alpha = 1 , | ||
const double beta = 5 , | ||
const double p = 1 , | ||
const double q = 1 , | ||
const double scale = 1 , | ||
const double shift = 0 ) ; | ||
/// destructor | ||
~GenBetaPrime () ; | ||
// ====================================================================== | ||
public: | ||
// ====================================================================== | ||
/// evaluate beta'-distributions | ||
double pdf ( const double x ) const ; | ||
/// evaluate beta'-distributions | ||
double operator() ( const double x ) const { return pdf ( x ) ; } | ||
// ====================================================================== | ||
public: // direct getters | ||
// ====================================================================== | ||
double alpha () const { return m_alpha ; } | ||
double beta () const { return m_beta ; } | ||
double p () const { return m_p ; } | ||
double q () const { return m_q ; } | ||
double scale () const { return m_scale ; } | ||
double shift () const { return m_shift ; } | ||
// ====================================================================== | ||
public: // general properties | ||
// ====================================================================== | ||
double mean () const ; | ||
double mode () const ; | ||
// ====================================================================== | ||
public: // direct setters | ||
// ====================================================================== | ||
bool setAlpha ( const double value ) ; | ||
bool setBeta ( const double value ) ; | ||
bool setP ( const double value ) ; | ||
bool setQ ( const double value ) ; | ||
bool setScale ( const double value ) ; | ||
bool setShift ( const double value ) ; | ||
// ====================================================================== | ||
public: // integrals | ||
// ====================================================================== | ||
double integral () const ; | ||
double cdf ( const double x ) const ; | ||
double integral | ||
( const double low , | ||
const double high ) const ; | ||
// ====================================================================== | ||
public: | ||
// ====================================================================== | ||
// get the tag | ||
std::size_t tag () const ; | ||
// ====================================================================== | ||
private: | ||
// ====================================================================== | ||
double m_alpha { 1 } ; | ||
double m_beta { 5 } ; | ||
double m_p { 1 } ; | ||
double m_q { 1 } ; | ||
double m_scale { 1 } ; | ||
double m_shift { 0 } ; | ||
// ====================================================================== | ||
private: | ||
// ====================================================================== | ||
/// auxillary intermediate parameter | ||
double m_aux ; // auxillary intermediate parameter | ||
double m_aux { 1 } ; // auxillary intermediate parameter | ||
/// integration workspace | ||
Ostap::Math::WorkSpace m_workspace {} ; // integration workspace | ||
// ====================================================================== | ||
} ; | ||
|
||
|
||
|
||
// ======================================================================== | ||
/** @class Landau | ||
* http://en.wikipedia.org/wiki/Landau_distribution | ||
|
Oops, something went wrong.