Dataset

#Load Ozone Dataset
load("Ozone Data with Region.RData")
test.dat<-df4

test.dat$USDM.categorical <- factor(test.dat$USDM.categorical, levels = c("NoDrought", "ModerateDrought", "SevereDrought"))
test.dat$USDM.categorical <- relevel(test.dat$USDM.categorical, ref = "NoDrought")


## model 1 
md1_random <- plm(Max.Ozone ~USDM.categorical, data = test.dat, 
                  model = "random", 
                  index = c("GEOID", "Year","month"))

md1_fix <- plm(Max.Ozone ~USDM.categorical, data = test.dat
               ,model = "between", 
               index = c("GEOID", "Year","month"))

stargazer(md1_random, md1_fix, type = "text", 
          title = "Comparison of Random and Fixed Effect Models 1", 
          align = TRUE,
          add.lines = list(c("Model Name", "Random Effect Model",
                             "Fixed Effect Model")), 
          dep.var.labels.include = FALSE)
## 
## Comparison of Random and Fixed Effect Models 1
## ===========================================================================
##                                             Dependent variable:            
##                                 -------------------------------------------
##                                         (1)                   (2)          
## ---------------------------------------------------------------------------
## USDM.categoricalModerateDrought      1.321***               2.083*         
##                                       (0.014)               (1.252)        
##                                                                            
## USDM.categoricalSevereDrought        2.626***              9.192***        
##                                       (0.020)               (1.774)        
##                                                                            
## Constant                             42.243***             41.689***       
##                                       (0.148)               (0.264)        
##                                                                            
## ---------------------------------------------------------------------------
## Model Name                      Random Effect Model   Fixed Effect Model   
## Observations                         6,589,427                923          
## R2                                     0.006                 0.046         
## Adjusted R2                            0.006                 0.044         
## F Statistic                        20,447.550***    22.147*** (df = 2; 920)
## ===========================================================================
## Note:                                           *p<0.1; **p<0.05; ***p<0.01
## model 2
md2_random<- plm(Max.Ozone ~ USDM.categorical +elevation+ Longitude +Latitude,
data=test.dat,
index = c("GEOID", "Year","month"),
model = "random")

md2_fix<- plm(Max.Ozone ~ USDM.categorical +elevation+ Longitude + Latitude,
data=test.dat,
index = c("GEOID", "Year","month"),
model = "between")

stargazer(md2_random, md2_fix, type = "text", title = "Comparison of Random and Fixed Effect Models 2", align = TRUE, 
          add.lines = list(c("Model Name", "Random Effect Model", "Fixed Effect Model")), 
          dep.var.labels.include = FALSE)
## 
## Comparison of Random and Fixed Effect Models 2
## ===========================================================================
##                                             Dependent variable:            
##                                 -------------------------------------------
##                                         (1)                   (2)          
## ---------------------------------------------------------------------------
## USDM.categoricalModerateDrought      1.311***               2.354*         
##                                       (0.014)               (1.311)        
##                                                                            
## USDM.categoricalSevereDrought        2.606***               4.101**        
##                                       (0.020)               (1.903)        
##                                                                            
## elevation                            0.007***              0.004***        
##                                      (0.00004)             (0.0003)        
##                                                                            
## Longitude                            0.142***              0.085***        
##                                       (0.009)               (0.014)        
##                                                                            
## Latitude                               0.012               -0.156***       
##                                       (0.024)               (0.034)        
##                                                                            
## Constant                             52.072***             54.062***       
##                                       (1.231)               (1.562)        
##                                                                            
## ---------------------------------------------------------------------------
## Model Name                      Random Effect Model   Fixed Effect Model   
## Observations                         6,589,427                923          
## R2                                     0.011                 0.200         
## Adjusted R2                            0.011                 0.195         
## F Statistic                        51,590.720***    45.718*** (df = 5; 917)
## ===========================================================================
## Note:                                           *p<0.1; **p<0.05; ***p<0.01
## model 3

md3_random <- plm(Max.Ozone ~ USDM.categorical + tmean +
elevation + Longitude + Latitude,
data=test.dat,
index = c("GEOID", "Year","month"),
model = "random")


md3_fix <- plm(Max.Ozone ~ USDM.categorical + tmean+
elevation + Longitude + Latitude,
data=test.dat,
index = c("GEOID", "Year","month"),
model = "between"
)

stargazer(md3_random, md3_fix, type = "text", title = "Comparison of Random and Fixed Effect Models 3", align = TRUE, 
          add.lines = list(c("Model Name", "Random Effect Model", "Fixed Effect Model")), 
          dep.var.labels.include = FALSE)
## 
## Comparison of Random and Fixed Effect Models 3
## ============================================================================
##                                             Dependent variable:             
##                                 --------------------------------------------
##                                         (1)                   (2)           
## ----------------------------------------------------------------------------
## USDM.categoricalModerateDrought      1.183***                1.962*         
##                                       (0.013)               (1.019)         
##                                                                             
## USDM.categoricalSevereDrought        1.441***                2.401          
##                                       (0.019)               (1.480)         
##                                                                             
## tmean                                0.651***               0.943***        
##                                       (0.001)               (0.038)         
##                                                                             
## elevation                            0.009***               0.008***        
##                                      (0.00003)              (0.0003)        
##                                                                             
## Longitude                            0.099***               0.109***        
##                                       (0.008)               (0.011)         
##                                                                             
## Latitude                             0.294***               0.385***        
##                                       (0.021)               (0.035)         
##                                                                             
## Constant                             26.002***             19.010***        
##                                       (1.036)               (1.874)         
##                                                                             
## ----------------------------------------------------------------------------
## Model Name                      Random Effect Model    Fixed Effect Model   
## Observations                         6,589,427                923           
## R2                                     0.153                 0.517          
## Adjusted R2                            0.153                 0.514          
## F Statistic                      1,154,186.000***   163.552*** (df = 6; 916)
## ============================================================================
## Note:                                            *p<0.1; **p<0.05; ***p<0.01
md4_random <- plm(Max.Ozone ~  tmean+elevation + Longitude + Latitude,
data=test.dat,
index = c("GEOID", "Year","month"),
model = "random")


md4_fix <- plm(Max.Ozone ~  tmean+elevation + Longitude + Latitude,
data=test.dat,
index = c("GEOID", "Year","month"),
model = "between"
)


stargazer(md4_random, md4_fix, type = "text", title = "Comparison of Random and Fixed Effect Models 4", align = TRUE, 
          add.lines = list(c("Model Name", "Random Effect Model", "Fixed Effect Model")), 
          dep.var.labels.include = FALSE)
## 
## Comparison of Random and Fixed Effect Models 4
## =========================================================
##                          Dependent variable:             
##              --------------------------------------------
##                      (1)                   (2)           
## ---------------------------------------------------------
## tmean             0.654***               0.947***        
##                    (0.001)               (0.038)         
##                                                          
## elevation         0.009***               0.008***        
##                   (0.00003)              (0.0003)        
##                                                          
## Longitude         0.087***               0.093***        
##                    (0.008)               (0.009)         
##                                                          
## Latitude          0.295***               0.357***        
##                    (0.022)               (0.033)         
##                                                          
## Constant          25.120***             19.090***        
##                    (1.083)               (1.874)         
##                                                          
## ---------------------------------------------------------
## Model Name   Random Effect Model    Fixed Effect Model   
## Observations      6,589,427                923           
## R2                  0.151                 0.513          
## Adjusted R2         0.151                 0.511          
## F Statistic   1,140,976.000***   242.229*** (df = 4; 918)
## =========================================================
## Note:                         *p<0.1; **p<0.05; ***p<0.01
## Model 5
md5_random <- plm(Max.Ozone ~  ppt+elevation + Longitude + Latitude,
data=test.dat,
index = c("GEOID", "Year","month"),
model = "random")

md5_fix <- plm(Max.Ozone ~  ppt+elevation + Longitude + Latitude,
data=test.dat,
index = c("GEOID", "Year","month"),
model = "between"
)


stargazer(md5_random, md5_fix, type = "text", title = "Comparison of Random and Fixed Effect Models 5", align = TRUE, 
          add.lines = list(c("Model Name", "Random Effect Model", "Fixed Effect Model")), 
          dep.var.labels.include = FALSE)
## 
## Comparison of Random and Fixed Effect Models 5
## ========================================================
##                          Dependent variable:            
##              -------------------------------------------
##                      (1)                   (2)          
## --------------------------------------------------------
## ppt               -0.231***               0.013         
##                    (0.001)               (0.214)        
##                                                         
## elevation         0.007***              0.004***        
##                   (0.00004)             (0.0003)        
##                                                         
## Longitude         0.146***              0.063***        
##                    (0.010)               (0.015)        
##                                                         
## Latitude           -0.001               -0.202***       
##                    (0.025)               (0.032)        
##                                                         
## Constant          53.943***             54.400***       
##                    (1.279)               (2.485)        
##                                                         
## --------------------------------------------------------
## Model Name   Random Effect Model   Fixed Effect Model   
## Observations      6,589,427                923          
## R2                  0.025                 0.192         
## Adjusted R2         0.025                 0.188         
## F Statistic    150,132.900***    54.495*** (df = 4; 918)
## ========================================================
## Note:                        *p<0.1; **p<0.05; ***p<0.01
## model 6

md6_random <- plm(Max.Ozone ~  tdmean+elevation + Longitude + Latitude,
data=test.dat,
index = c("GEOID", "Year","month"),
model = "random")

md6_fix <- plm(Max.Ozone ~  tdmean+elevation + Longitude + Latitude,
data=test.dat,
index = c("GEOID", "Year","month"),
model = "between"
)


stargazer(md6_random, md6_fix, type = "text", title = "Comparison of Random and Fixed Effect Models 6", align = TRUE, 
          add.lines = list(c("Model Name", "Random Effect Model", "Fixed Effect Model")), 
          dep.var.labels.include = FALSE)
## 
## Comparison of Random and Fixed Effect Models 6
## =========================================================
##                          Dependent variable:             
##              --------------------------------------------
##                      (1)                   (2)           
## ---------------------------------------------------------
## tdmean            0.326***               0.655***        
##                    (0.001)               (0.044)         
##                                                          
## elevation         0.008***               0.008***        
##                   (0.00004)              (0.0004)        
##                                                          
## Longitude         0.129***               0.030***        
##                    (0.010)               (0.011)         
##                                                          
## Latitude          0.312***               0.129***        
##                    (0.025)               (0.035)         
##                                                          
## Constant          36.127***             31.056***        
##                    (1.285)               (2.115)         
##                                                          
## ---------------------------------------------------------
## Model Name   Random Effect Model    Fixed Effect Model   
## Observations      6,589,427                923           
## R2                  0.042                 0.347          
## Adjusted R2         0.042                 0.344          
## F Statistic    265,907.600***    121.700*** (df = 4; 918)
## =========================================================
## Note:                         *p<0.1; **p<0.05; ***p<0.01
## model 7

md7_random <- plm(Max.Ozone ~  tdmean+tmean+ppt+elevation + Longitude + Latitude,
data=test.dat,
index = c("GEOID", "Year","month"),
model = "random")

md7_fix <- plm(Max.Ozone ~  tdmean+tmean+ppt+elevation + Longitude + Latitude,
data=test.dat,
index = c("GEOID", "Year","month"),
model = "between"
)

stargazer(md7_random, md7_fix, type = "text", title = "Comparison of Random and Fixed Effect Models 7", align = TRUE, 
          add.lines = list(c("Model Name", "Random Effect Model", "Fixed Effect Model")), 
          dep.var.labels.include = FALSE)
## 
## Comparison of Random and Fixed Effect Models 7
## =========================================================
##                          Dependent variable:             
##              --------------------------------------------
##                      (1)                   (2)           
## ---------------------------------------------------------
## tdmean            -0.831***             -0.196***        
##                    (0.001)               (0.074)         
##                                                          
## tmean             1.350***               1.096***        
##                    (0.001)               (0.068)         
##                                                          
## ppt               -0.136***               0.156          
##                    (0.001)               (0.208)         
##                                                          
## elevation         0.008***               0.007***        
##                   (0.00003)              (0.0003)        
##                                                          
## Longitude         0.066***               0.101***        
##                    (0.008)               (0.012)         
##                                                          
## Latitude          -0.068***              0.352***        
##                    (0.021)               (0.033)         
##                                                          
## Constant          34.488***             19.136***        
##                    (1.064)               (2.423)         
##                                                          
## ---------------------------------------------------------
## Model Name   Random Effect Model    Fixed Effect Model   
## Observations      6,589,427                923           
## R2                  0.226                 0.518          
## Adjusted R2         0.226                 0.515          
## F Statistic   1,894,545.000***   163.893*** (df = 6; 916)
## =========================================================
## Note:                         *p<0.1; **p<0.05; ***p<0.01
## model 8


md8_random <- plm(Max.Ozone ~ USDM.categorical+ tdmean+tmean+ppt+elevation + Longitude + Latitude,
data=test.dat,
index = c("GEOID", "Year","month"),
model = "random")

md8_fix <- plm(Max.Ozone ~  USDM.categorical+tdmean+tmean+ppt+elevation + Longitude + Latitude,
data=test.dat,
index = c("GEOID", "Year","month"),
model = "between"
)

stargazer(md8_random, md8_fix, type = "text", title = "Comparison of Random and Fixed Effect Models 8", align = TRUE, 
          add.lines = list(c("Model Name", "Random Effect Model", "Fixed Effect Model")), 
          dep.var.labels.include = FALSE)
## 
## Comparison of Random and Fixed Effect Models 8
## ============================================================================
##                                             Dependent variable:             
##                                 --------------------------------------------
##                                         (1)                   (2)           
## ----------------------------------------------------------------------------
## USDM.categoricalModerateDrought      0.531***                1.736          
##                                       (0.012)               (1.079)         
##                                                                             
## USDM.categoricalSevereDrought        0.304***                1.834          
##                                       (0.018)               (1.614)         
##                                                                             
## tdmean                               -0.827***              -0.165**        
##                                       (0.001)               (0.076)         
##                                                                             
## tmean                                1.346***               1.067***        
##                                       (0.001)               (0.070)         
##                                                                             
## ppt                                  -0.136***               0.272          
##                                       (0.001)               (0.216)         
##                                                                             
## elevation                            0.008***               0.007***        
##                                      (0.00003)              (0.0003)        
##                                                                             
## Longitude                            0.080***               0.106***        
##                                       (0.008)               (0.012)         
##                                                                             
## Latitude                             -0.052**               0.381***        
##                                       (0.020)               (0.037)         
##                                                                             
## Constant                             35.119***             17.854***        
##                                       (1.028)               (2.526)         
##                                                                             
## ----------------------------------------------------------------------------
## Model Name                      Random Effect Model    Fixed Effect Model   
## Observations                         6,589,427                923           
## R2                                     0.227                 0.520          
## Adjusted R2                            0.227                 0.515          
## F Statistic                      1,896,923.000***   123.617*** (df = 8; 914)
## ============================================================================
## Note:                                            *p<0.1; **p<0.05; ***p<0.01