# Immigration Choice Conjoint Experiment Data from Hainmueller et. al. (2014).
data("immigrationconjoint")
data("immigrationdesign")
# Run AMCE estimator using all attributes in the design
results <- amce(Chosen_Immigrant ~ Gender + Education + `Language Skills` +
`Country of Origin` + Job + `Job Experience` + `Job Plans` +
`Reason for Application` + `Prior Entry`, data=immigrationconjoint,
cluster=TRUE, respondent.id="CaseID", design=immigrationdesign)
# Plot results
plot(results, xlab="Change in Pr(Immigrant Preferred for Admission to U.S.)",
ylim=c(-.3,.3), breaks=c(-.2, 0, .2), labels=c("-.2","0",".2"), text.size=13)
# Run AMCE estimator with an interaction with a respondent-varying characteristic
interaction_results <- amce(Chosen_Immigrant ~ Gender + Education
+ Job + ethnocentrism*Job,
data = subset(immigrationconjoint, !is.na(immigrationconjoint$ethnocentrism)),
cluster=TRUE, respondent.id="CaseID",
design = immigrationdesign,
respondent.varying = c("ethnocentrism"))
# Plot results with different plots for quantiles of the respondent-varying characteristic
# Do not show output for variables that do not vary with facetted levels
plot(interaction_results,facet.name = c("ethnocentrism"))
# RUN AMCE estimator with an interaction between two factor variables
interaction_results <- amce(Chosen_Immigrant ~ Gender + Education + Job
+ Education*Job, data = immigrationconjoint,
cluster = FALSE, design = immigrationdesign)
# Plot results with different plots for all levels of ACIE
plot(interaction_results,facet.name = c("Education"))
# Plot results with different plots for only two levels of one interacted variable
facet.levels1 <- list()
facet.levels1[["Education"]] <- data.frame(c("college degree","graduate degree"))
rownames(facet.levels1[["Education"]]) <- c("college degree","graduate degree")
plot(interaction_results,facet.name = c("Education"),facet.levels = facet.levels1)Run the code above in your browser using DataLab