Economics Homework Help
Economics Homework Help. Problem set
In this problem set you will summarize the paper “Do Workers Work More if Wages Are High? Evidence from a Randomized Field Experiment” (Fehr and Goette, AER 2007) and recreate some of its findings
2 Replication
Use theme_classic()
for all plots.
2.1 Correlations in revenues across firms
For this section please use dailycorrs.csv
.
= read_csv("../data/fehr_goette_2007/dailycorrs.csv")
dailycorrs
[Q8] The authors show that earnings at Veloblitz and Flash are correlated. Show this with a scatter plot with a regression line and no confidence interval. Title your axes and the plot appropriately. Do not print the plot but assign it to an object called
p1
.
# your code here
[Q9] Next plot the kernel density estimates of revenues for both companies. Overlay the distributions and make the densities transparent so they are easily seen. Title your axes and the plot appropriately. Do not print the plot but assign it to an object called
p2
.
# your code here
[Q11] Now combine both plots using
library(patchwork)
and label the plots with letters.
# your code here
2.2 Tables 2 and 3
For this section please use tables1to4.csv
.
# your code here
2.2.1 Table 2
On page 307 the authors write:
“Table 2 controls for individual fixed effects by showing how, on average, the messengers’ revenues deviate from their person-specific mean revenues. Thus, a positive number here indicates a positive deviation from the person-specific mean; a negative number indicates a negative deviation.”
[Q12] Fixed effects are a way to control for heterogeneity across individuals that is time invariant. Why would we want to control for fixed effects? Give a reason how bike messengers could be different from each other, and how these differences might not vary over time.
[your written answer here]
[Q13] Create a variable called
totrev_fe
and add it to the dataframe. This requires you to “average out” each individual’s revenue for a block from their average revenue:xfei=xit−x¯i wherexfei is the fixed effect revenue fori .
# your code here
[Q14] Use
summarise()
to recreate the findings in Table 2 for “Participating Messengers” using your new variabletotrev_fe
. (You do not have to calculate the differences in means.)
In addition to calculating the fixed-effect controled means, calculate the standard errors. Recall the standard error issjtnjt√ wheresjt is the standard deviation for treatmentj in blockt andnjt are the corresponding number of observations.
(Hint: usen()
to count observations.) Each calculation should be named to a new variable. Assign the resulting dataframe to a new dataframe calleddf_avg_revenue
.
# your code here
[Q15] Plot
df_avg_revenue
. Use points for the means and error bars for standard errors of the means.
To dodge the points and size them appropriately, use
geom_point(position=position_dodge(width=0.5), size=4)
To place the error bars use
geom_errorbar(aes(
x=block,
ymin = [MEAN] - [SE], ymax = [MEAN] + [SE]),
width = .1,
position=position_dodge(width=0.5))
You will need to replace [MEAN]
with whatever you named your average revenues and [SE]
with whatever you named your standard errors.
# your code here
[Q16] Interpret the plot.
[your written answer here]
2.2.2 Table 3
[Q17] Recreate the point estimates in Model (1) in Table 3 by hand (you don’t need to worry about the standard errors). Assign it to object
m1
. Recreating this model requires you to control for individual fixed effects and estimate the following equation whereH is the variablehigh
,B2 is the second block (block == 2
) andB3 is the third block (block == 3
):
# your code here
[Q18] Now recreate the same point estimates using
lm
and assign it to objectm2
. You are estimating the model below where whereFi is the dummy variable for each messenger (fahrer
). Make sure to cluster the standard errors at the messenger level. (Uselmtest
andsandwhich
for this.)
# your code here
[Q20] Now use
feols
to recreate Model (1), including the standard errors. Assign your estimates to the objectm3
. You are estimating the model below where whereαi is the individual intercept (i.e. the individual fixed effect):
# your code here
[Q21] Compare the estimates in
m1
,m2
andm3
. What is the same? What is different? What would you say is the main advantage of usingfelm()
?
[your written answer]
[Q22] Explain why you need to cluster the standard errors.
[your written answer]