CosmoBolognaLib
Free Software C++/Python libraries for cosmological calculations
cbl::statistics Namespace Reference

The namespace of the functions and classes used for statistical analyses More...

Classes

class  Chi2
 The class Chi2. More...
 
struct  STR_DependentProbes_data_model
 the structure STR_DependentProbes_data_model More...
 
class  CombinedPosterior
 The class CombinedPosterior. More...
 
class  Likelihood
 The class Likelihood. More...
 
struct  STR_likelihood_inputs
 the struct STR_likelihood_inputs More...
 
class  LikelihoodParameters
 The class LikelihoodParameters. More...
 
class  Model
 The class Model. More...
 
class  Model1D
 The class Model1D. More...
 
class  Model2D
 The class Model2D. More...
 
class  ModelParameters
 The class ModelParameters. More...
 
class  Posterior
 The class Posterior. More...
 
class  PosteriorDistribution
 The class PosteriorDistribution. More...
 
class  PosteriorParameters
 The class PosteriorParameters. More...
 
class  Prior
 The class Prior. More...
 
class  PriorDistribution
 The class PriorDistribution. More...
 
class  Sampler
 The class Sampler. More...
 

Typedefs

typedef std::function< double(std::vector< double > &, const std::shared_ptr< void >)> LogLikelihood_function
 definition of a function for computation of the LogLikelihood
 
typedef std::function< double(std::vector< double > &, const std::shared_ptr< void >)> Likelihood_function
 definition of a function for computation of the Likelihood
 
typedef std::function< std::vector< double >std::vector< double >, std::shared_ptr< void >, std::vector< double > &)> model_function_1D
 1D function: the inputs are a vector of values at which the function is computed, a pointer to a set of data used to construct the function and a vector of parameters
 
typedef std::function< std::vector< std::vector< double > >std::vector< double >, std::vector< double >, std::shared_ptr< void >, std::vector< double > &)> model_function_2D
 2D function: the inputs are the values at which the function is computed, a pointer to a set of data used to construct the function and a vector of parameters
 
typedef std::function< std::vector< std::vector< double > >std::vector< std::vector< double > >, std::shared_ptr< void >, std::vector< double > &)> model_function_generic
 generic function: the inputs are the values at which the function is computed, a pointer to a set of data used to construct the function and a vector of parameters
 
typedef std::function< double(const std::vector< double >, const std::shared_ptr< void >)> Prior_function
 definition of a function for computation of the Prior
 

Enumerations

enum class  LikelihoodType {
  _NotSet_ , _Gaussian_Error_ , _Gaussian_Covariance_ , _Poissonian_ ,
  _UserDefined_
}
 the type of likelihood function More...
 
enum class  ParameterType { _Base_ , _Derived_ , _Correlated_ }
 the parameter type More...
 
enum class  SamplerType { _MetropolisHastings_ , _StretchMove_ }
 the parameter type More...
 

Functions

std::vector< std::string > LikelihoodTypeNames ()
 return a vector containing the LikelihoodType names More...
 
LikelihoodType LikelihoodTypeCast (const int likelihoodTypeIndex)
 cast an enum of type LikelihoodType from its index More...
 
LikelihoodType LikelihoodTypeCast (const std::string likelihoodTypeName)
 cast an enum of type LikelihoodType from its name More...
 
std::vector< LikelihoodTypeLikelihoodTypeCast (const std::vector< int > likelihoodTypeIndeces)
 cast an enum of type LikelihoodType from indeces More...
 
std::vector< LikelihoodTypeLikelihoodTypeCast (const std::vector< std::string > likelihoodTypeNames)
 cast enums of type LikelihoodType from thier names More...
 
double LogLikelihood_1D_interpolated (std::vector< double > &likelihood_parameter, const std::shared_ptr< void > input)
 function to compute the loglikelihood on a grid More...
 
double LogLikelihood_2D_interpolated (std::vector< double > &likelihood_parameter, const std::shared_ptr< void > input)
 function to compute the loglikelihood on a grid More...
 
double LogLikelihood_Gaussian_1D_error (std::vector< double > &likelihood_parameter, const std::shared_ptr< void > input)
 function to compute the Gaussian log-likelihood More...
 
double LogLikelihood_Gaussian_1D_covariance (std::vector< double > &likelihood_parameter, const std::shared_ptr< void > input)
 function to compute the gaussian loglikelihood More...
 
double LogLikelihood_Gaussian_2D_error (std::vector< double > &likelihood_parameter, const std::shared_ptr< void > input)
 function to compute the gaussian loglikelihood model with one parameter \( \chi^2 \) More...
 
double LogLikelihood_Poissonian_1D_ (std::vector< double > &likelihood_parameter, const std::shared_ptr< void > input)
 function to compute the poissonian loglikelihood More...
 
double LogLikelihood_Poissonian_2D_ (std::vector< double > &likelihood_parameter, const std::shared_ptr< void > input)
 function to compute the poissonian loglikelihood More...
 
std::vector< std::string > ParameterTypeNames ()
 return a vector containing the ParameterType names More...
 
ParameterType ParameterTypeCast (const int parameterTypeIndex)
 cast an enum of type ParameterType from its index More...
 
ParameterType ParameterTypeCast (const std::string parameterTypeName)
 cast an enum of type ParameterType from its name More...
 
std::vector< ParameterTypeParameterTypeCast (const std::vector< int > parameterTypeIndeces)
 cast an enum of type ParameterType from indeces More...
 
std::vector< ParameterTypeParameterTypeCast (const std::vector< std::string > parameterTypeNames)
 cast enums of type ParameterType from thier names More...
 
std::vector< std::string > SamplerTypeNames ()
 return a vector containing the SamplerType names More...
 
SamplerType SamplerTypeCast (const int samplerTypeIndex)
 cast an enum of type SamplerType from its index More...
 
SamplerType SamplerTypeCast (const std::string samplerTypeName)
 cast an enum of type SamplerType from its name More...
 
std::vector< SamplerTypeSamplerTypeCast (const std::vector< int > samplerTypeIndeces)
 cast an enum of type SamplerType from indeces More...
 
std::vector< SamplerTypeSamplerTypeCast (const std::vector< std::string > samplerTypeNames)
 cast enums of type SamplerType from their names More...
 
log-likelihood functions
double LogLikelihood_Gaussian_combined (std::vector< double > &likelihood_parameter, const std::shared_ptr< void > input)
 Gaussian log-likelihood. More...
 
double LogLikelihood_Poissonian_combined (std::vector< double > &likelihood_parameter, const std::shared_ptr< void > input)
 Poissonian log-likelihood. More...
 
double LogLikelihood_Poissonian_SSC_combined (std::vector< double > &likelihood_parameter, const std::shared_ptr< void > input)
 Poissonian log-likelihood with super-sample covariance. More...
 

Detailed Description

The namespace of the functions and classes used for statistical analyses

The statistic namespace contains all the functions and classes used for statistical analyes

Enumeration Type Documentation

◆ LikelihoodType

the type of likelihood function

Enumerator
_NotSet_ 

not set

_Gaussian_Error_ 

Gaussian likelihood error.

_Gaussian_Covariance_ 

Gaussian likelihood covariance.

_Poissonian_ 

Poissonian likelihood.

_UserDefined_ 

Likelihood function defined by the user.

Definition at line 51 of file LikelihoodFunction.h.

◆ ParameterType

the parameter type

Enumerator
_Base_ 

base parameter

_Derived_ 

derived parameter

_Correlated_ 

correlated parameters

Definition at line 48 of file ModelParameters.h.

◆ SamplerType

the parameter type

Enumerator
_MetropolisHastings_ 

Metropolis-Hastings sampler.

_StretchMove_ 

stretch-move sampler (Goodman & Weare 2010, Foreman-Mackey et al. 2012)

Definition at line 51 of file Sampler.h.

Function Documentation

◆ LikelihoodTypeCast() [1/4]

LikelihoodType cbl::statistics::LikelihoodTypeCast ( const int  likelihoodTypeIndex)
inline

cast an enum of type LikelihoodType from its index

Parameters
likelihoodTypeIndexthe likelihoodType index
Returns
object of class LikelihoodType

Definition at line 84 of file LikelihoodFunction.h.

◆ LikelihoodTypeCast() [2/4]

LikelihoodType cbl::statistics::LikelihoodTypeCast ( const std::string  likelihoodTypeName)
inline

cast an enum of type LikelihoodType from its name

Parameters
likelihoodTypeNamethe likelihoodType name
Returns
object of class LikelihoodType

Definition at line 93 of file LikelihoodFunction.h.

◆ LikelihoodTypeCast() [3/4]

std::vector<LikelihoodType> cbl::statistics::LikelihoodTypeCast ( const std::vector< int >  likelihoodTypeIndeces)
inline

cast an enum of type LikelihoodType from indeces

Parameters
likelihoodTypeIndecesthe likelihoodType indeces
Returns
vector of objects of class LikelihoodType

Definition at line 102 of file LikelihoodFunction.h.

◆ LikelihoodTypeCast() [4/4]

std::vector<LikelihoodType> cbl::statistics::LikelihoodTypeCast ( const std::vector< std::string >  likelihoodTypeNames)
inline

cast enums of type LikelihoodType from thier names

Parameters
likelihoodTypeNamesthe likelihoodType names
Returns
vector of objects of class LikelihoodType

Definition at line 111 of file LikelihoodFunction.h.

◆ LikelihoodTypeNames()

std::vector<std::string> cbl::statistics::LikelihoodTypeNames ( )
inline

return a vector containing the LikelihoodType names

Returns
a vector containing the LikelihoodType names

Definition at line 75 of file LikelihoodFunction.h.

◆ LogLikelihood_1D_interpolated()

double cbl::statistics::LogLikelihood_1D_interpolated ( std::vector< double > &  likelihood_parameter,
const std::shared_ptr< void >  input 
)

function to compute the loglikelihood on a grid

Parameters
likelihood_parameterthe parameters of the model
inputpointer to an object of type STR_params
Returns
the value of the loglikelihood

Definition at line 104 of file LikelihoodFunction.cpp.

◆ LogLikelihood_2D_interpolated()

double cbl::statistics::LogLikelihood_2D_interpolated ( std::vector< double > &  likelihood_parameter,
const std::shared_ptr< void >  input 
)

function to compute the loglikelihood on a grid

Parameters
likelihood_parameterthe parameters of the model
inputpointer to an object of type STR_params
Returns
the value of the loglikelihood

Definition at line 119 of file LikelihoodFunction.cpp.

◆ LogLikelihood_Gaussian_1D_covariance()

double cbl::statistics::LogLikelihood_Gaussian_1D_covariance ( std::vector< double > &  likelihood_parameter,
const std::shared_ptr< void >  input 
)

function to compute the gaussian loglikelihood

Parameters
likelihood_parameterthe parameters of the model
inputpointer to an object of type STR_params
Returns
the value of the loglikelihood

Definition at line 157 of file LikelihoodFunction.cpp.

◆ LogLikelihood_Gaussian_1D_error()

double cbl::statistics::LogLikelihood_Gaussian_1D_error ( std::vector< double > &  likelihood_parameter,
const std::shared_ptr< void >  input 
)

function to compute the Gaussian log-likelihood

Parameters
likelihood_parameterthe parameters of the model
inputpointer to an object of type STR_params
Returns
the value of the loglikelihood
Warning
the Gaussian likelihood does not allow for null standard deviation

Definition at line 134 of file LikelihoodFunction.cpp.

◆ LogLikelihood_Gaussian_2D_error()

double cbl::statistics::LogLikelihood_Gaussian_2D_error ( std::vector< double > &  likelihood_parameter,
const std::shared_ptr< void >  input 
)

function to compute the gaussian loglikelihood model with one parameter \( \chi^2 \)

Parameters
likelihood_parameterthe parameters of the model
inputpointer to an object of type STR_params
Returns
the value of the loglikelihood
Warning
the Gaussian likelihood does not allow for null standard deviation

Definition at line 189 of file LikelihoodFunction.cpp.

◆ LogLikelihood_Gaussian_combined()

double cbl::statistics::LogLikelihood_Gaussian_combined ( std::vector< double > &  likelihood_parameter,
const std::shared_ptr< void >  input 
)

Gaussian log-likelihood.

Parameters
likelihood_parameterthe parameter values set in the modelling
inputfixed parameters
Returns
the value of the log-likelihood

Definition at line 1279 of file CombinedPosterior.cpp.

◆ LogLikelihood_Poissonian_1D_()

double cbl::statistics::LogLikelihood_Poissonian_1D_ ( std::vector< double > &  likelihood_parameter,
const std::shared_ptr< void >  input 
)

function to compute the poissonian loglikelihood

Parameters
likelihood_parameterthe parameters of the model
inputpointer to an object of type STR_params
Returns
the value of the loglikelihood
Warning
the poissian likelihood takes counts in input; it's care of the user to ensure that this is the case

Definition at line 211 of file LikelihoodFunction.cpp.

◆ LogLikelihood_Poissonian_2D_()

double cbl::statistics::LogLikelihood_Poissonian_2D_ ( std::vector< double > &  likelihood_parameter,
const std::shared_ptr< void >  input 
)

function to compute the poissonian loglikelihood

Parameters
likelihood_parameterthe parameters of the model
inputpointer to an object of type STR_params
Returns
the value of the loglikelihood
Warning
the poissian likelihood takes counts in input; it's care of the user to ensure that this is the case

Definition at line 233 of file LikelihoodFunction.cpp.

◆ LogLikelihood_Poissonian_combined()

double cbl::statistics::LogLikelihood_Poissonian_combined ( std::vector< double > &  likelihood_parameter,
const std::shared_ptr< void >  input 
)

Poissonian log-likelihood.

Parameters
likelihood_parameterthe parameter values set in the modelling
inputfixed parameters
Returns
the value of the log-likelihood

Definition at line 1327 of file CombinedPosterior.cpp.

◆ LogLikelihood_Poissonian_SSC_combined()

double cbl::statistics::LogLikelihood_Poissonian_SSC_combined ( std::vector< double > &  likelihood_parameter,
const std::shared_ptr< void >  input 
)

Poissonian log-likelihood with super-sample covariance.

Parameters
likelihood_parameterthe parameter values set in the modelling
inputfixed parameters
Returns
the value of the log-likelihood

Definition at line 1364 of file CombinedPosterior.cpp.

◆ ParameterTypeCast() [1/4]

ParameterType cbl::statistics::ParameterTypeCast ( const int  parameterTypeIndex)
inline

cast an enum of type ParameterType from its index

Parameters
parameterTypeIndexthe parameterType index
Returns
object of class ParameterType

Definition at line 73 of file ModelParameters.h.

◆ ParameterTypeCast() [2/4]

ParameterType cbl::statistics::ParameterTypeCast ( const std::string  parameterTypeName)
inline

cast an enum of type ParameterType from its name

Parameters
parameterTypeNamethe parameterType name
Returns
object of class ParameterType

Definition at line 81 of file ModelParameters.h.

◆ ParameterTypeCast() [3/4]

std::vector<ParameterType> cbl::statistics::ParameterTypeCast ( const std::vector< int >  parameterTypeIndeces)
inline

cast an enum of type ParameterType from indeces

Parameters
parameterTypeIndecesthe parameterType indeces
Returns
object of class ParameterType

Definition at line 89 of file ModelParameters.h.

◆ ParameterTypeCast() [4/4]

std::vector<ParameterType> cbl::statistics::ParameterTypeCast ( const std::vector< std::string >  parameterTypeNames)
inline

cast enums of type ParameterType from thier names

Parameters
parameterTypeNamesthe parameterType names
Returns
vector of ParameterType enums

Definition at line 97 of file ModelParameters.h.

◆ ParameterTypeNames()

std::vector<std::string> cbl::statistics::ParameterTypeNames ( )
inline

return a vector containing the ParameterType names

Returns
a vector containing the ParameterType names

Definition at line 65 of file ModelParameters.h.

◆ SamplerTypeCast() [1/4]

SamplerType cbl::statistics::SamplerTypeCast ( const int  samplerTypeIndex)
inline

cast an enum of type SamplerType from its index

Parameters
samplerTypeIndexthe samplerType index
Returns
object of class SamplerType

Definition at line 77 of file Sampler.h.

◆ SamplerTypeCast() [2/4]

SamplerType cbl::statistics::SamplerTypeCast ( const std::string  samplerTypeName)
inline

cast an enum of type SamplerType from its name

Parameters
samplerTypeNamethe samplerType name
Returns
object of class SamplerType

Definition at line 86 of file Sampler.h.

◆ SamplerTypeCast() [3/4]

std::vector<SamplerType> cbl::statistics::SamplerTypeCast ( const std::vector< int >  samplerTypeIndeces)
inline

cast an enum of type SamplerType from indeces

Parameters
samplerTypeIndecesthe samplerType indeces
Returns
vector of objects of class SamplerType

Definition at line 95 of file Sampler.h.

◆ SamplerTypeCast() [4/4]

std::vector<SamplerType> cbl::statistics::SamplerTypeCast ( const std::vector< std::string >  samplerTypeNames)
inline

cast enums of type SamplerType from their names

Parameters
samplerTypeNamesthe samplerType names
Returns
vector of objects of class SamplerType

Definition at line 104 of file Sampler.h.

◆ SamplerTypeNames()

std::vector<std::string> cbl::statistics::SamplerTypeNames ( )
inline

return a vector containing the SamplerType names

Returns
a vector containing the SamplerType names

Definition at line 67 of file Sampler.h.