# Chapter 5: Making Controlled Comparisons
library(poliscidata) # Loads R companion package in session
# MEAN COMPARISON ANALYSIS WITH A CONTROL VARIABLE
cat("Controlled Mean Comparison Table:\n")
imeansC(~modsex_scale, ~link_wom_scale + dem_raceeth2, nesD)
# Next commands create plot with legend
iplotC(~modsex_scale, ~link_wom_scale+dem_raceeth2, nesD,
modsex_scale~dem_raceeth2+link_wom_scale,
xlab="Linked Fate Scale", ylab="Modern Sexism Scale",
main=list("Modern Sexism Opinions by \n Linked Fate and Race", cex=1.2))
legend("topleft", legend=c("Black","White"), lty=c(2,1), lwd=2,
title="Race", inset=0.1, bty="n")