hypergeotable {hypersampleplan} | R Documentation |
Calculation exact Hypergeometric Probabilities Table using Chebyshev Polynomials
Description
This is an algorithm for efficient and exact calculation of hypergeometric probabilities using Chebyshev polynomials. For a fixed population size N and fixed sample size n, such calculations simultaneously produce distributions for all possible values of the population number of "successes" M.
The well-known hypergeometric distribution arises in the combinatorial problem in which a finite population of N ob-jects contains M of one kind which may be labeled "success." A sample of n objects is picked without replacement from this set of N objects and it is wished to find the probability that the sample contains exactly x objects labeled "success", where x = 0,1, ... ,N. The probability of observing exactly x such objects is given by The hypergeometric distribution is used for sampling without replacement:
p(x)=choose(M,x)choose(N-M,n-x)/choose(N,n)
where max(0,n-N+M)<=x<=min(n,M)
This algorthim calculate the exact probability even for large N of n, while other algorthims simply use binomial approximation.
Usage
hypergeotable(N,n,output='density')
Arguments
N |
population size N. |
n |
sample size n. |
output |
The output can be 'density', 'distribution' or 'both'. Default output is 'density' |
Details
The detailed algorthim can be found: Alvo, M., & Cabilio, P. (2000). Calculation of hypergeometric probabilities using Chebyshev polynomials. The American Statistician, 54(2), 141-144.
Value
a matrix containing in row M=0,1,...,N, the required values of the hypergeometric probabilities(or distribution if output='distribution') indexed by the columns x=0,1,..,n.
Note
N can be very large say 2000 in our algorthim.
References
Alvo, M., & Cabilio, P. (2000). Calculation of hypergeometric probabilities using Chebyshev polynomials. The American Statistician, 54(2), 141-144.
Examples
# Calculate the hypergeometric probabilities for N=10, n=5.
hypergeotable(10,5)
# Calculate the hypergeometric distribution for N=10, n=5.
hypergeotable(10,5,output='distribution')