tadaatoolbox (version 0.16.1)

tadaa_t.test: Tadaa, t-Test!

Description

An extension for stats::t.test with added boni and tidy and/or pretty output. Before a t-test is performed, car::leveneTest is consulted as to wether heteroskedasticity is present (using the default center = "mean" method for a more robust test), and sets var.equal accordingly. Afterwards, the effect size is calculated and pwr::pwr.t.test or pwr::pwr.t2n.test are used to calculate the test's power accordingly. The result is either returned as a broom::tidy data.frame or prettified using various pixiedust::sprinkle shenanigans.

Usage

tadaa_t.test(data, response, group, direction = "two.sided",
  paired = FALSE, var.equal = NULL, conf.level = 0.95,
  print = c("df", "console", "html", "markdown"))

Arguments

data

A data.frame.

response

The response variable (dependent).

group

The group variable, usually a factor.

direction

Test direction, like alternative in t.test.

paired

If TRUE, a paired test is performed, defaults to FALSE.

var.equal

If set, passed to stats::t.test to decide whether to use a Welch-correction. Default is NULL to automatically determine heteroskedasticity.

conf.level

Confidence level used for power and CI, default is 0.95.

print

Print method, default df: A regular data.frame. Otherwise passed to pixiedust::sprinkle_print_method for fancyness.

Value

A data.frame by default, otherwise dust object, depending on print.

See Also

Other Tadaa-functions: tadaa_aov, tadaa_chisq, tadaa_kruskal, tadaa_levene, tadaa_nom, tadaa_normtest, tadaa_one_sample, tadaa_ord, tadaa_pairwise_gh, tadaa_pairwise_tukey, tadaa_pairwise_t, tadaa_wilcoxon

Examples

Run this code
# NOT RUN {
set.seed(42)
df <- data.frame(x = runif(100), y = sample(c("A", "B"), 100, TRUE))
tadaa_t.test(df, x, y)

df <- data.frame(x = runif(100), y = c(rep("A", 50), rep("B", 50)))
tadaa_t.test(df, x, y, paired = TRUE)

tadaa_t.test(ngo, deutsch, geschl, print = "console")
# }

Run the code above in your browser using DataLab