oneWayAOV.Fstat: Use F statistic to compute Bayes factor for balanced one-way...

Description Usage Arguments Details Value Note Author(s) References See Also Examples

Description

Using the classical F test statistic for a balanced one-way design, this function computes the corresponding Bayes factor test.

Usage

1
  oneWayAOV.Fstat(F, N, J, rscale = "medium")

Arguments

F

F statistic from classical ANOVA

N

number of observations per cell or group

J

number of cells or groups

rscale

numeric prior scale

Details

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.

Value

a vector of length 2 containing the computed log(e) Bayes factor (against the intercept-only null), along with a proportional error estimate on the Bayes factor.

Note

oneWayAOV.Fstat should only be used with F values obtained from balanced designs.

Author(s)

Richard D. Morey (richarddmorey@gmail.com)

References

Morey, R. D., Rouder, J. N., Pratte, M. S., \& Speckman, P. L. (2011). Using MCMC chain outputs to efficiently estimate Bayes factors. Journal of Mathematical Psychology, 55, 368-378

See Also

integrate, aov; see lmBF for the intended interface to this function, using the full data set.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
## 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"[1]
result <- oneWayAOV.Fstat(Fvalue, N=12, J=6)
exp(result[['bf']])

Example output

Loading required package: coda
Loading required package: Matrix
************
Welcome to BayesFactor 0.9.12-2. If you have questions, please contact Richard Morey (richarddmorey@gmail.com).

Type BFManual() to open the manual.
************
            Df Sum Sq Mean Sq F value Pr(>F)    
spray        5  88.44  17.688    44.8 <2e-16 ***
Residuals   66  26.06   0.395                   
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
[1] 6.229073e+16

BayesFactor documentation built on May 2, 2019, 5:54 p.m.