Homework 2: SDGB 7844
Submit two files through Blackboard: (a) .Rmd R Markdown file with answers and code
and (b) Word document of knitted R Markdown file. Your file should be named as follows:
“HW2-[Full Name]-[Class Time]” and include those details in the body of your file.
For those of you who have studied U.S. government, you know that Congress (legislature) is
made up of the House of Representatives and the Senate. The number of people each state
sends to the House is dependent on that state’s population, whereas every state sends two
people to the Senate.
A census of the U.S. population is required every ten years by the U.S. Constitution
(Article 1, Section 2). The primary purpose of the census is to determine how many representatives
each state will send to the House. This procedure is called apportionment
(link). There are 435 representatives in the House and each state sends at least once person.
Once the census is complete, the equal proportions method is used to apportion those
435 seats among the states.
The first census was conducted in 1790 when people were hired to visit each home and
count who lived there. At that time, only white males were eligible to vote, but according
to the Constitution everyone was to be counted, not just eligible voters or citizens. Slaves
were counted too, but were considered only three-fifths of a person (see Constitution Article
1, Section 2, Clause 3). This was abolished after the Civil War when the 13th Amendment
to the Constitution was ratified in 1865.
The Electoral College is a body which decides who is president. The number of House
members plus two equals the number of electoral votes each state gets. During a presidential
election, citizens technically vote for the Electoral College members (even though the presidential
candidates are on the ballot) and the Electoral College votes for president (link).
For all practical purposes, though, whichever candidate gets the most votes in the state gets
all of the electoral votes for that state. (Note: There are 538 electoral college members and
so 538 electoral votes. 538 = 435 House reps + 50 Senators + 3 people for the District of
Columbia. Therefore, whomever gets at least 270 electoral votes wins.)
The next census is in 2020 when, again, everyone will be counted. Every residential address
will receive a form to fill regarding the occupants of that residence. Between censuses, the
government keeps track of population changes through the Population Estimates Program
(PEP), which is administered by the U.S. Census Bureau (link).
Goal: Use 2018 Population Estimates Program (PEP) data to estimate the number
of House of Representative members for each state expected from the results
of the upcoming 2020 census. Compare your estimates with the current House
distribution which is based on the 2010 census1
DO NOT CHANGE ANY OF THE FILE NAMES OR FILES THEMSELVES!!
• “PEP 2018 PEPANNRES with ann.csv”: 2018 population for each state from
the PEP from American FactFinder, a website maintained by the Census Bureau.
Instructions are at the end of this assignment.
• “ApportionmentPopulation2010.xls”: 2010 population for each state and the
2010 apportionment results. Instructions are at the end of this assignment.
• Equal proportions algorithm: In “Congressional Apportionment...” file posted
with this assignment.
• U.S. map: from the R package usmap . You need to install this package on your
computer and then load it by using the command require(usmap). See Lecture 3
slides for instructions on installing an R package.
1. What was the “residence rule” for the 2010 census and why is it important? (Use the
internet and provide a link for any sources you use.)
2. Upload the 2018 data file into R. Only keep the columns Geography; April 1, 2010
- Census; and Population Estimate (as of July 1) - 2018. Rename the columns
state; res2010; and pep2018 (all lowercase).
(a) There are 50 states, so why are there more than 50 rows in the data set?
(b) What is the resident population of the U.S. according to the 2010 census? Which
geographies are included/excluded from this total? Remove the extra rows from
your 2018 PEP data set so you only have the data for the 50 states. (The functions
sum() and is.element() are useful here.)
(c) Calculate the percent change of the total resident population between the 2010
census and 2018. How much has the population grown? Once you’ve answered this