SSDANOVA | R Documentation |
The function SSDANOVA
in the R
package SSDbain
computes the sample size for ANOVA and Welch's ANOVA using Bayes factors implemented in bain
with informative hypothesis. SSDbain
can be found at https://github.com/Qianrao-Fu/SSDbain..In Fu, Moerbeek, and Hoijtink (unpublished), it is elaborated how to use SSDANOVA
. Users are well advised to read this paper before using SSDANOVA
. Users are required to install package bain
from CRAN before using SSDbain
package.
Res<-SSDANOVA(hyp1,hyp2,type,f1,f2,var,BFthresh,eta,T,seed)
hyp1 |
strings that specify the former hypothesis of a pair of interested hypotheses. For example, if H0: mu1=mu2=mu3 vs H1: mu1>mu2>mu3, then |
hyp2 |
strings that specify the latter hypothesis. For example, as the previous example, then |
type |
a string that specifies the type of the ANOVA. If |
f1 |
parameter used to specify the populations corresponding to hyp1. It can be specified as a number denoting the effect size or a vector denoting the means for each of group. |
f2 |
parameter used to specify the populations corresponding to hyp2. It can be specified as a number denoting the effect size or a vector denoting the means for each of group. |
var |
a vector that specifies the within-group variances for each of the group. If type = "equal" and f1 and f2 are Cohen's f, the specification var = NULL implies that each within-group variance is set to 1. In case of type = "unequal", the user need to input Cohen's f and the variances for each group. If f1 and f2 are vectors of means, the user need to input the variances for each group. |
BFthresh |
numeric value not less than 1 that specifies the required size of the Bayes factor. The default setting is |
eta |
a numeric value that specifies the probability that the Bayes factor is larger than the |
T |
a positive integer that specifies the number of data sets sampled from the populations corresponding to the two hypotheses of interest. The default setting is |
seed |
a positive integer that specifies the seed of R's random number generator. The default setting is |
The output resulting from analyses with SSDANOVA
contains:
1) required sample size N
2) the probability P(BFsv>BFthresh|Hs)
3) the probability P(BFvs>BFthresh|Hv)
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., Mirjam, M., and Hoijtink, H. (unpublished). Sample size determination for the Bayesian ANOVAs with Informative hypotheses. doi:10.31234/osf.io/ymvb9. Research Archive on Github. 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: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. doi:10.1111/bmsp.12145
#Example 1: using Cohen's f to specify the populations of interest for regular ANOVA.
Res<-SSDANOVA(hyp1="mu1=mu2=mu3",hyp2="Ha",type="equal",f1=0,f2=0.25,var=NULL,BFthresh=3,eta=0.80,T=10000,seed=10)
#Example 2: using Cohen's f and withing-group variances to specify the populations for Welch's ANOVA.
Res<-SSDANOVA(hyp1="mu1>mu2>mu3",hyp2="Hc",type="unequal",f1=0.25,f2=0.25,var=c(1.5,0.75,0.75),BFthresh=1,eta=0.9,T=10000,seed=10)
#Example 3: using means and within-group variances to specify the populations of interest.
Res<-SSDANOVA(hyp1="mu1=mu2=mu3",hyp2="mu3>mu2>mu1",type="equal",f1=c(0,0,0),f2=c(550,560,580),var=c(2500,2500,2500),BFthresh=3,eta=0.8,T=10000,seed=10)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.