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)
## 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+log(CancerPC+1)
summary(ols <-lm(f1, data=tractLA2@data))
##
## Call:
## lm(formula = f1, data = tractLA2@data)
##
## Residuals:
## Min 1Q Median 3Q Max
## -1.44265 -0.35932 -0.00162 0.31551 1.69273
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) -7.291e-01 2.811e-01 -2.594 0.009660 **
## log(popdens) 9.359e-02 1.345e-02 6.957 6.85e-12 ***
## pubtransit 4.219e+00 7.538e-01 5.596 2.93e-08 ***
## outsidecounty 1.268e+00 1.064e-01 11.916 < 2e-16 ***
## tourismemp 6.845e-01 3.748e-01 1.826 0.068133 .
## collegepct 5.987e-02 1.633e-01 0.367 0.714000
## povpct -1.085e+00 2.187e-01 -4.962 8.38e-07 ***
## noinsurance -1.219e+00 4.667e-01 -2.612 0.009150 **
## blackpct 1.411e+00 1.002e-01 14.086 < 2e-16 ***
## hisppct 3.699e+00 4.054e-01 9.124 < 2e-16 ***
## asianpct 2.028e+00 5.887e-01 3.445 0.000599 ***
## otherracepct 1.851e+00 7.265e-01 2.548 0.011009 *
## DiversityIndex -1.852e-01 1.310e-01 -1.413 0.158010
## over70pct 1.461e+00 6.683e-01 2.187 0.029036 *
## male 3.670e-01 4.365e-01 0.841 0.400740
## log(CancerPC + 1) 9.361e+04 2.192e+04 4.270 2.17e-05 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 0.5086 on 871 degrees of freedom
## (261 observations deleted due to missingness)
## Multiple R-squared: 0.5113, Adjusted R-squared: 0.5028
## F-statistic: 60.74 on 15 and 871 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
## Warning in spatialreg::lagsarlm(formula = formula, data = data, listw = listw, : inversion of asymptotic covariance matrix failed for tol.solve = 1e-10
## reciprocal condition number = 7.78663e-15 - 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
## -1.11007 -0.23327 -0.02405 0.19757 1.82878
##
## Type: lag
## Regions with no neighbours included:
## 950 974 982
## Coefficients: (numerical Hessian approximate standard errors)
## Estimate Std. Error z value Pr(>|z|)
## (Intercept) -7.8381e-01 2.0390e-01 -3.8440 0.0001210
## log(popdens) 3.3905e-02 1.0030e-02 3.3803 0.0007240
## pubtransit 1.7609e+00 5.5067e-01 3.1977 0.0013854
## outsidecounty 4.9379e-01 8.1712e-02 6.0431 1.512e-09
## tourismemp 7.1261e-01 2.6690e-01 2.6700 0.0075861
## collegepct 1.8695e-02 1.3128e-01 0.1424 0.8867625
## povpct -5.8690e-01 1.5793e-01 -3.7162 0.0002023
## noinsurance -1.6330e-01 3.3541e-01 -0.4869 0.6263387
## blackpct 7.8603e-01 7.7077e-02 10.1979 < 2.2e-16
## hisppct 1.3470e+00 3.0127e-01 4.4710 7.784e-06
## asianpct 4.9733e-01 4.2549e-01 1.1688 0.2424683
## otherracepct 6.8115e-01 5.2632e-01 1.2942 0.1956031
## DiversityIndex 7.2064e-02 9.5217e-02 0.7568 0.4491500
## over70pct 8.3846e-01 4.7619e-01 1.7608 0.0782797
## male 4.2941e-01 3.1229e-01 1.3750 0.1691202
## log(CancerPC + 1) 6.5984e+04 1.5760e+04 4.1867 2.830e-05
##
## Rho: 0.62856, LR test value: 497.51, p-value: < 2.22e-16
## Approximate (numerical Hessian) standard error: 0.022346
## z-value: 28.129, p-value: < 2.22e-16
## Wald statistic: 791.23, p-value: < 2.22e-16
##
## Log likelihood: -402.014 for lag model
## ML residual variance (sigma squared): 0.13094, (sigma: 0.36186)
## Number of observations: 887
## Number of parameters estimated: 18
## AIC: 840.03, (AIC for lm: 1335.5)
## 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
## 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.36821e-13 - 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
## -1.227515 -0.239766 -0.031236 0.195204 1.963498
##
## Type: error
## Regions with no neighbours included:
## 950 974 982
## Coefficients: (asymptotic standard errors)
## Estimate Std. Error z value Pr(>|z|)
## (Intercept) 4.5964e-01 2.1315e-01 2.1564 0.0310504
## log(popdens) 1.6305e-02 1.2539e-02 1.3003 0.1934858
## pubtransit 5.6723e-01 5.8284e-01 0.9732 0.3304449
## outsidecounty 9.4962e-02 1.0737e-01 0.8845 0.3764521
## tourismemp 5.0327e-01 2.5525e-01 1.9717 0.0486467
## collegepct -1.3560e-01 1.5528e-01 -0.8732 0.3825330
## povpct -4.7149e-01 1.6455e-01 -2.8654 0.0041653
## noinsurance -1.1281e-01 3.1603e-01 -0.3570 0.7211224
## blackpct 9.2168e-01 8.3935e-02 10.9809 < 2.2e-16
## hisppct 8.1391e-01 3.2528e-01 2.5022 0.0123440
## asianpct 4.3515e-01 5.7159e-01 0.7613 0.4464826
## otherracepct -1.0806e-01 5.5557e-01 -0.1945 0.8457756
## DiversityIndex 4.9134e-02 1.0108e-01 0.4861 0.6269070
## over70pct 9.0840e-01 4.3184e-01 2.1036 0.0354177
## male 6.4809e-01 2.6904e-01 2.4089 0.0160020
## log(CancerPC + 1) 5.2458e+04 1.4570e+04 3.6004 0.0003177
##
## Lambda: 0.80119, LR test value: 508.5, p-value: < 2.22e-16
## Approximate (numerical Hessian) standard error: 0.01978
## z-value: 40.504, p-value: < 2.22e-16
## Wald statistic: 1640.6, p-value: < 2.22e-16
##
## Log likelihood: -396.5213 for error model
## ML residual variance (sigma squared): 0.1181, (sigma: 0.34366)
## Number of observations: 887
## Number of parameters estimated: 18
## AIC: 829.04, (AIC for lm: 1335.5)