# Small example
target_dist_marginal <- OnoBurden$target_dist_marginal
OnoBurden_data <- OnoBurden$OnoBurden_data
OnoBurden_data_small <- OnoBurden_data[1:300, ]
target_dist_marginal_small <- target_dist_marginal[c("gender", "race")]
# model-based estimation without regularization
out_model_s <-
model_pAMCE(formula = Y ~ gender + race,
data = OnoBurden_data_small, reg = FALSE,
pair_id = OnoBurden_data_small$pair_id,
cluster_id = OnoBurden_data_small$id,
target_dist = target_dist_marginal_small,
target_type = "marginal")
# \donttest{
# model-based estimation with regularization
out_model <-
model_pAMCE(formula = Y ~ gender + age + family + race + experience + party + pos_security,
data = OnoBurden_data_small, reg = TRUE,
pair_id = OnoBurden_data_small$pair_id,
cluster_id = OnoBurden_data_small$id,
target_dist = target_dist_marginal,
target_type = "marginal",
nfolds = 2, # suggest "nfolds = 5" in practice
numCores = 1, # when numCores = NULL, it automatically uses all cores.
boot = 5) # suggest "boot = 500" in practice
summary(out_model, factor_name = c("gender"))
# decompose the difference in the pAMCEs
decompose_pAMCE(out_model, effect_name = c("gender", "Female"))
# }
Run the code above in your browser using DataLab