Skip to contents

These functions calculate the asymptotic standard errors of common statistical estimates. se_meanx calculates the standard error of the mean, se_sx calculates the standard error of the population standard deviation estimate, and se_rxy calculate the standard error of the correlation estimate between two vectors.

Usage

se_meanx(x, na.rm = FALSE)

se_rxy(x, y, na.rm = FALSE)

se_sx(x, na.rm = FALSE)

Arguments

x

A numeric vector, representing a sample from a population

na.rm

A boolean, whether or not to remove any NAs (default FALSE)

y

A numeric vector, representing a sample of a different variable

Value

A number representing the asymptotic standard error of the particular estimate

Examples

# calculate the mean and se of the mean of wage in the cps data
paste(
  "The average wage is",
  mean(cps$wagehr, na.rm = TRUE),
  "with a margin of error of",
  se_meanx(cps$wagehr, na.rm = TRUE)
)
#> [1] "The average wage is 18.6044915715063 with a margin of error of 0.204128707715679"