# loading required packages library(stargazer) library(robustbase) library(tidyverse) library(sandwich) library(plm) #set default directory (this is not necessary, but, if a directory is not specified, this is the one used. DIRECTORY MUST BE CHANGED TO YOUR DIRECTORY setwd("C:/Users/Public") # open workfile: JBNST_dataset <- read_csv("dataset.csv") attach(JBNST_dataset) #dropping Delaware as an extreme outlier in terms of the extent of equalization JBNST_wo_de <- filter(JBNST_dataset, code!= 8 ) JBNST_0_between <- plm( Eq_eff_0_1 ~ polfract +Overturned + rr + urbhomo , data = JBNST_wo_de, index = c("code", "year"), model = "between") JBNST_0_within <- plm( Eq_eff_0_1 ~ polfract +Overturned + rr + urbhomo , data = JBNST_wo_de, index = c("code", "year"), model = "within") JBNST_2_between <- plm( Eq_eff_2_1 ~ polfract +Overturned + rr + urbhomo , data = JBNST_wo_de, index = c("code", "year"), model = "between") JBNST_2_within <- plm( Eq_eff_2_1 ~ polfract +Overturned + rr + urbhomo , data = JBNST_wo_de, index = c("code", "year"), model = "within") robust_0_within <- sqrt(diag(vcovHC(JBNST_0_within, type = 'HC1', cluster = 'group'))) robust_2_within <- sqrt(diag(vcovHC(JBNST_2_within, type = 'HC1', cluster = 'group'))) stargazer(JBNST_0_between, JBNST_2_between, JBNST_0_within, JBNST_2_within, se=list(NULL, NULL, robust_0_within, robust_2_within), type="text", dep.var.labels=c("I0" , "I2", "I0" , "I2"), covariate.labels=c("Political fractionalization", "Court-ordered reform", "Revenue decentralization", "Urban homogeneity" ), omit.stat=c("LL","ser","f"), align=TRUE) #dropping the six New England states (Connecticut, Maine, Massachusetts, New Hampshire, Rhode Island, and Vermont) in addition to Delaware JBNST_wo_de_NewEng <- filter(JBNST_dataset, code!= 7 & code!= 8 & code!= 20 & code!= 30 & code!= 22 & code!= 40 & code!= 46) JBNST_0_between <- plm( Eq_eff_0_1 ~ polfract +Overturned + rr + urbhomo , data = JBNST_wo_de_NewEng, index = c("code", "year"), model = "between") JBNST_0_within <- plm( Eq_eff_0_1 ~ polfract +Overturned + rr + urbhomo, data = JBNST_wo_de_NewEng, index = c("code", "year"), model = "within") JBNST_2_between <- plm( Eq_eff_2_1 ~ polfract +Overturned + rr + urbhomo, data = JBNST_wo_de_NewEng, index = c("code", "year"), model = "between") JBNST_2_within <- plm( Eq_eff_2_1 ~ polfract +Overturned + rr + urbhomo, data = JBNST_wo_de_NewEng, index = c("code", "year"), model = "within") robust_0_within <- sqrt(diag(vcovHC(JBNST_0_within, type = 'HC1', cluster = 'group'))) robust_2_within <- sqrt(diag(vcovHC(JBNST_2_within, type = 'HC1', cluster = 'group'))) stargazer(JBNST_0_between, JBNST_2_between, JBNST_0_within, JBNST_2_within, se=list(NULL, NULL, robust_0_within, robust_2_within), type="text", dep.var.labels=c("I0" , "I2", "I0" , "I2"), covariate.labels=c("Political fractionalization", "Court-ordered reform", "Revenue decentralization", "Urban homogeneity" ), omit.stat=c("LL","ser","f"), align=TRUE)