Logo

PSIGNRANK

Updated 2023-11-06 16:41:23.307000

Syntax

SELECT [westclintech].[wct].[PSIGNRANK](
  <@X, float,>
 ,<@N, float,>
 ,<@Exact, bit,>)

Description

Use the scalar function PSIGNRANK to calculate the distribution function of the Wilcoxon Signed Rank statistic.

Arguments

@Exact

tells the function whether or not to do the exact calculation or to calculate an approximate value using the normal distribution. @Exact is an expression of type bit or of a type that can be implicitly converted to bit.

@X

the Wilcoxon signed rank statistic. @X is an expression of type float or of a type that can be implicitly converted to float.

@N

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

Return Type

float

Remarks

If @N < 0 then an error is returned.

If @Exact IS NULL and @N > 50 then @Exact = FALSE.

IF @N > 1023 Then @Exact = FALSE.

Examples

SELECT x,
       n,
       wct.PSIGNRANK(x, n, NULL) as PSIGNRANK
FROM
(
    SELECT 2,
           4
    UNION ALL
    SELECT 5,
           6
    UNION ALL
    SELECT 22,
           10
    UNION ALL
    SELECT 27,
           15
) p(x, n);

This produces the following result.

{"columns":[{"field":"x","headerClass":"ag-right-aligned-header","cellClass":"ag-right-aligned-cell"},{"field":"n","headerClass":"ag-right-aligned-header","cellClass":"ag-right-aligned-cell"},{"field":"PSIGNRANK","headerClass":"ag-right-aligned-header","cellClass":"ag-right-aligned-cell"}],"rows":[{"x":"2","n":"4","PSIGNRANK":"0.1875"},{"x":"5","n":"6","PSIGNRANK":"0.15625"},{"x":"22","n":"10","PSIGNRANK":"0.3125"},{"x":"27","n":"15","PSIGNRANK":"0.0318603515625"}]}