# \donttest{
# Loading sample data
data("eusilcA_smp")
# Example 1: With weights and naive bootstrap
emdi_direct <- direct(
y = "eqIncome", smp_data = eusilcA_smp,
smp_domains = "district", weights = "weight", threshold = 11064.82,
var = TRUE, boot_type = "naive", B = 50, seed = 123, X_calib = NULL,
totals = NULL, na.rm = TRUE
)
# Example 2: With function as threshold
emdi_direct <- direct(
y = "eqIncome", smp_data = eusilcA_smp,
smp_domains = "district", weights = "weight", threshold =
function(y, weights) {
0.6 * laeken::weightedMedian(y, weights)
}, na.rm = TRUE
)
# Example 3: With custom indicators
emdi_direct <- direct(
y = "eqIncome", smp_data = eusilcA_smp,
smp_domains = "district", weights = "weight", threshold = 10859.24,
var = TRUE, boot_type = "naive", B = 50, seed = 123, X_calib = NULL,
totals = NULL, custom_indicator = list(my_max = function(y) {
max(y)
}, my_min = function(y) {
min(y)
}),
na.rm = TRUE
)
# }
Run the code above in your browser using DataLab