tTest: Bayesian 't-tests'

Description Usage Arguments Value Examples

View source: R/tTest.R

Description

INDEPENDENT SAMPLES T-TEST:

The difference in means is modeled as mu_1 - mu_2. The difference in the standard deviations of both groups is modeled as sqrt(1/tau_1 - 1/tau_2).

The log-Bayes Factor is estimated as the difference in log density of the effect evaluated at zero and the log density evaluated at each point within the posterior distribution (the Savage-Dickey ratio method). It is presented on the log-density scale for numerical stability. Note that the log-Bayes Factor is here presented as the log-evidence in favor of the alternative hypothesis. Hence, a larger log-BF is evidence in favor of a non-zero difference. Use the median Bayes Factor if you use the median as your point estimate, and the mean if using the posterior mean as your point estimate.

Several effect size measures are also provided. A quantity variously known as Cohen's d or Hedge's g (1981)* is given as the primary effect size measure. Due to the ambiguity in which term is correct, it is simply labeled as "effSize" in the output. The specific formula used is given below:

√{\frac{≤ft[σ_{1}^{2} \times≤ft(n_{1}-1\right)\right]+≤ft[σ_{2}^{2} \times≤ft(n_{2}-1\right)\right]}{n_{1}+n_{2}-2}}

This formula for the effect size is robust to differences in the variances across groups.

Cohen's U3 (1977) is defined as a measure of non-overlap, which quantifies the percentage of data points in group A that are smaller than the median of group B. It is given by the probability density below the observed effect size via the normal cumulative distribution function; phi(effSize).

A similar measure of effect size known as the probability of superiority, or alternatively the common language effect size (CLES), is given by the effect size divided by the square root of two entered into the normal cumulative distribution function; phi(effSize / sqrt(2)). It is very similar in size to Cohen's U3 and carries a similar meaning, but is more strightforward. The CLES gives the probability that an observation sampled at random from group A will have a higher value than an observation sampled at random from group B. The common language effect size was developed to facilitate an easy way to explain the importance of a statistical result to the layman who may not have an intuition for Cohen's d or Hedge's g, which are defined as changes in standard deviation. It is labeled "CL" in the posterior output.

Finally, the output contains posterior predictive simulations for each participant (column-wise). The row-wise posterior predictive distribution gives simulated samples of size N that allow you to visualize what future data sets of the same size might look like.

*The labels Cohen's d and Hedge's g have both been applied to various measures of effect size. See the citation below for a discussion of this.

Difference between Cohen's d and Hedges' g for effect size metrics, URL (version: 2018-09-28): https://stats.stackexchange.com/q/338043

REPEATED MEASURES T-TEST:

Much of the information is the same as above, except Cohen's U3 is not provided as it lacks an intuitive definition for this case.

The effect size is simply the standardized mean difference (z-score)

ONE SAMPLE T-TEST:

Same as above, but the CLES is also dropped because it is not applicable to one group. The effect size is calculated as the mean of y - the comparison value / sd(y)

Usage

1
2
3
4
tTest(formula = NULL, data, compval = 0, model = "is",
  median = FALSE, iter = 10000, warmup = 2500, adapt = 2500,
  chains = 4, thin = 3, method = "parallel", cl = makeCluster(2),
  ...)

Arguments

formula

If using an independent samples t-test, supply a formula of the form y ~ group

data

the data frame containing the outcome variable and group labels for independent samples t-test. If using the one sample t-test, the vector of observations. If using repeated measures, the vector of group differences.

compval

the hypothesized null value for a one sample t-test

model

one of "is" (independent samples t-test), "rm" (repeated measures t-test), or "os" (one sample t-test)

median

change to TRUE to compare the medians instead of means

iter

the number of iterations. defaults to 10000.

warmup

number of burnin samples. defaults to 2500.

adapt

number of adaptation steps. defaults to 2500.

chains

number of chains. defaults to 4.

thin

the thinning interval. defaults to 3.

method

Defaults to "parallel". For an alternative parallel option, choose "rjparallel" or. Otherwise, "rjags" (single core run).

cl

Use parallel::makeCluster(# clusters) to specify clusters for the parallel methods. Defaults to two cores.

...

other arguments to run.jags

Value

a runjags object

Examples

1
tTest(len ~ supp, ToothGrowth)

abnormally-distributed/Bayezilla documentation built on Oct. 31, 2019, 1:57 a.m.