Name:

Go to https://voteview.com/data and download the member ideology data for the 118th House of Representatives. In the chunk below, set your working directory to wherever you have saved that data, and load the data into R.

dat <- read.csv('H118_members.csv')

Answer the following questions about the data:

  1. Who was the most conservative member of the 118th House of Representatives? Greg Lopez

  2. Who was the most liberal member of the 118th House of Representatives? Sylvia Garcia

Using the chunk below, make a density plot showing the distribution of the ideology variable, nominate_dim1.

plot(density(dat$nominate_dim1))

  1. Describe what the density plot tells you about the distribution of ideology in the 118th House. Moderate ideologies seem to be dominate in each of the political parties. There seems to be little to few neutral or purely moderate members with ideological values near the value of ‘0.0’. As well as few members with extreme views on either the left or the right.

Using the chunk below, create a variable for the age of each member. This will not be exact, as you don’t have the exact birthdate for each member, but you should be able to get a rough age by using the members’ birth years. Using the variable you create, answer the following question:

  1. What was the average age for members serving in the 118th House of Representatives? 60 years old (born 1965)
table(dat$born)
## 
## 1936 1937 1938 1939 1940 1941 1942 1943 1944 1945 1946 1947 1948 1949 1950 1951 
##    1    3    1    1    2    2    2    3    3    4    5    9    8    6    9    7 
## 1952 1953 1954 1955 1956 1957 1958 1959 1960 1961 1962 1963 1964 1965 1966 1967 
##    8   13   10   12   10    9   14   10   12   13   17   12   15   12   15    8 
## 1968 1969 1970 1971 1972 1973 1974 1975 1976 1977 1978 1979 1980 1981 1982 1983 
##    8   13   10    9   12    8   11   10   20    6    8   11   13    8   10    6 
## 1984 1985 1986 1987 1988 1989 1997 
##    9    3    6    2    7    4    1
median(dat$born)
## [1] 1965

Using the chunk below, make the following subsets of your data:

  1. a subset of only members from Texas
  2. a subset of only Republican members
  3. a subset of only Democratic members
  4. a subset of members who were born after the median birth year (this is a two-parter, because first you have to find the median birth year, and then you have to make a subset including only members born after that year.)
dat_subsettexas <- subset(dat,dat$state_abbrev=='TX')
dat_subsetrep <- subset(dat,dat$party_code=='200')
dat_subsetdem <- subset(dat,dat$party_code=='100')
dat_subsetpast1995 <- subset(dat,dat$born > 1965) 

table(dat_subsetpast1995$party_code)
## 
## 100 200 
## 105 113
  1. How many members represented districts in Texas in the 118th House of Representatives? 39

  2. How many Republicans served in the 118th House of Representatives? 230

  3. How many Democrats served in the 118th House of Representatives? 221

  4. Of the members born after the median birth year, how many are Republicans and how many are Democrats? 105 Democrats 113 Republicans

Using the chunk below, create a scatter plot with member age on the x-axis and member ideology (nominate_dim1) on the y axis

  1. Looking at the plot, does there appear to be a systematic relationship between age and ideology? There does not seem to be an obvious observable difference in the relationship between age and ideology as the data throughout the plot is quite evenyl distributed.

Using the chunk below, create two different versions of the same scatter plot described above – one using the subset of only Democratic members that you created above, and the other using the subset of only Republican members.

  1. Within each party, does there appear to be any systematic relationship between member age and ideology? If so, what is the nature of that relationship?

The republican ideological shifts seem to become more progressive, leaning closer to the moderate ideological perspective as members become younger. On the same coin, democratic members seem to become more moderate as well as they get younger in age.