MCPcopy Create free account
hub / github.com/BirolLab/abyss / computeLikelihood

Function computeLikelihood

DistanceEst/MLE.cpp:84–98  ·  view source on GitHub ↗

Compute the log likelihood that these samples came from the * specified distribution shifted by the parameter theta. * @param theta the parameter of the PMF, f_theta(x) * @param samples the samples * @param pmf the probability mass function * @return the log likelihood */

Source from the content-addressed store, hash-verified

82 * @return the log likelihood
83 */
84static pair<double, unsigned>
85computeLikelihood(int theta, const Histogram& samples, const PMF& pmf)
86{
87 double likelihood = 0;
88 unsigned nsamples = 0;
89 for (Histogram::const_iterator it = samples.begin();
90 it != samples.end(); ++it) {
91 double p = pmf[it->first + theta];
92 unsigned n = it->second;
93 likelihood += n * log(p);
94 if (p > pmf.minProbability())
95 nsamples += n;
96 }
97 return make_pair(likelihood, nsamples);
98}
99
100/** Return the most likely distance between two contigs and the number
101 * of pairs that support that estimate. */

Callers 1

Calls 3

minProbabilityMethod · 0.80
beginMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected