bSignedRankTest: Bayesian equivalent to Wilcoxon's signed-rank test

View source: R/bayesian.R

bSignedRankTestR Documentation

Bayesian equivalent to Wilcoxon's signed-rank test

Description

Implementation of the Bayesian version of the signed-rank test presented in Benavoli et al. 2017

Usage

bSignedRankTest(
  x,
  y = NULL,
  s = 0.5,
  z0 = 0,
  rope = c(-0.01, 0.01),
  nsim = 1000,
  seed = as.numeric(Sys.time())
)

Arguments

x

First sample

y

Second sample (if not provided, x is assumed to be the difference)

s

Scale parameter of the prior Dirichlet Process. The default value is set to 0.5

z0

Position of the pseudo-observation associated to the prior Dirichlet Process. The default value is set to 0 (inside the rope)

rope

Interval for the difference considered as "irrelevant"

nsim

Number of samples used to estimate the posterior distribution

seed

Optional parameter used to fix the random seed

Details

The results includes the typical information relative to the three areas of the posterior density (left, right and rope probabilities), but also the result of the simulation used to estimate the probabilities.

The posterior contains the sampled probabilities in a matrix where each colums corresponds to the sampled (posterior) probability of the measure (z), falling in that particular area (left to the rope, inside the rope and right to the rope). Conversely, the posterior probabilities refer to the probability of each region having the highest probability

As for the prior parameters, they are set to the default values indicated in Benavoli et al. 2017 and you should not modify the unless you know what you are doing.

Value

A list with the following elements:

method

a string with the name of the method used

posterior.probabilities

a vector with the left, rope and right probabilities

approximated

a logical value, TRUE if the posterior distribution is approximated (sampled) and FALSE if it is exact

parameters

parameters used by the method

posterior

Sampled probabilities (see details)

References

A. Benavoli, G. Corani, J. Demsar, M. Zaffalon (2017) Time for a Change: a Tutorial for Comparing Multiple Classifiers Through Bayesian Analysis. Journal of Machine Learning Research, 18, 1-36.

Examples

sample1 <- rnorm(25, 1, 1)
sample2 <- rnorm(25, 1.2, 1)
results <- bSignedRankTest (x=sample1, y=sample2, s=0.5, z0=0)
res$posterior.probabilities


b0rxa/scmamp documentation built on Jan. 17, 2024, 10:49 a.m.