Copyright | (c) 2010 Neil Brown |
---|---|

License | BSD3 |

Maintainer | bos@serpentine.com |

Stability | experimental |

Portability | portable |

Safe Haskell | None |

Language | Haskell98 |

The Wilcoxon matched-pairs signed-rank test is non-parametric test which could be used to test whether two related samples have different means.

## Synopsis

- wilcoxonMatchedPairTest :: (Ord a, Num a, Unbox a) => PositionTest -> Vector (a, a) -> Test ()
- wilcoxonMatchedPairSignedRank :: (Ord a, Num a, Unbox a) => Vector (a, a) -> (Int, Double, Double)
- wilcoxonMatchedPairSignificant :: PositionTest -> PValue Double -> (Int, Double, Double) -> Maybe TestResult
- wilcoxonMatchedPairSignificance :: Int -> Double -> PValue Double
- wilcoxonMatchedPairCriticalValue :: Int -> PValue Double -> Maybe Int
- module Statistics.Test.Types

# Wilcoxon signed-rank matched-pair test

## Test

:: (Ord a, Num a, Unbox a) | |

=> PositionTest | Perform one-tailed test. |

-> Vector (a, a) | Sample of pairs |

-> Test () | Return |

The Wilcoxon matched-pairs signed-rank test. The samples are zipped together: if one is longer than the other, both are truncated to the length of the shorter sample.

For one-tailed test it tests whether first sample is significantly greater than the second. For two-tailed it checks whether they significantly differ

Check `wilcoxonMatchedPairSignedRank`

and
`wilcoxonMatchedPairSignificant`

for additional information.

## Building blocks

wilcoxonMatchedPairSignedRank :: (Ord a, Num a, Unbox a) => Vector (a, a) -> (Int, Double, Double) #

Calculate (n,T⁺,T⁻) values for both samples. Where *n* is reduced
sample where equal pairs are removed.

wilcoxonMatchedPairSignificant #

:: PositionTest | How to compare two samples |

-> PValue Double | The p-value at which to test (e.g. |

-> (Int, Double, Double) | The (n,T⁺, T⁻) values from |

-> Maybe TestResult | Return |

Tests whether a given result from a Wilcoxon signed-rank matched-pairs test is significant at the given level.

This function can perform a one-tailed or two-tailed test. If the first
parameter to this function is `TwoTailed`

, the test is performed two-tailed to
check if the two samples differ significantly. If the first parameter is
`OneTailed`

, the check is performed one-tailed to decide whether the first sample
(i.e. the first sample you passed to `wilcoxonMatchedPairSignedRank`

) is
greater than the second sample (i.e. the second sample you passed to
`wilcoxonMatchedPairSignedRank`

). If you wish to perform a one-tailed test
in the opposite direction, you can either pass the parameters in a different
order to `wilcoxonMatchedPairSignedRank`

, or simply swap the values in the resulting
pair before passing them to this function.

wilcoxonMatchedPairSignificance #

:: Int | The sample size |

-> Double | The value of T for which you want the significance. |

-> PValue Double | The significance (p-value). |

Works out the significance level (p-value) of a T value, given a sample size and a T value from the Wilcoxon signed-rank matched-pairs test.

See the notes on `wilcoxonCriticalValue`

for how this is calculated.

wilcoxonMatchedPairCriticalValue #

:: Int | The sample size |

-> PValue Double | The p-value (e.g. |

-> Maybe Int | The critical value (of T), or Nothing if the sample is too small to make a decision. |

Obtains the critical value of T to compare against, given a sample size and a p-value (significance level). Your T value must be less than or equal to the return of this function in order for the test to work out significant. If there is a Nothing return, the sample size is too small to make a decision.

`wilcoxonSignificant`

tests the return value of `wilcoxonMatchedPairSignedRank`

for you, so you should use `wilcoxonSignificant`

for determining test results.
However, this function is useful, for example, for generating lookup tables
for Wilcoxon signed rank critical values.

The return values of this function are generated using the method detailed in the Mitic's paper. According to that paper, the results may differ from other published lookup tables, but (Mitic claims) the values obtained by this function will be the correct ones.

module Statistics.Test.Types

# References

- "Critical Values for the Wilcoxon Signed Rank Statistic", Peter Mitic, The Mathematica Journal, volume 6, issue 3, 1996 (http://www.mathematica-journal.com/issue/v6i3/article/mitic/contents/63mitic.pdf)