tbf01 {bfpwr} | R Documentation |
t-test Bayes factor
Description
This function computes the Bayes factor that forms the basis of
the informed Bayesian t
-test from Gronau et al. (2020). The Bayes
factor quantifies the evidence that the data provide for the null
hypothesis that the standardized mean difference (SMD) is zero against
the alternative that the SMD is non-zero. A location-scale
t
-distribution is assumed for the SMD under the alternative
hypothesis. The Jeffreys-Zellner-Siow (JZS) Bayes factor (Rouder et al.,
2009) is obtained as a special case by setting the location of the prior
to zero and the prior degrees of freedom to one, which is the default.
The data are summarized by t
-statistics and sample sizes. The
following types of t
-statistics are accepted:
Two-sample
t
-test where the SMD represents the standardized mean difference between two group means (assuming equal variances in both groups)One-sample
t
-test where the SMD represents the standardized mean difference to the null valuePaired
t
-test where the SMD represents the standardized mean change score
Usage
tbf01(
t,
n,
n1 = n,
n2 = n,
plocation = 0,
pscale = 1/sqrt(2),
pdf = 1,
type = c("two.sample", "one.sample", "paired"),
alternative = c("two.sided", "less", "greater"),
log = FALSE,
...
)
Arguments
t |
|
n |
Sample size (per group) |
n1 |
Sample size in group 1 (only required for two-sample |
n2 |
Sample size in group 2 (only required for two-sample |
plocation |
|
pscale |
|
pdf |
|
type |
Type of |
alternative |
Direction of the test. Can be either |
log |
Logical indicating whether the natural logarithm of the Bayes
factor should be returned. Defaults to |
... |
Additional arguments passed to |
Details
The Bayes factor is implemented as in equation (5) in Gronau et al.
(2020), and using suitable truncation in case of one-sided alternatives.
Integration is performed numerically with stats::integrate
.
Value
Bayes factor in favor of the null hypothesis over the alternative
(\text{BF}_{01}
> 1 indicates evidence for the null
hypothesis, whereas \text{BF}_{01}
< 1 indicates evidence for
the alternative)
Author(s)
Samuel Pawel
References
Rouder, J. N., Speckman, P. L., Sun, D., Morey, R. D., Iverson,
G. (2009). Bayesian t
tests for accepting and rejecting the null
hypothesis. Psychonomic Bulletin & Review, 16(2):225-237.
doi:10.3758/PBR.16.2.225
Gronau, Q. F., Ly., A., Wagenmakers, E.J. (2020). Informed Bayesian
t
-Tests. The American Statistician, 74(2):137-143.
doi:10.1080/00031305.2018.1562983
See Also
Examples
## analyses from Rouder et al. (2009):
## values from Table 1
tbf01(t = c(0.69, 3.20), n = 100, pscale = 1, type = "one.sample")
## examples from p. 232
tbf01(t = c(2.24, 2.03), n = 80, pscale = 1, type = "one.sample")
## analyses from Gronau et al. (2020) section 3.2:
## informed prior
tbf01(t = -0.90, n1 = 53, n2 = 57, plocation = 0.350, pscale = 0.102, pdf = 3,
alternative = "greater", type = "two.sample")
## default (one-sided) prior
tbf01(t = -0.90, n1 = 53, n2 = 57, plocation = 0, pscale = 1/sqrt(2), pdf = 1,
alternative = "greater", type = "two.sample")