{ "cells": [ { "cell_type": "code", "execution_count": 1, "id": "7046e3dd", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "iminuit version: 2.16.0\n" ] } ], "source": [ "# stave.py\n", "# Computes Student's t average, with the number of degrees of\n", "# freedom nu related to the relative uncertainty r in the\n", "# standard deviations of the measurements, nu = 1/(2*r**2), see\n", "# G. Cowan, Eur. Phys. J. C (2019) 79 :133, arXiv:1809.05778.\n", "# Uses iminuit version 2.x (not compatible with v 1.x).\n", "# G. Cowan / RHUL Physics / December 2022\n", "\n", "import numpy as np\n", "import scipy.stats as stats\n", "from scipy.stats import truncexpon\n", "from scipy.stats import truncnorm\n", "import iminuit\n", "from iminuit import Minuit\n", "import matplotlib.pyplot as plt\n", "plt.rcParams[\"font.size\"] = 14\n", "print(f\"iminuit version: {iminuit.__version__}\") # should be v 2.x" ] }, { "cell_type": "code", "execution_count": 2, "id": "aa82f19d", "metadata": {}, "outputs": [], "source": [ "# Set input values\n", "mu = 10. # initial value for fit\n", "y = np.array([17., 19., 15., 3.]) # measured values\n", "s = np.array([1.5, 1.5, 1.5, 1.5]) # estimates of std. dev\n", "v = s**2 # estimates of variances\n", "r = np.array([0.2, 0.2, 0.2, 0.2]) # relative errors on errors\n", "x = np.array([1., 2., 3., 4.]) # arbitrary x coord. for measurements" ] }, { "cell_type": "code", "execution_count": 3, "id": "150af0a5", "metadata": {}, "outputs": [], "source": [ "# Define function to be minimized\n", "class NegLogL:\n", "\n", " def __init__(self, y, s, r):\n", " self.setData(y, s, r)\n", " \n", " def setData(self, y, s, r):\n", " self.data = y, s, r\n", "\n", " def __call__(self, mu):\n", " y, s, r = self.data\n", " v = s ** 2\n", " lnf = -0.5*(1. + 1./(2.*r**2))*np.log(1. + 2.*(r*(y-mu))**2/v)\n", " return -np.sum(lnf)" ] }, { "cell_type": "code", "execution_count": 4, "id": "add98882", "metadata": {}, "outputs": [], "source": [ "# Initialize Minuit and set up fit:\n", "negLogL = NegLogL(y, s, r) # instantiate function to be minimized\n", "parin = np.array([mu]) # initial values\n", "parname = ['mu']\n", "parstep = np.array([0.5]) # initial setp sizes\n", "parfix = [False] # change these to fix/free parameters\n", "parlim = [(None, None)]\n", "m = Minuit(negLogL, parin, name=parname)\n", "m.errors = parstep\n", "m.fixed = parfix\n", "m.limits = parlim\n", "m.errordef = 0.5 # errors from lnL = lnLmax - 0.5" ] }, { "cell_type": "code", "execution_count": 5, "id": "7f629d63", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "par index, name, estimate, standard deviation:\n", " 0 mu = 16.205276 +/- 0.987898\n" ] } ], "source": [ "# do the fit, extract results\n", "m.migrad() # minimize -logL\n", "MLE = m.values # max-likelihood estimates\n", "sigmaMLE = m.errors # standard deviations\n", "cov = m.covariance # covariance matrix\n", "rho = m.covariance.correlation() # correlation coeffs.\n", "muHat = MLE[0]\n", "sigma_muHat = sigmaMLE[0]\n", "\n", "print(r\"par index, name, estimate, standard deviation:\")\n", "for i in range(m.npar):\n", " if not m.fixed[i]:\n", " print(\"{:4d}\".format(i), \"{:<10s}\".format(m.parameters[i]), \" = \",\n", " \"{:.6f}\".format(MLE[i]), \" +/- \", \"{:.6f}\".format(sigmaMLE[i]))" ] }, { "cell_type": "code", "execution_count": 6, "id": "07d791e7", "metadata": {}, "outputs": [ { "data": { "image/png": "iVBORw0KGgoAAAANSUhEUgAAAXgAAAEWCAYAAABsY4yMAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjUuMywgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy/NK7nSAAAACXBIWXMAAAsTAAALEwEAmpwYAAAwqklEQVR4nO3dd3RVVfr/8feTRhIggZBQEwgtoUroxYYURxB0RhQYRcWG3cEy8xsYG+qgM5ZBZ8aCBawICiogNlBE6S10QgmEhF6TQHqyf3/cy3dFJj252bc8r7XO4rbkfE4uebLv3vvsI8YYlFJKeR8/2wGUUkq5hhZ4pZTyUlrglVLKS2mBV0opL6UF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OJcv2ALEWk2mVCVpgVfqt3KL3S4qdr8Ix9pNBfz29ya4lnIpVWla4JWqnP04LsmGiPTAsRy0Um5JC7xSlTMXiHBe0PpeYJfdOEqVTleTVEopL6UteKWU8lJa4JVSyktpgVdKKS+lBV4ppbyUFnillPJSWuCVUspLaYFXSikv9f8BRtzdPALe1z0AAAAASUVORK5CYII=\n", "text/plain": [ "
" ] }, "metadata": { "needs_background": "light" }, "output_type": "display_data" } ], "source": [ "# Make scan of -lnL\n", "if not m.fixed[\"mu\"]:\n", " plt.figure()\n", " m.draw_mnprofile('mu', band=False, bound=(muHat-3.*sigma_muHat, muHat+3.*sigma_muHat), size=200)\n", " plt.show()" ] }, { "cell_type": "code", "execution_count": 7, "id": "28a27e06", "metadata": {}, "outputs": [ { "data": { "image/png": "iVBORw0KGgoAAAANSUhEUgAAAXcAAAEFCAYAAAAYKqc0AAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjUuMywgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy/NK7nSAAAACXBIWXMAAAsTAAALEwEAmpwYAAAgnUlEQVR4nO3dfXgV9Z338feXhxAS6A0pATFIojxZpICYaoGrQi21ukippV3kThVbadZKBamuxXqtYGuw3boKK2KvsCDWjUC1Sl26iqgQpYIaIApsRFAIiuHBtVYwtyDJ9/7jDGkeIUFyJmfyeV3XuTLzm9/MfHMIn0xm5vzG3B0REYmWNmEXICIip5/CXUQkghTuIiIRpHAXEYkghbuISAQp3EVEIqhd2AU0Vbdu3TwrKyvsMkREQrdx48YP3D29vmUJF+5ZWVkUFRWFXYaISOjMrLShZTotIyISQQp3EZEIUriLiERQXMLdzM4yszVmVmJm28xsetA+28z2mllx8PqHeNQjIhJ18bqgegy42d03mVlnYKOZrQ6W3efu98SpDhGRViEu4e7uZUBZMH3IzEqAjHjsW0SkNYr7OXczywLOB14Jmn5qZm+Y2WIz69rAOrlmVmRmRQcPHoxXqSIiCSuu4W5mnYA/Aje5+8fAg0Af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yhY8++uikNYm0RAr3WgoKCsjNzaW0tBR3p7S0lNzc3GYP+IKCAjp37swrr7zCzJkzuemmm/jOd75D//79KSoqYvLkyUyZMoX3338fgPLycr7+9a+TnJxMYWEh69evp2fPnowZM4by8nIADh8+zOWXX87q1at5/fXXmTBhAt/97nd58803Adi3bx9XXXUVkydPpqSkhBdffJGrr766ybXv2rWLRx99lMcee4zXX3+dDh06MHbsWPbu3cvKlSvZvHkzF198MZdccgllZWUAvPLKK1x77bXk5uZSXFzMuHHjuOOOO064n8rKSq688koqKytZv349ixcvZvbs2Rw5cqRGv9TUVBYvXkxJSQkLFixg2bJl5OXlATBx4kRuvvlmBgwYQFlZGWVlZUycOBGANm3aMHfuXLZt28ajjz7Kq6++yo033tjk90OkRXD3hHpdcMEF3pwyMzMdqPPKzMxstn2OGjXKv/rVr1bNV1ZWerdu3XzcuHFVbUePHvX27dv7Y4895u7uixYt8r59+3plZWVVn2PHjnlaWpovX768wX1ddNFF/qtf/crd3Tdu3OiA7969u96+s2bN8vPOO69G20MPPeSpqak1+rRr18737dtX1fb88897amqql5eX11h3yJAh/pvf/Mbd3SdNmuRjxoypsfy6667z2I9k/VatWuVt2rTx0tLSqraXXnrJAX/ooYcaXO/BBx/0Pn36nPD7qs/TTz/tSUlJXlFRcdK+ImEAiryBrGwX2m+VFmrPnj1Naj9dBg8eXDVtZnTv3p0vf/nLVW3t27ena9euHDhwAICNGzeya9cuOnfuXGM75eXlvP322wB88skn3HnnnaxcuZKysjI+++wzPv3006p9DRkyhDFjxjBo0CAuvfRSxowZw/e+9z3S09ObVHuvXr3o0aNH1fzGjRspLy+vs51PP/20qraSkhLGjRtXY/nw4cNZtGhRg/spKSkhIyOD3r17V7VddNFFtGlT8w/Qxx9/nLlz57Jz504OHz5MRUUFFRUVJ/0+XnjhBe6++25KSkr429/+RkVFBUePHmXfvn2ceeaZJ11fpCVRuNfSu3dvSktL621vTu3bt68xb2b1tlVWVgKxUxRDhw5l2bJldbaVlpYGwC233MIzzzzDPffcQ79+/UhJSeGaa67h6NGjALRt25Znn32WDRs28Oyzz7Jo0SJuu+02CgsLGTJkCG3atKlzcfSzzz6rs7/U1NQa85WVlfTo0YOXXnqpTt8vfOELAKd00bUx62zYsIGrrrqKWbNmcd9999GlSxeeeuopbrnllhOuV1paytixY/nxj3/ML3/5S774xS+yadMmJk2aVPV+iSQShXsteXl55ObmVp23BkhJSak6Z9tSDBs2jKVLl9KtWze6dOlSb59169ZxzTXXMGHCBODvR879+/ev6mNmDB8+nOHDh3PHHXdw3nnnsXz5coYMGUJ6ejr79+/H3avuPy8uLm5Ubfv376dNmzacc8459fYZOHAgGzZsqNFWe76+dfbu3cu7777LWWedBcCrr75a9QsP4C9/+QsZGRn8y7/8S1Vb7V/WSUlJdY7ki4qKOHr0KPfddx9t27YFqPdirUiiCP2CqpntNrMtZlZsZkUnX6N55eTkkJ+fT2ZmJmZGZmYm+fn55OTkhF1aDTk5OfTo0YPx48dTWFjIrl27ePHFF7n55pur7pjp378/Tz75JJs2bWLLli384Ac/qLprBGJhetddd/Haa6+xZ88ennrqKd59910GDhwIxO7i+fDDD5kzZw5vv/02ixYt4vHHHz9pbWPGjGHkyJGMHz+ep59+ml27drF+/XpmzZpVdTQ/bdo0nnvuOe6++2527NjBwoULefLJJ0+63XPPPZdrrrmG4uJi1q9fz4wZM2jX7u/HKP3792fv3r0UFBTwzjvv8OCDD7J06dIa28nKyqK0tJRNmzbxwQcfcOTIEfr160dlZSVz585l165dLF26lLlz5zbq30KkRWroZHy8XsBuoFtj+zf3BdUwjBo1yqdOnVqj7bzzzvNZs2bVaOvRo4fff//9VfP79u3za6+91tPT0z0pKcmzsrL8hz/8oR88eNDd3Xfv3u3f+MY3PCUlxTMyMvy3v/2tjx071idPnuzu7v/zP//jl112mXfv3t2TkpK8T58+VRc8j/vd737nvXv39pSUFJ84caLPnTu3zgXV+i5Ofvzxxz5t2jTPyMjw9u3be69evXzixIm+c+fOqj6LFy/2s846y5OTk/2yyy7z+++//4QX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25EHY+5e0VwlD0CeCw2TA0QC8Xj/qtafftr1Z5FbBTGgcBfgvWTiA0Hcdzxgcw2At9tRF0Af3b3I8ARMzsA9GjEOk8FX7cA29y9LKjzHeAs4CPgXXf/S9DvP4FpwDPAIGB1UH9boKzadpc3smZJAAp3aU5Hqk1XVpuv5O8/ewZMcPft1VcMTkPsB4YQO3r+FGIPLDGzi4k9rOERM/utu/+emg+sSK5VxyfB1zbARx4bLvdE9VavtXq9FcTGcpl0kvUraPz/rer7Ob7eMWqeMq39/ZysTqj7AA8n9l5vc/fhDdTySQPtkoB0zl3Ctgq4MRjxETM7P2j/P0CZu1cSGyysbbA8k9h43guJjRA5LOi/38y+ZGZtgCvr25HHxn7fZWbfD7ZlZjakCbVuAEaaWd9g/RQz63+SdQ4BnZuwD4j9UutuZl80sw7AFU1cH6C3mR0P8UnAOmA7kH683czam9l5p7BtSQAKdwnbr4idC34juIj4q6B9ATDZzDYQOyVz/KhyNFBsZpuBCcC8oH0msXPrL1DzVENtOcB1ZvY6sI3Y+fVGcfeDwLXAUouNyrgBOPckq/0XcGV9F1RPsJ/PgF8Se8rUSk5tSN8SYu/fG0Aa8KC7HyV2PeI3wfdfTILdySONp1EhRUQiSEfuIiIRpHAXEYkghbuISAQp3EVEIkjhLiISQQp3EZEIUriLiESQwl1EJIL+Px6ICLQu1AVmAAAAAElFTkSuQmCC\n", "text/plain": [ "
" ] }, "metadata": { "needs_background": "light" }, "output_type": "display_data" } ], "source": [ "# Plot fit\n", "fig, ax = plt.subplots(1,1)\n", "plt.errorbar(x, y, yerr=s, xerr=0, color='black', fmt='o', label='measured data')\n", "plt.xlabel(r'measurement number')\n", "plt.ylabel(r'$y$', labelpad=5)\n", "xMin = 1.e-4\n", "xMax = 5. - 1.e-4\n", "yMin = 0.\n", "yMax = 26.\n", "plt.xlim(xMin, xMax)\n", "plt.ylim(yMin, yMax)\n", "xPlot = np.array([xMin, xMax])\n", "fit = np.array([muHat, muHat])\n", "plotLabel = r'$\\hat{\\mu} = ' + '{:.2f}'.format(muHat) + '\\pm' + '{:.2f}'.format(sigma_muHat) + '$'\n", "plt.plot(xPlot, fit, 'orange', linewidth=2, label=plotLabel)\n", "fitUp = np.array([muHat+sigma_muHat, muHat+sigma_muHat])\n", "fitLo = np.array([muHat-sigma_muHat, muHat-sigma_muHat])\n", "plt.fill_between(xPlot, fitLo, fitUp, color='dodgerblue', alpha=0.2)\n", "plt.subplots_adjust(left=0.15, right=0.9, top=0.9, bottom=0.15)\n", "handles, labels = ax.get_legend_handles_labels() # Tweak legend\n", "handles = [handles[1], handles[0]]\n", "labels = [labels[1], labels[0]]\n", "handles = [handles[0][0], handles[1]] # turn off error bar for data in legend\n", "plt.legend(handles, labels, loc='lower left', fontsize=14, frameon=False)\n", "plt.show()" ] }, { "cell_type": "code", "execution_count": null, "id": "f1197fcb", "metadata": {}, "outputs": [], "source": [] } ], "metadata": { "kernelspec": { "display_name": "Python 3 (ipykernel)", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.10.8" } }, "nbformat": 4, "nbformat_minor": 5 }