42 namespace statistics {
144 PosteriorParameters (
const size_t nparameters,
const std::vector<std::shared_ptr<PriorDistribution>> priorDistributions, std::vector<ParameterType> parameterTypes, std::vector<std::string> parameterNames);
170 std::string
status (
const int p)
const;
177 std::vector<std::string>
status ()
const;
208 std::vector<double>
full_parameter (
const std::vector<double> parameter_value)
const override;
224 void set_parameters (
const size_t nparameters,
const std::vector<std::shared_ptr<PriorDistribution>> priorDistributions, std::vector<ParameterType> parameterTypes, std::vector<std::string> parameterNames)
override;
325 std::shared_ptr<Prior>
prior ()
const;
373 void set_bestfit_values (
const int start,
const int thin,
const int nbins,
const int seed)
override;
406 void set_posterior_distribution (
const int start,
const int thin,
const int nbins,
const int seed=34121,
const std::vector<double> weight={});
466 void show_results (
const int start,
const int thin,
const int nbins,
const int seed=34121,
const bool show_mode=
false,
const int ns=-1,
const int nb=-1,
const std::vector<double> weight={});
522 void write_results (
const std::string dir,
const std::string file,
const int start,
const int thin,
const int nbins,
const int seed=34121,
const bool compute_mode=
false,
const int ns=-1,
const int nb=-1,
const std::vector<double> weight={});
547 void set_chain (
const size_t size,
const size_t nwalkers);
577 double chain_value (
const int param,
const int pos,
const int ww)
const
603 std::vector<double>
parameter_chain_values (
const int param,
const int start=0,
const int thin = 1)
const;
619 void set_chain_value (
const int param,
const int pos,
const int ww,
const double value)
631 void set_chain_values (
const std::vector<std::vector<double>> values,
const int nwalkers);
640 void set_chain_values (
const std::vector<std::vector<std::vector<double>>> values);
670 void initialize_chain_ball (
const std::vector<double> center,
const double radius,
const double seed);
The class ModelParameters.
The class PosteriorDistribution.
The class ModelParameters.
size_t nparameters() const
return the total number of parameters
The class PosteriorParameters.
std::vector< unsigned int > fixed_parameter() const
return the private member m_fixed_parameter
void set_parameters(const size_t nparameters, const std::vector< std::shared_ptr< PriorDistribution >> priorDistributions, std::vector< ParameterType > parameterTypes, std::vector< std::string > parameterNames) override
set the parameter
void initialize_chain_ball_bestfit(const double radius, const double seed)
initialize the chain values around bestfit values
size_t chain_size() const
return the private member m_chain_size
size_t nparameters_free() const override
return the number of free parameters
void write_results(const std::string dir, const std::string file, const int start, const int thin, const int nbins, const int seed=34121, const bool compute_mode=false, const int ns=-1, const int nb=-1, const std::vector< double > weight={})
store the results to file
void reset_chain()
reset the chain using m_size and m_nwalkers
void initialize_chain(const std::vector< std::vector< double >> values)
initialize the chain values
void set_chain_value(const int param, const int pos, const int ww, const double value)
set the private member m_chain_value at the pp-th step for the ww-th step
void set_prior_distribution(const int p, const std::shared_ptr< PriorDistribution > priorDistribution)
set the prior distribution for the p-th parameter
int m_inds_to_index(const int pp, const int ww) const
get the position in the vector m_values from position index and walker index
std::vector< std::vector< double > > m_parameter_covariance
the function parameter covariance matrix
std::shared_ptr< PosteriorDistribution > posterior_distribution(const int par) const
get the posterior distribution for the chosen parameter
std::vector< double > m_parameter_bestfit_value
the best-fit parameter values, either the medians of the MCMC chain or the maximum of the posterior (...
std::vector< unsigned int > m_fixed_parameter
the indexes of fixed parameters
void write_bestfit_info()
write bestfit info
size_t nparameters_fixed() const override
return the number of fixed parameters
std::vector< double > parameter_chain_values(const int param, const int start=0, const int thin=1) const
return all the chain values for a parameter
size_t m_chain_size
the lenght of the chain
void set_chain(const size_t size, const size_t nwalkers)
set the chain
std::vector< double > full_parameter(const std::vector< double > parameter_value) const override
return all the model parameters
size_t m_chain_nwalkers
the number of parallel walkers
size_t m_nparameters_fixed
the number of fixed parameters
void set_prior_distribution_seed(const std::shared_ptr< random::UniformRandomNumbers_Int > ran_generator)
set the prior distributions for the parameters
void set_bestfit_values(const std::vector< double > bestfit_value)
set the protected member m_bestfit_value
void show_results(const int start, const int thin, const int nbins, const int seed=34121, const bool show_mode=false, const int ns=-1, const int nb=-1, const std::vector< double > weight={})
show the results on the standard output
size_t chain_nwalkers() const
return the private member m_chain_nwalkers
std::vector< std::string > status() const
return all the model parameter status
std::vector< double > chain_value_parameter(const int pos, const int ww) const
return the private member m_values at the pp-th step for the ww-th step for all the parameters
void expand_chain(const int append)
expand the already existing chain
std::vector< std::shared_ptr< PriorDistribution > > m_correlated_parameter_prior
the correlated parameter prior distributions
std::shared_ptr< Prior > prior() const
get the prior function
PosteriorParameters()=default
default constructor
double chain_value(const int param, const int pos, const int ww) const
return the private member m_chain_value at the pos step for the ww-th walker, for the chosen paramete...
size_t m_nparameters_free
the numbers of free parameters
std::vector< double > bestfit_value() const
get the protected member m_parameter_bestfit_value
std::shared_ptr< PriorDistribution > prior_distribution(const int p) const
get the prior distribution for the p-th parameter
void set_posterior_distribution(const int start, const int thin, const int nbins, const int seed=34121, const std::vector< double > weight={})
set the posterior distribution from the chains
void set_chain_values(const std::vector< std::vector< double >> values, const int nwalkers)
set the chain values
std::vector< size_t > m_multipriors
the lenght of each set of multidimensional prior
std::vector< std::shared_ptr< PriorDistribution > > m_parameter_prior
the parameter prior distributions
~PosteriorParameters()=default
default destructor
void initialize_chain_from_prior()
initialize the chain values random sampling the parameter priors
std::vector< std::shared_ptr< PriorDistribution > > prior_distribution() const
get the prior distribution for the p-th parameter
void set_parameter_covariance(const int start=0, const int thin=1)
set the internal method m_parameter_covariance
std::vector< std::shared_ptr< PosteriorDistribution > > m_posterior_distribution
the parameter posterior distributions
std::vector< unsigned int > m_free_parameter
the indexes of the free parameters
std::vector< unsigned int > free_parameter() const override
return the private member m_free_parameter
std::vector< std::vector< double > > m_chain_value
content of the chain
void m_set_parameter_type() override
private member to set the parameter types
void initialize_chain_ball(const std::vector< double > center, const double radius, const double seed)
initialize the chain values
std::vector< std::vector< double > > parameter_covariance() const
return the protected member m_parameter_covariance
The global namespace of the CosmoBolognaLib
void checkDim(const std::vector< T > vect, const int val, const std::string vector, bool equal=true)
check if the dimension of a std::vector is equal/lower than an input value