Top |
NcmLikelihood * | ncm_likelihood_new () |
NcmLikelihood * | ncm_likelihood_ref () |
NcmLikelihood * | ncm_likelihood_dup () |
void | ncm_likelihood_free () |
void | ncm_likelihood_clear () |
NcmDataset * | ncm_likelihood_peek_dataset () |
NcmVector * | ncm_likelihoood_peek_m2lnL_v () |
void | ncm_likelihood_priors_add () |
void | ncm_likelihood_priors_take () |
NcmPrior * | ncm_likelihood_priors_peek_f () |
guint | ncm_likelihood_priors_length_f () |
NcmPrior * | ncm_likelihood_priors_peek_m2lnL () |
guint | ncm_likelihood_priors_length_m2lnL () |
void | ncm_likelihood_priors_leastsquares_f () |
void | ncm_likelihood_leastsquares_f () |
void | ncm_likelihood_priors_m2lnL_val () |
void | ncm_likelihood_priors_m2lnL_vec () |
void | ncm_likelihood_m2lnL_val () |
NcmDataset * | dataset | Read / Write / Construct |
NcmVector * | m2lnL-v | Read / Write |
NcmObjArray * | priors-f | Read / Write |
NcmObjArray * | priors-m2lnL | Read / Write |
Class combining a NcmDataset and priors. It represents the posterior distribution of the parameters of a model given the data and the priors. For historical reasons it is called likelihood, but it is actually the posterior distribution. This will be fixed in version 1.0 but for backward compatibility for version 0 it will remain as likelihood.
The posterior distribution is the combination of the NcmDataset containing the individual likelihoods of the data and the priors. The priors are defined as NcmPrior objects. The priors can be leastsquares priors or m2lnL priors. The leastsquares priors compute the leastsquares vectors $\vec{f}_i$ and the m2lnL priors the probabilities $-2\ln P_{\mathrm{prior},i}$.
The final posterior distribution is defined as: \begin{equation} -2\ln P_{\mathrm{posterior}} = -2\ln L_{\mathrm{data}} + \sum_i \vec{f}_i\cdot\vec{f}_i + \sum_i -2\ln P_{\mathrm{prior},i} \end{equation}
Note that to be able to use least squares the posterior must contain least-squares priors only and all individual likelihoods in the NcmDataset must also be least-squares.
NcmLikelihood *
ncm_likelihood_new (NcmDataset *dset
);
Creates a new NcmLikelihood for the given NcmDataset.
NcmLikelihood *
ncm_likelihood_ref (NcmLikelihood *lh
);
Increases the reference count of the object.
NcmLikelihood * ncm_likelihood_dup (NcmLikelihood *lh
,NcmSerialize *ser
);
Duplicates the object and all of its content.
void
ncm_likelihood_free (NcmLikelihood *lh
);
Decreases the reference count of the object. If the reference count reaches zero, the object is finalized (i.e. its memory is freed).
void
ncm_likelihood_clear (NcmLikelihood **lh
);
If *lh
is not NULL
, decreases the reference count of the object
and sets *lh
to NULL
.
NcmDataset *
ncm_likelihood_peek_dataset (NcmLikelihood *lh
);
Gets the NcmDataset associated with the NcmLikelihood.
NcmVector *
ncm_likelihoood_peek_m2lnL_v (NcmLikelihood *lh
);
Gets the m2lnL vector associated with the NcmLikelihood containing the last calculated m2lnL values.
void ncm_likelihood_priors_add (NcmLikelihood *lh
,NcmPrior *prior
);
Adds a NcmPrior to the NcmLikelihood.
void ncm_likelihood_priors_take (NcmLikelihood *lh
,NcmPrior *prior
);
Adds a NcmPrior to the NcmLikelihood and takes ownership of the object.
NcmPrior * ncm_likelihood_priors_peek_f (NcmLikelihood *lh
,guint i
);
Peeks the prior at index i
in the NcmLikelihood from the array of priors
that contribute to the leastsquares f.
guint
ncm_likelihood_priors_length_f (NcmLikelihood *lh
);
Gets the number of priors that contribute to the leastsquares f.
NcmPrior * ncm_likelihood_priors_peek_m2lnL (NcmLikelihood *lh
,guint i
);
Peek the prior at index i
in the NcmLikelihood from the array of priors
that contribute to the m2lnL.
guint
ncm_likelihood_priors_length_m2lnL (NcmLikelihood *lh
);
Gets the number of priors that contribute to the m2lnL.
void ncm_likelihood_priors_leastsquares_f (NcmLikelihood *lh
,NcmMSet *mset
,NcmVector *priors_f
);
Calculates the leastsquares f for the priors, note that the all priors
in lh
must be priors that contribute to the leastsquares f.
void ncm_likelihood_leastsquares_f (NcmLikelihood *lh
,NcmMSet *mset
,NcmVector *f
);
Combines the leastsquares f for the dataset and the priors, note that the
first elements of f
are the leastsquares f for the dataset and the last
elements are the leastsquares f for the priors.
void ncm_likelihood_priors_m2lnL_val (NcmLikelihood *lh
,NcmMSet *mset
,gdouble *priors_m2lnL
);
Combines the m2lnL for the priors, note that the priors can be priors that contribute to the leastsquares f or to the m2lnL.
void ncm_likelihood_priors_m2lnL_vec (NcmLikelihood *lh
,NcmMSet *mset
,NcmVector *priors_m2lnL_v
);
Computes the m2lnL for the priors, inserting the result in priors_m2lnL_v
.
The order of the elements in priors_m2lnL_v
is the same as the order of the
priors in the NcmLikelihood. The first elements are the m2lnL for the priors
that contribute to the leastsquares f and the last elements are the m2lnL for
the priors that contribute to the m2lnL.
void ncm_likelihood_m2lnL_val (NcmLikelihood *lh
,NcmMSet *mset
,gdouble *m2lnL
);
Combines the m2lnL for the dataset and the priors, note that the priors can be priors that contribute to the leastsquares f or to the m2lnL.
“dataset”
property“dataset” NcmDataset *
Dataset object.
Owner: NcmLikelihood
Flags: Read / Write / Construct
“priors-f”
property“priors-f” NcmObjArray *
Priors f array.
Owner: NcmLikelihood
Flags: Read / Write
“priors-m2lnL”
property“priors-m2lnL” NcmObjArray *
Priors m2lnL array.
Owner: NcmLikelihood
Flags: Read / Write