首页 > > 详细

Behavioral Economics作业代做、代写R编程设计作业、代做cowplot留学生作业、代写R课程作业代写Web开发|帮做Java程序

Problem Set 2
Behavioral Economics, Fall 2019
The assignment is worth 100 points 100 points. There are 26 questions 26 questions. You should have the following packages installed:
library(tidyverse)
library(cowplot)
library(lfe)
library(stargazer)
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.
1 Big picture
1. What is the main question asked in this paper?
2. Recall the taxi cab studies where reference dependence is studied using observational data. What can an experimental study do that an
observational study can’t?
3. Summarize the field experiment design.
4. Summarize the laboratory experiment design. Why was it included with the study?
5. Summarize the main results of the field experiment.
6. Summarize the main results of the laboratory experiment.
7. Why are these results valuable? What have we learned? Motivate your discussion with a real-world example.
2 Theory
Suppose the messenger’s utility function is
where is the wage rate in time , is the messenger’s e!ort, is the marginal utility of lifetime wealth, and is the
messenger’s cost function constant disutility of e!ort and exogenous disutility shock . Since , you can assume .
8. Show that the messenger chooses a level of e!ort so that the marginal benefit of working equals the marginal cost.
9. Show that the messenger in equilibrium responds to higher wages with higher e!ort.
10. Write an R function that calculates for di!erent levels of . Set default values of . Then use curve() to plot the labor supply for
.
11. Now suppose utility is given by
12. Show that how the messenger in equilibrium responds to higher wages depends on the reference point . (Hint: recall there are three cases to
consider.)
13. Once more write an R function that calculates for di!erent levels of . Set default values of , and . Then use
curve() to plot the labor supply for .
3 Replication
Use theme_classic() for all plots.
3.1 Correlations in revenues across firms
For this section please use dailycorrs.csv .
14. 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
15. 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
16. Now combine both plots using cowplot and label the plots with letters.
# your code here
3.2 Tables 2 and 3
For this section please use tables1to4.csv .
3.2.1 Table 2
On page 307 the authors write:
Table 2 controls for individual fixed e!ects 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 personspecific
mean; a negative number indicates a negative deviation.
17. Fixed e!ects are a way to control for heterogeneity heterogeneity across individuals that is time invariant. time invariant. Why would we want to control for fixed e!ects?
Give a reason how bike messengers could be di!erent from each other, and how these di!erences might not vary over time.
18. 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: where is the fixed e!ect revenue for .
# your code here
19. Use summarise() to recreate the findings in Table 2 for “Participating Messengers” using your new variable totrev_fe . (You do not have to
calculate the di!erences in means.) In addition to calculating the fixed-e!ect controled means, calculate too the standard errors. Recall the
standard error is where is the standard deviation for treatment in block and are the corresponding number of observations. (Hint: use
n() to count observations.) Each calculation should be named to a new variable. Assign the resulting dataframe to a new dataframe called
df_avg_revenue .
# your code here
20. Plot df_avg_revenue . Use points for the means and error bars for standard errors of the means. Note the following:
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 need to replace [MEAN] with whatever you named your average revenues and [SE] with whatever you named your standard errors.
# your code here
21. Interpret the plot.
3.2.2 Table 3
22. 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 . To
recreate this model requires you to control for individual fixed e!ects and estimate the following equation:
where is the variable high , is the second block ( block == 2 ) and is the third block ( block == 3 ).
# your code here
23. Now recreate the same point estimates (ignoring the standard errors again) using lm and assign it to object m2 . You are estimating
where is the dummy variable for each messenger ( fahrer ).
# your code here
24. Now use the function felm() (https://www.rdocumentation.org/packages/lfe/versions/2.8-3/topics/felm) from the lfe package to recreate
Model (1), including the standard errors. Assign your estimates to the object m3 . You are estimating
where is the individual intercept (i.e. the individual fixed e!ect). Note that the function call works as follows:
felm([y]~[x] | [grouping variable] | 0 | [clustering varaible], [name of data])
# your code here
25. Compare the estimates in m1 , m2 and m3 . What is the same? What is di!erent? What would you say is the main advantage of using felm() ?
26. Recreate all of Table 3 and use stargazer() (https://cran.r-project.org/web/packages/stargazer/vignettes/stargazer.pdf) to print the results.
# your code here
yijt − y¯ = ( − ) + ( − ) + ( − ) + ( − ) ij β1 Hijt H¯ ij β2 B2ijt B2¯ ij β3 B3ijt B3¯ ij εijt ε¯ijH B2 B3
yijt − β0 + β1Hijt + β2B2ijt + β3B3ijt + ∑ +i= 1nαiFi εijtFi
yijt = αi + β1Hijt + β2B2ijt + β3B3ijt + εijtαi

联系我们
  • QQ:99515681
  • 邮箱:99515681@qq.com
  • 工作时间:8:00-23:00
  • 微信:codinghelp
热点文章
程序代写更多图片

联系我们 - QQ: 99515681 微信:codinghelp
© 2014 www.7daixie.com
程序代写网!