lee_weights: Calculates Lee weights

Description Usage Arguments Details Value References Examples

View source: R/NonProbEst.R

Description

Computes weights from propensity estimates using the propensity stratification design weights averaging formula introduced in Lee (2006) and Lee and Valliant (2009).

Usage

1
lee_weights(convenience_propensities, reference_propensities, g = 5)

Arguments

convenience_propensities

A vector with the propensities associated with the convenience sample.

reference_propensities

A vector with the propensities associated with the reference sample.

g

The number of strata to use; by default, its value is 5.

Details

The function takes the vector of propensities π(x) and calculates the weights to be applied in the Horvitz-Thompson estimator using the formula that can be found in Lee (2006) and Lee and Valliant (2009). The vector of propensities is divided in g strata (ideally five according to Cochran, 1968) aiming to have individuals with similar propensities in each strata. After the stratification, weight is calculated as follows for an individual i:

w_i = \frac{n_r(g_i) / n_r}{n_v(g_i) / n_v}

where g_i represents the strata to which i belongs, n_r (g_i) and n_v (g_i) are the number of individuals in the g_i strata from the reference and the convenience sample respectively, and n_r and n_v are the sample sizes for the reference and the convenience sample respectively.

Value

A vector with the corresponding weights.

References

Lee, S. (2006). Propensity score adjustment as a weighting scheme for volunteer panel web surveys. Journal of official statistics, 22(2), 329.

Lee, S., & Valliant, R. (2009). Estimation for volunteer panel web surveys using propensity score adjustment and calibration adjustment. Sociological Methods & Research, 37(3), 319-343.

Cochran, W. G. (1968). The Effectiveness of Adjustment by Subclassification in Removing Bias in Observational Studies. Biometrics, 24(2), 295-313

Examples

1
2
3
covariates = c("education_primaria", "education_secundaria")
data_propensities = propensities(sampleNP, sampleP, covariates)
lee_weights(data_propensities$convenience, data_propensities$reference)

Example output

Loading required package: lattice
Loading required package: ggplot2
   [1] 0.000000 1.157895 1.571429 0.000000 1.571429 0.000000 1.157895 1.571429
   [9] 1.571429 1.157895 1.571429 1.157895 0.000000 1.157895 1.157895 1.157895
  [17] 0.000000 0.000000 1.157895 0.000000 1.157895 1.157895 1.157895 1.157895
  [25] 1.157895 1.571429 1.571429 0.000000 1.571429 1.157895 0.000000 0.000000
  [33] 0.000000 0.000000 0.000000 1.157895 0.000000 1.571429 1.157895 0.000000
  [41] 0.000000 1.157895 1.157895 1.157895 1.157895 0.000000 0.000000 1.571429
  [49] 1.157895 1.157895 1.157895 0.000000 1.157895 1.571429 0.000000 1.157895
  [57] 0.000000 0.000000 1.157895 0.000000 0.000000 0.000000 1.157895 0.000000
  [65] 0.000000 0.000000 1.571429 1.157895 0.000000 1.157895 0.000000 0.000000
  [73] 0.000000 1.157895 1.157895 0.000000 1.571429 0.000000 1.571429 1.157895
  [81] 0.000000 1.571429 1.157895 0.000000 1.571429 0.000000 1.571429 1.157895
  [89] 0.000000 0.000000 0.000000 0.000000 1.157895 0.000000 1.157895 0.000000
  [97] 0.000000 1.157895 0.000000 1.157895 1.157895 0.000000 1.571429 0.000000
 [105] 0.000000 1.157895 0.000000 0.000000 1.571429 0.000000 0.000000 1.157895
 [113] 1.157895 0.000000 0.000000 0.000000 1.571429 1.571429 0.000000 0.000000
 [121] 0.000000 1.157895 1.157895 0.000000 0.000000 1.157895 0.000000 0.000000
 [129] 0.000000 1.571429 0.000000 0.000000 1.157895 1.571429 0.000000 0.000000
 [137] 1.571429 0.000000 0.000000 0.000000 0.000000 0.000000 1.571429 1.157895
 [145] 0.000000 1.157895 1.157895 1.157895 1.157895 1.571429 1.571429 1.157895
 [153] 0.000000 0.000000 0.000000 1.157895 0.000000 0.000000 1.157895 0.000000
 [161] 0.000000 1.571429 1.571429 1.571429 1.571429 1.571429 1.571429 0.000000
 [169] 1.571429 0.000000 1.157895 1.571429 1.571429 1.157895 1.157895 0.000000
 [177] 1.157895 0.000000 0.000000 1.571429 0.000000 1.157895 0.000000 0.000000
 [185] 1.157895 0.000000 1.571429 1.157895 0.000000 1.571429 0.000000 1.571429
 [193] 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 1.157895 1.157895
 [201] 1.157895 0.000000 0.000000 0.000000 1.157895 0.000000 1.157895 0.000000
 [209] 1.571429 1.157895 0.000000 1.157895 1.571429 1.571429 0.000000 1.157895
 [217] 1.157895 0.000000 1.157895 0.000000 0.000000 0.000000 1.157895 1.157895
 [225] 0.000000 0.000000 1.157895 1.157895 0.000000 0.000000 0.000000 1.157895
 [233] 1.571429 1.157895 0.000000 1.571429 1.571429 1.157895 0.000000 1.157895
 [241] 1.157895 1.157895 0.000000 1.571429 0.000000 0.000000 1.157895 1.571429
 [249] 1.157895 1.571429 1.157895 0.000000 0.000000 0.000000 0.000000 0.000000
 [257] 1.157895 1.571429 1.571429 1.157895 1.571429 1.157895 1.157895 0.000000
 [265] 1.571429 1.157895 1.571429 1.157895 0.000000 0.000000 1.571429 1.571429
 [273] 1.571429 1.157895 0.000000 1.571429 0.000000 0.000000 0.000000 1.571429
 [281] 0.000000 1.571429 1.157895 1.571429 1.571429 0.000000 1.571429 1.157895
 [289] 0.000000 1.157895 0.000000 1.571429 0.000000 1.157895 1.157895 1.571429
 [297] 1.157895 0.000000 1.157895 0.000000 1.571429 0.000000 1.571429 0.000000
 [305] 0.000000 0.000000 0.000000 0.000000 1.571429 1.157895 1.157895 0.000000
 [313] 1.571429 1.157895 1.571429 1.571429 0.000000 0.000000 0.000000 1.157895
 [321] 1.157895 1.157895 1.571429 1.571429 0.000000 0.000000 1.157895 0.000000
 [329] 0.000000 0.000000 0.000000 1.157895 1.157895 0.000000 1.157895 0.000000
 [337] 1.157895 1.571429 1.571429 0.000000 0.000000 1.157895 0.000000 0.000000
 [345] 0.000000 0.000000 1.157895 0.000000 1.571429 0.000000 0.000000 1.157895
 [353] 1.157895 0.000000 1.157895 0.000000 1.157895 0.000000 1.571429 0.000000
 [361] 0.000000 1.157895 0.000000 1.157895 0.000000 0.000000 1.157895 0.000000
 [369] 1.157895 1.157895 0.000000 1.157895 1.157895 0.000000 1.571429 0.000000
 [377] 0.000000 1.157895 1.157895 1.571429 1.571429 0.000000 1.571429 0.000000
 [385] 0.000000 0.000000 0.000000 1.157895 1.157895 0.000000 0.000000 0.000000
 [393] 0.000000 1.571429 1.157895 1.571429 1.157895 1.157895 0.000000 0.000000
 [401] 1.571429 1.157895 1.571429 1.157895 0.000000 1.157895 0.000000 1.157895
 [409] 1.571429 0.000000 1.157895 1.571429 1.157895 0.000000 0.000000 1.157895
 [417] 1.157895 0.000000 0.000000 1.571429 1.157895 1.571429 1.571429 0.000000
 [425] 1.571429 1.157895 0.000000 1.157895 1.157895 0.000000 0.000000 1.571429
 [433] 0.000000 0.000000 0.000000 1.571429 0.000000 1.157895 0.000000 0.000000
 [441] 0.000000 0.000000 1.571429 0.000000 1.571429 0.000000 1.157895 1.157895
 [449] 0.000000 1.571429 0.000000 1.157895 1.157895 0.000000 0.000000 0.000000
 [457] 1.157895 1.571429 1.157895 1.571429 1.571429 0.000000 1.157895 0.000000
 [465] 1.157895 1.550296 1.550296 1.571429 1.550296 0.000000 1.571429 0.000000
 [473] 0.000000 1.550296 0.000000 0.000000 0.000000 0.000000 1.571429 0.000000
 [481] 1.571429 0.000000 1.550296 1.571429 0.000000 1.571429 1.571429 1.571429
 [489] 1.550296 1.571429 0.000000 1.571429 1.550296 1.550296 1.571429 0.000000
 [497] 0.000000 1.550296 0.000000 0.000000 1.571429 0.000000 1.550296 1.550296
 [505] 0.000000 1.571429 1.550296 0.000000 1.550296 0.000000 0.000000 0.000000
 [513] 1.571429 1.550296 1.550296 1.550296 1.571429 0.000000 1.571429 0.000000
 [521] 1.550296 1.571429 1.550296 0.000000 0.000000 0.000000 0.000000 1.550296
 [529] 1.550296 1.571429 0.000000 0.000000 0.000000 0.000000 1.571429 0.000000
 [537] 1.571429 0.000000 0.000000 0.000000 0.000000 1.550296 0.000000 1.571429
 [545] 0.000000 0.000000 1.550296 1.571429 0.000000 0.000000 0.000000 0.000000
 [553] 0.000000 1.550296 0.000000 1.571429 1.550296 0.000000 1.571429 1.550296
 [561] 0.000000 1.550296 0.000000 1.550296 0.000000 1.571429 0.000000 0.000000
 [569] 1.571429 1.550296 0.000000 0.000000 1.550296 1.571429 0.000000 0.000000
 [577] 0.000000 1.571429 1.571429 0.000000 1.571429 0.000000 0.000000 1.550296
 [585] 0.000000 0.000000 1.550296 1.550296 1.571429 1.571429 0.000000 1.550296
 [593] 1.571429 0.000000 1.571429 1.550296 0.000000 0.000000 0.000000 0.000000
 [601] 0.000000 1.550296 0.000000 1.571429 0.000000 1.571429 1.550296 1.550296
 [609] 0.000000 0.000000 1.571429 1.571429 1.550296 1.550296 1.550296 1.550296
 [617] 1.550296 0.000000 1.571429 0.000000 1.571429 0.000000 0.000000 1.550296
 [625] 0.000000 1.571429 1.571429 0.000000 1.571429 0.000000 1.550296 1.550296
 [633] 0.000000 1.550296 0.000000 0.000000 0.000000 1.571429 0.000000 1.550296
 [641] 1.550296 1.468208 1.468208 1.468208 1.468208 1.468208 1.571429 1.468208
 [649] 1.571429 1.571429 1.550296 1.550296 1.468208 1.571429 1.571429 1.550296
 [657] 1.571429 1.468208 1.550296 1.550296 1.550296 1.468208 1.468208 1.468208
 [665] 1.571429 1.571429 1.550296 1.571429 1.571429 1.550296 1.550296 1.468208
 [673] 1.550296 1.468208 1.550296 1.550296 1.571429 1.550296 1.468208 1.468208
 [681] 1.468208 1.550296 1.468208 1.550296 1.550296 1.468208 1.550296 1.550296
 [689] 1.468208 1.468208 1.571429 1.550296 1.571429 1.571429 1.468208 1.468208
 [697] 1.468208 1.550296 1.571429 1.468208 1.550296 1.550296 1.468208 1.550296
 [705] 1.468208 1.468208 1.468208 1.571429 1.550296 1.468208 1.468208 1.550296
 [713] 1.468208 1.550296 1.571429 1.468208 1.571429 1.571429 1.550296 1.550296
 [721] 1.571429 1.571429 1.550296 1.468208 1.468208 1.468208 1.468208 1.468208
 [729] 1.550296 1.468208 1.468208 1.468208 1.571429 1.468208 1.550296 1.550296
 [737] 1.571429 1.571429 1.468208 1.468208 1.468208 1.468208 1.550296 1.468208
 [745] 1.468208 1.468208 1.468208 1.571429 1.550296 1.157895 1.550296 1.550296
 [753] 1.550296 1.550296 1.550296 1.468208 1.550296 1.468208 1.468208 1.468208
 [761] 1.550296 1.550296 1.550296 1.468208 1.157895 1.157895 1.157895 1.550296
 [769] 1.468208 1.468208 1.550296 1.468208 1.550296 1.468208 1.550296 1.468208
 [777] 1.468208 1.157895 1.550296 1.468208 1.468208 1.157895 1.468208 1.468208
 [785] 1.468208 1.550296 1.550296 1.157895 1.550296 1.550296 1.550296 1.157895
 [793] 1.157895 1.468208 1.157895 1.550296 1.550296 1.550296 1.157895 1.550296
 [801] 1.550296 1.550296 1.157895 1.468208 1.550296 1.550296 1.550296 1.468208
 [809] 1.550296 1.468208 1.468208 1.468208 1.468208 1.468208 1.468208 1.157895
 [817] 1.550296 1.550296 1.468208 1.550296 1.550296 1.157895 1.468208 1.550296
 [825] 1.550296 1.550296 1.468208 1.468208 1.468208 1.468208 1.550296 1.468208
 [833] 1.468208 1.550296 1.468208 1.157895 1.468208 1.550296 1.550296 1.550296
 [841] 1.157895 1.468208 1.468208 1.468208 1.468208 1.468208 1.468208 1.157895
 [849] 1.550296 1.157895 1.468208 1.468208 1.468208 1.550296 1.157895 1.468208
 [857] 1.468208 1.550296 1.550296 1.468208 1.468208 1.157895 1.468208 1.550296
 [865] 1.157895 1.468208 1.550296 1.157895 1.468208 1.550296 1.157895 1.157895
 [873] 1.468208 1.550296 1.468208 1.468208 1.550296 1.550296 1.468208 1.468208
 [881] 1.468208 1.157895 1.468208 1.468208 1.468208 1.157895 1.550296 1.468208
 [889] 1.468208 1.550296 1.468208 1.550296 1.468208 1.157895 1.550296 1.157895
 [897] 1.550296 1.468208 1.468208 1.157895 1.468208 1.550296 1.550296 1.468208
 [905] 1.157895 1.468208 1.157895 1.468208 1.468208 1.550296 1.468208 1.550296
 [913] 1.550296 1.157895 1.550296 1.550296 1.468208 1.550296 1.468208 1.468208
 [921] 1.157895 1.468208 1.550296 1.550296 1.468208 1.468208 1.468208 1.468208
 [929] 1.468208 1.550296 1.550296 1.468208 1.550296 1.468208 1.468208 1.157895
 [937] 1.550296 1.157895 1.468208 1.468208 1.468208 1.468208 1.550296 1.468208
 [945] 1.468208 1.157895 1.468208 1.550296 1.468208 1.468208 1.550296 1.468208
 [953] 1.468208 1.468208 1.550296 1.468208 1.468208 1.157895 1.468208 1.468208
 [961] 1.468208 1.550296 1.468208 1.468208 1.550296 1.468208 1.468208 1.468208
 [969] 1.468208 1.468208 1.157895 1.550296 1.550296 1.468208 1.550296 1.468208
 [977] 1.468208 1.468208 1.550296 1.468208 1.157895 1.468208 1.468208 1.468208
 [985] 1.468208 1.468208 1.550296 1.468208 1.550296 1.157895 1.550296 1.468208
 [993] 1.468208 1.550296 1.550296 1.468208 1.468208 1.550296 1.550296 1.468208

NonProbEst documentation built on July 1, 2020, 6:08 p.m.