dfba_median_test {DFBA}R Documentation

Bayesian Median Test

Description

Given two independent groups of continuous variables, performs a Bayesian analysis of the likelihood of observing an above-median value from one of the groups relative to expectation.

Usage

dfba_median_test(E, C, a0 = 1, b0 = 1)

Arguments

E

Numeric vector of values for the continuous measurements for group 1 (generically denoted E for Experimental group).

C

Numeric vector of values for the continuous measurements for group 2 (generically denoted C for Control group).

a0

The first shape parameter for the prior beta distribution for the binomial parameter phi (default is 1). Must be positive and finite.

b0

The second shape parameter for the prior beta distribution for the binomial parameter phi (default is 1). Must be positive and finite.

Details

Given continuous measurements E and C from two separate and independent groups, a combined sample median value can be computed. For the frequentist median test, a 2x2 table is created. Row 1 consists of the frequencies of the above-median responses in terms of the two groups (i.e., nEabove and nCabove). Row 2 has the respective frequencies for the values that are at or below the combined median (i.e., nEbelow and nCbelow). See Siegel & Castellan (1988) for the details concerning the frequentist median test.

Chechile (2020) provided an alternative Bayesian analysis for the median-test procedure of examining continuous data in terms of the categorization of the values as being either above the combined median or not. The frequencies in row 1 (above median response) are binomial frequencies in terms of the group origin (i.e., E versus C). From a Bayesian perspective, a population-level \phi parameter can be defined for the population proportion of E values that are above the combined sample median. Similarly, the frequencies for the scores at or below the combined sample median can also be examined; in that case, the corresponding population proportion in the E condition must be 1-\phi. Thus, it is sufficient only to examine the above-median frequencies to make an inference about the \phi parameter. Since this is a binomial problem, the prior and posterior distributions for the population \phi parameter belong to the beta family of distributions. The default prior for this function is the uniform distribution, i.e, a0 = b0 = 1. The posterior shape parameters for \phi are a_post = a0 + nEabove and b_post = b0 + nCabove.

Because the number of scores in groups E and C might be very different, it is important to examine the \phi parameter relative to an expected base-rate value from the sample. For example, suppose that there are nE = 90 values from the E group and nC = 10 values from the C group. In this example, there are 50 scores that are above the combined median (and no ties that would result in fewer than half of the scores being greater than the median) that should be examined to see if \phi is greater than 0.9. If there were no difference between the E and C conditions whatsoever in this hypothetical example, then about 90 percent of the above-median values would be from the E group. If the posterior \phi parameter were substantially above the group E base rate, then that would support the hypothesis that group E has larger values than group C in the population.

The dfba_median_test() provides the descriptive sample information for the combined median as well as the entries for a table for the frequencies for the E and C scores that are above the median, as well as the frequencies for the E and C scores at or below the median. The function also provides the prior and posterior probabilities that the E and C groups exceeding their respective base rates for a value being above the median. The function also evaluates the hypotheses that the E and C response rates for the above-median responses exceeding their base rate. Bayes factors are provided for these hypothesis.

Because the Bayesian median test ignores the available rank-order information, this procedure has less power than the Bayesian Mann-Whitney analysis that can be computed for the same data. Nonetheless, sometimes researchers are interested if condition differences are so strong that even a lower power median test can detect the difference.

Value

A list containing the following components:

median

The sample combined median for the E and C values

nE

The number of scores from group E

nC

The number of scores from group C

Ebaserate

The proportion nE/(nE+nC)

Cbaserate

The proportion nC/(nE+nC)

nEabove

Number of E responses above the median

nCabove

Number of C responses above the median

nEbelow

Number of E responses at or below median

nCbelow

Number of C response at or below median

a0

The first shape parameter for the prior beta distribution for the population binomial parameter

b0

The second shape parameter for the prior beta distribution for the population binomial parameter

a_post

Posterior first shape parameter for the beta distribution for the probability that an above-median response is from the E group

b_post

Posterior second shape parameter for the beta distribution for the probability that an above-median response is from the E group

postEhi

Posterior probability that an above-median response exceeds the E group base rate

postChi

Posterior probabilty that an above-median response exceeds the C group base rate

priorEhi

The probability that a beta prior distribution would exceed the E group base rate

priorChi

The probability that a beta prior distribution would exceed the C group base rate

BF10E

The Bayes factor in favor of the hypothesis that an above-median response from the E group is more probable than the E expected base rate

BF10C

The Bayes factor in favor of the hypothesis that an above-median response from the C group is more probable than the C group base rate

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.

See Also

dfba_beta_bayes_factor for further documentation about the Bayes factor and its interpretation.

dfba_mann_whitney for a more powerful alternative Bayesian analysis of the E and C values that use rank order information.

Examples


## Example with the default uniform prior
group1 <- c(12.90, 10.84, 22.67, 10.64, 10.67, 10.79, 13.55, 10.95, 12.19,
            12.76, 10.89, 11.02, 14.27, 13.98, 11.52, 13.49, 11.22, 15.07,
            15.74, 19.00)

group2 <- c(4.63, 58.64, 5.07, 4.66, 4.13, 3.92, 3.39, 3.57, 3.56, 3.39)

dfba_median_test(E = group1,
                 C = group2)

## Example with the Jeffreys prior
dfba_median_test(group1,
                 group2,
                 a0 = .5,
                 b0 = .5)


[Package DFBA version 0.1.0 Index]