cohen_d: Calculate Cohen's d and its confidence interval using the...

View source: R/cohen_d.R

cohen_dR Documentation

Calculate Cohen's d and its confidence interval using the package 'psych'

Description

To run this function, the following package(s) must be installed: Package 'psych' v2.1.9 (or possibly a higher version) by William Revelle (2021), https://cran.r-project.org/package=psych

Usage

cohen_d(
  sample_1 = NULL,
  sample_2 = NULL,
  data = NULL,
  iv_name = NULL,
  dv_name = NULL,
  ci_range = 0.95,
  output_type = "all"
)

Arguments

sample_1

a vector of values in the first of two samples

sample_2

a vector of values in the second of two samples

data

a data object (a data frame or a data.table)

iv_name

name of the independent variable

dv_name

name of the dependent variable

ci_range

range of the confidence interval for Cohen's d (default = 0.95)

output_type

If output_type == "all" or if output_type == "d_and_ci", the output will be a vector of Cohen's d and its confidence interval. If output_type == "d", the output will be Cohen's d. If output_type == "ci", the output will be a vector of the confidence interval around Cohen's d. By default, output_type == "all".

Examples

## Not run: 
cohen_d(sample_1 = 1:10, sample_2 = 3:12)
cohen_d(data = mtcars, iv_name = "vs", dv_name = "mpg", ci_range = 0.99)
sample_dt <- data.table::data.table(iris)[Species != "setosa"]
cohen_d(data = sample_dt, iv_name = "Species", dv_name = "Petal.Width")

## End(Not run)

kim documentation built on Oct. 9, 2023, 5:08 p.m.

Related to cohen_d in kim...