h1: close proximity
h2: greater travel
h3: socioeconomic status
h4: race
other controls
case6 <- read.csv("~/Dropbox (ASU)/Papers/Neighborhood COVID/Data/FullData.csv")
case6$CancerPC <- case6$CaseCount/(case6$Pop*1000)
cntyhealth <- read.csv("~/Dropbox (ASU)/Papers/Neighborhood COVID/Data/CntyHealth.csv")
case6 <- merge(case6, cntyhealth, by.x="county", by.y="FIPS")
## reading in shapefile
tractLA <- shapefile('~/Dropbox (ASU)/Papers/Neighborhood COVID/Data/tl_2019_22_tract/tl_2019_22_tract.shp')
tractLA2 <- merge(tractLA, case6, by.x="GEOID", by.y="Tract.ID")
f1 <- cpcln~ log(popdens)+pubtransit+ outsidecounty+tourismemp+collegepct+povpct+noinsurance+blackpct+hisppct+asianpct+otherracepct+DiversityIndex+over70pct+male+mle
summary(ols <-lm(f1, data=tractLA2@data))
##
## Call:
## lm(formula = f1, data = tractLA2@data)
##
## Residuals:
## Min 1Q Median 3Q Max
## -1.51437 -0.36249 -0.00913 0.33518 1.82779
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 1.85586 0.84125 2.206 0.02759 *
## log(popdens) 0.09855 0.01232 7.997 3.34e-15 ***
## pubtransit 4.09586 0.45898 8.924 < 2e-16 ***
## outsidecounty 1.31021 0.10028 13.066 < 2e-16 ***
## tourismemp 0.54584 0.31377 1.740 0.08222 .
## collegepct 0.14424 0.13778 1.047 0.29542
## povpct -1.02739 0.19499 -5.269 1.67e-07 ***
## noinsurance -1.02912 0.41157 -2.500 0.01255 *
## blackpct 1.38029 0.09110 15.151 < 2e-16 ***
## hisppct 3.19890 0.36887 8.672 < 2e-16 ***
## asianpct 2.10964 0.52012 4.056 5.36e-05 ***
## otherracepct 2.00231 0.68890 2.907 0.00373 **
## DiversityIndex -0.19189 0.11863 -1.618 0.10606
## over70pct 3.18687 0.43684 7.295 5.88e-13 ***
## male 0.22315 0.37579 0.594 0.55276
## mle -0.03076 0.01107 -2.779 0.00555 **
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 0.5128 on 1047 degrees of freedom
## (85 observations deleted due to missingness)
## Multiple R-squared: 0.5478, Adjusted R-squared: 0.5413
## F-statistic: 84.54 on 15 and 1047 DF, p-value: < 2.2e-16
covid_nbq <- poly2nb(tractLA) #Queenโs neighborhood
covid_nbq_w <- nb2listw(covid_nbq, style="W")
## Spatial Lag Model
summary(covid_LAG <- lagsarlm(f1, data = tractLA2@data, covid_nbq_w, zero.policy = T))
## Warning: Function lagsarlm moved to the spatialreg package
##
## Call:spatialreg::lagsarlm(formula = formula, data = data, listw = listw,
## na.action = na.action, Durbin = Durbin, type = type, method = method,
## quiet = quiet, zero.policy = zero.policy, interval = interval,
## tol.solve = tol.solve, trs = trs, control = control)
##
## Residuals:
## Min 1Q Median 3Q Max
## -1.205872 -0.233053 -0.022222 0.196545 1.869021
##
## Type: lag
## Coefficients: (asymptotic standard errors)
## Estimate Std. Error z value Pr(>|z|)
## (Intercept) 0.2646335 0.5875851 0.4504 0.6524403
## log(popdens) 0.0332319 0.0086558 3.8392 0.0001234
## pubtransit 0.9888728 0.3240213 3.0519 0.0022742
## outsidecounty 0.4514090 0.0711070 6.3483 2.177e-10
## tourismemp 0.1753277 0.2163075 0.8105 0.4176251
## collegepct -0.0384949 0.0949947 -0.4052 0.6853073
## povpct -0.5114520 0.1356359 -3.7708 0.0001627
## noinsurance 0.0208207 0.2842164 0.0733 0.9416021
## blackpct 0.7514712 0.0674960 11.1336 < 2.2e-16
## hisppct 1.1087421 0.2591434 4.2785 1.882e-05
## asianpct 0.4319181 0.3608990 1.1968 0.2313908
## otherracepct 0.7671376 0.4749403 1.6152 0.1062610
## DiversityIndex -0.0106457 0.0819582 -0.1299 0.8966518
## over70pct 2.1625369 0.3020527 7.1595 8.098e-13
## male 0.2540599 0.2589791 0.9810 0.3265900
## mle -0.0100747 0.0077218 -1.3047 0.1919934
##
## Rho: 0.69116, LR test value: 656.04, p-value: < 2.22e-16
## Asymptotic standard error: 0.022483
## z-value: 30.741, p-value: < 2.22e-16
## Wald statistic: 945, p-value: < 2.22e-16
##
## Log likelihood: -462.2106 for lag model
## ML residual variance (sigma squared): 0.12484, (sigma: 0.35333)
## Number of observations: 1063
## Number of parameters estimated: 18
## AIC: 960.42, (AIC for lm: 1614.5)
## LM test for residual autocorrelation
## test value: 43.382, p-value: 4.504e-11
## Spatial Error Model
summary(covid_error <- errorsarlm(f1, data = tractLA2@data, covid_nbq_w, zero.policy = T))
## Warning: Function errorsarlm moved to the spatialreg package
##
## Call:
## spatialreg::errorsarlm(formula = formula, data = data, listw = listw,
## na.action = na.action, Durbin = Durbin, etype = etype, method = method,
## quiet = quiet, zero.policy = zero.policy, interval = interval,
## tol.solve = tol.solve, trs = trs, control = control)
##
## Residuals:
## Min 1Q Median 3Q Max
## -1.077680 -0.230002 -0.012376 0.209799 1.979168
##
## Type: error
## Coefficients: (asymptotic standard errors)
## Estimate Std. Error z value Pr(>|z|)
## (Intercept) 4.545041 1.379964 3.2936 0.0009892
## log(popdens) 0.016441 0.011584 1.4193 0.1558060
## pubtransit 0.383689 0.397596 0.9650 0.3345338
## outsidecounty 0.110414 0.100818 1.0952 0.2734358
## tourismemp 0.049042 0.215659 0.2274 0.8201081
## collegepct -0.302469 0.134086 -2.2558 0.0240843
## povpct -0.490904 0.149012 -3.2944 0.0009864
## noinsurance 0.121547 0.279368 0.4351 0.6635046
## blackpct 0.957661 0.077757 12.3160 < 2.2e-16
## hisppct 0.682580 0.293702 2.3241 0.0201227
## asianpct 0.409007 0.475545 0.8601 0.3897442
## otherracepct 0.251461 0.518605 0.4849 0.6277621
## DiversityIndex -0.063919 0.091642 -0.6975 0.4854994
## over70pct 2.113638 0.315290 6.7038 2.031e-11
## male 0.380884 0.235592 1.6167 0.1059410
## mle -0.051093 0.019059 -2.6807 0.0073460
##
## Lambda: 0.82906, LR test value: 623.66, p-value: < 2.22e-16
## Asymptotic standard error: 0.018923
## z-value: 43.811, p-value: < 2.22e-16
## Wald statistic: 1919.4, p-value: < 2.22e-16
##
## Log likelihood: -478.3972 for error model
## ML residual variance (sigma squared): 0.11974, (sigma: 0.34604)
## Number of observations: 1063
## Number of parameters estimated: 18
## AIC: 992.79, (AIC for lm: 1614.5)