|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.ObjectbaseCode.math.SpecFunc
Assorted special functions, primarily concerning probability distributions. For cumBinomial use cern.jet.stat.Probability.binomial.
Mostly ported from the R source tree (dhyper.c etc.), much due to Catherine Loader.
Copyright (c) 2004 Columbia University
| Constructor Summary | |
SpecFunc()
|
|
| Method Summary | |
static double |
dbinom(double x,
double n,
double p)
See dbinom_raw. |
static double |
dhyper(int x,
int r,
int b,
int n)
Ported from R (Catherine Loader) |
static double |
phyper(int x,
int NR,
int NB,
int n,
boolean lowerTail)
Ported from R phyper.c |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
public SpecFunc()
| Method Detail |
public static double phyper(int x,
int NR,
int NB,
int n,
boolean lowerTail)
Sample of n balls from NR red and NB black ones; x are red
x - - number of reds retrieved == successesNR - - number of reds in the urn. == positivesNB - - number of blacks in the urn == negativesn - - the total number of objects drawn == successes + failureslowerTail -
public static double dhyper(int x,
int r,
int b,
int n)
DESCRIPTION
Given a sequence of r successes and b failures, we sample n (\le b+r) items without replacement. The hypergeometric probability is the probability of x successes:
choose(r, x) * choose(b, n-x)
p(x; r,b,n) = ----------------------------- =
choose(r+b, n)
dbinom(x,r,p) * dbinom(n-x,b,p)
= --------------------------------
dbinom(n,r+b,p)
for any p. For numerical stability, we take p=n/(r+b); with this choice, the denominator is not exponentially
small.
public static double dbinom(double x,
double n,
double p)
x - Number of successesn - Number of trialsp - Probability of success
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||