Login     Register

        Contact Us     Search

XLeratorDB/statistics Documentation

SQL Server CHISQ.DIST function


CHISQ_DIST

Updated: 31 July 2015

Use CHISQ_DIST to calculate the probability density or the lower cumulative probability of a chi-squared distribution for x and a number of degrees of freedom.
Syntax
SELECT [wct].[CHISQ_DIST](
  <@X, float,>
 ,<@Degrees_freedom, float,>
 ,<@Cumulative, bit,>)
Arguments
@X
The value of interest to be evaluated. @X must be of a type float or of type that intrinsically converts to float
@Degrees_freedom
The number of degrees freedom. @Degrees_freedom must be of a type float or of a type that intrinsically converts to float.
@Cumulative
A bit value indicating whether the probability density function ('False') or the cumulative distribution function ('True') should be returned.
Return Type
float
Remarks
·         0 < @X
·         0 < @Degrees_freedom
Examples
In this example we calculate the chi-squared lower-tailed cumulative distribution function.
SELECT
       wct.CHISQ_DIST(
               0.5          --@X
              ,1            --@Degrees_freedom
              ,'True'       --@Cumulative
              ) as CDF
 
This produces the following result


Using the same data we calculate the chi-squared probability distribution function.
SELECT
       wct.CHISQ_DIST(
               0.5          --@X
              ,1            --@Degrees_freedom
              ,'False'      --@Cumulative
              ) as PDF

This produces the following result.
 


The chi-squared distribution is a special case of the gamma distribution
SELECT
        wct.CHISQ_DIST(x,df,'True') as [Chi-squared]
       ,wct.GAMMAP(0.5*df,0.5*x) as GammaP
FROM (VALUES (42,57))n(x,df)

This produces the following result.

 

See Also

 



Copyright 2008-2024 Westclintech LLC         Privacy Policy        Terms of Service