moe_test: Significance testing of differences with MOEs

Description Usage Arguments Value Examples

View source: R/moe_test.R

Description

This function uses 2 estimates and 2 margins of error to do significance testing. It optionally returns the input data frame with the calculations used for testing, or just the data frame with results attached.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
moe_test(
  .data,
  est1,
  moe1,
  est2,
  moe2,
  cl = 0.9,
  alpha = 0.05,
  show_calc = TRUE
)

Arguments

.data

A data frame

est1

Estimate for first group

moe1

Margin of error for first group

est2

Estimate for second group

moe2

Margin of error for second group

cl

Confidence level used in calculating MOEs given; defaults to 0.9, per ACS data

alpha

Alpha used for significance testing; defaults to 0.05

show_calc

Logical, whether to keep intermediary calculations (default) or only result of testing

Value

A tibble/data frame with testing-related columns added

Examples

1
2
3
4
5
med_age <- data.frame(name = c("Hamden", "New Haven"),
    men_est = c(37.2, 29.5), men_moe = c(1.9, 0.8),
    women_est = c(37.8, 31.9), women_moe = c(1.9, 0.8))
med_age %>%
  moe_test(men_est, men_moe, women_est, women_moe, alpha = 0.9, show_calc = TRUE)

camille-s/camiller documentation built on Jan. 22, 2022, 6:50 a.m.