#
The Nested_fit Data Analysis Program^{ †}

^{†}

## Abstract

**:**

`Nested_fit`, a Bayesian data analysis code developed for investigations of atomic spectra and other physical data. It is based on the nested sampling algorithm with the implementation of an upgraded lawn mower robot method for finding new live points. For a given data set and a chosen model, the program provides the Bayesian evidence, for the comparison of different hypotheses/models, and the different parameter probability distributions. A large database of spectral profiles is already available (Gaussian, Lorentz, Voigt, Log-normal, etc.) and additional ones can easily added. It is written in Fortran, for an optimized parallel computation, and it is accompanied by a Python library for the results visualization.

## 1. Introduction

`Nested_fit`is a general purpose parallelized data analysis code for the evaluation of Bayesian evidence and parameter probability distributions for given data sets and modeling function. The computation of the Bayesian evidence is based on the nested sampling algorithm [1,2,3], for the integration of the likelihood function over the parameter space. This integration is obtained reducing the J-dimensional volume (where J is the number of parameters) in a one-dimensional integral by a clever exploration of the parameter space. In

`Nested_fit`, this exploration is obtained with a search algorithm for new parameter values called lawn mower robot, which has been initially developed by L. Simons [4] and modified here for a better exploration of multimodal problems.

`Nested_fit`has been developed over the past years to analyze several sets of experimental data from, mainly, atomic physics experiments. For this reason, it has some special feature well adapted to the analysis of atomic spectra as specific line profiles, possibility to study correlated spectra at the same time, eg. background and signal-plus-background spectra, and with a likelihood function built considering a Poisson statistics per each channel, well adapted to low-statistics data.

`Nested_fit`. In Section 3 we shortly introduce the basic concepts of Bayesian model comparison and the nested sampling method. The specific algorithm for the parameter space exploration for the nested sampling is presented in details in Section 4. An example of application of

`Nested_fit`is presented in Section 5 for the analysis of single two-body electron capture ion decay. A conclusive section will end the article, where recent application of

`Nested_fit`to different atomic physics analysis are mentioned.

## 2. General Structure of the Program

`nf_input.dat`, where all computation input parameters are included, and the data file, which name is indicated in the parameter input file. The function name in the input file indicates the model to be used for the calculation of the likelihood function. Several functions are already defined in the function library for modelling spectral lines: Gaussian, Log-normal, Lorentzian, Voigt (Gaussian and Lorentzian convolution), Gaussian convoluted with an exponential (for asymmetric peaks), etc. Additional functions can be easily defined by the users in the dedicated routine (

`USERFNC`). Differently from the version presented in Ref. [5] (V. 0.7), in the new version discussed here (V. 2.2) non-analytical or simulated profile models can be implemented. In this case, one or more additional files have to be provided by the users. These external data, which can have some noise like the case of simulated data, are interpolated by B-splines using FITPACK routines [6]. The B-spline parameters are stored and used as profile/model with the total amplitude and a possible offset as free parameters. An additional feature of this new program version, is the possibility to analyze data with error bars. This option has to be indicated in the input file.

`nf_input_set.dat`for the additional datafile names to analyze and data ranges to consider.

`nf_output_res.dat`. Here the details of the computation (n. of live points, n. of trials, n. of total iteration) can be found as well as the final evidence value and its uncertainty $E\pm \delta E$, the parameter values $\widehat{\mathit{a}}$ corresponding to the maximum of the likelihood function, the mean, the median, the standard deviation and the confidence intervals (68%, 95% and 99%) of the posterior probability distribution of each parameter. The information gain $\mathcal{H}$ and the Bayesian complexity $\mathcal{C}$ are also provided in the output.

`nf_output_data_*.dat`. These files contain the original input data together with the model function values corresponding to the parameters with the highest likelihood function value (

`nf_output_data_max.dat`) or the parameter mean value (

`nf_output_data_mean.dat`) or median value (

`nf_output_data_median.dat`) with the corresponding residuals and error bars. Additional

`nf_output_fit_*.dat`files contain a model evaluation with higher density than the original data for graphical presentation purpose.

`nf_output_points.dat`that contains the live points used during the parameter space exploration, their associated likelihood values and posterior probabilities. From this file, the different parameter probability distributions and joint probabilities can be built from the marginalization of the unretained parameters. For this purpose, a special dedicated Phython library

`Nested_res`has been developed. Additional informations can be found in Ref. [5].

## 3. Implementation of the Nested Sampling for the Evidence Calculation

`Nested_fit`is presented in details in Ref. [5].

`Nested_fit`program is based on an improved version of the lawn mower robot method, originally developed by L. Simons [4] and presented in details in the next section.

## 4. The Lawn Mower Robot Search Algorithm

- 1.
- Choose randomly a starting point ${\mathit{a}}_{n=0}={\mathit{a}}_{0}$ from the available live points $\left\{{\mathit{a}}_{m,k}\right\}$ as starting point of the Markov chain where n is the number of the jump. The number of tries ${n}_{t}$ (see below) is set to zero.
- 2.
- From the values ${\mathit{a}}_{n-1}$, find a new parameter sets ${\mathit{a}}_{n}$ where each $j\mathrm{th}$ parameter is calculated by ${\left({a}_{n}\right)}_{j}={\left({a}_{n-1}\right)}_{j}+f\phantom{\rule{4pt}{0ex}}{r}_{j}{\sigma}_{j}$, where ${\sigma}_{j}$ is the standard deviation of the live points of the nested sampling computation step relative to the $j\mathrm{th}$ parameter, ${r}_{j}\in [-1,1]$ is a sorted random number and f is a factor defined by the user.
- (a)
- If $L\left({\mathit{a}}_{n}\right)>{\mathcal{L}}_{m}$ and $n<N$, go to the beginning of step 2 with an increment of the jump number $n=n+1$.
- (b)
- If $L\left({\mathit{a}}_{n}\right)>{\mathcal{L}}_{m}$ and $n=N$, ${\mathit{a}}_{n=N}$ is new live point to be included in the new set $\left\{{\mathit{a}}_{m+1,k}\right\}$.
- (c)
- If $L\left({\mathit{a}}_{n}\right)<{\mathcal{L}}_{m}$ and $n<N$ and the number of tries ${n}_{t}$ is less than the maximum allowed number ${N}_{t}$, go back to beginning of step 2 with an increment of the number of tries ${n}_{t}={n}_{t}+1$.
- (d)
- If $L\left({\mathit{a}}_{n}\right)<{\mathcal{L}}_{m}$ and $n<N$ and ${n}_{t}={N}_{t}$ a new parameter set ${\mathit{a}}_{0}$ has to be selected. Instead than choosing one of the existing live points, ${\mathit{a}}_{0}$ is built from distinct $j\mathrm{th}$ components from different live points: ${\left({a}_{0}\right)}_{j}={\left({a}_{m,k}\right)}_{j}$ where k is randomly chosen between 1 and K for each j. Then ${\mathit{a}}_{n=0}={\mathit{a}}_{0}$ and go to the beginning of step 2.

## 5. An Application to Low-Statistics Data

`Nested_fit`, we present in this section its implementation on a particular critical case corresponding to a debated experiment. In 2008 it was observed an unexpected modulation in the two-body electron capture decay of single H-like ${}_{61}^{142}$Pm ions to the stable ${}_{60}^{142}$Nd bare nucleus, with a monochromatic electron-neutrino emission [13]. The same modulation frequency, but with much smaller amplitude, was found in 2010 data [14] but not in the latest campaign in 2014 [15] where much more events have been recorded.

`Nested_fit`.

`Nested_fit`are presented in Table 1 where model 1 and 2 represent the absence of presence of modulation. For each model, values of the evidence, Bayesian complexity and extracted information are provided, as well as model probabilities. The uncertainty of the probabilities is related to the uncertainty of the evidence. As example of probability distribution, we present in Figure 3 (bottom) the joint probability of the amplitude a and pulsation $\omega $ of the modulation in model 2. The 2D histogram (obtained with Python

`nested_res.py`library that accompany

`Nested_fit`program) is constructed by marginalization on the other parameters. As it can be seen, different maxima are visible, which make difficult the convergence of the nested sampling method. The improved lawn mower robot algorithm can deal with this kind of situation, even if the computation time is sometime long (several days in a single CPU).

## 6. Conclusions

`Nested_fit`, a general purpose parallelized data analysis code for the evaluation of Bayesian evidence and other statistically relevant outputs. It uses the nested sampling method with the implementation of the improved lawn mower robot algorithm for the evaluation of the Bayesian evidence.

`Nested_fit`has been developed over the past years for the analysis of several sets of atomic experimental data that strongly contribute to the code evolution. We would like to mention in particular the analysis of low-statistics X-ray spectra of He-like uranium [5,17], X-ray spectra of pionic atoms [18,19], electron photoemission spectra from nano-particles [20,21], single-ion decay spectra [15] and response function of crystal X-ray spectrometers (in progress).

`Nested_fit`will be focussed on the implementation of new exploration methods for the live point evolution of the nested sampling [8,9,11,12]. More precisely, the main goal is the improvement the efficiency for the exploration of the parameter space where the likelihood function presents several local maxima.

## Funding

## Acknowledgments

## Conflicts of Interest

## References

- Skilling, J. Nested Sampling. AIP Conf. Proc.
**2004**, 735, 395–405. [Google Scholar] - Sivia, D.S.; Skilling, J. Data Analysis: A Bayesian Tutorial, 2nd ed.; Oxford University Press: Oxford, UK, 2006. [Google Scholar]
- Skilling, J. Nested sampling for general Bayesian computation. Bayesian Anal.
**2006**, 1, 833–859. [Google Scholar] [CrossRef] - Theisen, M. Analyse der Linienform von Röntgenübergängen nach der Bayesmethode. Master Thesis, Faculty of Mathematics, Computer Science and Natural Sciences, RWTH Aachen University, Aachen, Germany, 2013. [Google Scholar]
- Trassinelli, M. Bayesian data analysis tools for atomic physics. Nucl. Instrum. Methods B
**2017**, 408, 301–312. [Google Scholar] [CrossRef] - Dierckx, P. Curve and Surface Fitting with Splines; Oxford University Press: Oxford, UK, 1995. [Google Scholar]
- Mukherjee, P.; Parkinson, D.; Liddle, A.R. A Nested Sampling Algorithm for Cosmological Model Selection. Astrophys. J. Lett.
**2006**, 638, L51. [Google Scholar] [CrossRef] - Feroz, F.; Hobson, M.P. Multimodal nested sampling: An efficient and robust alternative to Markov Chain Monte Carlo methods for astronomical data analyses. Mon. Not. R. Astron. Soc.
**2008**, 384, 449–463. [Google Scholar] [CrossRef] - Feroz, F.; Hobson, M.P.; Bridges, M. MultiNest: An efficient and robust Bayesian inference tool for cosmology and particle physics. Mon. Not. R. Astron. Soc.
**2009**, 398, 1601–1614. [Google Scholar] [CrossRef] - Veitch, J.; Vecchio, A. Bayesian coherent analysis of in-spiral gravitational wave signals with a detector network. Phys. Rev. D
**2010**, 81, 062003. [Google Scholar] [CrossRef] - Skilling, J. Bayesian computation in big spaces-nested sampling and Galilean Monte Carlo. AIP Conf. Proc.
**2012**, 1443, 145–156. [Google Scholar] - Feroz, F.; Skilling, J. Exploring multi-modal distributions with nested sampling. AIP Conf. Proc.
**2013**, 1553, 106–113. [Google Scholar] - Litvinov, Y.A.; Bosch, F.; Winckler, N.; Boutin, D.; Essel, H.G.; Faestermann, T.; Geissel, H.; Hess, S.; Kienle, P.; Knöbel, R.; et al. Observation of non-exponential orbital electron capture decays of hydrogen-like
^{140}Pr and^{142}Pm ions. Phys. Lett. B**2008**, 664, 162–168. [Google Scholar] [CrossRef] - Kienle, P.; Bosch, F.; Bühler, P.; Faestermann, T.; Litvinov, Y.A.; Winckler, N.; Sanjari, M.; Shubina, D.; Atanasov, D.; Geissel, H.; et al. High-resolution measurement of the time-modulated orbital electron capture and of the decay of hydrogen-like
^{142}Pm^{60+}ions. Phys. Lett. B**2013**, 726, 638–645. [Google Scholar] [CrossRef] - Ozturk, F.C.; Akkus, B.; Atanasov, D.; Beyer, H.; Bosch, F.; Boutin, D.; Brandau, C.; Bühler, P.; Cakirli, R.B.; Chen, R.J.; et al. Recision Test of Purely Exponential Electron Capture Decay of Hydrogen-Like
^{142}Pm Ions. arXiv**2019**, preprint. arXiv:1907.06920. [Google Scholar] - King, G.; Lovell, A.; Neufcourt, L.; Nunes, F. Direct Comparison between Bayesian and Frequentist Uncertainty Quantification for Nuclear Reactions. Phys. Rev. Lett.
**2019**, 122, 232502. [Google Scholar] [CrossRef] [PubMed] - Trassinelli, M.; Kumar, A.; Beyer, H.F.; Indelicato, P.; Märtin, R.; Reuschl, R.; Stöhlker, T. Doppler-tuned Bragg spectroscopy of excited levels in He-like uranium: A discussion of the uncertainty contributions. J. Phys. CS
**2009**, 163, 012026. [Google Scholar] [CrossRef] - Trassinelli, M.; Anagnostopoulos, D.F.; Borchert, G.; Dax, A.; Egger, J.P.; Gotta, D.; Hennebach, M.; Indelicato, P.; Liu, Y.W.; Manil, B.; et al. Measurement of the charged pion mass using X-ray spectroscopy of exotic atoms. Phys. Lett. B
**2016**, 759, 583–588. [Google Scholar] [CrossRef] - Trassinelli, M.; Anagnostopoulos, D.; Borchert, G.; Dax, A.; Egger, J.P.; Gotta, D.; Hennebach, M.; Indelicato, P.; Liu, Y.W.; Manil, B.; et al. Measurement of the charged pion mass using a low-density target of light atoms. EPJ Web Conf.
**2016**, 130, 01022. [Google Scholar] [CrossRef] - Papagiannouli, I.; Patanen, M.; Blanchet, V.; Bozek, J.D.; de Anda Villa, M.; Huttula, M.; Kokkonen, E.; Lamour, E.; Mevel, E.; Pelimanni, E.; et al. Depth Profiling of the Chemical Composition of Free-Standing Carbon Dots Using X-ray Photoelectron Spectroscopy. J. Phys. Chem. A
**2018**, 122, 14889–14897. [Google Scholar] [CrossRef] - Villa, M.D.A.; Gaudin, J.; Amans, D.; Boudjada, F.; Bozek, J.; Grisenti, R.E.; Lamour, E.; Laurens, G.; Macé, S.; Nicolas, C.; et al. Assessing the surface oxidation state of free-standing gold nanoparticles produced by laser ablation. Langmuir
**2019**. submitted. [Google Scholar]

**Figure 3.**Top: Data relative to the single decay of H-like ${}_{61}^{142}$Pm to ${}_{60}^{142}$Nd bare nucleus obtained with a binning of 0.08 s. The profile curves relative to pure exponential and exponential with modulation models are also represented. Bottom: 2D histogram of the joint probability of the amplitude a and pulsation $\omega $ of the model with modulation. Red, yellow and green colors represent approximatively the regions corresponding to 68%, 95% and 66% confidence intervals. Both figures are obtained by Python

`nested_res.py`library that accompany

`Nested_fit`program.

**Table 1.**Summary of the results provided from

`Nested_fit`for the two considered models. The parameter values are given in terms of most probable value and 95% confidential interval (CI).

Model 1 | Model 2 | |
---|---|---|

Function | $y={N}_{0}{e}^{-t/\tau}$ | $y={N}_{0}{e}^{-t/\tau}[1+asin(\omega t+\varphi )]$ |

log${}_{e}$(Evidence) | $-1594.11\pm 0.30$ | $-1594.60\pm 0.36$ |

Probability | 34.2–41.9% | 58.1–68.8% |

Complexity | 2.05 | 15.19 |

Extracted information [nat] | 4.76 | 6.32 |

$\omega $ (CI 95%) [rad s${}^{-1}$] | – | $0.89(0.17-6.86)$ |

a (CI 95%) | – | $9.2\times {10}^{-2}(2.2\times {10}^{-4}-7.2\times {10}^{-2})$ |

$\varphi $ (CI 95%) [rad] | – | $3.84(0.18-6.14)$ |

Publisher’s Note: MDPI stays neutral with regard to jurisdictional claims in published maps and institutional affiliations. |

© 2019 by the author. Licensee MDPI, Basel, Switzerland. This article is an open access article distributed under the terms and conditions of the Creative Commons Attribution (CC BY) license (https://creativecommons.org/licenses/by/4.0/).

## Share and Cite

**MDPI and ACS Style**

Trassinelli, M.
The Nested_fit Data Analysis Program. *Proceedings* **2019**, *33*, 14.
https://doi.org/10.3390/proceedings2019033014

**AMA Style**

Trassinelli M.
The Nested_fit Data Analysis Program. *Proceedings*. 2019; 33(1):14.
https://doi.org/10.3390/proceedings2019033014

**Chicago/Turabian Style**

Trassinelli, Martino.
2019. "The Nested_fit Data Analysis Program" *Proceedings* 33, no. 1: 14.
https://doi.org/10.3390/proceedings2019033014