# NOT RUN {
# Examples for comparisons of direct estimates and models of type ebp
# Loading data - population and sample data
data("eusilcA_pop")
data("eusilcA_smp")
# Generation of two emdi objects
emdi_model <- ebp(fixed = eqIncome ~ gender + eqsize + cash +
self_empl + unempl_ben + age_ben + surv_ben + sick_ben + dis_ben + rent +
fam_allow + house_allow + cap_inv + tax_adj, pop_data = eusilcA_pop,
pop_domains = "district", smp_data = eusilcA_smp, smp_domains = "district",
threshold = function(y){0.6 * median(y)}, L = 50, MSE = TRUE,
na.rm = TRUE, cpus = 1)
emdi_direct <- direct(y = "eqIncome", smp_data = eusilcA_smp,
smp_domains = "district", weights = "weight", threshold = 11161.44,
var = TRUE, boot_type = "naive", B = 50, seed = 123, na.rm = TRUE)
# Example 1: Receive first overview
compare_plot(model = emdi_model, direct = emdi_direct)
# Example 2: Change plot theme
library(ggplot2)
compare_plot(emdi_model, emdi_direct, indicator = "Median",
gg_theme = theme(axis.line = element_line(size = 3, colour = "grey80"),
plot.background = element_rect(fill = "lightblue3"),
legend.position = "none"))
# Example for comparison of direct estimates and models of type fh
# Loading data - population and sample data
data("eusilcA_popAgg")
data("eusilcA_smpAgg")
# Combine sample and population data
combined_data <- combine_data(pop_data = eusilcA_popAgg, pop_domains = "Domain",
smp_data = eusilcA_smpAgg, smp_domains = "Domain")
# Generation of the emdi object
fh_std <- fh(fixed = Mean ~ cash + self_empl, vardir = "Var_Mean",
combined_data = combined_data, domains = "Domain", method = "ml",
MSE = TRUE)
# Example 3: Receive first overview
compare_plot(fh_std)
# Example 4: Compare also MSE and CV estimates
compare_plot(fh_std, MSE = TRUE, CV = TRUE)
# }
Run the code above in your browser using DataLab