Optimal Binning TutorialReturn to: Analysis Threads | Analysis Main Page
OverviewWhen performing spectral analysis, the binning of your spectrum matters. There are several tools now available to help you obtain optimal (or nearly optimal) binning. Read this thread if you want to: What is Optimal Binning and How to Obtain It Last update: 2021-10-13 IntroductionWhen performing spectral analysis, the binning of your spectrum matters. The nature of the spectral binning affects the statistical properties of your spectral fit. Therefore, it is worth obtaining the best possible binning for your spectrum before starting to perform spectral fitting. Spectral binning may affect your spectrum in several different ways. In the low counts limit, too few counts may lead to a bias in the spectral fitting. Most spectral fitting applications, including XSPEC, assume Gaussian statistics (or nearly Gaussian), which effectively implies that there are enough counts in each spectral bin of your fit. If that is not the case, then the fitting process may drive the parameters to a biased value, far from its "true" value. Goodness of fit (chi-square) and confidence intervals may also be biased. The temptation is present to widen spectral bins, and therefore increase the number of counts. If this process is done naively, there is a risk of averaging over sharp or narrow spectral or detector features. XSPEC does have a feature known as "setplot rebin", but this feature only governs the display of the spectrum, and does not affect how the spectral fit or goodness of fit are reported. NICER spectral bins are naturally 10 eV wide, and it is not easy (or recommended) to attempt to change this bin width. However, HEASoft supports the notion of "grouping" or combining adjacent bins into larger effective bins. This can be done with additional metadata and not disturbing the original counts in the spectrum. Tools such as "grppha" and "ftgrouppha" are available that aid the analyst in performing grouping/rebinning. This thread discusses how to use "ftgrouppha" with "optimal" binning. What is Optimal Binning?Although grouping/rebinning may be performed in a coarse way by simply combining set numbers of spectral bins - for example, rebinning by a factor of two - this may not always be desirable. The best grouping strategy should take into account where the counts are the greatest and where the sharpest features are present in the spectrum or response (requiring less rebinning), but also where counts are least (requiring more rebinning). Kaastra & Bleeker (2016) introduced a concept of optimal binning of spectra. This technique attempts to find the best binning that preserves the most information. The Kaastra & Bleeker technique is implemented in the tool 'ftgrouppha'. In addition, the 'ftgrouppha' tool implements a variation of the technique, which we will highlight here, which ensures a minimum number of counts per spectral bin, which - as mentioned - minimizes the statistical bias for many spectral fitting applications.
PrerequisitesHere we assume:
The minimum number of counts is typically 10-25. A value of 10 is the
bare minimum for approaching Gaussian statistics (~3 sigma), while a
value of 25 leaves a more comfortable margin. However, this value
may need to be adjusted based upon feedback or experience.
Figure 1 is the example spectrum we will work with, before any grouping has been applied. This spectrum has the standard NICER default of 10 eV for each and every bin width. Apply Grouping (with Minimum Counts)
You will use the 'ftgrouppha' command to apply a specific grouping.
where
The result is a grouped spectrum (myspectrum_grp25.pha in this
example), which can be loaded into XSPEC.
Figure 2 shows an example spectrum that has been groupd in this way. Apply Grouping (no Minimum Counts)
Here we will use ftgrouppha with optimal binning and no minimum number of
counts.
where
Figure 3 shows an example spectrum with pure optimal binning (and non minimum counts). What's Next: How to Use Grouped Spectra?You may use a spectrum that has been rebinned by grouping (such as with ftgrouppha), in XSPEC as you would with any NICER spectrum. There is no need to rebin the response files. Plots of spectra will automatically be rebinned as necessary to comply with the requested rebinning. AcknowledgementPortions contributed by Ethan Partington. References
Kaastra, J. S. & Bleeker, J. A. M. 2016, Astronomy & Astrophysics, 587, A151 DOI 10.1051/0004-6361/201527395 Modifications
|