complete exercise 2 in Pollock and Edwards (An R Companion to Political Analysis