derive_pct_est_moe: Derive percent/ratio margin of error for groups

derive_pct_est_moeR Documentation

Derive percent/ratio margin of error for groups

Description

A function to calculate the margin of error for proportions or ratios of tidycensus ACS dataframes, which are not included by default. Dataset should be structured with an aggregate column and margin of error uniform across rows, and a column for component values/margins of error. Formula construction follows ACS guidance in "Understanding and Using ACS Data," available here: https://www.census.gov/programs-surveys/acs/guidance/handbooks/general.html.

Usage

derive_pct_est_moe(
  df,
  proportion_col,
  aggregate_est,
  aggregate_moe,
  component_est = "estimate",
  component_moe = "moe",
  type_moe = "proportion"
)

Arguments

df

A tidycensus ACS dataframe with rows representing component values and a column with a common group total.

proportion_col

The name of the proportion column to create

aggregate_est

A column representing an aggregate total for the group; the denominator in the proportion

aggregate_moe

A column representing the margin of error for the aggregate estimate

component_est

A column representing the value of the component value for which a proportion is being calculated; the numerator in the proportion

component_moe

A column representing the marging of error of the component value

type_moe

"proportion" or "ratio" for whether a proportion or ratio is being constructed

Value

A tidycensus dataframe with a calculated proportion or ratio and its margin of error.


dpowerstp/acsprocess documentation built on Sept. 4, 2022, 10:18 a.m.