Using the classical t test statistic for a one- or two-sample design, this function computes the corresponding Bayes factor test.
classical t statistic
size of first group (or only group, for one-sample tests)
size of second group, for independent-groups tests
optional vector of length 2 containing lower and upper bounds of an interval hypothesis to test, in standardized units
numeric prior scale
This function can be used to compute the Bayes factor
corresponding to a one-sample, a paired-sample, or an
independent-groups t test, using the classical t
statistic. It can be used when you don't have access to
the full data set for analysis by
but you do have the test statistic.
For details about the model, see the help for
ttestBF, and the references therein.
The Bayes factor is computed via Gaussian quadrature.
nullInterval is defined, then two Bayes factors
will be computed: The Bayes factor for the interval
against the null hypothesis that the standardized effect
is 0, and the corresponding Bayes factor for the
compliment of the interval. For each Bayes factor, a
vector of length 2 containing the computed log(e) Bayes
factor (against the point null), along with a
proportional error estimate on the Bayes factor is
Morey, R. D. & Rouder, J. N. (2011). Bayes Factor Approaches for Testing Interval Null Hypotheses. Psychological Methods, 16, 406-419
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, 752-760
1 2 3 4 5 6 7 8 9 10
## Classical example: Student's sleep data data(sleep) plot(extra ~ group, data = sleep) ## t.test() gives a t value of -4.0621 t.test(extra ~ group, data = sleep, paired=TRUE) ## Gives a Bayes factor of about 17 ## in favor of the alternative hypothesis result <- ttest.tstat(t = -4.0621, n1 = 10) exp(result[['bf']])
Loading required package: coda Loading required package: Matrix ************ Welcome to BayesFactor 0.9.12-2. If you have questions, please contact Richard Morey (firstname.lastname@example.org). Type BFManual() to open the manual. ************ Paired t-test data: extra by group t = -4.0621, df = 9, p-value = 0.002833 alternative hypothesis: true difference in means is not equal to 0 95 percent confidence interval: -2.4598858 -0.7001142 sample estimates: mean of the differences -1.58  17.25829
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.