@Test public void testNegativeBinomialCdf() { logger.info("NegativeBinomialCdf"); int n = 10; int r = 4; double p = 0.5; double expResult = 0.1279296875; double result = DiscreteDistributions.negativeBinomialCdf(n, r, p); assertEquals(expResult, result, Constants.DOUBLE_ACCURACY_HIGH); }
public static double negativeBinomialCdf(int n, int r, double p) { if(n<0 || r<0 || p<0) { throw new IllegalArgumentException("All the parameters must be positive."); } n = Math.max(n,r); double probabilitySum = 0.0; for(int i=0;i<=r;++i) { probabilitySum += negativeBinomial(n, i, p); } return probabilitySum; }
DiscreteDistributions { public static double negativeBinomialCdf(int n, int r, double p) { if(n<0 || r<0 || p<0) { throw new IllegalArgumentException("All the parameters must be positive."); } n = Math.max(n,r); double probabilitySum = 0.0; for(int i=0;i<=r;++i) { probabilitySum += negativeBinomial(n, i, p); } return probabilitySum; } }
DiscreteDistributions { public static double negativeBinomialCdf(int n, int r, double p) { if(n<0 || r<0 || p<0) { throw new IllegalArgumentException("All the parameters must be positive."); } n = Math.max(n,r); double probabilitySum = 0.0; for(int i=0;i<=r;++i) { probabilitySum += negativeBinomial(n, i, p); } return probabilitySum; }  }
DiscreteDistributions { public static double negativeBinomialCdf(int n, int r, double p) { if(n<0 || r<0 || p<0) { throw new IllegalArgumentException("All the parameters must be positive."); } n = Math.max(n,r); double probabilitySum = 0.0; for(int i=0;i<=r;++i) { probabilitySum += negativeBinomial(n, i, p); } return probabilitySum; }  static double bernoulli(boolean k, double p); static double bernoulliCdf(int k, double p); static double binomial(int k, double p, int n); static double binomialCdf(int k, double p, int n); static double geometric(int k, double p); static double geometricCdf(int k, double p); static double negativeBinomial(int n, int r, double p); static double negativeBinomialCdf(int n, int r, double p); static double uniform(int n); static double uniformCdf(int k, int n); static double hypergeometric(int k, int n, int Kp, int Np); static double hypergeometricCdf(int k, int n, int Kp, int Np); static double poisson(int k, double lamda); static double poissonCdf(int k, double lamda); }
DiscreteDistributions { public static double negativeBinomialCdf(int n, int r, double p) { if(n<0 || r<0 || p<0) { throw new IllegalArgumentException("All the parameters must be positive."); } n = Math.max(n,r); double probabilitySum = 0.0; for(int i=0;i<=r;++i) { probabilitySum += negativeBinomial(n, i, p); } return probabilitySum; }  static double bernoulli(boolean k, double p); static double bernoulliCdf(int k, double p); static double binomial(int k, double p, int n); static double binomialCdf(int k, double p, int n); static double geometric(int k, double p); static double geometricCdf(int k, double p); static double negativeBinomial(int n, int r, double p); static double negativeBinomialCdf(int n, int r, double p); static double uniform(int n); static double uniformCdf(int k, int n); static double hypergeometric(int k, int n, int Kp, int Np); static double hypergeometricCdf(int k, int n, int Kp, int Np); static double poisson(int k, double lamda); static double poissonCdf(int k, double lamda);  }