#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","SevereDrought","ModerateDrought"))
## 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.2)
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.categoricalSevereDrought 2.087*** 2.140***
## (0.061) (0.062)
##
## USDM.categoricalModerateDrought 2.065*** 1.792***
## (0.043) (0.043)
##
## elevation 0.006*** 0.007***
## (0.0001) (0.0001)
##
## Longitude 0.031*** -1.261***
## (0.012) (0.096)
##
## Latitude 0.229*** 0.808***
## (0.034) (0.135)
##
## splines::ns(tmean, 2)1 35.385*** 36.716***
## (0.459) (0.451)
##
## splines::ns(tmean, 2)2 18.527*** 18.823***
## (0.189) (0.187)
##
## Constant 20.309***
## (1.685)
##
## ---------------------------------------------------------------------------------
## Model Name Random Effect Model Fixed Effect Model
## Observations 687,602 687,602
## R2 0.050 0.034
## Adjusted R2 0.050 0.033
## F Statistic 23,364.010*** 3,481.448*** (df = 7; 686655)
## =================================================================================
## 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.categoricalSevereDrought -0.785*** 1.101***
## (0.100) (0.114)
##
## USDM.categoricalModerateDrought 0.675*** 1.208***
## (0.073) (0.079)
##
## elevation 0.007*** 0.008***
## (0.0001) (0.0002)
##
## Longitude -0.100*** -3.657***
## (0.018) (0.132)
##
## Latitude -0.299*** -0.869***
## (0.071) (0.192)
##
## splines::ns(tmean, 2)1 36.189*** 36.174***
## (0.730) (0.718)
##
## splines::ns(tmean, 2)2 29.817*** 31.858***
## (0.339) (0.343)
##
## Constant 31.440***
## (3.391)
##
## ---------------------------------------------------------------------------------
## Model Name Random Effect Model Fixed Effect Model
## Observations 215,596 215,596
## R2 0.076 0.067
## Adjusted R2 0.076 0.066
## F Statistic 13,681.310*** 2,199.060*** (df = 7; 215340)
## =================================================================================
## 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.categoricalSevereDrought 1.642*** 1.357***
## (0.173) (0.180)
##
## USDM.categoricalModerateDrought 1.965*** 1.400***
## (0.122) (0.126)
##
## elevation 0.005*** 0.005***
## (0.0004) (0.0005)
##
## Longitude -0.068** -1.974***
## (0.034) (0.363)
##
## Latitude 0.898*** 3.545***
## (0.083) (0.431)
##
## splines::ns(tmean, 2)1 35.827*** 37.277***
## (0.927) (0.912)
##
## splines::ns(tmean, 2)2 5.378*** 5.910***
## (0.418) (0.413)
##
## Constant -12.793**
## (5.473)
##
## -------------------------------------------------------------------------------
## Model Name Random Effect Model Fixed Effect Model
## Observations 101,468 101,468
## R2 0.058 0.021
## Adjusted R2 0.058 0.020
## F Statistic 2,144.061*** 312.977*** (df = 7; 101333)
## ===============================================================================
## 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.categoricalSevereDrought 5.718*** 5.252***
## (0.213) (0.242)
##
## USDM.categoricalModerateDrought 3.499*** 2.706***
## (0.174) (0.188)
##
## elevation 0.008*** 0.013***
## (0.001) (0.001)
##
## Longitude 0.215*** -0.670
## (0.068) (0.598)
##
## Latitude 0.984*** -0.004
## (0.224) (0.685)
##
## splines::ns(tmean, 2)1 -0.408 -1.804
## (1.610) (1.571)
##
## splines::ns(tmean, 2)2 8.047*** 8.344***
## (0.446) (0.437)
##
## Constant 26.782**
## (11.169)
##
## ------------------------------------------------------------------------------
## Model Name Random Effect Model Fixed Effect Model
## Observations 27,452 27,452
## R2 0.109 0.037
## Adjusted R2 0.109 0.034
## F Statistic 1,396.171*** 148.482*** (df = 7; 27391)
## ==============================================================================
## 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.categoricalSevereDrought 6.690*** 5.768***
## (0.218) (0.229)
##
## USDM.categoricalModerateDrought 3.768*** 3.164***
## (0.140) (0.143)
##
## elevation 0.011*** 0.015***
## (0.001) (0.001)
##
## Longitude -0.219*** 0.110
## (0.033) (0.487)
##
## Latitude 0.103* -0.863*
## (0.056) (0.524)
##
## splines::ns(tmean, 2)1 18.888*** 19.214***
## (1.228) (1.211)
##
## splines::ns(tmean, 2)2 -2.871*** -2.073***
## (0.478) (0.475)
##
## Constant 5.503
## (3.868)
##
## ------------------------------------------------------------------------------
## Model Name Random Effect Model Fixed Effect Model
## Observations 64,446 64,446
## R2 0.067 0.026
## Adjusted R2 0.067 0.024
## F Statistic 2,252.885*** 244.666*** (df = 7; 64324)
## ==============================================================================
## 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.categoricalSevereDrought 5.864*** 4.523***
## (0.375) (0.417)
##
## USDM.categoricalModerateDrought 2.634*** 1.584***
## (0.226) (0.237)
##
## elevation 0.008*** 0.007**
## (0.001) (0.003)
##
## Longitude 0.222*** -5.976***
## (0.023) (1.645)
##
## Latitude 0.351*** -7.419***
## (0.066) (1.738)
##
## splines::ns(tmean, 2)1 34.669*** 36.447***
## (1.875) (1.852)
##
## splines::ns(tmean, 2)2 6.798*** 7.535***
## (0.676) (0.671)
##
## Constant 31.452***
## (2.941)
##
## ------------------------------------------------------------------------------
## Model Name Random Effect Model Fixed Effect Model
## Observations 29,974 29,974
## R2 0.070 0.023
## Adjusted R2 0.069 0.021
## F Statistic 910.713*** 101.158*** (df = 7; 29893)
## ==============================================================================
## 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.categoricalSevereDrought 3.534*** 1.917***
## (0.221) (0.237)
##
## USDM.categoricalModerateDrought 2.182*** 1.511***
## (0.148) (0.156)
##
## elevation 0.006*** 0.005***
## (0.0003) (0.0003)
##
## Longitude 0.106*** 0.549
## (0.028) (0.400)
##
## Latitude 0.097 1.373**
## (0.062) (0.655)
##
## splines::ns(tmean, 2)1 20.057*** 20.036***
## (1.438) (1.430)
##
## splines::ns(tmean, 2)2 14.512*** 13.967***
## (0.411) (0.409)
##
## Constant 37.329***
## (3.134)
##
## ------------------------------------------------------------------------------
## Model Name Random Effect Model Fixed Effect Model
## Observations 45,363 45,363
## R2 0.129 0.033
## Adjusted R2 0.129 0.031
## F Statistic 2,129.980*** 219.953*** (df = 7; 45260)
## ==============================================================================
## 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.categoricalSevereDrought 3.115*** 1.101**
## (0.532) (0.544)
##
## USDM.categoricalModerateDrought 2.731*** 0.837***
## (0.207) (0.209)
##
## elevation 0.005*** 0.010***
## (0.001) (0.002)
##
## Longitude 0.063 -0.086
## (0.058) (0.725)
##
## Latitude 0.741*** 0.122
## (0.227) (1.186)
##
## splines::ns(tmean, 2)1 20.753*** 23.076***
## (1.141) (1.110)
##
## splines::ns(tmean, 2)2 21.205*** 20.515***
## (0.520) (0.511)
##
## Constant 12.584
## (12.926)
##
## ------------------------------------------------------------------------------
## Model Name Random Effect Model Fixed Effect Model
## Observations 47,555 47,555
## R2 0.084 0.048
## Adjusted R2 0.084 0.047
## F Statistic 2,610.943*** 345.058*** (df = 7; 47465)
## ==============================================================================
## 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.categoricalSevereDrought 5.819*** 2.052***
## (0.248) (0.276)
##
## USDM.categoricalModerateDrought 5.848*** 3.233***
## (0.168) (0.178)
##
## elevation 0.001 0.0001
## (0.001) (0.001)
##
## Longitude 0.052 1.809
## (0.085) (1.483)
##
## Latitude 0.793*** -2.372
## (0.173) (1.794)
##
## splines::ns(tmean, 2)1 5.680*** 9.521***
## (1.404) (1.356)
##
## splines::ns(tmean, 2)2 6.279*** 6.370***
## (0.448) (0.438)
##
## Constant 19.952***
## (6.992)
##
## -----------------------------------------------------------------------------
## Model Name Random Effect Model Fixed Effect Model
## Observations 48,736 48,736
## R2 0.085 0.013
## Adjusted R2 0.084 0.011
## F Statistic 1,876.403*** 93.310*** (df = 7; 48614)
## =============================================================================
## 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.categoricalSevereDrought 5.819*** 2.052***
## (0.248) (0.276)
##
## USDM.categoricalModerateDrought 5.848*** 3.233***
## (0.168) (0.178)
##
## elevation 0.001 0.0001
## (0.001) (0.001)
##
## Longitude 0.052 1.809
## (0.085) (1.483)
##
## Latitude 0.793*** -2.372
## (0.173) (1.794)
##
## splines::ns(tmean, 2)1 5.680*** 9.521***
## (1.404) (1.356)
##
## splines::ns(tmean, 2)2 6.279*** 6.370***
## (0.448) (0.438)
##
## Constant 19.952***
## (6.992)
##
## -----------------------------------------------------------------------------
## Model Name Random Effect Model Fixed Effect Model
## Observations 48,736 48,736
## R2 0.085 0.013
## Adjusted R2 0.084 0.011
## F Statistic 1,876.403*** 93.310*** (df = 7; 48614)
## =============================================================================
## Note: *p<0.1; **p<0.05; ***p<0.01