# 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(~ft_dem, ~gender + married, nesD)
# Next commands create plot with legend
iplotC(~ft_dem, ~gender+married, nesD, ft_dem~married+gender,
xlab="Gender", ylab="Democratic Party Rating",
main="Democratic Party Ratings\nby Gender and Marital Status")
legend("topleft", legend=c("No","Yes"), lty=c(1,2), lwd=2,
title="Is R married?", inset=0.1, bty="n")