NEGBINOMINV
Updated 2023-11-03 21:40:38.107000
Syntax
SELECT [westclintech].[wct].[NEGBINOMINV] (
<@P, float,>
,<@Number_s, float,>
,<@Probability_s, float,>)
Description
Use the scalar function NEGBINOMINV to calculate the smallest value of x such that NEGBINOMDISTP(@x, @Number_s, @Probability_s) >= @P.
Arguments
@P
the cumulative distribution function. @P is an expression of type float or of a type that implicitly converts to float.
@Probability_s
is the probability of success. @Probability_s is an expression of type float or of a type that implicitly converts to float.
@Number_s
is the number of successes. @Number_s is an expression of type float or of a type that implicitly converts to float.
Return Type
float
Remarks
@P must be greater than zero and less than one (0 < @P < 1).
@Number_s must be greater than or equal to one (1<= @Number_s).
@Number_s is truncated to an integer.
@Probability_s must be greater than zero and less than one (0 < @Probability_s < 1).
Examples
Calculate the cumulative distribution function:
SELECT wct.NEGBINOMDISTP(4, 90, 0.975);
This produces the following result.
{"columns":[{"field":"column 1","headerClass":"ag-right-aligned-header","cellClass":"ag-right-aligned-cell"}],"rows":[{"column 1":"0.912840044254324"}]}
Calculate the inverse:
SELECT wct.NEGBINOMINV(0.912840044254324, 90, 0.975);
This produces the following result.
{"columns":[{"field":"column 1","headerClass":"ag-right-aligned-header","cellClass":"ag-right-aligned-cell"}],"rows":[{"column 1":"4"}]}
See Also
NEGBINOMDIST - Negative binomial distribution
NEGBINOMDISTP - Negative binomial distribution (pdf)