smd {JWileymisc}R Documentation

Calculate Standardized Mean Difference (SMD)

Description

Simple function to calculate effect sizes for mean differences.

Usage

smd(x, g, index = c("all", "1", "2"))

Arguments

x

A continuous variable

g

A grouping variable, with two levels

index

A character string: “all” uses pooled variance, “1” uses the first factor level variance, “2” uses the second factor level variance.

Value

The standardized mean difference.

Examples

smd(mtcars$mpg, mtcars$am)
smd(mtcars$mpg, mtcars$am, "all")
smd(mtcars$mpg, mtcars$am, "1")
smd(mtcars$mpg, mtcars$am, "2")

smd(mtcars$hp, mtcars$vs)

d <- data.table::as.data.table(mtcars)
d[, smd(mpg, vs)]
rm(d)

[Package JWileymisc version 1.4.1 Index]