Wednesday, November 2, 2011

PDF CDF

http://en.wikipedia.org/wiki/Hypergeometric_distribution
In probability theory and statistics, the hypergeometric distribution is a discrete probability distribution that describes the probability of k successes in n draws from a finite population without replacement. (cf. the binomial distribution, which describes the probability of k successes in n draws with replacement.)

Hypergeometric calculator
http://stattrek.com/tables/hypergeometric.aspx

http://www.six-sigma-material.com/Hypergeometric-Distribution.html
Assumptions
# Discrete distribution.
# Population, N, is finite and a known value.
# Two outcomes - call them SUCCESS (S) and FAILURE (F).
# Number of successes in the population is known, S.
# Used when sample size,n, is greater than or equal to 5% of N.
# Trials are done without replacement, dependent.


http://www.mathworks.com/help/toolbox/stats/hygecdf.html
hygecdf - Hypergeometric cumulative distribution function

Example
Suppose you have a lot of 100 floppy disks and you know that 20 of them are defective. What is the probability of drawing 0 through 5 defective floppy disks if you select 10 at random?

In Matlab:
p = hygepdf(0:5,100,20,10)
p =
0.0951 0.2679 0.3182 0.2092 0.0841 0.0215

In R:
> library('stats')
> dhyper(0:5,20,80,10)
[1] 0.09511627 0.26793316 0.31817063 0.20920809 0.08410730 0.02153147

> phyper(0:5,20,80,10) # CDF, at most 5
[1] 0.09511627 0.36304943 0.68122006 0.89042815 0.97453545 0.99606692
> 1-phyper(5,20,80,10) # at least 6
[1] 0.003933076

http://www.youtube.com/watch?v=1xQ4r2gcW3c

No comments: