주요 콘텐츠

hygeinv

Hypergeometric inverse cumulative distribution function

Description

x = hygeinv(p,m,k,n) returns the smallest integer x such that the hypergeometric cdf defined by the parameters m, k, and n exceeds p. An interpretation of p is the probability of observing x defective items in n drawings without replacement from a group of m items where k are defective.

example

Examples

collapse all

Suppose that the production line for a manufacturer produces machine parts in batches of 1000. You want to sample 50 parts from each batch to see if they have defects, and accept 99% of the batches if there are no more than 10 defective parts in each batch. What is the maximum number of defective parts you should allow in your sample of 50?

p = 0.99;
m = 1000;
k = 10;
n = 50;
x = hygeinv(p,m,k,n)
x = 
3

What is the median number of defective machine parts in samples of 50 parts from batches with 10 defective parts?

x = hygeinv(0.5,m,k,n)
x = 
0

Input Arguments

collapse all

Probability values at which to evaluate the inverse of the cdf (icdf), specified as a scalar value or an array of scalar values in the range [0,1].

To evaluate the icdf at multiple values, specify p using an array. To evaluate the icdfs of multiple distributions, specify m, k, and n using arrays. If one or more of the input arguments p, m, k, and n are arrays, then the array sizes must be the same. In this case, hygeinv expands each scalar input into a constant array of the same size as the array inputs. Each element in x is the icdf value of the distribution specified by the corresponding elements in m, k, and n, evaluated at the corresponding element in p.

Data Types: single | double

Size of the population, specified as a nonnegative integer or an array of nonnegative integers. Each value in m must be greater than or equal to the corresponding values in n and k.

To evaluate the icdf at multiple values, specify p using an array. To evaluate the icdfs of multiple distributions, specify m, k, and n using arrays. If one or more of the input arguments p, m, k, and n are arrays, then the array sizes must be the same. In this case, hygeinv expands each scalar input into a constant array of the same size as the array inputs. Each element in x is the icdf value of the distribution specified by the corresponding elements in m, k, and n, evaluated at the corresponding element in p.

Data Types: single | double

Number of items with intended characteristics in the population, specified as a nonnegative integer or an array of nonnegative integers. Each value in k must be less than or equal to the corresponding value in m.

To evaluate the icdf at multiple values, specify p using an array. To evaluate the icdfs of multiple distributions, specify m, k, and n using arrays. If one or more of the input arguments p, m, k, and n are arrays, then the array sizes must be the same. In this case, hygeinv expands each scalar input into a constant array of the same size as the array inputs. Each element in x is the icdf value of the distribution specified by the corresponding elements in m, k, and n, evaluated at the corresponding element in p.

Data Types: single | double

Number of items drawn from the population, specified as a nonnegative integer or an array of nonnegative integers. Each value in n must be less than or equal to the corresponding value in m.

To evaluate the icdf at multiple values, specify p using an array. To evaluate the icdfs of multiple distributions, specify m, k, and n using arrays. If one or more of the input arguments p, m, k, and n are arrays, then the array sizes must be the same. In this case, hygeinv expands each scalar input into a constant array of the same size as the array inputs. Each element in x is the icdf value of the distribution specified by the corresponding elements in m, k, and n, evaluated at the corresponding element in p.

Data Types: single | double

Output Arguments

collapse all

Hypergeometric icdf values, returned as a scalar value or an array of scalar values. x is the same size as p, m, k, and n after any necessary scalar expansion. Each element in x is the icdf value of the distribution specified by the corresponding elements in m, k, and n, evaluated at the corresponding element in p.

Alternative Functionality

  • hygeinv is a function specific to the hypergeometric distribution. Statistics and Machine Learning Toolbox™ also offers the generic function icdf, which supports various probability distributions. To use icdf, specify the probability distribution name and its parameters. Note that the distribution-specific function hygeinv is faster than the generic function icdf.

Extended Capabilities

expand all

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

Version History

Introduced before R2006a