Learn R Programming

esvis (version 0.2.0)

coh_d: Compute Cohen's d

Description

This function calculates effect sizes in terms of Cohen's d, also called the uncorrected effect size. See hedg_g for the sample size corrected version. Also see Lakens (2013) for a discussion on different types of effect sizes and their interpretation. Note that missing data are removed from the calculations of the means and standard deviations.

Usage

coh_d(formula, data, ref_group = NULL, tidy = TRUE)

Arguments

formula

A formula of the type out ~ group where out is the outcome variable and group is the grouping variable. Note this variable can include any arbitrary number of groups.

data

The data frame that the data in the formula come from.

ref_group

Optional. If the name of the reference group is provided (must be character and match the grouping level exactly), only the estimates corresponding to the given reference group will be returned.

tidy

Logical. Should the data be returned in a tidy data frame? (see Wickham, 2014). If false, effect sizes returned as a vector.

Value

By default the Cohen's d for all possible pairings of the grouping factor are returned as a tidy data frame.

Examples

Run this code
# NOT RUN {
# Calculate Cohen's d for all pairwise comparisons
coh_d(reading ~ condition, star) 

# Report only relative to regular-sized classrooms
coh_d(reading ~ condition, 
		star, 
		ref_group = "reg")

# Return a vector instead of a data frame
coh_d(reading ~ condition, 
		star, 
		ref_group = "reg", 
		tidy = FALSE)
# }

Run the code above in your browser using DataLab