Description Usage Arguments Details Value References Examples
Computes weights from propensity estimates using the propensity stratification 1/p_i averaging formula introduced in Valliant and Dever (2011).
1 | vd_weights(convenience_propensities, reference_propensities, g = 5)
|
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. |
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 Valliant and Dever (2019). 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(g_i)}{ ∑_{k \in g_i} π_k (x)}
where g_i represents the strata to which i belongs, and n(g_i) is the number of individuals in the g_i strata.
A vector with the corresponding weights.
Valliant, R., & Dever, J. A. (2011). Estimating propensity adjustments for volunteer web surveys. Sociological Methods & Research, 40(1), 105-137.
Cochran, W. G. (1968). The Effectiveness of Adjustment by Subclassification in Removing Bias in Observational Studies. Biometrics, 24(2), 295-313
1 2 3 | covariates = c("education_primaria", "education_secundaria")
data_propensities = propensities(sampleNP, sampleP, covariates)
vd_weights(data_propensities$convenience, data_propensities$reference)
|
Loading required package: lattice
Loading required package: ggplot2
[1] 2.095137 1.932302 2.074002 2.095137 2.074002 2.095137 1.932302 2.074002
[9] 2.074002 1.932302 2.074002 1.932302 2.095137 1.932302 1.932302 1.932302
[17] 2.095137 2.095137 1.932302 2.095137 1.932302 1.932302 1.932302 1.932302
[25] 1.932302 2.074002 2.074002 2.095137 2.074002 1.932302 2.095137 2.095137
[33] 2.095137 2.095137 2.095137 1.932302 2.095137 2.074002 1.932302 2.095137
[41] 2.095137 1.932302 1.932302 1.932302 1.932302 2.095137 2.095137 2.074002
[49] 1.932302 1.932302 1.932302 2.095137 1.932302 2.074002 2.095137 1.932302
[57] 2.095137 2.095137 1.932302 2.095137 2.095137 2.095137 1.932302 2.095137
[65] 2.095137 2.095137 2.074002 1.932302 2.095137 1.932302 2.095137 2.095137
[73] 2.095137 1.932302 1.932302 2.095137 2.074002 2.095137 2.074002 1.932302
[81] 2.095137 2.074002 1.932302 2.095137 2.074002 2.095137 2.074002 1.932302
[89] 2.095137 2.095137 2.095137 2.095137 1.932302 2.095137 1.932302 2.095137
[97] 2.095137 1.932302 2.095137 1.932302 1.932302 2.095137 2.074002 2.095137
[105] 2.095137 1.932302 2.095137 2.095137 2.074002 2.095137 2.095137 1.932302
[113] 1.932302 2.095137 2.095137 2.095137 2.074002 2.074002 2.095137 2.095137
[121] 2.095137 1.932302 1.932302 2.095137 2.095137 1.932302 2.095137 2.095137
[129] 2.095137 2.074002 2.095137 2.095137 1.932302 2.074002 2.095137 2.095137
[137] 2.074002 2.095137 2.095137 2.095137 2.095137 2.095137 2.074002 1.932302
[145] 2.095137 1.932302 1.932302 1.932302 1.932302 2.074002 2.074002 1.932302
[153] 2.095137 2.095137 2.095137 1.932302 2.095137 2.095137 1.932302 2.095137
[161] 2.095137 2.074002 2.074002 2.074002 2.074002 2.074002 2.074002 2.095137
[169] 2.074002 2.095137 1.932302 2.074002 2.074002 1.932302 1.932302 2.095137
[177] 1.932302 2.095137 2.095137 2.074002 2.095137 1.932302 2.095137 2.095137
[185] 1.932302 2.095137 2.074002 1.932302 2.095137 2.074002 2.095137 2.074002
[193] 2.095137 2.095137 2.095137 2.095137 2.095137 2.095137 1.932302 1.932302
[201] 1.932302 2.095137 2.095137 2.095137 1.932302 2.095137 1.932302 2.095137
[209] 2.074002 1.932302 2.095137 1.932302 2.074002 2.074002 2.095137 1.932302
[217] 1.932302 2.095137 1.932302 2.095137 2.095137 2.095137 1.932302 1.932302
[225] 2.095137 2.095137 1.932302 1.932302 2.095137 2.095137 2.095137 1.932302
[233] 2.074002 1.932302 2.095137 2.074002 2.074002 1.932302 2.095137 1.932302
[241] 1.932302 1.932302 2.095137 2.074002 2.095137 2.095137 1.932302 2.074002
[249] 1.932302 2.074002 1.932302 2.095137 2.095137 2.095137 2.095137 2.095137
[257] 1.932302 2.074002 2.074002 1.932302 2.074002 1.932302 1.932302 2.095137
[265] 2.074002 1.932302 2.074002 1.932302 2.095137 2.095137 2.074002 2.074002
[273] 2.074002 1.932302 2.095137 2.074002 2.095137 2.095137 2.095137 2.074002
[281] 2.095137 2.074002 1.932302 2.074002 2.074002 2.095137 2.074002 1.932302
[289] 2.095137 1.932302 2.095137 2.074002 2.095137 1.932302 1.932302 2.074002
[297] 1.932302 2.095137 1.932302 2.095137 2.074002 2.095137 2.074002 2.095137
[305] 2.095137 2.095137 2.095137 2.095137 2.074002 1.932302 1.932302 2.095137
[313] 2.074002 1.932302 2.074002 2.074002 2.095137 2.095137 2.095137 1.932302
[321] 1.932302 1.932302 2.074002 2.074002 2.095137 2.095137 1.932302 2.095137
[329] 2.095137 2.095137 2.095137 1.932302 1.932302 2.095137 1.932302 2.095137
[337] 1.932302 2.074002 2.074002 2.095137 2.095137 1.932302 2.095137 2.095137
[345] 2.095137 2.095137 1.932302 2.095137 2.074002 2.095137 2.095137 1.932302
[353] 1.932302 2.095137 1.932302 2.095137 1.932302 2.095137 2.074002 2.095137
[361] 2.095137 1.932302 2.095137 1.932302 2.095137 2.095137 1.932302 2.095137
[369] 1.932302 1.932302 2.095137 1.932302 1.932302 2.095137 2.074002 2.095137
[377] 2.095137 1.932302 1.932302 2.074002 2.074002 2.095137 2.074002 2.095137
[385] 2.095137 2.095137 2.095137 1.932302 1.932302 2.095137 2.095137 2.095137
[393] 2.095137 2.074002 1.932302 2.074002 1.932302 1.932302 2.095137 2.095137
[401] 2.074002 1.932302 2.074002 1.932302 2.095137 1.932302 2.095137 1.932302
[409] 2.074002 2.095137 1.932302 2.074002 1.932302 2.095137 2.095137 1.932302
[417] 1.932302 2.095137 2.095137 2.074002 1.932302 2.074002 2.074002 2.095137
[425] 2.074002 1.932302 2.095137 1.932302 1.932302 2.095137 2.095137 2.074002
[433] 2.095137 2.095137 2.095137 2.074002 2.095137 1.932302 2.095137 2.095137
[441] 2.095137 2.095137 2.074002 2.095137 2.074002 2.095137 1.932302 1.932302
[449] 2.095137 2.074002 2.095137 1.932302 1.932302 2.095137 2.095137 2.095137
[457] 1.932302 2.074002 1.932302 2.074002 2.074002 2.095137 1.932302 2.095137
[465] 1.932302 1.821317 1.821317 2.074002 1.821317 2.095137 2.074002 2.095137
[473] 2.095137 1.821317 2.095137 2.095137 2.095137 2.095137 2.074002 2.095137
[481] 2.074002 2.095137 1.821317 2.074002 2.095137 2.074002 2.074002 2.074002
[489] 1.821317 2.074002 2.095137 2.074002 1.821317 1.821317 2.074002 2.095137
[497] 2.095137 1.821317 2.095137 2.095137 2.074002 2.095137 1.821317 1.821317
[505] 2.095137 2.074002 1.821317 2.095137 1.821317 2.095137 2.095137 2.095137
[513] 2.074002 1.821317 1.821317 1.821317 2.074002 2.095137 2.074002 2.095137
[521] 1.821317 2.074002 1.821317 2.095137 2.095137 2.095137 2.095137 1.821317
[529] 1.821317 2.074002 2.095137 2.095137 2.095137 2.095137 2.074002 2.095137
[537] 2.074002 2.095137 2.095137 2.095137 2.095137 1.821317 2.095137 2.074002
[545] 2.095137 2.095137 1.821317 2.074002 2.095137 2.095137 2.095137 2.095137
[553] 2.095137 1.821317 2.095137 2.074002 1.821317 2.095137 2.074002 1.821317
[561] 2.095137 1.821317 2.095137 1.821317 2.095137 2.074002 2.095137 2.095137
[569] 2.074002 1.821317 2.095137 2.095137 1.821317 2.074002 2.095137 2.095137
[577] 2.095137 2.074002 2.074002 2.095137 2.074002 2.095137 2.095137 1.821317
[585] 2.095137 2.095137 1.821317 1.821317 2.074002 2.074002 2.095137 1.821317
[593] 2.074002 2.095137 2.074002 1.821317 2.095137 2.095137 2.095137 2.095137
[601] 2.095137 1.821317 2.095137 2.074002 2.095137 2.074002 1.821317 1.821317
[609] 2.095137 2.095137 2.074002 2.074002 1.821317 1.821317 1.821317 1.821317
[617] 1.821317 2.095137 2.074002 2.095137 2.074002 2.095137 2.095137 1.821317
[625] 2.095137 2.074002 2.074002 2.095137 2.074002 2.095137 1.821317 1.821317
[633] 2.095137 1.821317 2.095137 2.095137 2.095137 2.074002 2.095137 1.821317
[641] 1.821317 2.095137 2.095137 2.095137 2.095137 2.095137 2.074002 2.095137
[649] 2.074002 2.074002 1.821317 1.821317 2.095137 2.074002 2.074002 1.821317
[657] 2.074002 2.095137 1.821317 1.821317 1.821317 2.095137 2.095137 2.095137
[665] 2.074002 2.074002 1.821317 2.074002 2.074002 1.821317 1.821317 2.095137
[673] 1.821317 2.095137 1.821317 1.821317 2.074002 1.821317 2.095137 2.095137
[681] 2.095137 1.821317 2.095137 1.821317 1.821317 2.095137 1.821317 1.821317
[689] 2.095137 2.095137 2.074002 1.821317 2.074002 2.074002 2.095137 2.095137
[697] 2.095137 1.821317 2.074002 2.095137 1.821317 1.821317 2.095137 1.821317
[705] 2.095137 2.095137 2.095137 2.074002 1.821317 2.095137 2.095137 1.821317
[713] 2.095137 1.821317 2.074002 2.095137 2.074002 2.074002 1.821317 1.821317
[721] 2.074002 2.074002 1.821317 2.095137 2.095137 2.095137 2.095137 2.095137
[729] 1.821317 2.095137 2.095137 2.095137 2.074002 2.095137 1.821317 1.821317
[737] 2.074002 2.074002 2.095137 2.095137 2.095137 2.095137 1.821317 2.095137
[745] 2.095137 2.095137 2.095137 2.074002 1.821317 1.932302 1.821317 1.821317
[753] 1.821317 1.821317 1.821317 2.095137 1.821317 2.095137 2.095137 2.095137
[761] 1.821317 1.821317 1.821317 2.095137 1.932302 1.932302 1.932302 1.821317
[769] 2.095137 2.095137 1.821317 2.095137 1.821317 2.095137 1.821317 2.095137
[777] 2.095137 1.932302 1.821317 2.095137 2.095137 1.932302 2.095137 2.095137
[785] 2.095137 1.821317 1.821317 1.932302 1.821317 1.821317 1.821317 1.932302
[793] 1.932302 2.095137 1.932302 1.821317 1.821317 1.821317 1.932302 1.821317
[801] 1.821317 1.821317 1.932302 2.095137 1.821317 1.821317 1.821317 2.095137
[809] 1.821317 2.095137 2.095137 2.095137 2.095137 2.095137 2.095137 1.932302
[817] 1.821317 1.821317 2.095137 1.821317 1.821317 1.932302 2.095137 1.821317
[825] 1.821317 1.821317 2.095137 2.095137 2.095137 2.095137 1.821317 2.095137
[833] 2.095137 1.821317 2.095137 1.932302 2.095137 1.821317 1.821317 1.821317
[841] 1.932302 2.095137 2.095137 2.095137 2.095137 2.095137 2.095137 1.932302
[849] 1.821317 1.932302 2.095137 2.095137 2.095137 1.821317 1.932302 2.095137
[857] 2.095137 1.821317 1.821317 2.095137 2.095137 1.932302 2.095137 1.821317
[865] 1.932302 2.095137 1.821317 1.932302 2.095137 1.821317 1.932302 1.932302
[873] 2.095137 1.821317 2.095137 2.095137 1.821317 1.821317 2.095137 2.095137
[881] 2.095137 1.932302 2.095137 2.095137 2.095137 1.932302 1.821317 2.095137
[889] 2.095137 1.821317 2.095137 1.821317 2.095137 1.932302 1.821317 1.932302
[897] 1.821317 2.095137 2.095137 1.932302 2.095137 1.821317 1.821317 2.095137
[905] 1.932302 2.095137 1.932302 2.095137 2.095137 1.821317 2.095137 1.821317
[913] 1.821317 1.932302 1.821317 1.821317 2.095137 1.821317 2.095137 2.095137
[921] 1.932302 2.095137 1.821317 1.821317 2.095137 2.095137 2.095137 2.095137
[929] 2.095137 1.821317 1.821317 2.095137 1.821317 2.095137 2.095137 1.932302
[937] 1.821317 1.932302 2.095137 2.095137 2.095137 2.095137 1.821317 2.095137
[945] 2.095137 1.932302 2.095137 1.821317 2.095137 2.095137 1.821317 2.095137
[953] 2.095137 2.095137 1.821317 2.095137 2.095137 1.932302 2.095137 2.095137
[961] 2.095137 1.821317 2.095137 2.095137 1.821317 2.095137 2.095137 2.095137
[969] 2.095137 2.095137 1.932302 1.821317 1.821317 2.095137 1.821317 2.095137
[977] 2.095137 2.095137 1.821317 2.095137 1.932302 2.095137 2.095137 2.095137
[985] 2.095137 2.095137 1.821317 2.095137 1.821317 1.932302 1.821317 2.095137
[993] 2.095137 1.821317 1.821317 2.095137 2.095137 1.821317 1.821317 2.095137
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.