# Clear the workspace
rm(list = ls()) # Clear environment
gc()            # Clear unused memory
##          used (Mb) gc trigger (Mb) max used (Mb)
## Ncells 450160 24.1     966700 51.7   638942 34.2
## Vcells 804234  6.2    8388608 64.0  1633131 12.5
cat("\f")       # Clear the console

Set-up and background

The assignment is worth 100 points. There are 27 questions. You should have the following packages installed:

library(tidyverse)
library(patchwork)
library(fixest)
library(lmtest)
library(sandwich)

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

[Q1] What is the main question asked in this paper?

The main question of the paper is measuring hours worked and productivity from wage increases. Does increasing wages make people work more and work harder?

[Q2] 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?

Experimental studies allow the researchers to control variables. Observational studies don’t have as much control. In the messenger study, there were things out of the researchers control that might have affected the results such as the type of bike, fitness of the rider, etc.

[Q3] Summarize the field experiment design.

There are two groups of bike messengers. One group spent four weeks working and had a 25% wage increase. The other group spent four weeks working with no wage increase. The key feature of this study is that the wage increase was exogenous and transitory so lifelong income was irrelevant.

[Q4] Summarize the laboratory experiment design. Why was it included with the study?

The laboratory experiment measured individual levels and responses to loss aversion. This was included to explain the negative affect on productivity.

[Q5] Summarize the main results of the field experiment.

The field experiment resulted in a positive impact on labor supply but a negative impact on effort. This means that as wage increases, the messengers will work more hours but the productivity (revenue per shift) decreases.

[Q6] Summarize the main results of the laboratory experiment.

The results of the laboratory experiment were that the level of loss aversion in each messenger drove the negative impact on productivity per shift. Those messengers that had higher levels of loss aversion saw lower productivity.

[Q7] Why are these results valuable? What have we learned? Motivate your discussion with a real-world example.

These results are definitely valuable as they show the affect of wages on productivity. Increasing wages doesn’t necessarily increase productivity per person. An example of this in the real-world could be raising wages on Instacart to incent new shoppers. I shopped for instacart for bit and on the day I would go shop, I tried to maximize my earnings and minimize my costs. Raising the amount a shopper would earn would actually decrease my productivity because if I could earn the amount I typically earn in a day on 3 trips versus 5, then I would actually wouldn’t work as hard. I would want to conserve gas for the next shopping session and I could earn just as much in 3 trips.

2 Replication

Use theme_classic() for all plots.

2.1 Correlations in revenues across firms

For this section please use dailycorrs.csv.

setwd("/Users/spoll/OneDrive/Documents/Boston College/Behavioral Economics/Week 4")
dailycorrs = read.csv("dailycorrs.csv"
                           , check.names = FALSE
                           , stringsAsFactors = FALSE
                           , na.strings = ""
)

[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.

p1 = dailycorrs %>% 
  ggplot(aes(x = logv, y = logf)) +
  geom_point() +
  geom_smooth(method = lm
              , se = FALSE) +
  labs(x = "Veloblitz"
       , y = "Flash"
       , title = "Earnings") +
  theme_classic()

[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.

p2 = dailycorrs %>% 
  pivot_longer(c(logf, logv)) %>% 
  ggplot(aes(x = value, fill = name)) +
  geom_density() +
  labs(x = "Earnings"
       , y  = "density"
       , title = "Earnings Density")

[Q11] Now combine both plots using library(patchwork) and label the plots with letters.

p1 + p2

2.2 Tables 2 and 3

For this section please use tables1to4.csv.

tables1to4 = read.csv("tables1to4.csv"
                           , check.names = FALSE
                           , stringsAsFactors = FALSE
                           , na.strings = ""
)

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.

Fixed effects should controlled in order to avoid avoid differences between messengers skewing the results. These differences could be the type of bike they have, the fitness level of the messenger, age, etc. These differences don’t happen over night and cannot affect the study.

[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: \(x_i^{fe} = x_{it} - \bar{x}_i\) where \(x_i^{fe}\) is the fixed effect revenue for \(i\).

tables1to4 = tables1to4 %>% 
  group_by(fahrer) %>% 
  mutate(totrev_fe = totrev - mean(totrev))

[Q14] 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 differences in means.)

In addition to calculating the fixed-effect controled means, calculate the standard errors. Recall the standard error is \(\frac{s_{jt}}{\sqrt{n_{jt}}}\) where \(s_{jt}\) is the standard deviation for treatment \(j\) in block \(t\) and \(n_{jt}\) 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.

df_avg_revenue = tables1to4 %>% 
  drop_na(odd) %>% 
  group_by(odd, block) %>% 
  summarise(n = n()
            ,mean_rev = mean(totrev_fe)
            , se_rev = sd(totrev_fe)/sqrt(n))
df_avg_revenue
## # A tibble: 6 x 5
## # Groups:   odd [2]
##     odd block     n mean_rev se_rev
##   <int> <int> <int>    <dbl>  <dbl>
## 1     0     1    19   -120.    303.
## 2     0     2    20   -278.    241.
## 3     0     3    20    392.    251.
## 4     1     1    21    -48.9   361.
## 5     1     2    22    722.    193.
## 6     1     3    22   -675.    289.

[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_rev - se_rev, ymax = mean_rev + se_rev),
  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.

p3 = df_avg_revenue %>% 
  ggplot(aes(x = block
             , y = mean_rev
             , group = odd
             , col = factor(odd))
         ) +
  geom_errorbar(aes(
  x=block, 
  ymin = mean_rev - se_rev, ymax = mean_rev + se_rev),
  width = .1,
  position=position_dodge(width=0.5)
  ) +
  geom_point(position=position_dodge(width=0.5), size=4) +
  labs(x = "Block"
       , y = "Avg Revenue"
       , title = "Table 2: Participating Messengers"
       , fill = "odd") +
  theme_classic()
p3

[Q16] Interpret the plot.

The chart above shows the distribution around the mean for each group. The graph shows that after block 1, the variance in average revenue between the groups gets significantly larger.

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 where \(\text{H}\) is the variable high, \(\text{B2}\) is the second block (block == 2) and \(\text{B3}\) is the third block (block == 3):

\[ y_{ijt} - \bar{y}_{ij} = \beta_1 (\text{H}_{ijt} - \bar{\text{H}}_{ij}) + \beta_2 (\text{B2}_{ijt} - \bar{\text{B2}}_{ij}) + \beta_3 (\text{B3}_{ijt} - \bar{\text{B3}}_{ij}) + (\varepsilon_{ijt} - \bar{\varepsilon}_{ij}) \]

tables1to4 = tables1to4 %>% 
  group_by(fahrer) %>% 
  mutate(totrev_mean = totrev - mean(totrev)
         , high_mean = high - mean(high)
         , block2_mean = block2 - mean(block2)
         , block3_mean = block3 - mean(block3))
m1 =lm(totrev_mean ~ high_mean + block2_mean + block3_mean, data = tables1to4) 
m1
## 
## Call:
## lm(formula = totrev_mean ~ high_mean + block2_mean + block3_mean, 
##     data = tables1to4)
## 
## Coefficients:
## (Intercept)    high_mean  block2_mean  block3_mean  
##   7.575e-14    1.076e+03   -2.900e+02   -6.759e+02

[Q18] Now recreate the same point estimates using lm and assign it to object m2. You are estimating the model below where where \(\text{F}_i\) is the dummy variable for each messenger (fahrer). Make sure to cluster the standard errors at the messenger level. (Use lmtest and sandwhich for this.)

\[ y_{ijt} - \beta_0 + \beta_1 \text{H}_{ijt} + \beta_2 \text{B2}_{ijt} + \beta_3 \text{B3}_{ijt} + \sum_{i=1}^{n} \alpha_i \text{F}_i + \varepsilon_{ijt} \]

m2 = lm(totrev ~ high + block2 + block3 + factor(fahrer), data = tables1to4)
m2
## 
## Call:
## lm(formula = totrev ~ high + block2 + block3 + factor(fahrer), 
##     data = tables1to4)
## 
## Coefficients:
##       (Intercept)               high             block2             block3  
##          1657.531           1076.175           -289.964           -675.904  
##   factor(fahrer)2    factor(fahrer)3    factor(fahrer)4    factor(fahrer)5  
##           436.700            747.200           -666.408          -1247.485  
##   factor(fahrer)6    factor(fahrer)7    factor(fahrer)8    factor(fahrer)9  
##          1537.500            750.167           -106.967           3912.200  
##  factor(fahrer)10   factor(fahrer)11   factor(fahrer)12   factor(fahrer)13  
##          -817.742           2936.092          -1228.575           -965.908  
##  factor(fahrer)14   factor(fahrer)15   factor(fahrer)16   factor(fahrer)17  
##           884.000            -39.967            191.725           -469.908  
##  factor(fahrer)18   factor(fahrer)19   factor(fahrer)20   factor(fahrer)21  
##          1327.367           2658.967           -726.275           -514.133  
##  factor(fahrer)22   factor(fahrer)23   factor(fahrer)24   factor(fahrer)25  
##          2955.600           3330.233           1759.167             61.167  
##  factor(fahrer)26   factor(fahrer)27   factor(fahrer)28   factor(fahrer)29  
##          -265.742           -579.275           -150.167          -1048.242  
##  factor(fahrer)30   factor(fahrer)31   factor(fahrer)32   factor(fahrer)33  
##          1557.533           -737.967           -526.100           2173.200  
##  factor(fahrer)34   factor(fahrer)35   factor(fahrer)36   factor(fahrer)37  
##          9107.033            -64.000           2054.900           2193.967  
##  factor(fahrer)38   factor(fahrer)39   factor(fahrer)40   factor(fahrer)41  
##          1836.933            225.892           -175.575           -902.075  
##  factor(fahrer)42   factor(fahrer)43   factor(fahrer)44   factor(fahrer)45  
##          3938.033          -1070.575            521.867            569.767  
##  factor(fahrer)46   factor(fahrer)47   factor(fahrer)48   factor(fahrer)49  
##           153.958           -781.242           -524.775           1044.200  
##  factor(fahrer)50   factor(fahrer)51   factor(fahrer)52   factor(fahrer)53  
##          6590.667           5288.967           4278.300           3433.033  
##  factor(fahrer)54   factor(fahrer)55   factor(fahrer)56   factor(fahrer)57  
##          -143.908            976.267           1761.800           2471.533  
##  factor(fahrer)58   factor(fahrer)59   factor(fahrer)60   factor(fahrer)61  
##          1353.200           -117.108            931.033            664.700  
##  factor(fahrer)62   factor(fahrer)63   factor(fahrer)64   factor(fahrer)65  
##            33.258           -238.185           2372.873           -268.627  
##  factor(fahrer)66   factor(fahrer)67   factor(fahrer)68   factor(fahrer)69  
##           490.373           -387.242           2408.092           -343.908  
##  factor(fahrer)70   factor(fahrer)71   factor(fahrer)72   factor(fahrer)73  
##          -336.575          -1030.908          -1151.908           -346.575  
##  factor(fahrer)74   factor(fahrer)75   factor(fahrer)76   factor(fahrer)77  
##          -626.242           2799.425           1052.092           -703.908  
##  factor(fahrer)78   factor(fahrer)79   factor(fahrer)80   factor(fahrer)81  
##          -364.242          -1258.242           -257.908           -980.575  
##  factor(fahrer)82   factor(fahrer)83   factor(fahrer)84   factor(fahrer)85  
##         -1277.575            470.425           -622.908           -888.242  
##  factor(fahrer)86   factor(fahrer)87   factor(fahrer)88   factor(fahrer)89  
##           989.092             17.758          -1170.242          -1171.242  
##  factor(fahrer)90   factor(fahrer)91   factor(fahrer)92   factor(fahrer)93  
##           629.425             -3.908            -33.242           4841.758  
##  factor(fahrer)94   factor(fahrer)95   factor(fahrer)96   factor(fahrer)97  
##            15.425           -424.575            275.373           -814.242  
##  factor(fahrer)98   factor(fahrer)99  factor(fahrer)100  factor(fahrer)101  
##           581.092          -1272.575           2382.425          -1193.575  
## factor(fahrer)102  factor(fahrer)103  factor(fahrer)104  factor(fahrer)105  
##           384.758           1992.758           1431.758           -979.575  
## factor(fahrer)106  factor(fahrer)107  factor(fahrer)108  factor(fahrer)109  
##          -749.908           -804.242           1573.092            -48.908  
## factor(fahrer)110  factor(fahrer)111  factor(fahrer)112  factor(fahrer)113  
##          1386.425          -1247.908            -88.908           -767.908  
## factor(fahrer)114  factor(fahrer)115  factor(fahrer)116  factor(fahrer)117  
##         -1045.908            410.092           -634.575            248.758  
## factor(fahrer)118  factor(fahrer)119  factor(fahrer)120  factor(fahrer)121  
##         -1300.908             68.425            -58.242           1257.425  
## factor(fahrer)122  factor(fahrer)123  factor(fahrer)124  factor(fahrer)125  
##          1016.092           1699.903           -434.597           -841.097  
## factor(fahrer)126  factor(fahrer)127  factor(fahrer)128  factor(fahrer)129  
##          -977.242          -1082.242           -151.242            455.092  
## factor(fahrer)130  factor(fahrer)131  factor(fahrer)132  factor(fahrer)133  
##          -352.597           -725.097           -156.597            259.373  
## factor(fahrer)134  factor(fahrer)135  factor(fahrer)136  factor(fahrer)137  
##           122.373           -396.627           -855.627            396.373  
## factor(fahrer)138  
##          -483.627
m2_clustered = coeftest(m2, vcov. = vcovCL, cluster = ~fahrer)
m2_clustered
## 
## t test of coefficients:
## 
##                      Estimate  Std. Error     t value  Pr(>|t|)    
## (Intercept)        1.6575e+03  1.5283e+02  1.0846e+01 < 2.2e-16 ***
## high               1.0762e+03  2.9055e+02  3.7039e+00 0.0002624 ***
## block2            -2.8996e+02  2.0063e+02 -1.4453e+00 0.1496600    
## block3            -6.7590e+02  2.3798e+02 -2.8402e+00 0.0048873 ** 
## factor(fahrer)2    4.3670e+02  1.5181e-10  2.8767e+12 < 2.2e-16 ***
## factor(fahrer)3    7.4720e+02  1.5159e-10  4.9290e+12 < 2.2e-16 ***
## factor(fahrer)4   -6.6641e+02  9.6851e+01 -6.8807e+00 4.946e-11 ***
## factor(fahrer)5   -1.2475e+03  7.6413e+01 -1.6326e+01 < 2.2e-16 ***
## factor(fahrer)6    1.5375e+03  1.5145e-10  1.0152e+13 < 2.2e-16 ***
## factor(fahrer)7    7.5017e+02  1.5137e-10  4.9558e+12 < 2.2e-16 ***
## factor(fahrer)8   -1.0697e+02  1.5157e-10 -7.0572e+11 < 2.2e-16 ***
## factor(fahrer)9    3.9122e+03  1.5150e-10  2.5822e+13 < 2.2e-16 ***
## factor(fahrer)10  -8.1774e+02  9.6851e+01 -8.4433e+00 2.737e-15 ***
## factor(fahrer)11   2.9361e+03  9.6851e+01  3.0315e+01 < 2.2e-16 ***
## factor(fahrer)12  -1.2286e+03  9.6851e+01 -1.2685e+01 < 2.2e-16 ***
## factor(fahrer)13  -9.6591e+02  9.6851e+01 -9.9731e+00 < 2.2e-16 ***
## factor(fahrer)14   8.8400e+02  1.5170e-10  5.8272e+12 < 2.2e-16 ***
## factor(fahrer)15  -3.9967e+01  1.5186e-10 -2.6319e+11 < 2.2e-16 ***
## factor(fahrer)16   1.9173e+02  9.6851e+01  1.9796e+00 0.0488701 *  
## factor(fahrer)17  -4.6991e+02  9.6851e+01 -4.8518e+00 2.178e-06 ***
## factor(fahrer)18   1.3274e+03  1.5209e-10  8.7272e+12 < 2.2e-16 ***
## factor(fahrer)19   2.6590e+03  1.5109e-10  1.7598e+13 < 2.2e-16 ***
## factor(fahrer)20  -7.2627e+02  9.6851e+01 -7.4989e+00 1.178e-12 ***
## factor(fahrer)21  -5.1413e+02  1.5149e-10 -3.3938e+12 < 2.2e-16 ***
## factor(fahrer)22   2.9556e+03  1.5129e-10  1.9536e+13 < 2.2e-16 ***
## factor(fahrer)23   3.3302e+03  1.5177e-10  2.1943e+13 < 2.2e-16 ***
## factor(fahrer)24   1.7592e+03  1.5210e-10  1.1566e+13 < 2.2e-16 ***
## factor(fahrer)25   6.1167e+01  1.5137e-10  4.0407e+11 < 2.2e-16 ***
## factor(fahrer)26  -2.6574e+02  9.6851e+01 -2.7438e+00 0.0065222 ** 
## factor(fahrer)27  -5.7927e+02  9.6851e+01 -5.9811e+00 7.803e-09 ***
## factor(fahrer)28  -1.5017e+02  1.5149e-10 -9.9127e+11 < 2.2e-16 ***
## factor(fahrer)29  -1.0482e+03  9.6851e+01 -1.0823e+01 < 2.2e-16 ***
## factor(fahrer)30   1.5575e+03  1.5154e-10  1.0278e+13 < 2.2e-16 ***
## factor(fahrer)31  -7.3797e+02  1.5157e-10 -4.8687e+12 < 2.2e-16 ***
## factor(fahrer)32  -5.2610e+02  1.5170e-10 -3.4679e+12 < 2.2e-16 ***
## factor(fahrer)33   2.1732e+03  1.5146e-10  1.4348e+13 < 2.2e-16 ***
## factor(fahrer)34   9.1070e+03  1.5161e-10  6.0067e+13 < 2.2e-16 ***
## factor(fahrer)35  -6.4000e+01  1.5155e-10 -4.2231e+11 < 2.2e-16 ***
## factor(fahrer)36   2.0549e+03  1.5159e-10  1.3555e+13 < 2.2e-16 ***
## factor(fahrer)37   2.1940e+03  1.5138e-10  1.4493e+13 < 2.2e-16 ***
## factor(fahrer)38   1.8369e+03  1.5147e-10  1.2127e+13 < 2.2e-16 ***
## factor(fahrer)39   2.2589e+02  9.6851e+01  2.3324e+00 0.0204929 *  
## factor(fahrer)40  -1.7557e+02  9.6851e+01 -1.8128e+00 0.0710821 .  
## factor(fahrer)41  -9.0207e+02  9.6851e+01 -9.3140e+00 < 2.2e-16 ***
## factor(fahrer)42   3.9380e+03  1.5147e-10  2.5998e+13 < 2.2e-16 ***
## factor(fahrer)43  -1.0706e+03  9.6851e+01 -1.1054e+01 < 2.2e-16 ***
## factor(fahrer)44   5.2187e+02  1.5161e-10  3.4422e+12 < 2.2e-16 ***
## factor(fahrer)45   5.6977e+02  1.5140e-10  3.7634e+12 < 2.2e-16 ***
## factor(fahrer)46   1.5396e+02  9.6851e+01  1.5896e+00 0.1132067    
## factor(fahrer)47  -7.8124e+02  9.6851e+01 -8.0664e+00 3.230e-14 ***
## factor(fahrer)48  -5.2477e+02  9.6851e+01 -5.4184e+00 1.437e-07 ***
## factor(fahrer)49   1.0442e+03  1.5168e-10  6.8841e+12 < 2.2e-16 ***
## factor(fahrer)50   6.5907e+03  1.5130e-10  4.3560e+13 < 2.2e-16 ***
## factor(fahrer)51   5.2890e+03  1.5127e-10  3.4963e+13 < 2.2e-16 ***
## factor(fahrer)52   4.2783e+03  1.5181e-10  2.8182e+13 < 2.2e-16 ***
## factor(fahrer)53   3.4330e+03  1.5296e-10  2.2444e+13 < 2.2e-16 ***
## factor(fahrer)54  -1.4391e+02  9.6851e+01 -1.4859e+00 0.1385999    
## factor(fahrer)55   9.7627e+02  1.5202e-10  6.4222e+12 < 2.2e-16 ***
## factor(fahrer)56   1.7618e+03  1.5141e-10  1.1636e+13 < 2.2e-16 ***
## factor(fahrer)57   2.4715e+03  1.5150e-10  1.6313e+13 < 2.2e-16 ***
## factor(fahrer)58   1.3532e+03  1.5132e-10  8.9427e+12 < 2.2e-16 ***
## factor(fahrer)59  -1.1711e+02  9.6851e+01 -1.2092e+00 0.2277690    
## factor(fahrer)60   9.3103e+02  1.5163e-10  6.1401e+12 < 2.2e-16 ***
## factor(fahrer)61   6.6470e+02  1.5128e-10  4.3938e+12 < 2.2e-16 ***
## factor(fahrer)62   3.3258e+01  9.6851e+01  3.4340e-01 0.7315953    
## factor(fahrer)63  -2.3818e+02  7.6413e+01 -3.1171e+00 0.0020447 ** 
## factor(fahrer)64   2.3729e+03  1.5961e+02  1.4867e+01 < 2.2e-16 ***
## factor(fahrer)65  -2.6863e+02  1.5961e+02 -1.6830e+00 0.0936498 .  
## factor(fahrer)66   4.9037e+02  1.5961e+02  3.0723e+00 0.0023643 ** 
## factor(fahrer)67  -3.8724e+02  9.6851e+01 -3.9983e+00 8.449e-05 ***
## factor(fahrer)68   2.4081e+03  9.6851e+01  2.4864e+01 < 2.2e-16 ***
## factor(fahrer)69  -3.4391e+02  9.6851e+01 -3.5509e+00 0.0004603 ***
## factor(fahrer)70  -3.3657e+02  9.6851e+01 -3.4752e+00 0.0006037 ***
## factor(fahrer)71  -1.0309e+03  9.6851e+01 -1.0644e+01 < 2.2e-16 ***
## factor(fahrer)72  -1.1519e+03  9.6851e+01 -1.1894e+01 < 2.2e-16 ***
## factor(fahrer)73  -3.4657e+02  9.6851e+01 -3.5784e+00 0.0004166 ***
## factor(fahrer)74  -6.2624e+02  9.6851e+01 -6.4660e+00 5.408e-10 ***
## factor(fahrer)75   2.7994e+03  9.6851e+01  2.8904e+01 < 2.2e-16 ***
## factor(fahrer)76   1.0521e+03  9.6851e+01  1.0863e+01 < 2.2e-16 ***
## factor(fahrer)77  -7.0391e+02  9.6851e+01 -7.2679e+00 4.872e-12 ***
## factor(fahrer)78  -3.6424e+02  9.6851e+01 -3.7608e+00 0.0002119 ***
## factor(fahrer)79  -1.2582e+03  9.6851e+01 -1.2992e+01 < 2.2e-16 ***
## factor(fahrer)80  -2.5791e+02  9.6851e+01 -2.6629e+00 0.0082597 ** 
## factor(fahrer)81  -9.8057e+02  9.6851e+01 -1.0124e+01 < 2.2e-16 ***
## factor(fahrer)82  -1.2776e+03  9.6851e+01 -1.3191e+01 < 2.2e-16 ***
## factor(fahrer)83   4.7043e+02  9.6851e+01  4.8572e+00 2.125e-06 ***
## factor(fahrer)84  -6.2291e+02  9.6851e+01 -6.4316e+00 6.566e-10 ***
## factor(fahrer)85  -8.8824e+02  9.6851e+01 -9.1712e+00 < 2.2e-16 ***
## factor(fahrer)86   9.8909e+02  9.6851e+01  1.0213e+01 < 2.2e-16 ***
## factor(fahrer)87   1.7758e+01  9.6851e+01  1.8340e-01 0.8546698    
## factor(fahrer)88  -1.1702e+03  9.6851e+01 -1.2083e+01 < 2.2e-16 ***
## factor(fahrer)89  -1.1712e+03  9.6851e+01 -1.2093e+01 < 2.2e-16 ***
## factor(fahrer)90   6.2943e+02  9.6851e+01  6.4989e+00 4.490e-10 ***
## factor(fahrer)91  -3.9083e+00  9.6851e+01 -4.0400e-02 0.9678440    
## factor(fahrer)92  -3.3242e+01  9.6851e+01 -3.4320e-01 0.7317249    
## factor(fahrer)93   4.8418e+03  9.6851e+01  4.9992e+01 < 2.2e-16 ***
## factor(fahrer)94   1.5425e+01  9.6851e+01  1.5930e-01 0.8735915    
## factor(fahrer)95  -4.2457e+02  9.6851e+01 -4.3838e+00 1.732e-05 ***
## factor(fahrer)96   2.7537e+02  1.5961e+02  1.7253e+00 0.0857414 .  
## factor(fahrer)97  -8.1424e+02  9.6851e+01 -8.4071e+00 3.476e-15 ***
## factor(fahrer)98   5.8109e+02  9.6851e+01  5.9998e+00 7.057e-09 ***
## factor(fahrer)99  -1.2726e+03  9.6851e+01 -1.3139e+01 < 2.2e-16 ***
## factor(fahrer)100  2.3824e+03  9.6851e+01  2.4599e+01 < 2.2e-16 ***
## factor(fahrer)101 -1.1936e+03  9.6851e+01 -1.2324e+01 < 2.2e-16 ***
## factor(fahrer)102  3.8476e+02  9.6851e+01  3.9727e+00 9.350e-05 ***
## factor(fahrer)103  1.9928e+03  9.6851e+01  2.0575e+01 < 2.2e-16 ***
## factor(fahrer)104  1.4318e+03  9.6851e+01  1.4783e+01 < 2.2e-16 ***
## factor(fahrer)105 -9.7957e+02  9.6851e+01 -1.0114e+01 < 2.2e-16 ***
## factor(fahrer)106 -7.4991e+02  9.6851e+01 -7.7429e+00 2.557e-13 ***
## factor(fahrer)107 -8.0424e+02  9.6851e+01 -8.3039e+00 6.866e-15 ***
## factor(fahrer)108  1.5731e+03  9.6851e+01  1.6242e+01 < 2.2e-16 ***
## factor(fahrer)109 -4.8908e+01  9.6851e+01 -5.0500e-01 0.6140247    
## factor(fahrer)110  1.3864e+03  9.6851e+01  1.4315e+01 < 2.2e-16 ***
## factor(fahrer)111 -1.2479e+03  9.6851e+01 -1.2885e+01 < 2.2e-16 ***
## factor(fahrer)112 -8.8908e+01  9.6851e+01 -9.1800e-01 0.3595285    
## factor(fahrer)113 -7.6791e+02  9.6851e+01 -7.9287e+00 7.835e-14 ***
## factor(fahrer)114 -1.0459e+03  9.6851e+01 -1.0799e+01 < 2.2e-16 ***
## factor(fahrer)115  4.1009e+02  9.6851e+01  4.2342e+00 3.246e-05 ***
## factor(fahrer)116 -6.3457e+02  9.6851e+01 -6.5520e+00 3.319e-10 ***
## factor(fahrer)117  2.4876e+02  9.6851e+01  2.5685e+00 0.0108089 *  
## factor(fahrer)118 -1.3009e+03  9.6851e+01 -1.3432e+01 < 2.2e-16 ***
## factor(fahrer)119  6.8425e+01  9.6851e+01  7.0650e-01 0.4805517    
## factor(fahrer)120 -5.8242e+01  9.6851e+01 -6.0140e-01 0.5481625    
## factor(fahrer)121  1.2574e+03  9.6851e+01  1.2983e+01 < 2.2e-16 ***
## factor(fahrer)122  1.0161e+03  9.6851e+01  1.0491e+01 < 2.2e-16 ***
## factor(fahrer)123  1.6999e+03  1.2521e+02  1.3577e+01 < 2.2e-16 ***
## factor(fahrer)124 -4.3460e+02  1.2521e+02 -3.4710e+00 0.0006126 ***
## factor(fahrer)125 -8.4110e+02  1.2521e+02 -6.7177e+00 1.281e-10 ***
## factor(fahrer)126 -9.7724e+02  9.6851e+01 -1.0090e+01 < 2.2e-16 ***
## factor(fahrer)127 -1.0822e+03  9.6851e+01 -1.1174e+01 < 2.2e-16 ***
## factor(fahrer)128 -1.5124e+02  9.6851e+01 -1.5616e+00 0.1196766    
## factor(fahrer)129  4.5509e+02  9.6851e+01  4.6989e+00 4.365e-06 ***
## factor(fahrer)130 -3.5260e+02  1.2521e+02 -2.8161e+00 0.0052564 ** 
## factor(fahrer)131 -7.2510e+02  1.2521e+02 -5.7912e+00 2.133e-08 ***
## factor(fahrer)132 -1.5660e+02  1.2521e+02 -1.2507e+00 0.2122334    
## factor(fahrer)133  2.5937e+02  1.5961e+02  1.6250e+00 0.1054443    
## factor(fahrer)134  1.2237e+02  1.5961e+02  7.6670e-01 0.4440046    
## factor(fahrer)135 -3.9663e+02  1.5961e+02 -2.4849e+00 0.0136259 *  
## factor(fahrer)136 -8.5563e+02  1.5961e+02 -5.3607e+00 1.914e-07 ***
## factor(fahrer)137  3.9637e+02  1.5961e+02  2.4833e+00 0.0136853 *  
## factor(fahrer)138 -4.8363e+02  1.5961e+02 -3.0300e+00 0.0027075 ** 
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

[Q20] Now use feols to recreate Model (1), including the standard errors. Assign your estimates to the object m3. You are estimating the model below where where \(\alpha_i\) is the individual intercept (i.e. the individual fixed effect):

\[ y_{ijt} = \alpha_i + \beta_1 \text{H}_{ijt} + \beta_2 \text{B2}_{ijt} + \beta_3 \text{B3}_{ijt} + \varepsilon_{ijt} \]

m3 = feols(totrev_mean ~ high_mean + block2_mean + block3_mean, data = tables1to4)
m3
## OLS estimation, Dep. Var.: totrev_mean
## Observations: 386 
## Standard-errors: IID 
##                  Estimate Std. Error       t value   Pr(>|t|)    
## (Intercept)  1.510000e-14    53.1225  2.840000e-16 1.0000e+00    
## high_mean    1.076175e+03   206.9707  5.199649e+00 3.2612e-07 ***
## block2_mean -2.899636e+02   138.4748 -2.093981e+00 3.6920e-02 *  
## block3_mean -6.759039e+02   137.6668 -4.909707e+00 1.3541e-06 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## RMSE: 1,038.3   Adj. R2: 0.094831

[Q21] Compare the estimates in m1, m2 and m3. What is the same? What is different? What would you say is the main advantage of using felm()?

The coefficient estimates in all models were the same, yet the standard errors were different.

[Q22] Explain why you need to cluster the standard errors.

Clustering the standard errors helps to eliminate any autocorrelation between the messengers of each group.