{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# Moderne Methoden der Datenanalyse SS2023\n", "# Practical Exercise 6" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Exercise 6.1: Hypothesis Testing\n", "\n", "\"Is this a new discovery or just a statistical fluctuation?\" Statistics offers some methods to give a quantitative answer. But these methods should not be used blindly. In particular, one should know exactly what the obtained numbers mean and what they don't mean." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### Exercise 6.1.1 (obligatory to solve either 6.1.1 or 6.1.2)\n", "\n", "The following table shows the number of winners in a horse race for different track numbers:\n", "\n", "| track ||| 1 || 2 || 3 || 4 || 5 || 6 || 7 || 8 |\n", "|------------|||------||------||------||------||------||------||------||------|\n", "| # winners ||| 29 || 19 || 18 || 25 || 17 || 10 || 15 || 11 |\n", "\n", "Use a $\\chi ^2$ test to check the hypothesis that the track number has *no* influence on the chance to win. Define a significance level, e.g., $\\alpha = 5 \\, \\%$ or $\\alpha = 1 \\, \\%$, *before* you do the test." ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "# pick your poison\n", "from ROOT import TMath\n", "from scipy.stats import chi2\n", "\n", "def exercise6_1_1(confidenceLevel):\n", " \n", " # numbers given in the exercise\n", " nTracks = 8\n", " nWin = [29, 19, 18, 25, 17, 10, 15, 11]\n", " \n", " return" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### Exercise 6.1.2 (obligatory to solve either 6.1.1 or 6.1.2)\n", "\n", "In a counting experiment, 5 events are observed while $\\mu _\\mathrm{B} = 1.8$ background events are expected. Is this a significant ($= 3 \\sigma$) excess? Calculate the probability of observing 5 or more events when the expectation value is 1.8 using Poisson statistics." ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "import numpy as np\n", "\n", "# pick your poison\n", "from ROOT import gRandom, TMath, Math\n", "from scipy.stats import poisson, norm" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "def exercise6_1_2():\n", " \n", " # numbers given in the exercise\n", " nBackground = 1.8\n", " nObserved = 5\n", "\n", " # calculate the probability to observe 5 or more events\n", " \n", " # optional: make toy experiments\n", " \n", " return" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Exercise 6.2: Parameter Estimation" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### Exercise 6.2.1 (voluntary)\n", "\n", "Consider the following set of values approximately following a Gaussian distribution (see also excercise_6_2_1.csv):\n", "\n", "\n", "\n", "
xi | yi | σi | \n", "xi | yi | σi | \n", "xi | yi | σi | \n", "xi | yi | σi | \n", "
---|---|---|---|---|---|---|---|---|---|---|---|
0.46 | 0.19 | 0.05 | 0.69 | 0.27 | 0.06 | \n", "0.71 | 0.28 | 0.05 | 1.04 | 0.62 | 0.01 | \n", "
1.11 | 0.68 | 0.05 | 1.14 | 0.70 | 0.07 | \n", "1.17 | 0.74 | 0.08 | 1.20 | 0.81 | 0.09 | \n", "
1.31 | 0.93 | 0.10 | 2.03 | 2.49 | 0.03 | \n", "2.14 | 2.73 | 0.04 | 2.52 | 3.57 | 0.01 | \n", "
3.24 | 3.90 | 0.07 | 3.46 | 3.55 | 0.03 | \n", "3.81 | 2.87 | 0.03 | 4.06 | 2.24 | 0.01 | \n", "
4.93 | 0.65 | 0.10 | 5.11 | 0.39 | 0.07 | \n", "5.26 | 0.33 | 0.05 | 5.38 | 0.26 | 0.08 | \n", "