NORMDIST
Updated 2024-03-13 12:56:37.127000
Syntax
SELECT [westclintech].[wct].[NORMDIST] (
<@X, float,>
,<@Mean, float,>
,<@Standard_dev, float,>
,<@Cumulative, bit,>)
Description
Use the scalar function NORMDIST to calculate the normal distribution for the specified mean and standard deviation. The formula for the probability density function (pdf) is:
f(x) = \frac{1}{\sigma \sqrt{2\pi} } e^{-\frac{1}{2}\left(\frac{x-\mu}{\sigma}\right)^2}
where μ is the mean and σ is the standard deviation.
The formula for the cumulative distribution function (cdf) is:
\Phi_{\mu,\sigma^2}(x) = \frac 1 {\sigma\sqrt{2\pi}} \int_{-\infty}^x e^{\frac{-(u-\mu)^2}{2\sigma^2}} \, du
Arguments
@Mean
is the arithmetic mean of the distribution. @Mean is an expression of type float or of a type that can be implicitly converted to float.
@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.
@Cumulative
is a logical value that determines if the probability density function (False, 0) or the cumulative distribution function (True, 1) is being calculated.
@Standard_dev
is the standard deviation of the distribution. @Standard_dev is an expression of type float or of a type that can be implicitly converted to float.
Return Type
float
Remarks
If @Standard_dev = 0, NORMDIST returns an error
If @Mean = 0 and @Standard_dev = 1 and @Cumulative = 'False', NORMDIST = NORMSDIST(@X)
Examples
Select wct.NORMDIST(-4.6159, 10, 5, 'False');
This produces the following result.
{"columns":[{"field":"column 1","headerClass":"ag-right-aligned-header","cellClass":"ag-right-aligned-cell"}],"rows":[{"column 1":"0.00111280980994974"}]}
Select wct.NORMDIST(-4.6159, 10, 5, 'True');
This produces the following result.
{"columns":[{"field":"column 1","headerClass":"ag-right-aligned-header","cellClass":"ag-right-aligned-cell"}],"rows":[{"column 1":"0.00173238078965338"}]}
See Also
NORMINV - Inverse of the normal distribution
NORMSDIST - standard normal distribution
NORMSINV - Inverse of the standard normal distribution
NORMAL - probability density function of the standard normal distribution
STANDARDIZE - normalized value from a distribution for a specified mean and standard deviation
ZTEST - one-tailed probability-value of a z-test (SQL Server 2008 and 2012 version)
ZTEST - one-tailed probability-value of a z-test (SQL Server 2008 and 2012 version)