Skip to contents

Compute and return information on tests for two group differences in the data.

Usage

two_group_tests(
  data,
  tests = c("t", "wilcox", "bayes", "factor"),
  alpha = 0.05
)

Arguments

data

Data.frame with the first column the values and the second column the group names

tests

Vector of strings, or a string, indicating the tests to check. Options include 't', 'wilcox', 'bayes', and 'factor'

alpha

Significance for confidence intervals, defaults to 0.05

Value

A list of two group difference statistics and related information

Details

Tests require independent data unless otherwise specified. t: t-test and a Welch modified t-test for uneven variances wilcox: A Wilcoxon test bayes: Bayesian t-test and a Welch modified Bayesian t-test for uneven variances factor: Bayesian factor approach to a t-test

Examples

data <- data.frame(
  "value" = c(rnorm(14, sd = 2), rnorm(10, mean = 2)),
  "group" = c(rep("A", 14), rep("B", 10))
)
two_group_tests(data)
#> $ttest_student
#> $ttest_student$pvalue
#> [1] 0.003666769
#> 
#> $ttest_student$means
#> mean in group A mean in group B 
#>      -0.2605641       1.6396194 
#> 
#> $ttest_student$interval
#> [1] -3.1124878 -0.6878793
#> attr(,"conf.level")
#> [1] 0.95
#> 
#> 
#> $ttest_welch
#> $ttest_welch$pvalue
#> [1] 0.001764247
#> 
#> $ttest_welch$means
#> mean in group A mean in group B 
#>      -0.2605641       1.6396194 
#> 
#> $ttest_welch$interval
#> [1] -3.0013825 -0.7989846
#> attr(,"conf.level")
#> [1] 0.95
#> 
#> 
#> $wilcox
#> $wilcox$pvalue
#> [1] 0.003844475
#> 
#> 
#> $bayes
#> $bayes$pvalue
#> [1] 0.003666769
#> 
#> $bayes$means
#> mean in group A mean in group B 
#>      -0.2605641       1.6396194 
#> 
#> $bayes$interval
#> [1] -3.1124878 -0.6878793
#> attr(,"conf.level")
#> [1] 0.95
#> 
#> 
#> $bayes_welch
#> $bayes_welch$pvalue
#> [1] 0.002034238
#> 
#> $bayes_welch$means
#> mean in group A mean in group B 
#>      -0.2878944       1.6145558 
#> 
#> $bayes_welch$interval
#> [1] -3.0420214 -0.7845969
#> attr(,"conf.level")
#> [1] 0.95
#> 
#> 
#> $bayes_factor
#> [1] 2.391523
#>