#### 联系方式

• QQ：99515681
• 邮箱：99515681@qq.com
• 工作时间：8:00-23:00
• 微信：codinghelp

#### 您当前位置：首页 >> Algorithm 算法作业Algorithm 算法作业

###### 日期：2020-02-13 09:48

POL 850 Spring 2020 Homework 1

This homework is due by 5 PM on Wednesday, February 12. Please use this R Markdown template to report

your code, ouput, and written answers in a single document. You may also submit your R script, output, and

typed written answers separately. In either case, turn in your homework on paper in your TA’s mailbox (19

W. 4th, 2d floor). Comment your code. Report results in the correct units of measurement. Do not report

more than two digits to the right of the decimal point.

Name:

TA:

Exercise 1: Bias in Self-Reported Turnout

Surveys are frequently used to measure political behavior such as voter turnout, but some researchers are

concerned about the accuracy of self-reports. In particular, they worry about possible social desirability

bias where in post-election surveys, respondents who did not vote in an election lie about not having voted

because they may feel that they should have voted. Is such a bias present in the American National Election

Studies (ANES)? The ANES is a nation-wide survey that has been conducted for every election since 1948.

The ANES conducts face-to-face interviews with a nationally representative sample of adults. The table

below displays the names and descriptions of variables in the turnout.csv data file.

Name Description

year Election year

VEP Voting Eligible Population (in thousands)

VAP Voting Age Population (in thousands)

total Total ballots cast for highest office (in thousands, including ballots cast by

overseas voters)

felons Total ineligible felons (in thousands)

noncit Total non-citizens (in thousands)

overseas Total eligible overseas voters (in thousands)

osvoters Total ballots counted by overseas voters (in thousands)

ANES Percentage of ANES respondents who report having voted

We will also make use of derivative data files pres_turnout.csv, mid_turnout.csv, earlier_turnout.csv,

and later_turnout.csv.

Question 1.1 (6 pts)

Load the data into R and check the dimensions of the data. How many observations are there? Using the

function head() and the argument n, list all observations. What years are included in the dataframe? What

type is each variable in the dataframe?

## insert code here

1

Question 1.2 (6 pts)

There are different possible measures of turnout. We will construct two alternative measures of turnout.

First, construct a new variable in the turnout dataframe that is defined as the total number of ballots cast

divided by the sum of voting age population and the total number of eligible overseas voters, times 100. Next,

construct a new variable in the turnout dataframe that is defined as the total number of ballots cast divided

by the voting eligible population, times 100. Use the function View() to browse the newly created variables.

What difference do you observe across the two measures of turnout, and why do you think that difference

exists?

## insert code here

Question 1.3 (6 pts)

Construct a new variable in the turnout dataframe defined as the difference between the voting age population

measure of turnout that you created for Question 2, and the ANES measure of turnout. What is the

average difference between these two turnout measures? Conduct the same comparison for the voting eligible

population measure of turnout that you created for Question 2, and the ANES measure of turnout. Briefly

comment on the results.

##insert code here

Question 1.4 (6 pts)

Presidential elections and midterm elections occur every four years, staggered by two years with respect to

each other. Let’s investigate differences in midterm and presidential elections. First, load the data from

pres_turnout.csv and mid_turnout.csv. Compute and compare the mean VEP turnout rate (defined as

in Question 2) with the ANES turnout rate, separately for presidential elections and midterm elections. Note

that the data set excludes the year 2006. Does the difference between the VEP and ANES turnout rates vary

across election types?

##insert code here

Question 1.5 (6 pts)

Load data from earlier_turnout.csv and later_turnout.csv so as to separately examine the first and

second halves of the year range of the original turnout.csv dataset. Calculate the mean difference between

2

the VEP turnout rate (defined as in Question 2) and the ANES turnout rate within each period. Has the

bias of the ANES increased over time?

##insert code here

Question 1.6 (6 pts)

The ANES does not interview overseas voters and prisoners. Let’s calculate an adjustment to the VAP

turnout rate. First, construct a new variable for adjusted VAP in the turnout dataframe that is defined

as the voting age population, minus the total number of ineligible felons and non-citizens. Next, construct

a new variable in the turnout dataframe defined as total ballots cast minus overseas ballots, divided by

the adjusted VAP, times 100. Finally, construct a new variable in the turnout dataframe defined as is the

difference between the adjusted VAP turnout rate and the ANES turnout rate. Compare the mean differences

between the adjusted VAP turnout rate and the ANES turnout rate, the unadjusted VAP turnout rate and

the ANES turnout rate, and the VEP turnout rate and the ANES turnout rate. Briefly discuss the results.

##insert code here

Exercise 2: Causality

Question 2.1.A (4 pts)

Do hospitals make people healthier? You are interested in estimating the causal effect of visiting a hospital

on individual i’s health status.

What is the treatment variable (Xi)? What is the outcome variable (Yi)?

Question 2.1.B (4 pts)

The National Health Interview Survey (NHIS) collected data on hospital visits and health conditions of

individuals. Health conditions are measured based on a 5-point scale (1, 2, 3, 4, 5), with higher numbers =

better health conditions. Table 2 summarizes the survey results.

3

Taken at face value, these results suggest that going to the hospital makes people sicker. What is the problem

with this conclusion? Provide an answer by comparing the likely pre-treatment characteristics of those who

are treated vs. those who are not treated.

Question 2.1.C (4 pts)

To make an causal argument, it is important to think about the factual (Yi) and counterfactual outcomes

(Yi(1) and Yi(0)).

What do Yi(1) and Yi(0) mean in this context? For a person who visited hospitals in the NHIS dataset,

among two potential outcomes (Yi(1) and Yi(0)), which one do you actually observe? For a person who did

not visit hospitals in the NHIS dataset, among two potential outcomes (Yi(1) and Yi(0)), which one do you

actually observe?

Question 2.2.A (4 pts)

Do small classes increase student achievement? Many studies with observational data suggest that there is

little or no link between class size and student learning. However, the observed relationship between class

size and student achievement should not be taken at face value.

Why? Could there be systematic differences between students in smaller classes and students in regular

classes that could be obscuring a true causal effect?

4

Question 2.2.B (4 pts)

You are determined to know the causal relationship between small class size and student learning, so you

design an experiment. At NYU, you randomly assign a group of Politics majors into a 10-person (small) POL

850 class and assign the rest of the students to a 100-person POL 850 class (regular). You will measure their

R programming skills at the end of the semester.

What is the treatment variable (Xi)? What is the outcome variable (Yi)? What do potential outcomes, Yi(1)

and Yi(0), mean in this context?

Question 2.2.C (4 pts)

For those who are assigned to a 10-person class (small), which potential outcome do you observe? For those

who are assigned to a 100-person class (regular), which potential outcome do you observe?

Exercise 3: The Mark of a Criminal Record

In this exercise, we analyze the causal effects of a criminal record on the job prospects of white and black job

applicants. This exercise is based on:

Pager, Devah. (2003). “The Mark of a Criminal Record.” American Journal of Sociology 108(5):937-975.

You are also welcome to watch Professor Pager discuss the design and result here.

To isolate the causal effect of a criminal record for black and white applicants, Pager ran an audit experiment.

In this type of experiment, researchers present two similar people that differ only according to one trait

thought to be the source of discrimination.

To examine the role of a criminal record, Pager hired a pair of white men and a pair of black men and

instructed them to apply for existing entry-level jobs in the city of Milwaukee. The men in each pair were

matched on a number of dimensions, including physical appearance and self-presentation. As much as

possible, the only difference between the two was that Pager randomly varied which individual in the pair

would indicate to potential employers that he had a criminal record. Further, each week, the pair alternated

which applicant would present himself as an ex-felon. To determine how incarceration and race influence

employment chances, she compared callback rates among applicants with and without a criminal background

and calculated how those callback rates varied by race.

In the data you will use (criminalrecord.csv) nearly all these cases are present, but 4 cases have been

redacted. As a result, your findings may differ slightly from those in the paper. The names and descriptions

of variables are shown below. You may not need to use all of these variables for this activity. We’ve kept these

unnecessary variables in the dataset because it is common to receive a dataset with much more information

than you need.

Name Description

jobid Job ID number

5

Name Description

callback 1 if tester received a callback, 0 if the tester did not receive a callback.

black 1 if the tester is black, 0 if the tester is white.

crimrec 1 if the tester has a criminal record, 0 if the tester does not.

interact city 1 if tester interacted with employer during the job application, 0 if

tester does not interact with employer. 1 is job is located in the city

center, 0 if job is located in the suburbs.

distance Job’s average distance to downtown.

custserv 1 if job is in the costumer service sector, 0 if it is not.

manualskill 1 if job requires manual skills, 0 if it does not.

Question 3.1 (8 pts)

Begin by loading the data into R. How many observations are there in the data? In what percentage of

observations is the tester black? Don’t forget to comment your code.

##insert code here

Question 3.2 (8 pts)

Now we examine the central question of the study. Calculate the proportions of callbacks for white applicants

with and without a criminal record, and calculate these proportions for black applicants with and without a

criminal record. Hint: Consider using the function subset() to create separate dataframes for black and

white applicants, and the symbol [] to select observations. Briefly discuss the results.

##insert code here

Question 3.3 (8 pts)

What is the difference in average callback rates between individuals with and without a criminal record,

within each race? What is the ratio of average callback rates for individuals with a criminal record, relative

to individuals without a criminal record, within each race? What do these results tell us?

##insert code here

6

Question 3.4 (8 pts)

Compare the callback rates of whites with a criminal record versus blacks without a criminal record. What

do we learn from this comparison?

Question 3.5 (8 pts)

When carrying out this experiment, Pager made many decisions. For example, she opted to conduct the

research in Milwaukee; she could have done the same experiment in Dallas or Topeka or Princeton. She

ran the study at a specific time: between June and December of 2001. But, she could have also run it at a

different time, say 5 years earlier or 5 years later. Pager decided to hire 23-year-old male college students as

her testers; she could have done the same experiment with 23-year-old female college students or 40-year-old

male high school drop-outs. Further, the criminal record she randomly assigned to her testers was a felony

convinction related to drugs (possession with intent to distribute, cocaine). But, she could have assigned her

testers a felony conviction for assault or tax evasion. Pager was very aware of each of these decisions, and she

discusses them in her paper. Now you should pick one of these decisions described above or another decision

of your choosing. Speculate about how the results of the study might (or might not) change if you were to

conduct the same study but alter this specific decision. This is part of thinking about the external validity of

the study.