h1: close proximity
h2: greater travel
h3: socioeconomic status
h4: race
other controls
case6 <- read.csv("~/Dropbox (ASU)/Papers/Neighborhood COVID/Data/FullData.csv")
## 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~ popdens+pubtransit+ outsidecounty+tourismemp+log(medinc)+collegepct+noinsurance+povpct+blackpct+hisppct+asianpct+otherracepct+DiversityIndex+over70pct+male+orleansparish+nolametro+othermetro
summary(ols <-lm(f1, data=tractLA2@data))
##
## Call:
## lm(formula = f1, data = tractLA2@data)
##
## Residuals:
## Min 1Q Median 3Q Max
## -0.0080459 -0.0020939 -0.0002738 0.0013618 0.0272571
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 7.570e-03 7.763e-03 0.975 0.329702
## popdens -3.997e-08 6.184e-08 -0.646 0.518209
## pubtransit 8.342e-03 4.162e-03 2.004 0.045283 *
## outsidecounty 3.589e-03 7.825e-04 4.587 5.05e-06 ***
## tourismemp -5.651e-04 2.279e-03 -0.248 0.804178
## log(medinc) -9.384e-04 6.883e-04 -1.363 0.173023
## collegepct -3.550e-03 1.177e-03 -3.016 0.002625 **
## noinsurance -5.007e-03 3.030e-03 -1.652 0.098778 .
## povpct -7.577e-03 1.931e-03 -3.925 9.24e-05 ***
## blackpct 9.547e-03 6.646e-04 14.364 < 2e-16 ***
## hisppct 9.420e-03 2.836e-03 3.322 0.000925 ***
## asianpct 7.857e-03 3.809e-03 2.063 0.039371 *
## otherracepct 1.413e-02 5.030e-03 2.809 0.005068 **
## DiversityIndex -9.346e-04 8.768e-04 -1.066 0.286723
## over70pct 1.997e-02 3.292e-03 6.066 1.83e-09 ***
## male 1.586e-03 2.715e-03 0.584 0.559295
## orleansparish 1.037e-02 7.008e-04 14.791 < 2e-16 ***
## nolametro 7.894e-03 4.914e-04 16.066 < 2e-16 ***
## othermetro 1.031e-03 3.732e-04 2.763 0.005833 **
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 0.003719 on 1043 degrees of freedom
## (86 observations deleted due to missingness)
## Multiple R-squared: 0.6539, Adjusted R-squared: 0.6479
## F-statistic: 109.5 on 18 and 1043 DF, p-value: < 2.2e-16
covid_nbq <- poly2nb(tractLA2) #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))
## Warning: Function lagsarlm moved to the spatialreg package
## Warning in spatialreg::lagsarlm(formula = formula, data = data, listw = listw, : inversion of asymptotic covariance matrix failed for tol.solve = 1e-10
## reciprocal condition number = 4.91482e-13 - using numerical Hessian.
##
## 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
## -0.00962959 -0.00170899 -0.00020511 0.00112188 0.02643301
##
## Type: lag
## Coefficients: (numerical Hessian approximate standard errors)
## Estimate Std. Error z value Pr(>|z|)
## (Intercept) 7.1205e-03 7.0436e-03 1.0109 0.3120599
## popdens -5.5327e-08 6.3008e-08 -0.8781 0.3798922
## pubtransit 4.8166e-03 3.9455e-03 1.2208 0.2221610
## outsidecounty 2.5708e-03 7.2008e-04 3.5702 0.0003568
## tourismemp -2.6474e-04 2.2832e-03 -0.1159 0.9076928
## log(medinc) -9.7902e-04 6.2768e-04 -1.5597 0.1188201
## collegepct -2.0087e-03 1.0907e-03 -1.8417 0.0655227
## noinsurance -2.0989e-03 2.6141e-03 -0.8029 0.4220206
## povpct -6.4833e-03 1.7757e-03 -3.6511 0.0002612
## blackpct 7.6125e-03 6.3640e-04 11.9618 < 2.2e-16
## hisppct 7.6800e-03 2.5955e-03 2.9589 0.0030874
## asianpct 4.6196e-03 3.6710e-03 1.2584 0.2082439
## otherracepct 1.2005e-02 4.6545e-03 2.5793 0.0098991
## DiversityIndex -1.2043e-03 7.8775e-04 -1.5288 0.1263152
## over70pct 1.8622e-02 3.0726e-03 6.0605 1.357e-09
## male 2.5137e-03 2.4762e-03 1.0151 0.3100396
## orleansparish 6.5191e-03 7.2079e-04 9.0443 < 2.2e-16
## nolametro 4.9693e-03 5.1688e-04 9.6140 < 2.2e-16
## othermetro 7.7331e-04 3.4454e-04 2.2445 0.0248030
##
## Rho: 0.38426, LR test value: 111.83, p-value: < 2.22e-16
## Approximate (numerical Hessian) standard error: 0.034216
## z-value: 11.23, p-value: < 2.22e-16
## Wald statistic: 126.12, p-value: < 2.22e-16
##
## Log likelihood: 4499.776 for lag model
## ML residual variance (sigma squared): 1.1874e-05, (sigma: 0.0034458)
## Number of observations: 1062
## Number of parameters estimated: 21
## AIC: -8957.6, (AIC for lm: -8847.7)
## Spatial Error Model
summary(covid_error <- errorsarlm(f1, data = tractLA2@data, covid_nbq_w))
## Warning: Function errorsarlm moved to the spatialreg package
## Warning in spatialreg::errorsarlm(formula = formula, data = data, listw = listw, : inversion of asymptotic covariance matrix failed for tol.solve = 1e-10
## reciprocal condition number = 1.0626e-12 - using numerical Hessian.
##
## 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
## -0.0093480 -0.0017502 -0.0002467 0.0010736 0.0256510
##
## Type: error
## Coefficients: (asymptotic standard errors)
## Estimate Std. Error z value Pr(>|z|)
## (Intercept) 5.1918e-03 7.3363e-03 0.7077 0.4791405
## popdens -7.9267e-08 6.4276e-08 -1.2332 0.2174881
## pubtransit 4.1676e-03 4.0749e-03 1.0228 0.3064249
## outsidecounty 1.9973e-03 8.8236e-04 2.2635 0.0236022
## tourismemp -4.3363e-04 2.1660e-03 -0.2002 0.8413265
## log(medinc) -7.6150e-04 6.5456e-04 -1.1634 0.2446738
## collegepct -3.5503e-03 1.2895e-03 -2.7532 0.0059020
## noinsurance -1.4303e-03 2.8530e-03 -0.5013 0.6161254
## povpct -6.4142e-03 1.7958e-03 -3.5717 0.0003547
## blackpct 9.0435e-03 7.3192e-04 12.3558 < 2.2e-16
## hisppct 7.4470e-03 2.8598e-03 2.6040 0.0092131
## asianpct 5.0881e-03 4.1951e-03 1.2129 0.2251776
## otherracepct 1.1295e-02 5.0665e-03 2.2293 0.0257917
## DiversityIndex -1.9783e-03 8.8714e-04 -2.2299 0.0257529
## over70pct 2.0194e-02 3.1723e-03 6.3656 1.945e-10
## male 3.9217e-03 2.4534e-03 1.5985 0.1099383
## orleansparish 1.0960e-02 8.8853e-04 12.3352 < 2.2e-16
## nolametro 8.0732e-03 6.6716e-04 12.1008 < 2.2e-16
## othermetro 1.0125e-03 5.0716e-04 1.9963 0.0458977
##
## Lambda: 0.44639, LR test value: 113.45, p-value: < 2.22e-16
## Approximate (numerical Hessian) standard error: 0.037947
## z-value: 11.764, p-value: < 2.22e-16
## Wald statistic: 138.38, p-value: < 2.22e-16
##
## Log likelihood: 4500.588 for error model
## ML residual variance (sigma squared): 1.1722e-05, (sigma: 0.0034238)
## Number of observations: 1062
## Number of parameters estimated: 21
## AIC: -8959.2, (AIC for lm: -8847.7)