Chapter Contents Previous Next
 Functions

## PROBHYPR Function

computes the probability that an observation from a hypergeometric distribution is less than or equal to x.

### Syntax

PROBHYPR(N,K,n,x<,r>)

where

 N is the population size for a hypergeometric distribution. In terms of acceptance sampling, N is the lot size. K is the number of items in the category of interest in the population. In terms of acceptance sampling, K is the number of nonconforming items in a lot. n is the sample size for a hypergeometric distribution. In terms of acceptance sampling, n is the sample size. x is the number of items from the category of interest in the sample. In terms of acceptance sampling, x is the number of nonconforming items in the sample. r is optional and gives the odds ratio for the extended hypergeometric distribution. For the standard hypergeometric distribution, r=1; this value is the default. In acceptance sampling, typically r=1.

Restrictions on items in the syntax are given in the following equations:

### Description

The PROBHYPR function returns the probability that an observation from an extended hypergeometric distribution with parameters N, K and n and an odds ratio of r is less than or equal to x. The default for r is 1 and leads to the usual hypergeometric distribution.

In terms of acceptance sampling, if r=1, the PROBHYPR function gives the probability of x or fewer nonconforming items in a sample of size n taken from a lot containing N items, K of which are nonconforming, when sampling is done without replacement. Typically r=1 in acceptance sampling.

For example, suppose an urn contains red and white balls, and you are interested in the probability of selecting a white ball. If r=1, the function returns the probability of selecting x white balls when given the population size (number of balls in the urn), sample size (number of balls taken from the urn), and number of white balls in the population (urn).

If, however, the probability of selecting a white ball differs from the probability of selecting a red ball, then .Suppose an urn contains one white ball and one red ball, and the probability of choosing the red ball is higher than the probability of choosing the white ball. This might occur if the red ball were larger than the white ball, for example. Given the probabilities of choosing a red ball and a white ball when an urn contains one of each, you calculate r and use the value in the PROBHYPR function. Returning to the case where an urn contains many balls with , the function gives the probability of selecting x white balls when given the number of balls in the urn, the number of balls taken from the urn, the number of white balls in the urn, and the relative probability of selecting a white ball or a red ball.

The PROBHYPR function is used to evaluate Type A single-sampling plans. See "Evaluating Single-Sampling Plans" for details.

If r=1 (the default), the PROBHYPR function calculates probabilities from the usual hypergeometric distribution:

where

The PROBHYPR function accepts values other than 1 for r, and in these cases, it calculates the probability for the extended hypergeometric distribution:

where

where

 X1 is binomially distributed with parameters K and p1. X2 is binomially distributed with parameters N-K and p2. q1 =1-p1 q2 =1-p2 r =(p1q2)/(p2q1)

For details on the extended hypergeometric distribution, refer to Johnson and Kotz (1969).

### Examples

Suppose you take a sample of size 10 (without replacement) from an urn that contains 200 balls, 50 of which are white. The remaining 150 balls are red. The following statements calculate the probability that your sample contains 2 or fewer white balls:

    data;
y=probhypr(200,50,10,2);
put y;
run;


These statements result in a value of 0.5236734081. Now, suppose the probability of selecting a red ball does not equal the probability of selecting a white ball. Specifically, suppose the probability of choosing a red ball is p2=0.4 and the probability of choosing a white ball is p1=0.2. Calculate r as

r = [(p1q2)/(p2q1)] = [(0.2)(0.6)/(0.4)(0.8)] = 0.375

With r=0.375, the probability of choosing 2 or fewer white balls from an urn that contains 200 balls, 50 of which are white, is calculated using the following statements:

   data;
y=probhypr(200,50,10,2,0.375);
put y;
run;


These statements return a value of 0.9053936127. See "Evaluating Single-Sampling Plans" for another example.

For additional information on probability functions, refer to SAS Language Reference: Dictionary.

 Chapter Contents Previous Next Top