Main Content

hygecdf

Hypergeometric cumulative distribution function

Syntax

hygecdf(x,M,K,N)
hygecdf(x,M,K,N,'upper')

Description

hygecdf(x,M,K,N)computes the hypergeometric cdf at each of the values inxusing the corresponding size of the population,M, number of items with the desired characteristic in the population,K, and number of samples drawn,N. Vector or matrix inputs forx,M,K, andNmust all have the same size. A scalar input is expanded to a constant matrix with the same dimensions as the other inputs.

hygecdf(x,M,K,N,'upper')returns the complement of the hypergeometric cdf at each value inx, using an algorithm that more accurately computes the extreme upper tail probabilities.

The hypergeometric cdf is

p = F ( x | M , K , N ) = i = 0 x ( K i ) ( M K N i ) ( M N )

The result,p, is the probability of drawing up toxof a possibleKitems inNdrawings without replacement from a group ofMobjects.

Examples

collapse all

Suppose you have a lot of 100 floppy disks and you know that 20 of them are defective. What is the probability of drawing zero to two defective floppies if you select 10 at random?

p = hygecdf(2,100,20,10)
p = 0.6812

Extended Capabilities

C/C++ Code Generation
Generate C and C++ code using MATLAB® Coder™.

版本历史

Introduced before R2006a