rxmc.likelihood_model.UnknownModelError#
- class rxmc.likelihood_model.UnknownModelError(averaging=True)[source]#
Bases:
ParametricLikelihoodModelA ParametricLikelihoodModel in which the frac_err is a free parameter $gamma$, such that the covariance due to the uncorrelated model error takes the form:
\[\Sigma_{ij}^{uncorrelated} = \gamma^2 y_m(x_i, \alpha)^2 \delta_{ij}\]where $gamma$ is a free parameter.
This is commonly used as a model-error term or unquantified uncertainty.
- __init__(averaging=True)[source]#
Initializes the UnknownModelError instance.
- Parameters:
averaging (bool, optional) – If
True, the model error term uses0.5 * (observation.y + ym)instead ofymalone, which improves stability whenymis near zero. Defaults toTrue.
Methods
__init__([averaging])Initializes the UnknownModelError instance.
chi2(observation, ym, *likelihood_params)Calculate the generalised chi-squared statistic.
covariance(observation, ym, log_frac_err)Default covariance model.
log_likelihood(observation, ym, ...)Returns the log likelihood that ym reproduces observation.y
residual(observation, ym)Return the residual
observation.y - ym.- covariance(observation: Observation, ym: ndarray, log_frac_err: float)[source]#
Default covariance model. Derived classes of LikelihoodModel will override this.
Returns the following covariance matrix:
\[\Sigma_{ij} = \sigma^2_{i}^{stat} \delta_{ij} + \Sigma_{ij}^{sys} + \gamma^2 y_m^2(x_i, \alpha)\]where $gamma$ is the fractional uncorrelated error (frac_err), treated here as a free parameter, and all other definitions are the same as LikelihoodModel.covariance
- Parameters:
ym (np.ndarray) – Model prediction for the observation.
observation (Observation) – The observation object containing the observed data.
log_frac_err (float) – log of fraction of the model prediction at point x_i that is treated as the standard deviation of the model prediction at that point, such that the model prediction is independent at every point (log of $gamma$).
- Returns:
np.ndarray – Covariance matrix of the observation.