Probability Functions for Normal Approximation to the Poisson Binomial

This function is called by the NormalContribution() call of the LogLikelihood class to calculate a Normal Approximation to the Poisson Binomial probability.

double poisson_binomial_normal_lpmf(int k, int probslen, LikelihoodData &data)

Completely different implementation of the probabilitity model. Allows for variance away from the strictness of the PoissonBinomial (whilst still being an approximation). This is good for us as although k is from Gaia, n is estimated from ScanningLaw stuff, so might be horribly wrong: hence the inclulsion of the VariancePopulation.

Parameters
  • k – The number of detections within the Gaia population for the target star

  • probslen – The number of visitation of the star (called n in theory work)

  • data – A LikelihoodData object, including an initialised LikelihoodData::p vector.

Returns

The probability p(K = k | p), and populates the gradient vectors LikelihoodData::dfdp_constantN, LikelihoodData::dfdN_constantP and LikelihoodData::hypergradient