likelihood_calculations¶
This module provides several functions for calculating likelihood values.
A ‘likelihood’ is an unnormalized probability, calculated from the pdf of a distribution. In this module, the pdf that is used is the Gaussian pdf.
The main function is cum_corr_loglikelihood() in that it can stand in for any of the other functions, in particular by setting the correlation coefficient to zero and possibly giving only a single point.

likelihood_calculations.
aicc
(logLikelihood, n, k)¶ Akaike information criterion corrected for small sample size n = number of samples k = number of degrees of freedom

likelihood_calculations.
likelihood
(y, m, sigma)¶ calculates likelihood given Gaussian statistics
 Args:
 y (float): measured value m (float): mean (expected model value) sigma (float): stdev of measurements
 Returns:
 unnormalized probability based on Gaussian distribution

likelihood_calculations.
loglikelihood
(y, m, sigma)¶ calculate ln(likelihood) given Gaussian statistics
 Args:
 y (float): measured value m (float): mean (expected model value) sigma (float): stdev of measurements
 Returns:
 natural logarithm of unnormalized probability based on Gaussian distribution

likelihood_calculations.
logLikelihoodLine
(y, sigmaB=None, left=None, right=None)¶ log likelihood of a straight line through the readings

likelihood_calculations.
cum_loglikelihood
(y, m, sigma, left, right)¶ numpy accelerated sum of loglikelihoods
 ARGS:
 y (ndarray): measured values m (ndarray): associated mean values (the ‘model’) sigma (ndarray): associated stdev values left index of first y to include right index of last y to include

likelihood_calculations.
conditional_likelihood
(rho, y1, m1, sigma1, y0, m0, sigma0)¶ Computes the conditional likelihood p(y1y0) which should be read as: ...the probability of y1, given y0, when the values are partially correlated.
All arguments are standard floats
 Args:
 rho: correlation coefficient (0 <= rho < 1) y1: measured value at position 1 y0: measured value at position 0 m1: model value at position 1 m0: model value at position 0 sigma1: noise at position 1 sigma0: noise at position 0

likelihood_calculations.
cum_corr_loglikelihood
(rho, y, m, sigma)¶ calculates the sum of correlated loglikelihoods of a measurement array using numpy acceleration
 Args:
 rho (float): average nearest neighbor correlation coeffiecient y (ndarray): measurements m (ndarray): means (model values) sigma (ndarray): stdev associated with each y
 Returns:
 sum of natural logarithms of nearest neighbor correlated measurements assuming measurements have Gaussian distributions