View source: R/Autosampleoptimization.R
SSDttest | R Documentation |
The function SSDttest
in the R
package SSDbain
computes the sample size for the Bayesian t-test and Welch's test using Bayes factors implemented in bain
. SSDbain
can be found at https://github.com/Qianrao-Fu/SSDbain. In
Fu, Hoijtink, and Moerbeek (2021), it is elaborated how to use SSDttest
. Users are well advised to read this paper before using SSDttest
. Users are required to install package bain
from CRAN before using SSDbain
package.
SSDttest(type='equal',Population_mean=c(0.5,0),var=NULL,BFthresh=3,eta=0.8,Hypothesis='two-sided',T=10000)
type |
a string that specifies the type of the test. If |
Population_mean |
vector of length 2 specifying the population means of the two groups under the alternative hypothesis H1 or H2. The default setting is |
var |
vector of length 2 giving the two within-group variances. If |
BFthresh |
a numeric value that specifies the magnitude of the Bayes factor, e.g. 1, 3, 5 or 10. The default setting is |
eta |
a numeric value that specifies the probability that the Bayes factor is larger than the |
Hypothesis |
a string that specifies the hypothesis. |
T |
a postive integer that indicating the number of data sets sampled from the null and alternative populations to determine the required sample size. The default setting is |
The output resulting from analyses with SSDttest
contains:
1) required sample size N
2) the probability P(BF0i>BFthresh|H0)
3) the probability P(BFi0>BFthresh|Hi)
Note: To perform the sensitive analysis, the results are provided for three different fractions b, 2b, and 3b, where b corresponds to fraction = 1 in the call to bain
.
Qianrao Fu
Fu, Q., Hoijtink, H. & Moerbeek, M. (2021). Sample-size determination for the Bayesian t test and Welch's test using the approximate adjusted fractional Bayes factor. Behavior Research Methods, 53, 139-152. doi:https://doi.org/10.3758/s13428-020-01408-1.
Gu, X., Mulder, J., and Hoijtink, H. (2017). Approximated adjusted fractional Bayes factors: A general method for testing informative hypotheses. British Journal of Mathematical and Statistical Psychology. British Journal of Mathematical and Statistical Psychology, 71(2), 229-261. doi:https://doi.org/10.1111/bmsp.12110.
Hoijtink, H., Gu, X., and Mulder, J. (2018). Bayesian evaluation of informative hypotheses for multiple populations. British Journal of Mathematical and Statistical Psychology, 72(2), 219-243. doi:https://doi.org/10.1111/bmsp.12145.
#Example 1: for the two-sided t-test, effect size d=0.5, BFthresh=3, and eta=0.8.
Res<-SSDttest(type='equal',Population_mean=c(0.5,0),var=NULL,BFthresh=3,eta=0.8,Hypothesis='two-sided',T=10000)
#Example 2: for the one-sided t-test, effect size d=0.2, BFthresh=1, and eta=0.9.
Res<-SSDttest(type='equal',Population_mean=c(0.2,0),var=NULL,BFthresh=1, eta=0.9,Hypothesis='one-sided',T=10000)
#Example 3: for the two-sided Welch's test, effect size d=0.5, BFthresh=3,and eta=0.8.
Res<-SSDttest(type='unequal',Population_mean=c(0.5,0),var=NULL,BFthresh=3,eta=0.8,Hypothesis='two-sided',T=10000)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.