smd | R Documentation |
Simple function to calculate effect sizes for mean differences.
smd(x, g, index = c("all", "1", "2"))
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. |
The standardized mean difference.
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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.