se_diff_means: Standard error for difference in means

View source: R/nice_diff_means.R

se_diff_meansR Documentation

Standard error for difference in means

Description

Calculates the standard error for the difference in means between two groups

Usage

se_diff_means(data, var, by)

Arguments

data

A data frame

var

A numeric variable containing the data for the calculation of the means

by

A grouping variable with only two values

Value

A numeric value for the difference in means

Examples

data(sleep)
sleep$group <- as.numeric(sleep$group)
se_diff_means(data = sleep, var = "extra", by = "group")

# confirming against Kirkwood and Sterne
dat <- data.frame(weight = c(3.18, 2.74, 2.90, 3.27, 3.65, 3.42, 3.23, 2.86,
                               3.6, 3.65, 3.69, 3.53, 2.38, 2.34, 3.99, 3.89,
                               3.60, 3.73, 3.31, 3.7, 4.08, 3.61, 3.83, 3.41,
                               4.13, 3.36, 3.54, 3.51, 2.71),
                    group = c(rep(1, 14), rep(0, 15)))
se_diff_means(data = dat, var = "weight", by = "group")

simonthelwall/nicethings documentation built on Feb. 27, 2023, 3:15 p.m.