Learn R Programming

hypersampleplan (version 0.1.1)

binomialtable: Calculation exact Binomial Probabilities Table using Chebyshev Polynomials

Description

This is an algorithm for efficient and exact calculation of Binomial probabilities using Chebyshev polynomials. For a fixed population size n and probability of "success" p, such calculations simultaneously produce distributions for all possible values of the number of "successes" x. The algorthim calculate the exact probability even for large n, while other algorthims simply use normal approximation.

Usage

binomialtable(n, p, output = "density")

Arguments

n

number of observations.

p

probability of "success"

output

The output can be 'density', 'distribution' or 'both'. Default output is 'density'

Value

a matrix containing the required values of the hypergeometric probabilities indexed by the columns x=0,1,..,n.

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.

References

Alvo, M., & Cabilio, P. (2000). Calculation of hypergeometric probabilities using Chebyshev polynomials. The American Statistician, 54(2), 141-144.

Examples

Run this code
# Calculate the binomialtable probabilities for n=10, p=0.4.
binomialtable(10,0.4)
# Calculate the binomialtable distribution for n=10, p=0.4.
binomialtable(10,0.4,output='distribution')

Run the code above in your browser using DataLab