This repository contains the coursework and solution for the "S1: Statistical Methods for Data Intensive Science" module (MPhil DIS).
The objective of this assignment is to evaluate the performance of a photon detector by analyzing calibration data. Given a dataset of 1,000 measured energies (
The analysis progresses through four distinct statistical approaches to estimate the parameters and robustly quantify their uncertainties:
- Sample Estimates: Initial parameter estimation using sample means and standard deviations followed by least-squares fitting.
-
Individual Maximum Likelihood (ML) Fits: Unbinned ML fits applied separately to the data at each known
$E_0$ level. - Simultaneous ML Fit: A comprehensive unbinned ML fit performed simultaneously across the entire dataset using the MINUIT algorithm.
- Bootstrapping: A non-parametric bootstrap (2,500 samples with replacement) to rigorously evaluate parameter uncertainties and cross-check the errors reported by the ML fits.
A detailed discussion of the results is included at the end of the solution notebook. A significant finding of this analysis is that the MINUIT (Hesse) errors consistently underestimate the true uncertainty compared to the bootstrap estimates, and a reparameterization of the model alleviates this issue. Another critical insight is that the three fitting methods (sample estimates, individual ML fits, and simultaneous ML fit) are theoretically similar with each other, with sample estimates being almost equivalent to the individual ML fits, and the individual ML fits being an approximation and simplification of the simultaneous ML fit.
notebooks/solution.ipynb: The main Jupyter Notebook containing the complete end-to-end analysis, plotting, and discussion.notebooks/instructions.ipynb: The original assignment instructions and problem description.s1_sol/: A custom, pip-installable Python package. The core statistical functions and fitting wrappers are implemented ins1_sol/methods.py.figs/: Directory containing all generated output plots (Figures 1.1 through 4.2, plus a custom Figure 5.1 for the diagnostic discussion).results.json: The formatted output file containing the final parameter estimates and error bounds from all methods.sample.csv: The unique calibration dataset used for this analysis.
To reproduce the results, figures, and results.json file:
- Install the local package:
Navigate to the root of the repository and install the
s1_solpackage in editable mode:pip install -e . - Run the Notebook:
Open
notebooks/solution.ipynband execute all cells from start to finish. The notebook is fully self-contained once the package is installed and will automatically populate thefigs/folder and overwriteresults.json.
GitHub Copilot was utilized to assist with writing certain portions of the codebase, primarily for drafting docstrings and matplotlib plotting boilerplate.