Problem 1

1. What value of α should you use?

α is 1-n2a_VA (1 - the labor share, n2a_VA is labor compensation/value added)

firm_df <- firm_df %>%
  mutate(alpha = 1-n2a_VA)

2. What variables should you use to compute value added?

VA = d2 (the total annual sales of establishment) - n2e (total cost of input)

3. Drop surveys that contain less than 500 firms. How many surveys do you have left?

Q3 <- firm_df%>%
  group_by(country) %>%
  summarise(n = n()) %>%
  filter(n>= 500) %>%
  summarise(sum(n)) %>%
  ungroup()
Q3
## # A tibble: 1 × 1
##   `sum(n)`
##      <int>
## 1    21249

There are 21249 remaining surveys

firm_df_filtered <-firm_df%>%
  group_by(country) %>%
  filter(n()>= 500) %>%
  ungroup()

4. Compute the output and capital wedge for all firms

firm_df_filtered <- firm_df_filtered %>%
  mutate(
    d2 = as.numeric(d2),
    n2e = as.numeric(n2e),
    n2a = as.numeric(n2a),
    n7a = as.numeric(n7a)
)

firm_df_filtered <- firm_df_filtered %>%
  group_by(country) %>%
  mutate(country_Ysum = sum(d2- n2e, na.rm = TRUE),
    country_wsum = sum(n2a, na.rm= TRUE),
    country_ksum = sum(n7a, na.rm= TRUE),
    IRR = (country_Ysum-country_wsum)/country_ksum)

firm_df_filtered <- firm_df_filtered %>%
  mutate(
    capital_wedge = ((alpha / (1 - alpha)) * (n2a/ 0.1*n7a)) - 1,
    output_wedge =-((1 / (1 - alpha)) * (n2a / (d2)) - 1)
)

firm_df_filtered
## # A tibble: 21,249 × 64
## # Groups:   country [24]
##    idstd  country    country_official  year    wt a0    strata_all unitconverter
##    <chr>  <chr>      <chr>            <dbl> <dbl> <chr>      <dbl>         <dbl>
##  1 532287 Banglades… Bangladesh        2013  9.23 manu…     531234             1
##  2 531350 Banglades… Bangladesh        2013 13.6  manu…     531208             1
##  3 532319 Banglades… Bangladesh        2013  1.07 manu…     531259             1
##  4 531797 Banglades… Bangladesh        2013  7.42 manu…     531212             1
##  5 531855 Banglades… Bangladesh        2013  1    manu…     531218             1
##  6 532164 Banglades… Bangladesh        2013  1    manu…     531284             1
##  7 531336 Banglades… Bangladesh        2013  8.29 manu…     531202             1
##  8 531290 Banglades… Bangladesh        2013  1.34 manu…     531223             1
##  9 532631 Banglades… Bangladesh        2013  2.05 manu…     531206             1
## 10 531249 Banglades… Bangladesh        2013  1.22 manu…     531213             1
## # ℹ 21,239 more rows
## # ℹ 56 more variables: deflator_usd_adjust_d2 <dbl>, exrate_d2 <dbl>,
## #   d2_l1_year_perf_indicators <dbl>, isic <dbl>, sector_MS <chr>,
## #   income <chr>, d2_orig <chr>, n2a_orig <chr>, n2e_orig <chr>,
## #   n2i_orig <lgl>, l1_orig <chr>, n7a_orig <chr>, d2_outlier_check <chr>,
## #   n2a_outlier_check <chr>, n2e_outlier_check <chr>, n7a_outlier_check <chr>,
## #   n2i_outlier_check <chr>, l1_outlier_check <chr>, …

5. What five countries feature the largest average τy ?

firm_df_filtered %>%
  group_by(country_official) %>%
  summarise(avg_output_wedge = mean(output_wedge)) %>%
  arrange(desc(avg_output_wedge))
## # A tibble: 19 × 2
##    country_official avg_output_wedge
##    <chr>                       <dbl>
##  1 India                       0.550
##  2 Bangladesh                  0.497
##  3 Vietnam                     0.483
##  4 Peru                        0.434
##  5 Spain                       0.421
##  6 Chile                       0.414
##  7 Egypt, Arab Rep.            0.408
##  8 South Africa                0.405
##  9 Colombia                    0.403
## 10 Denmark                     0.388
## 11 China                       0.378
## 12 France                      0.373
## 13 Nigeria                     0.371
## 14 Brazil                      0.359
## 15 Indonesia                   0.350
## 16 Mexico                      0.339
## 17 Thailand                    0.287
## 18 Portugal                    0.271
## 19 Turkey                      0.241

India, Turkey, China, Bangladesh and Vietnam have the top five largest output wedge

6. What five countries feature the largest dispersion of τy ?

firm_df_filtered %>%
  group_by(country_official) %>%
  summarise(var_output_wedge= var(output_wedge)) %>%
  arrange(desc(var_output_wedge))
## # A tibble: 19 × 2
##    country_official var_output_wedge
##    <chr>                       <dbl>
##  1 Vietnam                    0.0654
##  2 Bangladesh                 0.0589
##  3 Egypt, Arab Rep.           0.0446
##  4 Chile                      0.0438
##  5 Colombia                   0.0414
##  6 Peru                       0.0406
##  7 Thailand                   0.0395
##  8 Mexico                     0.0390
##  9 Brazil                     0.0386
## 10 Spain                      0.0376
## 11 Indonesia                  0.0375
## 12 China                      0.0371
## 13 Portugal                   0.0361
## 14 India                      0.0342
## 15 Denmark                    0.0320
## 16 France                     0.0309
## 17 Nigeria                    0.0207
## 18 Turkey                     0.0205
## 19 South Africa               0.0176

Vietnam, Bangladesh, Egypt, Chile, Columbia have the largest dispersion of output wedges

7. What five countries feature the largest dispersion of τk?

firm_df_filtered %>%
  group_by(country_official) %>%
  summarise(avg_capital_wedge = mean(capital_wedge, na.rm = TRUE)) %>%
  arrange(desc(avg_capital_wedge))
## # A tibble: 19 × 2
##    country_official avg_capital_wedge
##    <chr>                        <dbl>
##  1 Vietnam                    7.33e22
##  2 Indonesia                  5.67e22
##  3 Colombia                   5.34e21
##  4 Chile                      4.23e21
##  5 Mexico                     7.07e17
##  6 Bangladesh                 3.81e17
##  7 India                      2.79e17
##  8 Thailand                   2.77e17
##  9 Denmark                    1.69e17
## 10 Egypt, Arab Rep.           7.93e16
## 11 South Africa               5.29e16
## 12 Peru                       3.43e16
## 13 China                      1.70e16
## 14 Brazil                     1.42e16
## 15 Turkey                     8.30e15
## 16 Nigeria                    8.21e15
## 17 Portugal                   1.54e15
## 18 Spain                      1.33e15
## 19 France                     7.17e14
firm_df_filtered %>%
  group_by(country_official) %>%
  summarise(var_capital_wedge= var(capital_wedge)) %>%
  arrange(desc(var_capital_wedge))
## # A tibble: 19 × 2
##    country_official var_capital_wedge
##    <chr>                        <dbl>
##  1 Indonesia                  9.96e47
##  2 Vietnam                    6.12e47
##  3 Colombia                   4.14e45
##  4 Chile                      1.54e45
##  5 Mexico                     1.93e38
##  6 India                      1.14e37
##  7 Thailand                   9.55e36
##  8 Bangladesh                 8.25e36
##  9 Denmark                    1.49e36
## 10 Egypt, Arab Rep.           8.80e35
## 11 South Africa               2.33e35
## 12 Peru                       1.34e35
## 13 Brazil                     4.01e34
## 14 China                      3.21e34
## 15 Turkey                     4.58e33
## 16 Nigeria                    2.22e33
## 17 Spain                      8.93e31
## 18 Portugal                   7.99e31
## 19 France                     2.94e31

Problem 2

library(pwt10)
pwt<- pwt10.0 %>%
filter(country %in% c("Brazil", "Chile"))
alpha = 0.4
phi= 2.24
hrs = 5200
pwt <- pwt %>%
mutate(
  L = avh/hrs,
  labor_wedge = 1-((phi/(1-alpha))*(ccon/cgdpo)*(L/(1-L)))
)
library(ggplot2)
brazil_graph <- pwt %>%
  filter(country=="Brazil") %>%
  ggplot(aes(x = year, y = labor_wedge)) +
  geom_line(color = "blue") +
  labs(
    title = "Labor Wedge Over Time (Brazil)",
    x = "Year",
    y = "Labor Wedge"
  )

chile_graph <- pwt %>%
  filter(country=="Chile") %>%
  ggplot(aes(x = year, y = labor_wedge)) +
  geom_line(color = "blue") +
  labs(
    title = "Labor Wedge Over Time (Chile)",
    x = "Year",
    y = "Labor Wedge"
  )
joined_graph <- pwt %>%
  filter(country %in% c("Brazil", "Chile")) %>%
  ggplot(aes(x = year, y = labor_wedge, color = country)) +
  geom_line(size = 1.2) +
  labs(
    title = "Labor Wedge Over Time: Brazil vs Chile",
    x = "Year",
    y = "Labor Wedge",
    color = "Country"
  ) +
  theme_minimal()
## Warning: Using `size` aesthetic for lines was deprecated in ggplot2 3.4.0.
## ℹ Please use `linewidth` instead.
## This warning is displayed once every 8 hours.
## Call `lifecycle::last_lifecycle_warnings()` to see where this warning was
## generated.
chile_graph2 <- pwt %>%
  filter(country=="Chile") %>%
  ggplot(aes(x = labor_wedge, y = avh)) +
  geom_line(color = "black") +
  labs(
    title = "Labor Wedge Over Time (Chile)",
    x = "Labor Wedge",
    y = "Hour"
  )
brazil_graph2 <- pwt %>%
  filter(country=="Brazil") %>%
  ggplot(aes(x = labor_wedge, y = avh)) +
  geom_line(color = "black") +
  labs(
    title = "Labor Wedge Over Time (Brazil)",
    x = "Labor Wedge",
    y = "Hour"
  )
pwt<-pwt %>% mutate(GDP_growth = log(rgdpe))
gamma = 0.02
pwt <- pwt %>%
  mutate(t = year-year[1]) %>%
  mutate(trend = log(rgdpe[1])+log(1+gamma)*t)
brazil_gdp <- pwt %>%
  filter(country=="Brazil") %>%
  ggplot()+
  geom_line(mapping = aes(x=year,y=GDP_growth,color="Log Real GDP"),size=1.5) +
  geom_line(mapping = aes(x=year,y=trend,color="2% Linear Trend"),size=1) +
  labs(
    title = "Brazil GDP Growth",
    x = "Year",
    y = "Brazil GDP Growth"
  )
chile_gdp <- pwt %>%
  filter(country=="Chile") %>%
  ggplot()+
  geom_line(mapping = aes(x=year,y=GDP_growth,color="Log Real GDP"),size=1.5) +
  geom_line(mapping = aes(x=year,y=trend,color="2% Linear Trend"),size=1) +
  labs(
    title = "Chile GDP Growth",
    x = "Year",
    y = "Chile GDP Growth"
  )
brazil_graph

chile_graph
## Warning: Removed 1 row containing missing values or values outside the scale range
## (`geom_line()`).

brazil_gdp

chile_gdp
## Warning: Removed 1 row containing missing values or values outside the scale range
## (`geom_line()`).

The two countries that I looked at are Brazil and Chile

1. What assumptions on preferences did you use? What parameters values did you use?

Assumption on preferences: \[ U(C_t, L_t) = \log(C_t) + \phi \log(1 - L_t) \] \[ \phi = 2.24 \] The data set used was pwt10 Variables used: - Consumption: ccon - the real consumption of households and governments - H: avh - average annual hours worked per employed person - L: avh / 5200 - each year there is around 5200 hours for work and leisure combined - Output: cgdpo - output gdp at current ppp - Capital share: alpha - this is assumed to be 0.4

Labor wedge formula: \[ \tau_{L,t} = 1 - \frac{\phi}{1 - \alpha} \cdot \frac{C_t}{Y_t} \cdot \frac{L_t}{1 - L_t} \] Interpretation: Decreases in labor share lead to moving closer to 0

Brazil: Brazil’s labor wedge declined from 1940 to mid 1960s. From -0.9 to -0.12. After that, it steadily increased until it is about -0.5 It saw a short decline in the early 2010s. This is likely due to the commodity bubble as Brazil’s economy is somewhat reliant on commodities. These changes may also have been caused by changes in laws that affected the level of formality in Brazil’s economy.

Chile: Chile’s labor wedge increases from -2.5 to -0.7 from 1955 to 2020. This started with a brief rise into a sharp decline between 1955 to early 1960s. This was then followed up by a remarkable rise from -2.7 to -1.75 from 1962 to 1965. After this the labor share fluctated and was volatile until around 1980s. After that it almost directly increases until 2007. After that it experiences a short decline likely due to the financial crisis and starts growing again only recently surpassing pre financial crisis highs.

brazil_graph2

chile_graph2
## Warning: Removed 1 row containing missing values or values outside the scale range
## (`geom_line()`).

The graphs of labor wedge vs hours worked for both countries show a trend of decreasing overtime. This likely means that the labor force is more efficient nad productive. Declining hours worked usually is coincided with increasing productivity per worker and shifts from labor heavy sectors such as agriculture to higher productivity service sectors with less reliance on long working hours.