threeML.classicMLE.likelihood_ratio_test module

class threeML.classicMLE.likelihood_ratio_test.LikelihoodRatioTest(joint_likelihood_instance0: JointLikelihood, joint_likelihood_instance1: JointLikelihood)

Bases: object

property TS_distribution
by_mc(n_iterations=1000, continue_on_failure=False, save_pha=False)

Compute the Likelihood Ratio Test by generating Monte Carlo datasets and fitting the current models on them. The fraction of synthetic datasets which have a value for the TS larger or equal to the observed one gives the null-hypothesis probability (i.e., the probability that the observed TS is obtained by chance from the null hypothesis)

Parameters:
  • n_iterations – number of MC iterations to perform (default: 1000)

  • continue_of_failure – whether to continue in the case a fit fails (False by default)

  • save_pha – Saves pha files for reading into XSPEC as a cross check. Currently only supports OGIP data. This can become slow! (False by default)

Returns:

tuple (null. hyp. probability, TSs, frame with all results, frame with all likelihood values)

get_models(id)
get_simulated_data(id: int)
property null_hypothesis_probability
plot_TS_distribution(show_chi2=True, scale=1.0, **hist_kwargs)
Parameters:
  • show_chi2

  • scale

  • hist_kwargs

Returns:

property reference_TS