{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"In this notebook, we investigate nonlinear least squares, and goodness of fit"
]
},
{
"cell_type": "code",
"execution_count": 1,
"metadata": {},
"outputs": [
{
"name": "stderr",
"output_type": "stream",
"text": [
"In /Users/holtz/anaconda3/lib/python3.7/site-packages/matplotlib/mpl-data/stylelib/_classic_test.mplstyle: \n",
"The text.latex.preview rcparam was deprecated in Matplotlib 3.3 and will be removed two minor releases later.\n",
"In /Users/holtz/anaconda3/lib/python3.7/site-packages/matplotlib/mpl-data/stylelib/_classic_test.mplstyle: \n",
"The mathtext.fallback_to_cm rcparam was deprecated in Matplotlib 3.3 and will be removed two minor releases later.\n",
"In /Users/holtz/anaconda3/lib/python3.7/site-packages/matplotlib/mpl-data/stylelib/_classic_test.mplstyle: Support for setting the 'mathtext.fallback_to_cm' rcParam is deprecated since 3.3 and will be removed two minor releases later; use 'mathtext.fallback : 'cm' instead.\n",
"In /Users/holtz/anaconda3/lib/python3.7/site-packages/matplotlib/mpl-data/stylelib/_classic_test.mplstyle: \n",
"The validate_bool_maybe_none function was deprecated in Matplotlib 3.3 and will be removed two minor releases later.\n",
"In /Users/holtz/anaconda3/lib/python3.7/site-packages/matplotlib/mpl-data/stylelib/_classic_test.mplstyle: \n",
"The savefig.jpeg_quality rcparam was deprecated in Matplotlib 3.3 and will be removed two minor releases later.\n",
"In /Users/holtz/anaconda3/lib/python3.7/site-packages/matplotlib/mpl-data/stylelib/_classic_test.mplstyle: \n",
"The keymap.all_axes rcparam was deprecated in Matplotlib 3.3 and will be removed two minor releases later.\n",
"In /Users/holtz/anaconda3/lib/python3.7/site-packages/matplotlib/mpl-data/stylelib/_classic_test.mplstyle: \n",
"The animation.avconv_path rcparam was deprecated in Matplotlib 3.3 and will be removed two minor releases later.\n",
"In /Users/holtz/anaconda3/lib/python3.7/site-packages/matplotlib/mpl-data/stylelib/_classic_test.mplstyle: \n",
"The animation.avconv_args rcparam was deprecated in Matplotlib 3.3 and will be removed two minor releases later.\n"
]
}
],
"source": [
"import numpy as np\n",
"import matplotlib\n",
"%matplotlib inline\n",
"import matplotlib.pyplot as plt"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
" Nonlinear least squares \n",
"\n",
"OK, how about a nonlinear fit? Let's do a Gaussian function, with 3 parameters: amplitude, center, and sigma"
]
},
{
"cell_type": "code",
"execution_count": 14,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
""
]
},
"execution_count": 14,
"metadata": {},
"output_type": "execute_result"
},
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAXYAAAD4CAYAAAD4k815AAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjQuMywgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy/MnkTPAAAACXBIWXMAAAsTAAALEwEAmpwYAAAVLElEQVR4nO3df6wlZX3H8c+nILSrWLRcFVl2F1NCpcREekNWbYW4WFdKRZu2gax2I5vcmNRWmzYVsok1MSS1tqZttJqLUGi7gTb+qMRAZbUupolQL3T51QVZdMGVlb3W+KMlWdz47R8zFw7H82PumWfO/Hq/ks2eMzN35slz7/meZ77znWccEQIAdMfP1N0AAEBaBHYA6BgCOwB0DIEdADqGwA4AHXNiHQc97bTTYsuWLXUcGgBa6+677/5uRCxM266WwL5lyxatrKzUcWgAaC3bjxXZjlQMAHQMgR0AOobADgAdQ2AHgI4hsANAxxDYAaBjCgd229fbPmr7gYFlH7b9kO37bH/W9qmVtBIAUNh6Ruw3SNo+tGyvpPMi4lWSvi7p6kTtAgDMqHBgj4ivSPre0LLbI+J4/vZOSRsTtg2o1kUXZf+AjkmZY79S0m3jVtpesr1ie2V1dTXhYYEJCN7ooSSB3fZuSccl7Rm3TUQsR8RiRCwuLEyd6gAAMKPSc8XY3inpUknbgufsAUDtSgV229slvU/ShRHxVJomAQDKWE+5402SvirpHNuHbe+S9FFJp0jaa3u/7U9U1E4AQEGFR+wRccWIxdclbAsAIAHuPAWAjiGwA1Wh1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bZKfHH8vX3a6Baq+J2/aqyU+/7BvrrkqG2vTvvo3uVXYx+7ZzaNvJ31IR+y4+9QVmg/vmBZbX0m7IvlyOSfpzHtl3j4lSKzyhTCgBAx7QtFQMAmILADgAdQ2AHgI4hsANAxxDYAaBjCOwA0DEEdgDomP8HPqCiAr/XMBMAAAAASUVORK5CYII=\n",
"text/plain": [
""
]
},
"metadata": {
"needs_background": "light"
},
"output_type": "display_data"
}
],
"source": [
"# here we define the function. For use with curve_fit, we need each parameter to \n",
"# be a separate argument (i.e., not have all arguments as a single list/array)\n",
"def func(x,amp,cent,wid) :\n",
" return amp*np.exp(-0.5*(x-cent)**2/wid**2)\n",
"\n",
"# simulate some data. Note that I've defined a par array, but pass it as\n",
"# individual arguments using *par\n",
"x=np.arange(-10,10,0.5)\n",
"par=[10,0,3]\n",
"sig=1\n",
"y=func(x,*par)+np.random.normal(0.,sig,size=len(x))\n",
"plt.errorbar(x,y,sig,fmt='ro')"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Use [scipy.optimize.curve_fit()](https://docs.scipy.org/doc/scipy/reference/generated/scipy.optimize.curve_fit.htm) to do the nonlinear fit. curve_fit returns both the best fit paramters and the covariance matrix"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Moments for initial parameters"
]
},
{
"cell_type": "code",
"execution_count": 15,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"11.03839521600013 19 -0.5 -0.20767008783541083\n"
]
}
],
"source": [
"amp=y.max()\n",
"cent=x[y.argmax()]\n",
"mean=(y*x).sum()/y.sum()\n",
"sigma=(y*x**2).sum()/y.sum()\n",
"print(amp,y.argmax(),cent, mean)"
]
},
{
"cell_type": "code",
"execution_count": 17,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"parameters: [10.12727042 -0.02159847 2.85080193]\n",
"covariance matrix: \n",
" [[ 1.87759941e-01 -1.08577429e-06 -3.52419268e-02]\n",
" [-1.08577429e-06 1.98371456e-02 6.70284425e-07]\n",
" [-3.52419268e-02 6.70284425e-07 1.98416511e-02]]\n"
]
},
{
"data": {
"text/plain": [
"[]"
]
},
"execution_count": 17,
"metadata": {},
"output_type": "execute_result"
},
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAXIAAAD4CAYAAADxeG0DAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjQuMywgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy/MnkTPAAAACXBIWXMAAAsTAAALEwEAmpwYAAArP0lEQVR4nO3dd3wUdfrA8c+TnlASQkJLIXRBpCsIKpw029nP44h3nKKcP+88PVFPxXKNExvenQUPy9mwnb0hIAqcCkoREKT30BJqIL18f3/sIiHsJpvs7M7O7vN+vfLK7szszJNJ8ux3v/PM9yvGGJRSSjlXlN0BKKWU8o8mcqWUcjhN5Eop5XCayJVSyuE0kSullMPF2HHQtLQ0k5OTY8ehlVLKsZYuXbrPGJNee7ktiTwnJ4clS5bYcWillHIsEdnmabl2rSillMNpIldKKYfTRK6UUg6niVwppRxOE7lSSjmcJnKllHI4nxO5iDwvIvkisqrGsodFZK2IrBSRd0UkJSBRKqWU8qohLfIXgPNqLZsD9DTG9ALWA3dZFJdSSikf+ZzIjTELgAO1ls02xlS6ny4CMi2MTSnrDRvm+lIqjFjZR34tMNPbShGZICJLRGRJQUGBhYdVqgZN1CoCWZLIRWQSUAnM8LaNMWa6MWaAMWZAevpJQwUopZRqJL/HWhGRccBFwHCj88YppVTQ+ZXIReQ84I/AUGNMsTUhKaWUaoiGlB++BiwEuolInoiMB54AmgFzRGS5iDwdoDiVUkp54XOL3BjzCw+Ln7MwFqWUUo2gd3YqpZTDaSJXyipa+qhsoolcKaUcThO5Uko5nCZyFTlmzIBFi2D+fMjJcT1XKgxoIlfho65EPWMGTJgAZWWu59u2uZ5rMldhQBO5Cg/1JepJk6C41j1rxcWu5Uo5nCZyFR7qS9Tbt3t+nbflSjmIJnIVHup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w+ozRWSFiMwUkVODFFJ9vxe7/6bG4L0xZcf5OsaXXOT3uYtpdHh+EpHPgDYeVk0yxrzv7WUelgWsftLHGH9B3a3xIcaYXSLSCpgjImvd79wBiQuYBvwV13n5K65un2tr78LDa/0+j76cLxGZBFQCM7zsxvLz5SlUD8tq//xB/Vs74cAiTYG3gVuMMYW1Vi/D1X1w1H394z2gSxDCqu/3Yuf5igMuBu7ysNqu89UQfp872xK5MWZEI16WB2TVeJ4J7PKw3V4RaWuM2e3+eJcfiBhFJAa4HOhfxz52ub/ni8i7uD5G+ZWYfD13IvIM8JGHVb6eR0vjEpFxwEXAcOPuHPSwD8vPlwe+/PwBOUf1EZFYXEl8hjHmndrrayZ2Y8wnIvKUiKQZYwI6OJQPvxdbzpfb+cAyY8ze2ivsOl81+JKL/D53Tuta+QAYIyLxItIB1zvrt162G+d+PA7w1sL31whgrTEmz9NKEWkiIs2OPcZ1wW+Vp22tUqtf8jIvx1sMdBGRDu7WzBhc5yyQcZ0H/BG42BhT7GWbYJ0vX37+D4BfuasxBgGHj31EDhT39ZbngDXGmKletmnj3g4ROQPX//D+AMfly+8l6OerBq+fiu04X7X4kov8/38MxtXcRlz9vQzXu1QZsBeYVWPdJFxXeNcB59dY/izuChegJTAX2OD+nhqgOF8Abqi1rB3wiftxR1xXoFcAq3F1MQT63L0MfA+sdP8xtK0dl/v5BbiqIjYFKa6NuPoBl7u/nrbzfHn6+YEbjv0+cX3cfdK9/ntqVE8FMKazcH2kXlnjPF1QK67fuc/NClwXjQcHIS6Pvxe7z5f7uEm4EnNyjWW2nC9cbya7gQp3/hrvLRdZ/f+ot+grpZTDOa1rRSmlVC2ayJVSyuE0kSullMNpIldKKYfTRK6UUg6niVwppRxOE7lSSjnc/wPDocbg8XtGgwAAAABJRU5ErkJggg==\n",
"text/plain": [
""
]
},
"metadata": {
"needs_background": "light"
},
"output_type": "display_data"
}
],
"source": [
"from scipy.optimize import curve_fit\n",
"init=[12,1,2]\n",
"fit=curve_fit(func,x,y,p0=init,sigma=sig*np.ones(len(x)))\n",
"print('parameters:' ,fit[0])\n",
"print('covariance matrix: \\n',fit[1])\n",
"\n",
"# plot the data and the best fit\n",
"plt.errorbar(x,y,sig,fmt='ro')\n",
"xfit=np.arange(-10,10,0.01)\n",
"plt.plot(xfit,func(xfit,*fit[0]))"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Now calculate the $X^2$ statistic for the data set and fit:\n",
"$$X^2 = \\Sigma {(y_i - f(x_i, parameters))^2 \\over \\sigma_i^2}$$"
]
},
{
"cell_type": "code",
"execution_count": 22,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"46.80136673096389\n",
"0.8703309955431144\n"
]
}
],
"source": [
"x2=((y-func(x,*fit[0]))**2/sig**2).sum()\n",
"print(x2)\n",
"from scipy.stats import chi2\n",
"print(chi2.cdf(x2,len(y)-len(fit[0])))"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Use scipy.stats.chi2() to determine the probability of getting a $\\chi^2$ smaller than and larger than your value. Would you rule this fit out as a good fit?\n",
" ANSWER HERE: "
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Change the size of the uncertainties going into the simulation but not the uncertainties that you feed the fit (or vice versa). Redo the fit , calculate $X^2$ and the probability again.\n",
" DISCUSS YOUR RESULTS: "
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Now add a second Gaussian to your simulated data, with different parameters"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"x=np.arange(-10,10,0.5)\n",
"par=[10,0,3]\n",
"sig=1\n",
"y=func(x,*par)+func(x,10,6,3)+np.random.normal(0.,sig,size=len(x))\n",
"plt.errorbar(x,y,sig,fmt='ro')"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Fit it with a single Gaussian"
]
},
{
"cell_type": "code",
"execution_count": 11,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"parameters: [13.26859434 3.13414992 4.67786386]\n",
"covariance matrix: \n",
" [[ 0.13120967 -0.00599569 -0.03835598]\n",
" [-0.00599569 0.02497582 0.00693781]\n",
" [-0.03835598 0.00693781 0.03102229]]\n"
]
},
{
"data": {
"text/plain": [
"[]"
]
},
"execution_count": 11,
"metadata": {},
"output_type": "execute_result"
},
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAXwAAAD6CAYAAACiefy7AAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADh0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uMy4xLjEsIGh0dHA6Ly9tYXRwbG90bGliLm9yZy8QZhcZAAAgAElEQVR4nO3dd3xUVfr48c9DKgECBEInoSlVaRGwguuKimJZdRWCoCJYUH+6X11RXOtiYdVdFZWiuBbAtaOICqsC6ooYOkgLPdTQS0IgyfP7YyY6hJlkkqmZed6vV16ZuffcOSd3Js/c+9xzzxFVxRhjTOSrFuoGGGOMCQ4L+MYYEyUs4BtjTJSwgG+MMVHCAr4xxkQJC/jGGBMlvA74IjJJRHaJyHKXZY+JyFYRWez86edh24tFZLWIZIvISH803BhjTMWIt/3wReQ84DDwtqp2ci57DDisqs+VsV0MsAa4EMgBfgEGqOqv5dVZv359bdGihVftM8YYAwsWLNitqqnu1sV6+yKqOldEWlSi/h5AtqquBxCR94ArgHIDfosWLcjKyqpElcYYE51EZJOndf7I4d8pIkudKZ+6btY3Bba4PM9xLnNLRIaLSJaIZOXm5vqhecYYY8D3gP8a0BroAmwHnndTRtws85hHUtUJqpqhqhmpqW7PSowxxlSCTwFfVXeqapGqFgMTcaRvSssBmrs8bwZs86VeY4wxFedTwBeRxi5PrwKWuyn2C3CKiLQUkXjgeuAzX+o1xhhTcV5ftBWRqUAfoL6I5ACPAn1EpAuOFM1G4FZn2SbA66raT1ULReRO4GsgBpikqiv8+lcYY4wpl9fdMkMhIyNDrZeOMcZ4T0QWqGqGu3V2p60xxkQJC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3pVS7BHjFuT+X4dK7LsBtS8IRwGu7LAv6/sLxhbMdOO6MXUNxXPP5Bljr/J3iLJsBvO6y7c3Oz1k2cFNl6rehFYwxJkpEakrHGGNMKRbwjTEmSljAN8aYKGEB3xhjooQFfGOMiRIW8I0xJkpYwDfGmCjx/wF7VQvrv6f1qwAAAABJRU5ErkJggg==\n",
"text/plain": [
""
]
},
"metadata": {
"needs_background": "light"
},
"output_type": "display_data"
}
],
"source": [
"init=[12,1,2]\n",
"fit=curve_fit(func,x,y,p0=init,sigma=sig*np.ones(len(x)))\n",
"print('parameters:' ,fit[0])\n",
"print('covariance matrix: \\n',fit[1])\n",
"\n",
"# plot the data and the best fit\n",
"plt.errorbar(x,y,sig,fmt='ro')\n",
"x=np.arange(-10,10,0.01)\n",
"plt.plot(x,func(x,*fit[0]))"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Calculate the $X^2$ statistic and it's probability"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Modify your function to fit the sum of two Gaussians, and\n",
"see how well you can recover the parameters. Experiment with different starting guesses."
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
" DISCUSS YOUR RESULTS: "
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"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.7.11"
}
},
"nbformat": 4,
"nbformat_minor": 1
}