Skip to contents

Calculate the standard error of the mean given the standard deviation and sample size, or calculate from data.

Usage

se_mean(dat = NULL, sd = NULL, n = NULL)

Arguments

dat

(numeric) A numeric vector from which to calculate standard deviation and sample size. If provided, sd and n will be ignored.

sd

(numeric) The standard deviation of the data. Ignored if dat is provided.

n

(numeric) The sample size. Ignored if dat is provided.

Value

The standard error of the mean.

Examples

# If dat is provided, calculate sd and n from dat
se_mean(c(1, 2, 3, 4, 5))
#> [1] 0.7071068

# If sd and n are provided
se_mean(sd = 3, n = 30)
#> [1] 0.5477226

# If dat is not provided but sd and n are provided
se_mean(sd = 3, n = 30)
#> [1] 0.5477226