Multivariate Bayes and marginalization"
]
},
{
"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",
"%matplotlib inline\n",
"import matplotlib.pyplot as plt"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"
Fitting mean and standard deviation of a set of measurements"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"let's generate a synthetic data set of measurements of some quantity that has some mean and variance, that we will want to try to determine from the data set\n"
]
},
{
"cell_type": "code",
"execution_count": 2,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"[]"
]
},
"execution_count": 2,
"metadata": {},
"output_type": "execute_result"
},
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAXIAAAD4CAYAAADxeG0DAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjQuMywgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy/MnkTPAAAACXBIWXMAAAsTAAALEwEAmpwYAAAN2UlEQVR4nO3df4hl513H8c9ndlPTm1YiZLB2f8xEDNUQaiKX0BpQTBbdamlQERquVVS4CFZTKWjjgCIyIFSKgkW5tFHBa4ukKSlpan5gpRRs7Gy6xt1uoiFmJmsjmSJtWi8Y13z949xlZzazO/fOee6c+d7zfsHlzHnuzTlfDjufPPOc5znXESEAQF4LTRcAAKiHIAeA5AhyAEiOIAeA5AhyAEjucBMnveGGG2J5ebmJUwNAWqdOnfp6RCxe3t5IkC8vL2ttba2JUwNAWrbXd2pnaAUAkiPIASA5ghwAkiPIASA5ghwAkiPIgXkzHErLy9LCQrUdDpuuCDPWyPRDADMyHEr9vjQaVfvr69W+JPV6zdWFmaJHDsyTlZVLIX7RaFS1Y24R5MA82diYrh1zgSAH5snx49O1Yy4Q5MA8WV2VOp3tbZ1O1Y65RZAD86TXkwYDaWlJsqvtYMCNzjnHrBVg3vR6BHfL0CMHgORqB7nta23/k+1/tn3W9u+XKAwAMJkSQyv/I+nOiPi27WskfdH25yLiSwWODQDYRe0gj4iQ9O3x7jXjV9Q9LgBgMkXGyG0fsn1a0suSHo+IJ0scFwCwuyJBHhH/FxG3Sjoq6Xbbt1z+Gdt922u21zY3N0uc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