You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.rst
+13-8Lines changed: 13 additions & 8 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -55,16 +55,21 @@ Accepts an open-ended set of paired lists, each expected to provide an estimate
55
55
Approximating means
56
56
~~~~~~~~~~~~~~~~~~~
57
57
58
-
Estimate a mean and approximate the margin of error. The Census Bureau guidelines do not provide instructions for
59
-
approximating a mean using data from the ACS. They do provide guidance for approximating a mean with data `from the PUMS <https://www2.census.gov/programs-surveys/acs/tech_docs/pums/accuracy/2013_2017AccuracyPUMS.pdf?#>`_.
60
-
Instead, we implement a simulation based approach. First the number of units in each bin is simulated (assuming a normal distribution around the
61
-
estimate). Then for each unit a value within the bin is simulated (assuming a uniform distribution within each bin).
62
-
Note that for quantities, such as income, the Pareto distribution is `often used <https://www2.census.gov/ces/wp/2014/CES-WP-14-21.pdf>`_ instead of the uniform distribution in the upper-most bin. We provide an option to do this (`usePareto = True`).
63
-
We can then calculate the mean directly from the simulated data. We repeat the simulation many times to calculate an empirical margin of error.
58
+
Estimate a mean and approximate the margin of error.
59
+
60
+
The Census Bureau guidelines do not provide instructions for approximating a mean using data from the ACS.
61
+
They do provide guidance for approximating a mean with data `from the PUMS <https://www2.census.gov/programs-surveys/acs/tech_docs/pums/accuracy/2013_2017AccuracyPUMS.pdf?#>`_.
62
+
Instead, we implement a simulation based approach.
63
+
64
+
First the number of units in each bin is simulated (assuming a normal distribution around the estimate). Then for each unit a value within
65
+
the bin is simulated (assuming a uniform distribution within each bin). Note that for quantities, such as income, the Pareto distribution is
66
+
`often used <https://www2.census.gov/ces/wp/2014/CES-WP-14-21.pdf>`_ instead of the uniform distribution in the upper-most bin. We provide an
67
+
option to do this (`pareto = True`). We can then calculate the mean directly from the simulated data. We repeat the simulation many times to
68
+
calculate an empirical margin of error.
69
+
64
70
Note that this function assumes you have a lower bound for the smallest bin and an upper bound for the largest bin. We recommend trying different
65
71
lower and upper bounds to assess the sensitivity of the resulting mean to your assumptions.
66
72
67
-
68
73
Expects a list of dictionaries that divide the full range of data values into continuous categories. Each dictionary should have four keys:
69
74
70
75
.. list-table::
@@ -110,7 +115,7 @@ Increasing the number of runs should increase your precision (with diminishing r
* n (int): The number of people, households or other unit in the range
426
432
* moe (float): The margin of error for n
427
-
number_replicates (int): number of replicates for simulation, used to estimate margin of error
428
-
usePareto (logical): use the Pareto distribution to simulate from in upper bin, otherwise use uniform, Pareto is appropriate for income
433
+
simulations (int): number of simulations to run, used to estimate margin of error. Defaults to 50.
434
+
pareto (logical): use the Pareto distribution to simulate from in upper bin, otherwise use uniform. Pareto is appropriate for income. Defaults to False.
429
435
430
436
Returns:
431
437
A two-item tuple with the mean followed by the approximated margin of error.
0 commit comments