Learn R Programming

selfea (version 1.0.1)

ttest_cohens_d: ttest_cohens_d

Description

Fulfill Welch Two Sample t-test (t.test) and calculate Cohen's d as well as determine significance by p-value and effect size threshold.

Usage

ttest_cohens_d(values, groups, alpha = 0.05, power = 0.9, alternative = "two.sided", paired = FALSE, var.equal = FALSE)

Arguments

values
A scalar vector. Length of both of two vectors, values and groups, should be same.
groups
Experiment groups for the vector 'values'. Length of both of two vectors, values and groups, should be same. The number of groups is not limited to two, such as group <- c('A','A','A','B','B').
alpha
P-value threshold
power
Give the statistical power you desired for output significant list
alternative
Choose one of these c("two.sided", "less", "greater"). Default is "two.sided".
paired
if two groups are paired, set it to TRUE. Default is FALSE.
var.equal
if two groups are assumed to have same variance, set it to TRUE. Default is FALSE.

Value

A list containing the followings:
observed_pvalue
Calculated P-value from T-test
observed_cohens_d
Calculated Cohen's f
threshold_cohens_d
Cohen's d threshold at the desired power
threshold_pvalue
Desired p-value threshold
flag_pvalue
TRUE=passed the pvalue threshold, FALSE=not
flag_cohens_d
TRUE=passed the Cohen's d threshold, FALSE=not
power_desired
Statistical power in you input parameters
method
'Welch Two Sample t-test'
alternative
alternative option in you input parameters
paired
paired option in you input parameters
var.equal
var.equal option in you input parameters

Examples

Run this code
library(selfea)

values <- c(8,10,8,8,11,29,26,22,27,26)
groups <- c("U200","U200","U200","U200","U200","U600","U600","U600","U600","U600")
list_result <- ttest_cohens_d (values, groups, 0.05, 0.90)

Run the code above in your browser using DataLab