ff_se_ratio: Standard error for derived ratios

ff_se_ratioR Documentation

Standard error for derived ratios

Description

This function calculates the standard error for derived ratios. An example of a ratio is the median income of males divided by the median income of females. If the data is a proportion instead of a ratio, use 'ff_se_prop'.

Usage

ff_se_ratio(estimate_num, estimate_den, se_num, se_den)

Arguments

estimate_num

The numerator for the estimated proportion

estimate_den

The denominator for the estimated proprotion

se_num

Standard error for the numerator of the derived proportions.

se_den

Standard error for the denominator of the derived proportions

Details

Reference for calculations: US Census Bureau, A Compass for Understanding and Using ACS Data, October 2008, A-15

Value

The standard error of the derived ratios.

Examples

df <- data.frame(estimate_numerator = rnorm(n = 10, mean = 2000, sd = 500),
                estimate_denominator = rnorm(n = 10, mean = 10000, sd = 2000),
                se_numerator = rnorm(n = 10, mean = 200, sd = 50),
                se_denominator = rnorm(n = 10, mean = 100, sd = 10))

# calculate standard errors of proportions for each observation
ff_se_ratio(df$estimate_numerator, df$estimate_denominator,
           df$se_numerator, df$se_denominator)

# add columns to dataframe showing proportions and standard errors of proportions
dplyr::mutate(df,
              ratio = estimate_numerator / estimate_denominator,
              se_ratio = ff_se_ratio(estimate_numerator, estimate_denominator,
                                     se_numerator, se_denominator))


forsythfuture/FFtools documentation built on April 5, 2022, 10:02 p.m.