get_pvalue_results

sherpa.astro.ui.get_pvalue_results()

Return the data calculated by the last plot_pvalue call.

The get_pvalue_results function returns the likelihood ratio test results computed by the plot_pvalue command, which compares fits of the null model to fits of the alternative model using faked data with Poisson noise. The likelihood ratio based on the observed data is returned, along with the p-value, used to reject or accept the null model.

Returns:plot – If plot_pvalue or get_pvalue_plot have been called then the return value is a sherpa.sim.simulate.LikelihoodRatioResults instance, otherwise None is returned.
Return type:None or a sherpa.sim.simulate.LikelihoodRatioResults instance

See also

plot_value()
Compute and plot a histogram of likelihood ratios by simulating data.
get_pvalue_plot()
Return the data used by plot_pvalue.

Notes

The fields of the returned (LikelihoodRatioResults) object are:

ratios
The calculated likelihood ratio for each iteration.
stats
The calculated fit statistics for each iteration, stored as the null model and then the alt model in a nsim by 2 array.
samples
The parameter samples array for each simulation, stored in a nsim by npar array.
lr
The likelihood ratio of the observed data for the null and alternate models.
ppp
The p value of the observed data for the null and alternate models.
null
The fit statistic of the null model on the observed data.
alt
The fit statistic of the alternate model on the observed data.

Examples

Return the results of the last pvalue analysis and display the results - first using the format method, which provides a summary of the data, and then a look at the individual fields in the returned object. The last call displays the contents of one of the fields (ppp).

>>> res = get_pvalue_results()
>>> print(res.format())
>>> print(res)
>>> print(res.ppp)