
Check the variable balance between the probability and non-probability samples
Source:R/check_balance.R
check_balance.Rd
Check the variable balance between the probability and non-probability samples
Examples
data(admin)
data(jvs)
jvs_svy <- svydesign(ids = ~ 1, weights = ~ weight,
strata = ~ size + nace + region, data = jvs)
ipw_est1 <- nonprob(selection = ~ region + private + nace + size,
target = ~ single_shift,
svydesign = jvs_svy,
data = admin, method_selection = "logit"
)
ipw_est2 <- nonprob(
selection = ~ region + private + nace + size,
target = ~ single_shift,
svydesign = jvs_svy,
data = admin, method_selection = "logit",
control_selection = control_sel(est_method = "gee", gee_h_fun = 1))
## check the balance for the standard IPW
check_balance(~size, ipw_est1)
#> $nonprob_totals
#> sizeL sizeM sizeS
#> 8193.376 13529.550 31175.205
#>
#> $prob_totals
#> sizeL sizeM sizeS
#> 8561 13758 29551
#>
#> $balance
#> sizeL sizeM sizeS
#> -367.62 -228.45 1624.21
#>
## check the balance for the calibrated IPW
check_balance(~size, ipw_est2)
#> $nonprob_totals
#> sizeL sizeM sizeS
#> 8561 13758 29551
#>
#> $prob_totals
#> sizeL sizeM sizeS
#> 8561 13758 29551
#>
#> $balance
#> sizeL sizeM sizeS
#> 0 0 0
#>