45 namespace statistics {
111 void m_set_grid_likelihood_1D (
const int npoints,
const std::vector<std::vector<double>> parameter_limits,
const std::string output_file);
137 void m_set_grid_likelihood_2D (
const int npoints,
const std::vector<std::vector<double>> parameter_limits,
const std::string output_file);
187 Likelihood (
const std::shared_ptr<data::Data> data,
const std::shared_ptr<Model> model,
const LikelihoodType likelihood_type,
const std::vector<size_t> x_index={0,2},
const int w_index=-1,
const std::shared_ptr<ModelParameters> model_parameters=NULL,
const double prec=1.e-10,
const int Nres=-1);
202 Likelihood (
const std::shared_ptr<data::Data> data,
const std::shared_ptr<Model> model,
const Likelihood_function log_likelihood_function,
const std::shared_ptr<ModelParameters> model_parameters=NULL);
227 double operator () (std::vector<double> &pp)
const;
237 double log (std::vector<double> ¶meter)
const;
246 void set_data (std::shared_ptr<data::Data> data);
257 void set_model (std::shared_ptr<Model> model=NULL,
const std::shared_ptr<ModelParameters> model_parameters=NULL);
303 void set_grid (
const int npoints,
const std::vector<std::vector<double>> parameter_limits,
const std::string file,
const bool read=
false);
326 void set_function (
const LikelihoodType likelihood_type,
const std::vector<size_t> x_index={0,2},
const int w_index=-1,
const double prec=1.e-10,
const int Nres=-1);
349 void write_results (
const std::string dir_output,
const std::string file);
382 void maximize (
const std::vector<double> start,
const std::vector<std::vector<double>> parameter_limits,
const unsigned int max_iter=10000,
const double tol=1.e-6,
const double epsilon=1.e-3);
395 void write_model (
const std::string output_dir,
const std::string output_file,
const std::vector<double>
parameters,
const std::vector<double> xx={},
const std::vector<double> yy={});
407 void write_model_at_bestfit (
const std::string output_dir,
const std::string output_file,
const std::vector<double> xx={},
const std::vector<double> yy={})
void write_model(const std::string output_dir, const std::string output_file, const std::vector< double > parameters, const std::vector< double > xx={}, const std::vector< double > yy={})
write the model at xx at bestfit
void write_model_at_bestfit(const std::string output_dir, const std::string output_file, const std::vector< double > xx={}, const std::vector< double > yy={})
write the model at xx at bestfit
void write_results(const std::string dir_output, const std::string file)
write best-fit results on a file
Likelihood_function m_likelihood_function
likelihood function
std::shared_ptr< Model > get_m_model()
get the values of the internal variable m_model
virtual ~Likelihood()=default
default destructor
void set_model(std::shared_ptr< Model > model=NULL, const std::shared_ptr< ModelParameters > model_parameters=NULL)
set the model for the likelihood analysis
void maximize(const std::vector< double > start, const std::vector< std::vector< double >> parameter_limits, const unsigned int max_iter=10000, const double tol=1.e-6, const double epsilon=1.e-3)
function that maximizes the likelihood, finds the best-fit parameters and stores them in the model
std::shared_ptr< ModelParameters > parameters() const
return the likelihood parameters
void m_set_grid_likelihood_1D(const int npoints, const std::vector< std::vector< double >> parameter_limits, const std::string output_file)
set the likelihood grid and write the grid on a file
std::shared_ptr< void > m_likelihood_inputs
likelihood inputs
double log(std::vector< double > ¶meter) const
evaluate the logarithm of the likelihood for the input parameters
std::shared_ptr< ModelParameters > get_model_parameters()
get the values of the internal variable m_model
void set_grid(const int npoints, const std::vector< std::vector< double >> parameter_limits, const std::string file, const bool read=false)
set the likelihood function as a grid, to speed up computation: this only works for one or two free p...
LogLikelihood_function m_log_likelihood_function_grid
log-likelihood function on a grid
std::shared_ptr< Model > m_model
model to test
double operator()(std::vector< double > &pp) const
evaluate the likelihood
int m_w_index
the index in extra info where the bin weight is stored
void unset_grid()
set the likelihood function with internal values of LikelihoodType
void set_log_function(const LogLikelihood_function loglikelihood_function)
set the natural logarithm of the likelihood function
std::shared_ptr< ModelParameters > m_model_parameters
likelihood parameters
std::vector< size_t > m_x_index
void m_set_grid_likelihood_2D(const int npoints, const std::vector< std::vector< double >> parameter_limits, const std::string output_file)
set the likelihood grid and write the grid on a file
LikelihoodType m_likelihood_type
type of the likelihood
void set_function(const LikelihoodType likelihood_type, const std::vector< size_t > x_index={0, 2}, const int w_index=-1, const double prec=1.e-10, const int Nres=-1)
set the likelihood type using the LikelihoodType object
LogLikelihood_function m_likelihood_function_grid
likelihood function on a grid
std::shared_ptr< data::Data > get_m_data()
get the values of the internal variable m_data
std::shared_ptr< data::Data > m_data
data containers
void set_data(std::shared_ptr< data::Data > data)
set the data for the likelihood analysis
LogLikelihood_function m_log_likelihood_function
log-likelihood function
Likelihood()
default constructor
LikelihoodType
the type of likelihood function
std::function< double(std::vector< double > &, const std::shared_ptr< void >)> LogLikelihood_function
definition of a function for computation of the LogLikelihood
std::function< double(std::vector< double > &, const std::shared_ptr< void >)> Likelihood_function
definition of a function for computation of the Likelihood
The global namespace of the CosmoBolognaLib