Introduction

List of Functions

The broom package:

  • tidy(): component-level statistics

  • augment(): observation-level statistics

  • glance(): model-level statistics

Model

Common Model model.

model <- dataraw %>%
  filter(floor(yearqtr) == yearqtr) %>% # only yearly
  select(countryname, yearqtr, TAXNAT_1000, TAXNAT_2000, 
         TAXNAT_3000, TAXNAT_4000, TAXNAT_5000, TAXNAT_TOTALTAX, B1_GE_VOBARSA) %>% # list.taxes above
  group_by(countryname) %>%
  mutate_at(vars(-yearqtr, -countryname), funs(log(.) - lag(log(.), 1))) %>%
  gather(variable, value, starts_with("TAXNAT_")) %>%
  filter(is.finite(value), !is.na(B1_GE_VOBARSA)) %>% 
  group_by(countryname, variable) %>%
  do(lm = lm(value ~ B1_GE_VOBARSA, data = .))

Tidy

Raw Tidy

model %>%
  tidy(lm) %>%
  head(10) %>%
  kable(align = "c", booktabs = T, linesep = "",
        caption = 'Cyclicality of Taxes') %>%
  kable_styling(bootstrap_options = c("striped", "hover", "condensed"),
                latex_options = c("striped", "hold_position"))
Table 1: Cyclicality of Taxes
countryname variable term estimate std.error statistic p.value
Australia TAXNAT_1000 (Intercept) 0.0456842 0.0166929 2.7367474 0.0086204
Australia TAXNAT_1000 B1_GE_VOBARSA 1.4007481 0.4264225 3.2848834 0.0018885
Australia TAXNAT_3000 (Intercept) 0.0791715 0.0304606 2.5991462 0.0123137
Australia TAXNAT_3000 B1_GE_VOBARSA 0.5823166 0.7781215 0.7483620 0.4578189
Australia TAXNAT_4000 (Intercept) 0.0971901 0.0164669 5.9021637 0.0000003
Australia TAXNAT_4000 B1_GE_VOBARSA -0.2620928 0.4206491 -0.6230676 0.5361295
Australia TAXNAT_5000 (Intercept) 0.0790206 0.0152562 5.1795665 0.0000042
Australia TAXNAT_5000 B1_GE_VOBARSA 0.1752971 0.3897231 0.4497990 0.6548390
Australia TAXNAT_TOTALTAX (Intercept) 0.0622269 0.0141993 4.3823977 0.0000619
Australia TAXNAT_TOTALTAX B1_GE_VOBARSA 0.8293698 0.3627236 2.2865065 0.0265848

Manipulate Tidy

model %>%
  tidy(lm) %>%
  ungroup %>%
  filter(term == "B1_GE_VOBARSA") %>%
  mutate(stars = case_when(p.value > 0.1 ~ "",
                           p.value > 0.05 ~ "*",
                           p.value > 0.01 ~ "**",
                           TRUE ~ "***"),
         est = round(estimate, 2) %>% paste0(stars),
         tax = gsub("TAXNAT_", "", variable)) %>%
  select(countryname, tax, est) %>%
  spread(tax, est) %>%
  mutate_all(funs(ifelse(is.na(.), "", .)))  %>%
  kable(align = "c", booktabs = T, linesep = "",
        caption = 'Cyclicality of Taxes') %>%
  kable_styling(bootstrap_options = c("striped", "hover", "condensed"),
                latex_options = c("striped", "hold_position"))
Table 2: Cyclicality of Taxes
countryname 1000 2000 3000 4000 5000 TOTALTAX
Australia 1.4*** 0.58 -0.26 0.18 0.83**
Austria 1.48*** 0.67*** 1.04*** 0.18 0.81*** 0.96***
Belgium 1.18*** 0.63** 1.39 2.17 0.31 0.83***
Canada 1.52*** 1.3** 0.26 0.16 1.12*** 1.16***
Chile 3.16** 0.57*** 1.17* 1.35*** 1.94***
Czech Republic 0.96** 1.06*** 1.55** 0.64** 0.9***
Denmark 1.11** -1.91 -3.14 0.92* 1.19*** 1.07***
Estonia 1.33*** 0.61*** 0.09 0.86*** 0.89***
Finland 1.39*** 0.99** 2.73 0.52 0.78*** 0.98***
France 2.3*** 0.98** -0.78 -0.17 0.95*** 1.12***
Germany 1.93*** 1.06*** 12.01 0.4 0.91*** 1.25***
Greece 1.01** 0.73** 0.31 0.2 0.62** 0.66**
Hungary 1.53* 1.46*** -2.55 0.46 0.41 1**
Iceland 4.25*** 1.91*** 6.79*** 4.01*** 4.16*** 4.03***
Ireland 0.6** 0.11 -0.98 0.42 0.42 0.44*
Israel 2.5*** 0.73** -0.79* 0.55 0.06 1.05**
Italy 1.67*** 1.14*** 3.03 -0.24 1.46*** 1.31***
Japan 2.21*** 1.16*** 1.29*** 0.97*** 1.54***
Korea 1.47*** 2.12*** 1.15** 1.41*** 1.37*** 1.29***
Latvia 2.01*** 1.19*** 0 0.78* 1.3*** 1.46***
Lithuania 3.13*** 0.56 -0.02 1.37*** 1.49***
Luxembourg 0.52* 0.12 0.62 1.06*** -0.06 0.33*
Mexico -0.34 -1.25 -0.63 -0.83 -1.6 -1.31
Netherlands 1.04*** 0.63* 1.14** 0.98*** 0.84***
New Zealand 0.5 -0.01 -0.16 0.26
Norway 2.18*** 0.94* 0.65 1.28*** 1.52***
Poland 3.36*** 1.11 3.46*** 1.53* 1.41** 1.78***
Portugal 1.51*** 0.95*** -0.93 1.59** 1.17*** 1.16***
Slovak Republic 1.86*** 0.3 -0.09 0.53 0.72***
Slovenia 2.03*** 0.91*** 10.81*** 1.03 0.74** 1.15***
Spain 1.38*** 2.1*** 1.25** 0.77 1.44***
Sweden 0.68** 0.2 6.07** -0.01 0.24 0.52*
Switzerland 0.58** 0.44 0.53** 0.47** 0.5**
Turkey -0.76 -1.6 0.08 -0.76 -0.83
United Kingdom 0.12 0.21 -10.32 0.09 0.2 0.06
United States 2*** 0.75** 0.01 0.54** 1.18***

Augment

Raw Augment

model %>%
  augment(lm) %>%
  head(10) %>%
  kable(align = "c", booktabs = T, linesep = "",
        caption = 'Cyclicality of Taxes') %>%
  kable_styling(bootstrap_options = c("striped", "hover", "condensed"),
                latex_options = c("striped", "hold_position"))
Table 3: Cyclicality of Taxes
countryname variable value B1_GE_VOBARSA .fitted .se.fit .resid .hat .sigma .cooksd .std.resid
Australia TAXNAT_1000 0.0686525 0.0121696 0.0627307 0.0126107 0.0059219 0.0393372 0.0642356 0.0001849 0.0950243
Australia TAXNAT_1000 0.1066427 0.0862986 0.1665668 0.0243644 -0.0599241 0.1468369 0.0635554 0.0895917 -1.0203457
Australia TAXNAT_1000 0.1185515 0.0169023 0.0693601 0.0112719 0.0491915 0.0314281 0.0638351 0.0100260 0.7861144
Australia TAXNAT_1000 0.1704476 0.0805569 0.1585241 0.0221035 0.0119235 0.1208492 0.0642153 0.0027493 0.2000020
Australia TAXNAT_1000 0.1309676 0.0793845 0.1568818 0.0216468 -0.0259142 0.1159073 0.0641182 0.0123164 -0.4334614
Australia TAXNAT_1000 0.1375286 0.0346170 0.0941739 0.0089264 0.0433547 0.0197095 0.0639299 0.0047680 0.6886846
Australia TAXNAT_1000 0.0759123 0.0198100 0.0734330 0.0105570 0.0024793 0.0275681 0.0642405 0.0000222 0.0395420
Australia TAXNAT_1000 0.2736811 0.0530424 0.1199832 0.0123081 0.1536979 0.0374717 0.0601304 0.1181695 2.4638984
Australia TAXNAT_1000 0.3007645 0.0367419 0.0971504 0.0090368 0.2036142 0.0202001 0.0569688 0.1078914 3.2351985
Australia TAXNAT_1000 0.1526585 -0.0035414 0.0407235 0.0179883 0.1119350 0.0800395 0.0619938 0.1465520 1.8354523

Glance

Raw Glance

model %>%
  glance(lm) %>%
  head(10) %>%
  kable(align = "c", booktabs = T, linesep = "",
        caption = 'Cyclicality of Taxes (\(R^2\))') %>%
  kable_styling(bootstrap_options = c("striped", "hover", "condensed"),
                latex_options = c("striped", "hold_position"))
Table 4: Cyclicality of Taxes (\(R^2\))
countryname variable r.squared adj.r.squared sigma statistic p.value df logLik AIC BIC deviance df.residual
Australia TAXNAT_1000 0.1804713 0.1637462 0.0635826 10.7904592 0.0018885 2 69.18045 -132.36090 -126.56543 0.1980947 49
Australia TAXNAT_3000 0.0113003 -0.0088772 0.1160234 0.5600457 0.4578189 2 38.50639 -71.01279 -65.21731 0.6596103 49
Australia TAXNAT_4000 0.0078604 -0.0123873 0.0627218 0.3882132 0.5361295 2 69.87566 -133.75132 -127.95584 0.1927669 49
Australia TAXNAT_5000 0.0041120 -0.0162123 0.0581105 0.2023191 0.6548390 2 73.77015 -141.54030 -135.74482 0.1654645 49
Australia TAXNAT_TOTALTAX 0.0964096 0.0779690 0.0540846 5.2281118 0.0265848 2 77.43172 -148.86344 -143.06796 0.1433323 49
Austria TAXNAT_1000 0.2707664 0.2561817 0.0560908 18.5651342 0.0000768 2 77.03570 -148.07140 -142.21767 0.1573087 50
Austria TAXNAT_2000 0.1441805 0.1270642 0.0378578 8.4235375 0.0054966 2 97.47872 -188.95743 -183.10370 0.0716606 50
Austria TAXNAT_3000 0.3263500 0.3128770 0.0346124 24.2225139 0.0000097 2 102.13924 -198.27848 -192.42474 0.0599008 50
Austria TAXNAT_4000 0.0018616 -0.0181012 0.0969080 0.0932542 0.7613479 2 48.60258 -91.20516 -85.35143 0.4695581 50
Austria TAXNAT_5000 0.2482988 0.2332648 0.0326798 16.5157942 0.0001704 2 105.12676 -204.25353 -198.39980 0.0533986 50

Manipulate Glance

model %>%
  glance(lm) %>%
  ungroup %>%
  mutate(r2 = round(r.squared*100, digits = 1) %>% paste0("%"),
         tax = gsub("TAXNAT_", "", variable)) %>%
  select(countryname, tax, r2) %>%
  spread(tax, r2) %>%
  mutate_all(funs(ifelse(is.na(.), "", .)))  %>%
  kable(align = "c", booktabs = T, linesep = "",
        caption = 'Cyclicality of Taxes (\(R^2\))') %>%
  kable_styling(bootstrap_options = c("striped", "hover", "condensed"),
                latex_options = c("striped", "hold_position"))
Table 5: Cyclicality of Taxes (\(R^2\))
countryname 1000 2000 3000 4000 5000 TOTALTAX
Australia 18% 1.1% 0.8% 0.4% 9.6%
Austria 27.1% 14.4% 32.6% 0.2% 24.8% 34%
Belgium 15.9% 9.1% 4.6% 2.5% 0.6% 16.3%
Canada 27.6% 9.2% 0.2% 0.9% 19.9% 27.1%
Chile 18.7% 53.5% 16.3% 48.9% 33.8%
Czech Republic 18.5% 47.5% 21.4% 21% 45.2%
Denmark 12% 0.3% 5% 5.9% 21.7% 17.8%
Estonia 54.1% 31.5% 0.3% 31.1% 56.8%
Finland 28% 8.5% 0.5% 1.7% 21.6% 23.8%
France 25.8% 9.7% 0.7% 0.1% 12.6% 18%
Germany 56.9% 31.1% 9.2% 4.2% 28% 54.1%
Greece 9% 10.2% 0.2% 0.1% 8.3% 8.9%
Hungary 14.6% 39.3% 1.6% 1.1% 5.1% 23.4%
Iceland 65.8% 21.7% 50.2% 22.4% 66.8% 61.1%
Ireland 8.5% 0.3% 0.5% 2.3% 5.1% 6.3%
Israel 36% 19.1% 13% 4.9% 0.1% 27.9%
Italy 18.4% 14.4% 1.9% 0.2% 28.1% 21.6%
Japan 56.7% 35.5% 37.5% 34.1% 59.3%
Korea 28.3% 19.2% 13.7% 24.2% 27.8% 31.2%
Latvia 60.3% 71.3% 0% 13.1% 63.7% 73%
Lithuania 77.8% 9.9% 0% 46.5% 56.2%
Luxembourg 5.6% 0.9% 7% 15.8% 0.1% 5.9%
Mexico 0.2% 2.8% 0.4% 0.9% 3.4% 3%
Netherlands 13.8% 5.5% 10.9% 26.2% 19.1%
New Zealand 4.4% 0% 0.5% 1.8%
Norway 26.9% 7.4% 4.2% 27.1% 35.3%
Poland 47.4% 10.3% 44.9% 16.3% 21.5% 47.5%
Portugal 18% 13% 10% 12.3% 14.5% 19.2%
Slovak Republic 56.5% 6.5% 0.3% 10.5% 40.6%
Slovenia 61.6% 52.3% 31.2% 10.7% 27.8% 59.5%
Spain 12.9% 17.7% 0% 11.2% 4.8% 20.3%
Sweden 7.7% 0.3% 8.7% 0% 1.4% 6.7%
Switzerland 7.8% 2.5% 7.7% 11.8% 10.2%
Turkey 2.5% 5.3% 0% 2% 2.9%
United Kingdom 0.2% 0.7% 4.4% 0% 0.5% 0.1%
United States 29.4% 8.8% 0% 11.4% 28%

Tidy and Glance

model %>% 
  tidy(lm) %>%
  filter(term == "B1_GE_VOBARSA") %>%
  select(countryname, variable, p.value, statistic) %>%
  full_join(model %>% 
              glance(lm) %>%
              select(countryname, variable, r.squared), 
            by = c("countryname", "variable")) %>%
  head(10) %>%
  kable(align = "c", booktabs = T, linesep = "",
        caption = 'Cyclicality of Taxes (\(R^2\))') %>%
  kable_styling(bootstrap_options = c("striped", "hover", "condensed"),
                latex_options = c("striped", "hold_position"))
Table 6: Cyclicality of Taxes (\(R^2\))
countryname variable p.value statistic r.squared
Australia TAXNAT_1000 0.0018885 3.2848834 0.1804713
Australia TAXNAT_3000 0.4578189 0.7483620 0.0113003
Australia TAXNAT_4000 0.5361295 -0.6230676 0.0078604
Australia TAXNAT_5000 0.6548390 0.4497990 0.0041120
Australia TAXNAT_TOTALTAX 0.0265848 2.2865065 0.0964096
Austria TAXNAT_1000 0.0000768 4.3087277 0.2707664
Austria TAXNAT_2000 0.0054966 2.9023331 0.1441805
Austria TAXNAT_3000 0.0000097 4.9216373 0.3263500
Austria TAXNAT_4000 0.7613479 0.3053755 0.0018616
Austria TAXNAT_5000 0.0001704 4.0639629 0.2482988