rxmc.likelihood_model.ParametricLikelihoodModel#
- class rxmc.likelihood_model.ParametricLikelihoodModel(likelihood_params: list[Parameter])[source]#
Bases:
LikelihoodModelA class to represent a likelihood model for comparing an Observation to a PhysicalModel, in which the LikelihoodModel has it’s own parameters to calculate the covariance, aside from the parameters of the PhysicalModel. This is useful when the covariance is unknown, and one would like to calibrate the likelihood parameters to an Observation, along with the parameters of a PhysicalModel.
- __init__(likelihood_params: list[Parameter])[source]#
Initializes the LikelihoodModel, optionally with a fractional uncorrelated error.
Methods
__init__(likelihood_params)Initializes the LikelihoodModel, optionally with a fractional uncorrelated error.
chi2(observation, ym, *likelihood_params)Calculate the generalised chi-squared statistic.
covariance(observation, ym, *likelihood_params)Returns the covariance matrix determined by the likelihood model, which is dependent on likelihood_params
log_likelihood(observation, ym, ...)Returns the log likelihood that ym reproduces observation.y
residual(observation, ym)Return the residual
observation.y - ym.- chi2(observation: Observation, ym: ndarray, *likelihood_params)[source]#
Calculate the generalised chi-squared statistic. This is the Mahalanobis distance between Observation.y and ym.
- Parameters:
observation (Observation) – The observation object containing the observed data.
ym (np.ndarray) – Model prediction for the observation.
likelihood_params (tuple) – Additional parameters for the covariance
- Returns:
float – Chi-squared statistic.
- log_likelihood(observation: Observation, ym: ndarray, *likelihood_params)[source]#
Returns the log likelihood that ym reproduces observation.y
- Parameters:
ym (np.ndarray) – Model prediction for the observation.
observation (Observation) – The observation object containing the observed data.
likelihood_params (tuple) – Additional parameters for the covariance
- Returns:
float
- covariance(observation: Observation, ym: ndarray, *likelihood_params)[source]#
Returns the covariance matrix determined by the likelihood model, which is dependent on likelihood_params
- Parameters:
observation (Observation) – The observation object containing the observed data.
ym (np.ndarray) – Model prediction for the observation.
likelihood_params (tuple) – Additional parameters for the covariance.
- Returns:
np.ndarray – Covariance matrix of the observation.