NcmFitMCMC

NcmFitMCMC — Markov Chain Monte Carlo analysis.

Functions

Properties

NcmFit * fit Read / Write / Construct Only
NcmFitRunMsgs mtype Read / Write
guint nthreads Read / Write
NcmMSetTransKern * sampler Read / Write / Construct

Types and Values

Object Hierarchy

    GObject
    ╰── NcmFitMCMC

Description

Markov Chain Monte Carlo (MCMC) analysis is a method for sampling the posterior probability distribution of a set of parameters. It relies on the Metropolis–Hastings algorithm. The transition kernel utilized in this implementation is specified by the NcmMSetTransKern object.

Functions

ncm_fit_mcmc_new ()

NcmFitMCMC *
ncm_fit_mcmc_new (NcmFit *fit,
                  NcmMSetTransKern *tkern,
                  NcmFitRunMsgs mtype);

Creates a new NcmFitMCMC object that will use the tkern transition kernel to generate the MCMC proposals.

Parameters

fit

a NcmFit

 

tkern

a NcmMSetTransKern.

 

mtype

messages type

 

Returns

a new NcmFitMCMC.


ncm_fit_mcmc_free ()

void
ncm_fit_mcmc_free (NcmFitMCMC *mcmc);

Decrement the reference count of mcmc and frees the memory used by it.

Parameters

mcmc

a NcmFitMCMC

 

ncm_fit_mcmc_clear ()

void
ncm_fit_mcmc_clear (NcmFitMCMC **mcmc);

If *mcmc is not NULL, decrement the reference count of mcmc and sets *mcmc to NULL.

Parameters

mcmc

a NcmFitMCMC

 

ncm_fit_mcmc_set_data_file ()

void
ncm_fit_mcmc_set_data_file (NcmFitMCMC *mcmc,
                            const gchar *filename);

Sets the data file to be used to save the Markov Chain Monte Carlo realizations catalog.

Parameters

mcmc

a NcmFitMCMC

 

filename

a filename.

 

ncm_fit_mcmc_set_mtype ()

void
ncm_fit_mcmc_set_mtype (NcmFitMCMC *mcmc,
                        NcmFitRunMsgs mtype);

Sets the messages type to be used during the Markov Chain Monte Carlo run.

Parameters

mcmc

a NcmFitMCMC

 

mtype

messages type NcmFitRunMsgs

 

ncm_fit_mcmc_set_trans_kern ()

void
ncm_fit_mcmc_set_trans_kern (NcmFitMCMC *mcmc,
                             NcmMSetTransKern *tkern);

Sets the transition kernel to be used during the Markov Chain Monte Carlo run.

Parameters

mcmc

a NcmFitMCMC

 

tkern

a NcmMSetTransKern.

 

ncm_fit_mcmc_set_nthreads ()

void
ncm_fit_mcmc_set_nthreads (NcmFitMCMC *mcmc,
                           guint nthreads);

Sets the number of threads to be used during the Markov Chain Monte Carlo run.

Parameters

mcmc

a NcmFitMCMC

 

nthreads

number of threads to run

 

ncm_fit_mcmc_set_fiducial ()

void
ncm_fit_mcmc_set_fiducial (NcmFitMCMC *mcmc,
                           NcmMSet *fiduc);

ncm_fit_mcmc_set_rng ()

void
ncm_fit_mcmc_set_rng (NcmFitMCMC *mcmc,
                      NcmRNG *rng);

Sets the random number generator to be used during the Markov Chain Monte Carlo run.

Parameters

mcmc

a NcmFitMCMC

 

rng

a NcmRNG

 

ncm_fit_mcmc_get_accept_ratio ()

gdouble
ncm_fit_mcmc_get_accept_ratio (NcmFitMCMC *mcmc);

Gets the acceptance ratio of the Markov Chain Monte Carlo run.

Parameters

mcmc

a NcmFitMCMC

 

Returns

the current acceptance ratio.


ncm_fit_mcmc_start_run ()

void
ncm_fit_mcmc_start_run (NcmFitMCMC *mcmc);

Starts a new run, setup the Markov Chain Monte Carlo object and syncs the catalog.

Parameters

mcmc

a NcmFitMCMC

 

ncm_fit_mcmc_end_run ()

void
ncm_fit_mcmc_end_run (NcmFitMCMC *mcmc);

Ends the current run, frees the memory used by the Markov Chain Monte Carlo and syncs the catalog.

Parameters

mcmc

a NcmFitMCMC

 

ncm_fit_mcmc_reset ()

void
ncm_fit_mcmc_reset (NcmFitMCMC *mcmc);

Resets the Markov Chain Monte Carlo object and the catalog.

Parameters

mcmc

a NcmFitMCMC

 

ncm_fit_mcmc_set_first_sample_id ()

void
ncm_fit_mcmc_set_first_sample_id (NcmFitMCMC *mcmc,
                                  gint first_sample_id);

Sets the first sample id to be used in the Markov Chain Monte Carlo.

Parameters

mcmc

a NcmFitMCMC

 

first_sample_id

id

 

ncm_fit_mcmc_run ()

void
ncm_fit_mcmc_run (NcmFitMCMC *mcmc,
                  guint n);

Runs the Markov Chain Monte Carlo until it reaches the n -th realization. Note that if the first_id is non-zero it will run n - first_id realizations.

Parameters

mcmc

a NcmFitMCMC

 

n

total number of realizations to run

 

ncm_fit_mcmc_run_lre ()

void
ncm_fit_mcmc_run_lre (NcmFitMCMC *mcmc,
                      guint prerun,
                      gdouble lre);

Runs the Markov Chain Monte Carlo until it reaches the n -th realization. It starts by running prerun realizations and then it runs more realizations until the largest relative error is less than lre .

Parameters

mcmc

a NcmFitMCMC

 

prerun

number of pre-runs to do

 

lre

largest relative error to attain

 

ncm_fit_mcmc_mean_covar ()

void
ncm_fit_mcmc_mean_covar (NcmFitMCMC *mcmc);

Computes the mean and covariance of the generated catalog.

Parameters

mcmc

a NcmFitMCMC

 

ncm_fit_mcmc_get_catalog ()

NcmMSetCatalog *
ncm_fit_mcmc_get_catalog (NcmFitMCMC *mcmc);

Gets the generated catalog of mcmc .

Parameters

mcmc

a NcmFitMCMC

 

Returns

the generated catalog.

[transfer full]

Types and Values

NCM_TYPE_FIT_MCMC

#define NCM_TYPE_FIT_MCMC (ncm_fit_mcmc_get_type ())

NCM_FIT_MCMC_MIN_SYNC_INTERVAL

#define NCM_FIT_MCMC_MIN_SYNC_INTERVAL (10.0)

NcmFitMCMC

typedef struct _NcmFitMCMC NcmFitMCMC;

Property Details

The “fit” property

  “fit”                      NcmFit *

Fit object.

Owner: NcmFitMCMC

Flags: Read / Write / Construct Only


The “mtype” property

  “mtype”                    NcmFitRunMsgs

Run messages type.

Owner: NcmFitMCMC

Flags: Read / Write

Default value: NCM_FIT_RUN_MSGS_SIMPLE


The “nthreads” property

  “nthreads”                 guint

Number of threads to run.

Owner: NcmFitMCMC

Flags: Read / Write

Allowed values: <= 100

Default value: 0


The “sampler” property

  “sampler”                  NcmMSetTransKern *

Metropolis–Hastings sampler.

Owner: NcmFitMCMC

Flags: Read / Write / Construct