Using the classical F test statistic for a balanced one-way design, this function computes the corresponding Bayes factor test.
oneWayAOV.Fstat(F, N, J, rscale = "medium", simple = FALSE)
F statistic from classical ANOVA
number of observations per cell or group
number of cells or groups
numeric prior scale
For F statistics computed from balanced one-way designs, this function can
be used to compute the Bayes factor testing the model that all group means
are not equal to the grand mean, versus the null model that all group means
are equal. It can be used when you don't have access to the full data set
for analysis by
lmBF, but you do have the test statistic.
For details about the model, see the help for
anovaBF, and the references therein.
The Bayes factor is computed via Gaussian quadrature.
TRUE, returns the Bayes factor (against the
intercept-only null). If
FALSE, the function returns a
vector of length 3 containing the computed log(e) Bayes factor,
along with a proportional error estimate on the Bayes factor and the method used to compute it.
oneWayAOV.Fstat should only be used with F values obtained from
Richard D. Morey (email@example.com)
Morey, R. D., Rouder, J. N., Pratte, M. S., and Speckman, P. L. (2011). Using MCMC chain outputs to efficiently estimate Bayes factors. Journal of Mathematical Psychology, 55, 368-378
lmBF for the intended interface to this function, using the full data set.
## Example data "InsectSprays" - see ?InsectSprays require(stats); require(graphics) boxplot(count ~ spray, data = InsectSprays, xlab = "Type of spray", ylab = "Insect count", main = "InsectSprays data", varwidth = TRUE, col = "lightgray") ## Classical analysis (with transformation) classical <- aov(sqrt(count) ~ spray, data = InsectSprays) plot(classical) summary(classical) ## Bayes factor (a very large number) Fvalue <- anova(classical)$"F value" result <- oneWayAOV.Fstat(Fvalue, N=12, J=6) exp(result[['bf']])
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.