#Load Ozone Dataset
load("Ozone_Drought_Final.RData")
combinedAir.final<-arrange(combinedAir.final,GEOID,Year)
#Load Population Dataset
region<-read.csv("region_code.csv")
## Merging dataset
combinedAir.final$State.Code<-as.numeric(combinedAir.final$State.Code)
combinedAir.final<-left_join(combinedAir.final,region,by="State.Code")
combinedAir.final$USDM.categorical<-factor(combinedAir.final$USDM.categorical,levels=c("NoDrought","ModerateDrought","SevereDrought"))
## Subset Between May 1st to Sep 31st.
combinedAir.final$month<-as.numeric(combinedAir.final$month)
combinedAir.final<-combinedAir.final%>%
filter(month>=5 & month<=9)
## Sampling 20%
s.combined <- combinedAir.final %>%
group_by(USDM.categorical, month, Year) %>%
sample_frac(0.5)
s.combined<-data.frame(s.combined)
md2_random<-plm(Max.Ozone~USDM.categorical +elevation+ Longitude + Latitude+ splines::ns(tmean, 2),
data =s.combined,
index = c("GEOID","Year","month"),
model = "random")
md2_fix<-plm(Max.Ozone~USDM.categorical +elevation+ Longitude + Latitude+ splines::ns(tmean, 2),
data =s.combined,
index = c("GEOID","Year","month"),
effect = "twoway")
stargazer(md2_random,md2_fix,type = "text", title = "All Regions", align = TRUE,
add.lines = list(c("Model Name", "Random Effect Model", "Fixed Effect Model")),
column.labels = c("Random Effect Model", "Fixed Effect Model"),
dep.var.caption = "Dependent Variable: Ozone Max",
dep.var.labels.include = FALSE,
omit.table.layout = "#")
##
## All Regions
## ==================================================================================
## Dependent Variable: Ozone Max
## --------------------------------------------------
## Random Effect Model Fixed Effect Model
## ----------------------------------------------------------------------------------
## USDM.categoricalModerateDrought 2.062*** 1.788***
## (0.027) (0.027)
##
## USDM.categoricalSevereDrought 2.124*** 2.181***
## (0.038) (0.039)
##
## elevation 0.006*** 0.007***
## (0.0001) (0.0001)
##
## Longitude 0.010 -1.132***
## (0.012) (0.061)
##
## Latitude 0.267*** 0.712***
## (0.032) (0.085)
##
## splines::ns(tmean, 2)1 38.593*** 40.417***
## (0.357) (0.351)
##
## splines::ns(tmean, 2)2 20.220*** 20.532***
## (0.125) (0.124)
##
## Constant 15.156***
## (1.607)
##
## ----------------------------------------------------------------------------------
## Model Name Random Effect Model Fixed Effect Model
## Observations 1,718,980 1,718,980
## R2 0.040 0.034
## Adjusted R2 0.040 0.034
## F Statistic 57,841.060*** 8,663.769*** (df = 7; 1718033)
## ==================================================================================
## Note: *p<0.1; **p<0.05; ***p<0.01
ne<- s.combined%>%
filter(noaa_region=="northeast")
ne_random<-plm(Max.Ozone~USDM.categorical +elevation+ Longitude + Latitude+ splines::ns(tmean, 2),
data =ne,
index = c("GEOID","Year","month"),
model = "random")
ne_fix<-plm(Max.Ozone~USDM.categorical +elevation+ Longitude + Latitude+ splines::ns(tmean, 2),
data =ne,
index = c("GEOID","Year","month"),
effect = "twoway")
stargazer(ne_random,ne_fix,type = "text", title = "Northeast", align = TRUE,
add.lines = list(c("Model Name", "Random Effect Model", "Fixed Effect Model")),
column.labels = c("Random Effect Model", "Fixed Effect Model"),
dep.var.caption = "Dependent Variable: Ozone Max",
dep.var.labels.include = FALSE,
omit.table.layout = "#")
##
## Northeast
## =================================================================================
## Dependent Variable: Ozone Max
## -------------------------------------------------
## Random Effect Model Fixed Effect Model
## ---------------------------------------------------------------------------------
## USDM.categoricalModerateDrought 0.762*** 1.284***
## (0.046) (0.050)
##
## USDM.categoricalSevereDrought -0.716*** 1.104***
## (0.063) (0.072)
##
## elevation 0.007*** 0.008***
## (0.0001) (0.0001)
##
## Longitude -0.183*** -3.327***
## (0.018) (0.084)
##
## Latitude -0.173*** -0.718***
## (0.064) (0.121)
##
## splines::ns(tmean, 2)1 35.754*** 36.423***
## (0.410) (0.403)
##
## splines::ns(tmean, 2)2 30.734*** 32.583***
## (0.239) (0.242)
##
## Constant 19.643***
## (3.085)
##
## ---------------------------------------------------------------------------------
## Model Name Random Effect Model Fixed Effect Model
## Observations 539,251 539,251
## R2 0.066 0.066
## Adjusted R2 0.066 0.066
## F Statistic 33,991.520*** 5,440.815*** (df = 7; 538995)
## =================================================================================
## Note: *p<0.1; **p<0.05; ***p<0.01
nr<- s.combined%>%
filter(noaa_region=="northern_rockies")
nr_random<-plm(Max.Ozone~USDM.categorical +elevation+ Longitude + Latitude+ splines::ns(tmean, 2),
data =nr,
index = c("GEOID","Year","month"),
model = "random")
nr_fix<-plm(Max.Ozone~USDM.categorical +elevation+ Longitude + Latitude+ splines::ns(tmean, 2),
data =nr,
index = c("GEOID","Year","month"),
effect = "twoway")
stargazer(nr_random,nr_fix,type = "text", title = "Northern Rockies", align = TRUE,
add.lines = list(c("Model Name", "Random Effect Model", "Fixed Effect Model")),
column.labels = c("Random Effect Model", "Fixed Effect Model"),
dep.var.caption = "Dependent Variable: Ozone Max",
dep.var.labels.include = FALSE,
omit.table.layout = "#")
##
## Northern Rockies
## ===============================================================================
## Dependent Variable: Ozone Max
## -----------------------------------------------
## Random Effect Model Fixed Effect Model
## -------------------------------------------------------------------------------
## USDM.categoricalModerateDrought 2.032*** 1.467***
## (0.077) (0.079)
##
## USDM.categoricalSevereDrought 1.723*** 1.498***
## (0.110) (0.113)
##
## elevation 0.005*** 0.005***
## (0.0003) (0.0003)
##
## Longitude -0.102*** -2.482***
## (0.030) (0.228)
##
## Latitude 0.966*** 3.321***
## (0.075) (0.270)
##
## splines::ns(tmean, 2)1 38.817*** 39.936***
## (0.642) (0.631)
##
## splines::ns(tmean, 2)2 5.451*** 5.931***
## (0.271) (0.268)
##
## Constant -20.153***
## (4.854)
##
## -------------------------------------------------------------------------------
## Model Name Random Effect Model Fixed Effect Model
## Observations 254,283 254,283
## R2 0.037 0.021
## Adjusted R2 0.037 0.020
## F Statistic 5,234.451*** 775.806*** (df = 7; 254148)
## ===============================================================================
## Note: *p<0.1; **p<0.05; ***p<0.01
nw<- s.combined%>%
filter(noaa_region=="northwest")
nw_random<-plm(Max.Ozone~USDM.categorical +elevation+ Longitude + Latitude+ splines::ns(tmean, 2),
data =nw,
index = c("GEOID","Year","month"),
model = "random")
nw_fix<-plm(Max.Ozone~USDM.categorical +elevation+ Longitude + Latitude+ splines::ns(tmean, 2),
data =nw,
index = c("GEOID","Year","month"),
effect = "twoway")
stargazer(nw_random,nw_fix,type = "text", title = "Northwest", align = TRUE,
add.lines = list(c("Model Name", "Random Effect Model", "Fixed Effect Model")),
column.labels = c("Random Effect Model", "Fixed Effect Model"),
dep.var.caption = "Dependent Variable: Ozone Max",
dep.var.labels.include = FALSE,
omit.table.layout = "#")
##
## Northwest
## ==============================================================================
## Dependent Variable: Ozone Max
## ----------------------------------------------
## Random Effect Model Fixed Effect Model
## ------------------------------------------------------------------------------
## USDM.categoricalModerateDrought 3.539*** 2.767***
## (0.109) (0.119)
##
## USDM.categoricalSevereDrought 5.539*** 5.095***
## (0.134) (0.153)
##
## elevation 0.010*** 0.013***
## (0.001) (0.001)
##
## Longitude 0.305*** -0.430
## (0.050) (0.374)
##
## Latitude 0.934*** 0.196
## (0.203) (0.429)
##
## splines::ns(tmean, 2)1 -3.099*** -3.850***
## (1.149) (1.123)
##
## splines::ns(tmean, 2)2 8.120*** 8.392***
## (0.289) (0.284)
##
## Constant 36.994***
## (9.188)
##
## ------------------------------------------------------------------------------
## Model Name Random Effect Model Fixed Effect Model
## Observations 68,460 68,460
## R2 0.074 0.036
## Adjusted R2 0.074 0.035
## F Statistic 3,329.115*** 362.014*** (df = 7; 68399)
## ==============================================================================
## Note: *p<0.1; **p<0.05; ***p<0.01
ohv<- s.combined%>%
filter(noaa_region=="ohio_valley")
ohv_random<-plm(Max.Ozone~USDM.categorical +elevation+ Longitude + Latitude+ splines::ns(tmean, 2),
data =ohv,
index = c("GEOID","Year","month"),
model = "random")
ohv_fix<-plm(Max.Ozone~USDM.categorical +elevation+ Longitude + Latitude+ splines::ns(tmean, 2),
data =ohv,
index = c("GEOID","Year","month"),
effect = "twoway")
stargazer(ohv_random,ohv_fix,type = "text", title = "Ohio Valley", align = TRUE,
add.lines = list(c("Model Name", "Random Effect Model", "Fixed Effect Model")),
column.labels = c("Random Effect Model", "Fixed Effect Model"),
dep.var.caption = "Dependent Variable: Ozone Max",
dep.var.labels.include = FALSE,
omit.table.layout = "#")
##
## Ohio Valley
## ===============================================================================
## Dependent Variable: Ozone Max
## -----------------------------------------------
## Random Effect Model Fixed Effect Model
## -------------------------------------------------------------------------------
## USDM.categoricalModerateDrought 3.579*** 3.011***
## (0.088) (0.090)
##
## USDM.categoricalSevereDrought 6.224*** 5.361***
## (0.137) (0.145)
##
## elevation 0.012*** 0.014***
## (0.0004) (0.0004)
##
## Longitude -0.206*** 0.326
## (0.033) (0.308)
##
## Latitude 0.050 -1.636***
## (0.054) (0.329)
##
## splines::ns(tmean, 2)1 19.364*** 20.346***
## (0.796) (0.785)
##
## splines::ns(tmean, 2)2 -3.051*** -2.271***
## (0.302) (0.300)
##
## Constant 8.023**
## (3.719)
##
## -------------------------------------------------------------------------------
## Model Name Random Effect Model Fixed Effect Model
## Observations 160,936 160,936
## R2 0.044 0.024
## Adjusted R2 0.044 0.023
## F Statistic 4,931.001*** 566.883*** (df = 7; 160814)
## ===============================================================================
## Note: *p<0.1; **p<0.05; ***p<0.01
sth<- s.combined%>%
filter(noaa_region=="south")
sth_random<-plm(Max.Ozone~USDM.categorical +elevation+ Longitude + Latitude+ splines::ns(tmean, 2),
data =sth,
index = c("GEOID","Year","month"),
model = "random")
sth_fix<-plm(Max.Ozone~USDM.categorical +elevation+ Longitude + Latitude+ splines::ns(tmean, 2),
data =sth,
index = c("GEOID","Year","month"),
effect = "twoway")
stargazer(sth_random,sth_fix,type = "text", title = "South", align = TRUE,
add.lines = list(c("Model Name", "Random Effect Model", "Fixed Effect Model")),
column.labels = c("Random Effect Model", "Fixed Effect Model"),
dep.var.caption = "Dependent Variable: Ozone Max",
dep.var.labels.include = FALSE,
omit.table.layout = "#")
##
## South
## ==============================================================================
## Dependent Variable: Ozone Max
## ----------------------------------------------
## Random Effect Model Fixed Effect Model
## ------------------------------------------------------------------------------
## USDM.categoricalModerateDrought 2.041*** 1.017***
## (0.141) (0.149)
##
## USDM.categoricalSevereDrought 5.072*** 3.488***
## (0.236) (0.261)
##
## elevation 0.009*** 0.013***
## (0.001) (0.002)
##
## Longitude 0.217*** -6.381***
## (0.023) (1.046)
##
## Latitude 0.320*** -8.956***
## (0.063) (1.101)
##
## splines::ns(tmean, 2)1 32.676*** 34.143***
## (1.168) (1.153)
##
## splines::ns(tmean, 2)2 8.682*** 9.617***
## (0.443) (0.440)
##
## Constant 33.180***
## (2.693)
##
## ------------------------------------------------------------------------------
## Model Name Random Effect Model Fixed Effect Model
## Observations 75,198 75,198
## R2 0.045 0.023
## Adjusted R2 0.045 0.022
## F Statistic 1,977.484*** 249.929*** (df = 7; 75117)
## ==============================================================================
## Note: *p<0.1; **p<0.05; ***p<0.01
se<- s.combined%>%
filter(noaa_region=="southeast")
se_random<-plm(Max.Ozone~USDM.categorical +elevation+ Longitude + Latitude+ splines::ns(tmean, 2),
data =se,
index = c("GEOID","Year","month"),
model = "random")
se_fix<-plm(Max.Ozone~USDM.categorical +elevation+ Longitude + Latitude+ splines::ns(tmean, 2),
data =se,
index = c("GEOID","Year","month"),
effect = "twoway")
stargazer(se_random,se_fix,type = "text", title = "Southeast", align = TRUE,
add.lines = list(c("Model Name", "Random Effect Model", "Fixed Effect Model")),
column.labels = c("Random Effect Model", "Fixed Effect Model"),
dep.var.caption = "Dependent Variable: Ozone Max",
dep.var.labels.include = FALSE,
omit.table.layout = "#")
##
## Southeast
## ===============================================================================
## Dependent Variable: Ozone Max
## -----------------------------------------------
## Random Effect Model Fixed Effect Model
## -------------------------------------------------------------------------------
## USDM.categoricalModerateDrought 2.144*** 1.480***
## (0.093) (0.098)
##
## USDM.categoricalSevereDrought 4.043*** 2.573***
## (0.140) (0.149)
##
## elevation 0.005*** 0.005***
## (0.0002) (0.0002)
##
## Longitude 0.087*** 0.566**
## (0.026) (0.254)
##
## Latitude 0.035 0.881**
## (0.061) (0.413)
##
## splines::ns(tmean, 2)1 19.938*** 20.707***
## (1.037) (1.030)
##
## splines::ns(tmean, 2)2 14.135*** 13.796***
## (0.253) (0.252)
##
## Constant 38.287***
## (2.978)
##
## -------------------------------------------------------------------------------
## Model Name Random Effect Model Fixed Effect Model
## Observations 113,250 113,250
## R2 0.085 0.033
## Adjusted R2 0.085 0.032
## F Statistic 5,053.501*** 557.850*** (df = 7; 113147)
## ===============================================================================
## Note: *p<0.1; **p<0.05; ***p<0.01
sw<- s.combined%>%
filter(noaa_region=="southwest")
sw_random<-plm(Max.Ozone~USDM.categorical +elevation+ Longitude + Latitude+ splines::ns(tmean, 2),
data =sw,
index = c("GEOID","Year","month"),
model = "random")
sw_fix<-plm(Max.Ozone~USDM.categorical +elevation+ Longitude + Latitude+ splines::ns(tmean, 2),
data =sw,
index = c("GEOID","Year","month"),
effect = "twoway")
stargazer(sw_random,sw_fix,type = "text", title = "Southwest", align = TRUE,
add.lines = list(c("Model Name", "Random Effect Model", "Fixed Effect Model")),
column.labels = c("Random Effect Model", "Fixed Effect Model"),
dep.var.caption = "Dependent Variable: Ozone Max",
dep.var.labels.include = FALSE,
omit.table.layout = "#")
##
## Southwest
## ===============================================================================
## Dependent Variable: Ozone Max
## -----------------------------------------------
## Random Effect Model Fixed Effect Model
## -------------------------------------------------------------------------------
## USDM.categoricalModerateDrought 2.752*** 0.853***
## (0.130) (0.131)
##
## USDM.categoricalSevereDrought 3.449*** 1.295***
## (0.334) (0.341)
##
## elevation 0.008*** 0.010***
## (0.001) (0.001)
##
## Longitude 0.061 0.922**
## (0.055) (0.459)
##
## Latitude 0.802*** 1.150
## (0.212) (0.749)
##
## splines::ns(tmean, 2)1 20.452*** 23.284***
## (0.708) (0.689)
##
## splines::ns(tmean, 2)2 21.840*** 21.176***
## (0.335) (0.329)
##
## Constant 9.722
## (12.085)
##
## -------------------------------------------------------------------------------
## Model Name Random Effect Model Fixed Effect Model
## Observations 118,710 118,710
## R2 0.069 0.050
## Adjusted R2 0.069 0.050
## F Statistic 6,730.520*** 898.968*** (df = 7; 118620)
## ===============================================================================
## Note: *p<0.1; **p<0.05; ***p<0.01
um<- s.combined%>%
filter(noaa_region=="upper_midwest")
um_random<-plm(Max.Ozone~USDM.categorical +elevation+ Longitude + Latitude+ splines::ns(tmean, 2),
data =um,
index = c("GEOID","Year","month"),
model = "random")
um_fix<-plm(Max.Ozone~USDM.categorical +elevation+ Longitude + Latitude+ splines::ns(tmean, 2),
data =um,
index = c("GEOID","Year","month"),
effect = "twoway")
stargazer(um_random,um_fix,type = "text", title = "Upper Midwest", align = TRUE,
add.lines = list(c("Model Name", "Random Effect Model", "Fixed Effect Model")),
column.labels = c("Random Effect Model", "Fixed Effect Model"),
dep.var.caption = "Dependent Variable: Ozone Max",
dep.var.labels.include = FALSE,
omit.table.layout = "#")
##
## Upper Midwest
## ===============================================================================
## Dependent Variable: Ozone Max
## -----------------------------------------------
## Random Effect Model Fixed Effect Model
## -------------------------------------------------------------------------------
## USDM.categoricalModerateDrought 5.638*** 2.903***
## (0.106) (0.112)
##
## USDM.categoricalSevereDrought 6.283*** 2.350***
## (0.155) (0.173)
##
## elevation -0.001 -0.001**
## (0.001) (0.001)
##
## Longitude 0.030 1.400
## (0.085) (0.932)
##
## Latitude 0.689*** -4.889***
## (0.174) (1.132)
##
## splines::ns(tmean, 2)1 3.031*** 6.750***
## (0.881) (0.850)
##
## splines::ns(tmean, 2)2 6.770*** 6.758***
## (0.283) (0.277)
##
## Constant 23.817***
## (6.984)
##
## -------------------------------------------------------------------------------
## Model Name Random Effect Model Fixed Effect Model
## Observations 121,755 121,755
## R2 0.061 0.012
## Adjusted R2 0.061 0.011
## F Statistic 4,765.231*** 216.147*** (df = 7; 121633)
## ===============================================================================
## Note: *p<0.1; **p<0.05; ***p<0.01
wst<- s.combined%>%
filter(noaa_region=="upper_midwest")
wst_random<-plm(Max.Ozone~USDM.categorical +elevation+ Longitude + Latitude+ splines::ns(tmean, 2),
data =wst,
index = c("GEOID","Year","month"),
model = "random")
wst_fix<-plm(Max.Ozone~USDM.categorical +elevation+ Longitude + Latitude+ splines::ns(tmean, 2),
data =wst,
index = c("GEOID","Year","month"),
effect = "twoway")
stargazer(wst_random,wst_fix,type = "text", title = "West", align = TRUE,
add.lines = list(c("Model Name", "Random Effect Model", "Fixed Effect Model")),
column.labels = c("Random Effect Model", "Fixed Effect Model"),
dep.var.caption = "Dependent Variable: Ozone Max",
dep.var.labels.include = FALSE,
omit.table.layout = "#")
##
## West
## ===============================================================================
## Dependent Variable: Ozone Max
## -----------------------------------------------
## Random Effect Model Fixed Effect Model
## -------------------------------------------------------------------------------
## USDM.categoricalModerateDrought 5.638*** 2.903***
## (0.106) (0.112)
##
## USDM.categoricalSevereDrought 6.283*** 2.350***
## (0.155) (0.173)
##
## elevation -0.001 -0.001**
## (0.001) (0.001)
##
## Longitude 0.030 1.400
## (0.085) (0.932)
##
## Latitude 0.689*** -4.889***
## (0.174) (1.132)
##
## splines::ns(tmean, 2)1 3.031*** 6.750***
## (0.881) (0.850)
##
## splines::ns(tmean, 2)2 6.770*** 6.758***
## (0.283) (0.277)
##
## Constant 23.817***
## (6.984)
##
## -------------------------------------------------------------------------------
## Model Name Random Effect Model Fixed Effect Model
## Observations 121,755 121,755
## R2 0.061 0.012
## Adjusted R2 0.061 0.011
## F Statistic 4,765.231*** 216.147*** (df = 7; 121633)
## ===============================================================================
## Note: *p<0.1; **p<0.05; ***p<0.01