Logo

SQL Server WEIBULL Function

Updated 2024-03-13 14:33:37.143000

Description

Use WEIBULL to calculate the Weibull distribution. The formula for the probability density function (pdf) is:

f(x;\lambda,k) = \begin{cases} \frac{k}{\lambda}\left(\frac{x}{\lambda}\right)^{k-1}e^{-(x/\lambda)^{k}}, & x\geq0 ,\\ 0, & x<0, \end{cases}

Where

column 1column 2
xis the value at which to evaluate the function
kus the shape parameter
λis the scale parameter

The formula for the cumulative distribution function (cdf) is:

F(x;k,b) = 1 - e^{-bx^k}

Syntax

SELECT [westclintech].[wct].[WEIBULL] (
  <@X, float,>
 ,<@Alpha, float,>
 ,<@Beta, float,>
 ,<@Cumulative, bit,>)

Arguments

@X

is the value at which to evaluate the function. @X is an expression of type float or of a type that can be implicitly converted to float.

@Alpha

is the shape parameter of the distribution. @Alpha is an expression of type float or of a type that can be implicitly converted to float.

@Beta

is the scale parameter of the distribution. @Beta is an expression of type float or of a type that can be implicitly converted to float.

@Cumulative

is a logical value that determines if the probability density function (False, 0) or the cumulative distribution function (True, 1) is being calculated.

Return Type

float

Remarks

If @X < 0, WEIBULL returns an error.

If @Alpha = 0 or @Beta = 0, WEIBULL returns an error.

WEIBULL(@X,1,@Beta,@Cumulative)= EXPONDIST(@X,1/@Beta, @Cumulative).

Examples

select wct.WEIBULL(105, 20, 100, 'True');

This produces the following result.

column 1
0.929581390069277
select wct.WEIBULL(105, 20, 100, 'False');

This produces the following result.

column 1
0.0355888640245043
select wct.WEIBULL(6, 1, 10, 'False');

This produces the following result.

column 1
0.0548811636094027
select wct.EXPONDIST(6, 1.0000 / 10, 'False');

This produces the following result.

column 1
0.0548811636094026