Description Usage Arguments Value Examples
generateBounds()
calculates district-level bounds. The returned object can be passed to evaluateBounds() to generate bounds across varying coverage probabilities
and to apply the heuristics presented in Jiang et al. 2019.
1 2 |
x |
Numeric (double-precision) vector. Contains the proportion of variable X in each precinct (or analagous geographic unit) |
t |
Numeric (double-precision) vector. Contains the proportion of variable T in each precinct (or analagous geographic unit) |
n |
Numeric (double-precision) vector. Contains the number of elements (people/households/etc.) in each precinct (or analagous geographic unit) |
trueBetaB |
Numeric (double-precision) vector. Contains the true conditional values (beta_i) in each precinct (or analagous geographic unit). Optional. Default NULL. |
useXRangeOffset |
boolean If True, an offset of 0.00001 is applied to l and u to avoid division by 0 in subsequent calculations. Default TRUE |
returnAdditionalStats |
boolean If True, additional summary statistics are generated. Default FALSE. |
printSummary |
boolean If True, the DD bounds, l and u, CI_0, CI_1, width-ratio, and (optionally) true district B are output to standard out. Default TRUE. |
List object with the bounds and summary statistics:
nx1 Total elements (people/households/etc.) of variable X across all geographic units
hbdl0 CI_0 lower bound
hbdu0 CI_0 upper bound
cil CI_1 lower bound
cir CI_1 upper bound
bdl Duncan-Davis lower bound
bdu Duncan-Davis upper bound
Optional: bd True district Beta
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | library("MASS")
library("eco")
data("census")
inputDataSet <- census
x <- inputDataSet$X
t <- inputDataSet$Y
n <- inputDataSet$N
trueBetaB <- inputDataSet$W1
outputList <- generateBounds(x, t, n, trueBetaB=trueBetaB, useXRangeOffset=TRUE,
returnAdditionalStats=FALSE, printSummary=TRUE)
# True B: 0.674809
# Duncan-Davis bounds: [0.535618, 0.974010]
# [l,u]=[min(X_i),max(X_i)]: [0.050810, 0.939290]
# CI_0=[Bl_hat, Bu_hat]: [0.606101, 0.810082]
# CI_1: [0.572566, 0.842403]
# Width-ratio: |CI_0|/|DD|: 0.465295
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.