calc_ttest_2: Internal function - two-sample t-test used in public function...

View source: R/calc_ttest.R

calc_ttest_2R Documentation

Internal function - two-sample t-test used in public function calc_ttest()

Description

Internal function - two-sample t-test used in public function calc_ttest()

Usage

calc_ttest_2(
  data,
  var,
  by = NULL,
  mu = 0,
  paired = FALSE,
  var_equal = FALSE,
  df_form = "Satterthwaite",
  conf_level = 0.95,
  check_variance = FALSE,
  reverse_groups = FALSE,
  show_cohens_d = FALSE,
  show_alternative = FALSE
)

Arguments

data

A data frame or tibble.

var

A (non-empty) numeric vector of data values.

by

A factor (or character) with two levels giving the corresponding groups.

mu

A number indicating the true value of the mean (or difference in means if you are performing a two sample test).

paired

A logical indicating whether you want a paired t-test.

var_equal

logical variable indicating whether to treat the two variances as being equal. If TRUE then the pooled variance is used to estimate the variance otherwise if FALSE then unequal variance is assumed and the Welch (or Satterthwaite) approximation to the degrees of freedom is used.

df_form

If unequal variances are assumed, then specify to use "Welch" or "Satterthwaite" (default) approximation to the degrees of freedom. R t.test documentation says it uses "Welch" but actually they use "Satterthwaite". At least, "Welch" in R matches "Satterthwaite" in Stata.

conf_level

Confidence level of the interval. Default level is 0.95.

check_variance

A logical whether to return some tests of homogeneity of variances. Bartlett's, Levene's, Fligner, and check of the ratio of the standard deviations.

reverse_groups

If TRUE, then uses forcats::fct_rev() to reverse the order of the groups being compared. Default is FALSE.

show_cohens_d

Logical whether to return the effect size, Cohen's d. T-test conventional effect sizes, proposed by Cohen, are: 0.2 (small effect), 0.5 (moderate effect) and 0.8 (large effect) (Cohen 1998, Navarro (2015)). This means that if two groups' means don’t differ by 0.2 standard deviations or more, the difference is trivial, even if it is statistically significant.

show_alternative

Logical whether to show alternative hypothesis notation in the test results. Default is FALSE.


emilelatour/lamisc documentation built on April 9, 2024, 10:33 a.m.