Logo

SQL Server HYPGEOMDISTQ Function

Updated 2024-03-08 16:35:34.570000

Description

Use the scalar function HYPGEOMDISTQ to calculate the upper cumulative distribution of the hypergeometric function. The formula is:

Q(k;N,m,n)=\sum_{t=k}^{m}f(t;N,m,n)

Where

column 1column 2
kis the number of successes in the sample
Nis the size of the sample
mis the number of successes in the population
nis the population size

Syntax

SELECT [westclintech].[wct].[HYPGEOMDISTQ] (
  <@Sample_s, float,>
 ,<@Number_sample, float,>
 ,<@Population_s, float,>
 ,<@Number_population, float,>)

Arguments

@Sample_s

is the number of successes in the sample. @Sample_s is an expression of type float or of a type that can be implicitly converted to float.

@Number_sample

is the size of the sample. @Number_sample is an expression of type float or of a type that can be implicitly converted to float.

@Population_s

is the number of successes in the population. @Population_s is an expression of type float or of a type that can be implicitly converted to float.

@Number_population

is the population size. @Number_population is an expression of type float or of a type that can be implicitly converted to float.

Return Type

float

Remarks

If @Sample_s < 0 or @Sample_s > MIN(@Number_sample, @Population_s), HYPGEOMDISTQ returns an error.

If @Sample_s < MAX(0, @Number_sample - @Number_population + @Population_s), HYPGEOMDISTQ returns an error.

If @Number_sample = 0 or @Number_sample > @Number_population, HYPGEOMDISTQ returns an error.

If @Population_s = 0 or @Population_s > @Number_population, HYPGEOMDISTQ returns an error.

If @Number_population = 0, HYPGEOMDISTQ returns an error.

Examples

SELECT wct.HYPGEOMDISTQ(20, 900, 45, 2000);

This produces the following result.

column 1
0.467930211161667