dfba_sign_test {DFBA} R Documentation

## Bayesian Sign Test

### Description

Given two paired continuous variates Y1 and Y2, provides a Bayesian sign test to assess the positivity rate for the difference Y1 - Y2.

### Usage

dfba_sign_test(Y1, Y2, a0 = 1, b0 = 1, prob_interval = 0.95)


### Arguments

 Y1 Vector of the continuous measurements for one group Y2 Vector of the continuous values paired with the Y1 vector for the values in a second group a0 The first shape parameter for the prior beta distribution for the positive-sign rate parameter (default is 1). Must be positive and finite. b0 The second shape parameter for the prior beta distribution for the positive-sign rate parameter (default is 1). Must be positive and finite. prob_interval Desired probability within interval limits for interval estimates of the positivity rate parameter (default is .95)

### Details

Given two paired continuous variates Y_1 and Y_2 for two repeated measures, statistical tests for differences examine the difference measure d = Y_1 - Y_2. The t-test is a conventional frequentist parametric procedure to assess values of d. There are also two common frequentist nonparametric tests for assessing condition differences: the sign test and the Wilcoxon signed-rank test. The sign test is less powerful than the Wilcoxon signed-rank test (Siegel & Castellan, 1988). The appeal of the sign test, for some researchers, is that it is simple and - in some cases - sufficient for demonstrating strong differences.

The dfba_sign_test() function provides a Bayesian version of the sign test (the function dfba_wilcoxon() provides the Bayesian signed-rank test). While the Wilcoxon procedure uses both rank and sign information, the sign test uses only sign information. The dfba_sign_test() function finds the number of positive and negative d values, which appear in the output as n_pos and n_neg, respectively. Note that it is standard both in the frequentist sign test and in the frequentist Wilcoxon signed-rank procedure to remove the d values that are zero. Consequently, the signs for the nonzero d values are binary, so the posterior is a beta distribution with shape parameters a - denoted in the output as a_post and b - denoted in the output as b_post - where a_post = a0 + n_pos and b_post = b0 + n_neg and a0 and b0 are the respective first and second beta shape parameters for the prior distribution. The default prior is a uniform distribution a0 = b0 = 1.

The function estimates the population rate for positive signs by calling dfba_beta_descriptive() using the computed a_post and b_post as arguments. Since interest in the sign test is focused on the null hypothesis that the positivity rate is less than or equal to .5, dfba_sign_test() calls dfba_beta_bayes_factor() to calculate the prior and posterior probabilities for the alternative hypothesis that the positivity rate is greater than .5. The output also includes the Bayes factors BF10 and BF01, where BF01 = 1/BF10. Large values of BF01 indicate support for the null hypothesis; large values of BF10 indicate support for the alternative hypothesis.

### Value

A list containing the following components:

 Y1 Vector of continuous values for the first within-block group Y2 Vector of continuous values for the second within-block group a0 First shape parameter for the prior beta distribution for the population parameter for the positivity rate b0 Second shape parameter for the prior beta distribution for the population positivity rate prob_interval The probability within the interval limits for the interval estimate of population positivity rate n_pos Sample number of positive differences n_neg Sample number of negative differences a_post First shape parameter for the posterior beta distribution for the population positivity rate b_post Second shape parameter for the posterior beta distribution for the population positivity rate for differences phimean Mean of the posterior distribution for the positivity rate parameter phimedian Median of the posterior distribution for the positivity rate parameter phimode Mode of the posterior distribution for the positivity rate parameter eti_lower Lower limit of the equal-tail interval estimate of the positivity rate parameter eti_upper Upper limt of the equal-tail interval estimate of the positivity rate parameter hdi_lower Lower limit for the highest-density interval estimate of the positivity rate parameter hdi_upper Upper limit for the highest-density interval estimate of the positivity rate parameter post_H1 Posterior probability that the positivity rate is greater than .5 prior_H1 Prior probability that the positivity rate is greater than .5 BF10 Bayes factor in favor of the alternative hypothesis that the positivity rate is greater than .5 BF01 Bayes factor in favor of the null hypothesis that the positivity rate is equal to or less than .5

### References

Chechile, R. A. (2020). Bayesian Statistics for Experimental Scientists: A General Introduction Using Distribution_Free Methods. Cambridge, MIT Press.

Siegel, S., & Castellan, N. J. (1988). Nonparametric Statistics for the Behavioral Sciences. New York: McGraw Hill.

dfba_beta_descriptive for details on the descriptive statistics in the output

dfba_beta_bayes_factor for details on Bayes Factors calculated on the basis of beta distributions

dfba_wilcoxon for an alternative, more powerful Bayesian nonparametric test for evaluting repeated-measures data.

### Examples


measure_1 <- c(1.49, 0.64, 0.96, 2.34, 0.78, 1.29, 0.72, 1.52,
0.62, 1.67, 1.19, 0.860)

measure_2 <- c(0.53, 0.55, 0.58, 0.97, 0.60, 0.22, 0.05, 13.14,
0.63, 0.33, 0.91, 0.37)

dfba_sign_test(Y1 = measure_1,
Y2 = measure_2)

dfba_sign_test(measure_1,
measure_2,
a0 = .5,
b0 = .5,
prob_interval = .99)



[Package DFBA version 0.1.0 Index]