Description Usage Arguments Details See Also Examples
Bayes Factor for t-test and one-way ANOVA
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
data |
A dataframe (or a tibble) from which variables specified are to be taken. A matrix or a table will not be accepted. |
x |
Either the grouping variable from the dataframe |
y |
The column in |
subject.id |
Relevant in case of repeated measures design ( |
paired |
Logical that decides whether the experimental design is
repeated measures/within-subjects or between-subjects. The default is
|
test.value |
A number specifying the value of the null hypothesis
(Default: |
bf.prior |
A number between |
... |
Arguments passed on to
|
If y
is NULL
, a one-sample t-test will be carried out,
otherwise a two-sample t-test will be carried out.
bf_contingency_tab
, bf_corr_test
,
bf_oneway_anova
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 | # for reproducibility
set.seed(123)
library(tidyBF)
# ----------------------- one-way ANOVA -----------------------------------
# to get dataframe (between-subjects)
bf_oneway_anova(
data = iris,
x = Species,
y = Sepal.Length,
bf.prior = 0.8,
output = "dataframe"
)
# to get expression (within-subjects) (needs `BayesFactor 0.9.12-4.3` or above)
if (utils::packageVersion("BayesFactor") >= package_version("0.9.12-4.3")) {
bf_oneway_anova(
data = bugs_long,
x = condition,
y = desire,
subject.id = subject,
paired = TRUE,
output = "expression"
)
}
# ------------------- two-samples tests -----------------------------------
# to get dataframe (between-subjects)
bf_ttest(
data = mtcars,
x = am,
y = wt,
paired = FALSE,
bf.prior = 0.880,
output = "dataframe"
)
# to get expression (within-subjects)
bf_ttest(
data = dplyr::filter(bugs_long, condition %in% c("LDLF", "LDHF")),
x = condition,
y = desire,
subject.id = subject,
paired = TRUE,
bf.prior = 0.880,
output = "dataframe"
)
# ------------------- one-samples test -----------------------------------
# to get expression
bf_ttest(
data = iris,
x = Sepal.Length,
test.value = 5.85,
output = "expression"
)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.