Learn R Programming

probstats4econ (version 0.3.1)

se_meanx: Asymptotic Standard Errors

Description

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)

Value

A number representing the asymptotic standard error of the particular estimate

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

Examples

Run this code
# 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)
)

Run the code above in your browser using DataLab