Gaussian distributions & statistical tests

Normal/gaussian/bell curve distributions and more to illustrate probability density functions (pdfs), sigma bands (68-95-99 rule), test statistics, critical regions (accept/reject), type-I and type-II errors (alpha, beta), null hypothesis tests, p-value, low sensitivity, bias & systematic error, S+B vs. B-only hypotheses, upper limits and the CLs method.

Inspired by Glen Cowen’s CERN lectures and this Higgs physics course by Mauro Donega at the UZH & ETHZ. Presented in this talk on the statistical method in particle physics.

Also see critical regions and these sets of critical regions.

Probability from gaussian probability density functions (pdfs):gaussians-001.pngThe 68-95-99 rule:gaussians-002.pngSigma (standard deviation) bands for 'Brazilian flag' plots:gaussians-003.pngHypothesis testing with a test statistics t to define a critical region (accept/reject) with type-I (alpha) and type-II errors (beta):gaussians-004.pngP-value (for a null-hypothesis):gaussians-005.pngP-value for a B-only model (signal strength μ = 0):gaussians-006.png gaussians-007.pngP-value for an S+B and B-only hypothesis:gaussians-008.pngBias & systematic error from nuisance parameters:gaussians-009.pngZ-scores for a normal distribution:gaussians-010.pngHypothesis testing with null-hypothesis H0:gaussians-011.pngHypothesis testing with two gaussians:gaussians-012.pngTest power:gaussians-013.pngLow power/sensitivity:gaussians-014.pngBetter power:gaussians-015.pngS+B and B-only p-values for the CLs method:gaussians-016.pnggaussians-017.pnggaussians-018.png

Edit and compile if you like:

% Author: Izaak Neutelings (August, 2017)
\documentclass[border=3pt,tikz]{standalone} %[dvipsnames]
\usepackage{amsmath} % for \dfrac
\usepackage{tikz}
\tikzset{>=latex} % for LaTeX arrow head
\usepackage{pgfplots} % for the axis environment
\usepackage{xcolor}
\usepackage[outline]{contour} % halo around text
\contourlength{1.2pt}
\usetikzlibrary{positioning,calc}
\usetikzlibrary{backgrounds}% required for 'inner frame sep'
%\usepackage{adjustbox} % add whitespace (trim)
% define gaussian pdf and cdf
\pgfmathdeclarefunction{gauss}{3}{%
\pgfmathparse{1/(#3*sqrt(2*pi))*exp(-((#1-#2)^2)/(2*#3^2))}%
}
\pgfmathdeclarefunction{cdf}{3}{%
\pgfmathparse{1/(1+exp(-0.07056*((#1-#2)/#3)^3 - 1.5976*(#1-#2)/#3))}%
}
\pgfmathdeclarefunction{fq}{3}{%
\pgfmathparse{1/(sqrt(2*pi*#1))*exp(-(sqrt(#1)-#2/#3)^2/2)}%
}
\pgfmathdeclarefunction{fq0}{1}{%
\pgfmathparse{1/(sqrt(2*pi*#1))*exp(-#1/2))}%
}
\colorlet{mydarkblue}{blue!30!black}
% to fill an area under function
\usepgfplotslibrary{fillbetween}
\usetikzlibrary{patterns}
\pgfplotsset{compat=1.12} % TikZ coordinates <-> axes coordinates
% https://tex.stackexchange.com/questions/240642/add-vertical-line-of-equation-x-2-and-shade-a-region-in-graph-by-pgfplots
% plot aspect ratio
%\def\axisdefaultwidth{8cm}
%\def\axisdefaultheight{6cm}
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

Click to download: gaussians.texgaussians.pdf
Open in Overleaf: gaussians.tex

One Reply to “Gaussian distributions & statistical tests”

  1. Hello,
    Thank you very much for these very nice examples. I wanted to share the follow problem and fix for it: I downloaded the .tex file, and the figure for the 68-95-99 rule came out wrong. After some investigations I figured ou that in the lines that place the vertical dashed lines and that are of the form

    \addplot[black,dashed,thick]
    coordinates {({\B-3*\Bs},{20*gauss(\B-3*\Bs,\B,\Bs)}) ({\B-3*\Bs},{-\h})};
    node[below=-3pt,scale=0.8] {\strut$\mu-3\sigma$};

    the semi-colon on the second row should not be there… and it is not there in the editable code that one can play with directly on line. By removing the column, as follows, in all similar lines

    \addplot[black,dashed,thick]
    coordinates {({\B-3*\Bs},{20*gauss(\B-3*\Bs,\B,\Bs)}) ({\B-3*\Bs},{-\h})}
    node[below=-3pt,scale=0.8] {\strut$\mu-3\sigma$};

    the figure was again correct. The presence of the semi-colon does not produce a compilation error, but it seems that it messes up the coordinate system.

Leave a Reply

Your email address will not be published.