Application Programming Interface (API)¶
nbi_stat Module¶
Module to help with various statistical choirs
This module contains many different functions and classes for statistical tasks, including
Robust and online mean and (co)variance calculations
Scientific rounding
Representation of results
Representation of data
Visualisation of data
Propagation of uncertainty
Sampling of arbitrary PDF
Histogramming
Fitting
Likelihood
Hypothesis testing
Simultanious fitting
Confidence intervals
Copyright © 2019 Christian Holm Christensen
2024-02-22 18:02:51.194062 UTC
Functions¶
|
A decorator indicating abstract methods. |
|
Calculate the binned logarithmic likelihood |
|
|
|
|
|
Evaluate the confince interval from an evaluated CDF |
|
Calculate the chi-square over the sample (x,y) |
|
Draw a corner plot of several variables. |
|
Calculated weighted covariance |
|
Perform a non-linear least squares fit of f to data |
|
Calculate the Kullback-Leibler discrepancy (or relative entropy) of a discrete random variable with assumed probability p[i] and observed probability q[i]=n[i]/N |
|
Calculates the effective variance |
|
Integrates the PDF f over the range x to get a table of the CDF |
|
Estimate the confidence interval given using the Feldman-Cousine algorithm |
|
Calculates Feldman-Cousine rank of PDF with measurements, hypotheses, and best value |
|
Fill a histogram |
|
Finalize histogram |
|
Unified interface for curve fitting |
|
Plot data and a fitted funtion |
|
Formats data into a LaTeX table |
|
Formats best-fit parameter values and uncertainties in a table. |
|
Function to pretty-format results |
|
Calculates and plots a histogram of data |
|
Generate a PDF function from a histogram |
|
Build a histogram of data in a |
|
Initialize a histogram structure |
|
Calculate the likelihood ratio of hypothesis H1 to H0 |
|
Fit a linear model f to data |
|
Fit a linear model f to data |
|
Calculate the logarithmic likelihood |
|
Perform a non-linear least squares fit of f to data |
|
Perform a non-linear least squares fit of f to data |
|
Maximize a logarithmic likelihood function |
|
Do an MLE estimate of parameters of the PDF given data yield. |
|
Determine the number of significant digits |
|
Calculate all n-sigma contours |
|
Calculate the two parameter n-sigma contour |
|
A decorate that adds an overall systematic uncertainty to a PDF |
|
Creates a function to sample a PDF |
|
Plots Confidence intervals of a CDF |
|
Plot data and a fitted funtion |
|
Plot data, fit, residuals of fit, and contours of fit parameters. |
|
Plot fit function with found parameters and (optional uncertainty band) |
|
Plot a fit table in the current (or passed) axes |
|
Plot a histogram |
|
|
|
Plot nsigma contour lines |
|
Plot the residuls and uncertainty on function |
|
Print a single result with uncertainties, properly rounded |
|
Propegate uncertainties on x to y |
|
Plot the residuls and uncertainty on function |
|
Calculate the residuals with respect to some function |
|
Round value(s) to the precision given by nbi_stat.py |
|
Round result and associated uncertainties |
|
|
|
Sample a PDF given by the table of the CDF |
|
Decorate to add norm to a PDF (any PDF) |
|
Draw a two-dimensional sample histogrammed as a scatter plot |
|
|
|
A decorate that adds a shape systematic uncertainty to a PDF |
|
Perform simulatinous MLE fit over several regions |
|
Initialize a structure for use with welford_update |
|
Merge two statistics into one |
|
Calculates running average and (co)variance by Welfords algorithm |
|
Initialize a data-structure for use with west_update |
|
Merge two statistics into one |
|
Do a West online update of mean and (co)variance of the weighted sample. |
Classes¶
|
Helper class that provides a standard way to create an ABC using inheritance. |
|
A 1 dimensional histogram class |
|
Base class for statistics classes |
|
A utility class for converting stat objects to and from dictionaries. |
|
An unweighted sample statistics |
|
An weighted sample statistics |
|
|
|
A generic continuous random variable class meant for subclassing. |
|