ff_se_prop | R Documentation |
This function calculates the standard error for derived proportions. The numerator must be a subset of the denominator. For example, the numerator might be the population of african-american males with a college degree, while the denominator is the population of african american males. Use 'ff_se_ratio' if the numerator is not a subset of the denominator.
ff_se_prop(estimate_num, estimate_den, se_num, se_den)
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 |
The function will fail if the value under the square root is negative. In such a case, users will see the following message: 'Warning message: In sqrt(...) : NaNs produced.'
If this occurs, use 'ff_se_ratio'.
Reference for calculations: US Census Bureau, A Compass for Understanding and Using ACS Data, October 2008, A-14
The standard error of the derived proportions
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_prop(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, proportion = estimate_numerator / estimate_denominator, se_proportion = ff_se_prop(estimate_numerator, estimate_denominator, se_numerator, se_denominator))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.