gr.demokritos.iit.jinsect.algorithms.statistics
Class statisticalCalculation

java.lang.Object
  extended by gr.demokritos.iit.jinsect.algorithms.statistics.statisticalCalculation

public class statisticalCalculation
extends java.lang.Object

Helper class implementing statistical calculation functions. Under review.


Constructor Summary
statisticalCalculation()
           
 
Method Summary
static double binomialSuccessProbability(int iNumberOfTrials, int iNumberOfSuccesses, double dSuccessChance)
          Returns the probability of a given number of successful results after a given number of Bernoulli trials.
static double combinationsOfNByK(int n, int k)
          Returns the number of groups of k members chosen from n elements.
static double entropy(Distribution dDist)
          Calculates the entropy given a Distribution.
static double getPoissonNumber(double dMean)
          Returns a poisson distributed random number.
static void main(java.lang.String[] args)
          Test function.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

statisticalCalculation

public statisticalCalculation()
Method Detail

entropy

public static final double entropy(Distribution dDist)
Calculates the entropy given a Distribution.

Parameters:
dDist - The give distribution.
Returns:
The entropy as bits.

combinationsOfNByK

public static final double combinationsOfNByK(int n,
                                              int k)
Returns the number of groups of k members chosen from n elements.

Parameters:
n - The number of items.
k - The size of group for every combination.
Returns:
The number of combinations of n by k.

binomialSuccessProbability

public static final double binomialSuccessProbability(int iNumberOfTrials,
                                                      int iNumberOfSuccesses,
                                                      double dSuccessChance)
Returns the probability of a given number of successful results after a given number of Bernoulli trials.

Parameters:
iNumberOfTrials - The number of Bernoulli trials.
iNumberOfSuccesses - The number of successful results.
dSuccessChance - The probability of a successful result in a signle trial.
Returns:
The probability of the given number of successful results.

getPoissonNumber

public static final double getPoissonNumber(double dMean)
Returns a poisson distributed random number. Based on the following algorithm:
algorithm poisson random number (Knuth):
 init:
  Let L ← pow(e,−λ), k ← 0 and p ← 1.
 do:
  k ← k + 1.
  Generate uniform random number u and let p ← p × u.
 while p ≥ L
 return k − 1.


main

public static void main(java.lang.String[] args)
Test function. Not to be used.