Chapter Contents
Chapter Contents
Previous
Previous
Next
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

Nis the population size for a hypergeometric distribution. In terms of acceptance sampling, N is the lot size.
Kis 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.
nis the sample size for a hypergeometric distribution. In terms of acceptance sampling, n is the sample size.
xis 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.
ris 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:

1\leq N \0\leq K\leq N \0\leq n\leq N \\max(0,K+n-N)\leq x\leq \min(K,n) \{N, K, n\space and x\space are integers }

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 r\neq 1.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 r\neq 1, 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:

{Pr}[X\leq x]=\sum_{i=0}^x P_i

where

P_i= \{ \frac{ ( K \ i )
 ( N-K \ n-i ) }
 { ( N \ n ) }
 & {if }\max(0,K+n-N)\leq i \leq\min(K,n) \ 
0 & {otherwise}.

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

\Pr[X_1\leq x | X_1+X_2 = n ] = \sum_{i=o}^x P_i

where
P_i= \{ \frac{ ( K \ i )
 ( N-K \ n-i ) }
 { ( N \ n ) }
 & {if }\max(0,K+n-N)\leq i \leq\min(K,n) \ 
0 & {otherwise}.

where

X1is binomially distributed with parameters K and p1.
X2is 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
Chapter Contents
Previous
Previous
Next
Next
Top
Top

Copyright © 1999 by SAS Institute Inc., Cary, NC, USA. All rights reserved.