next up previous
Next: Example 4: 2000 pid, Up: Programs for data from Previous: Example 2: 2000 pid,

Example 3: 1996 pid, libcon, watchtv, spatial distances; make tables

year 1996

VARS
  CF0301
  CF0704
  CF0704A
  CF0724
  VCF0803
  CF9088
  CF9096
;

# get rid of unwanted value in party ID
pid <- CF0301;
pid <- ifelse(pid == 9, NA, pid);

# get rid of unwanted value in libcon self-placement
libcon <- VCF0803;
libcon <- ifelse(libcon == 9, NA, libcon);

# presvote3 is three major party candidates only
presvote3 <- CF0704;

# presvote is Dem and Rep candidates only
presvote <- CF0704A - 1;

# watchtv is how much watched campaign on TV
watchtv <- CF0724;

# compute spatial model measure of difference between Dem and Rep candidates
demlibcon <- CF9088;
replibcon <- CF9096;
demdist <- abs(libcon-demlibcon);
repdist <- abs(libcon-replibcon);
distdiff <- demdist-repdist;

# crosstab of three-party vote given pid
xtable presvote3 pid

# crosstab of two-party vote given pid
xtable presvote pid

# crosstab of two-party vote given libcon
xtable presvote libcon

# crosstab of two-party vote given distdiff
xtable presvote distdiff


Walter Mebane 2004-11-18