Tulsa

Renata Oliveira

2020-11-17

Libraries

library(ggplot2)
library(dplyr)
library(flexdashboard)
library(tidyverse)
library(janitor)
library(usethis)
library(devtools)
library(plotly)
library(rlang)
library(sf)
library(sp)
library(spdep)
library(tmap)
library(tmaptools)
library(mapdeck)
library(cartography)
library(igraph)
library(rgdal)
library(shp2graph)
library(leaflet)
library(mapproj)
library(DCluster)
library(ggmap)
library(tidyverse)

Data sources

tulsa_grid_all <- st_read("D:/google_drive/00_city_logistics/01_production/shapefiles/eua/tulsa_grid_all.shp")
tulsa_ware <- st_read("D:/google_drive/00_city_logistics/01_production/shapefiles/eua/tulsa_ware.shp")
tulsa_poi <- st_read("D:/google_drive/00_city_logistics/01_production/shapefiles/eua/tulsa_poi.shp")
tulsa_road <- st_read("D:/google_drive/00_city_logistics/01_production/shapefiles/eua/tulsa_road.shp")

tulsa_grid_all <- tulsa_grid_all[,-c(1,2,3, 5, 6, 7, 8)]

names(tulsa_grid_all) <- c("id", "poi", "km", "wh", "avg_price", "sum_size", "avg_size", "area", "geometry")

tulsa_grid_all <- mutate(tulsa_grid_all, ipoi = poi/1741)
tulsa_grid_all <- mutate(tulsa_grid_all, ikm = km/59391.01)
tulsa_grid_all <- mutate(tulsa_grid_all, iwh = wh/45)
tulsa_grid_all <- mutate(tulsa_grid_all, iprice = avg_price/0.4763347)
tulsa_grid_all <- mutate(tulsa_grid_all, isize = avg_size/70073.35)
tulsa_grid_all <- mutate(tulsa_grid_all, wh_per_poi = wh/poi)
tulsa_grid_all <- mutate(tulsa_grid_all, wh_per_km = wh/km)

Warehouse absolute quantity

#>    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
#>   1.000   1.000   2.000   2.647   3.000   9.000

Warehouse proportion

#>    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
#> 0.02222 0.02222 0.04444 0.05882 0.06667 0.20000

POI absolute quantity

#>    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
#>   1.000   1.000   2.000   7.914   6.000 170.000

POI proportion

#>      Min.   1st Qu.    Median      Mean   3rd Qu.      Max. 
#> 0.0005744 0.0005744 0.0011488 0.0045455 0.0034463 0.0976450

km absolute extension per hexagon

#>    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
#>   0.084  38.386  57.046  69.059  77.954 577.992

km proportion

#>      Min.   1st Qu.    Median      Mean   3rd Qu.      Max. 
#> 1.415e-06 6.463e-04 9.605e-04 1.163e-03 1.313e-03 9.732e-03

> Concentration of POI is much more intense than of km in Tulsa.

Average rent price in hexagon

#>    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
#>  0.1800  0.4000  0.5025  0.4763  0.5450  0.6700

Average rent price in hexagon in relation to average of metropolitan area

#>    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
#>  0.3779  0.8397  1.0549  1.0000  1.1442  1.4066

Warehouse per poi in hexagon

#>    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
#> 0.00000 0.00000 0.00000 0.01467 0.00000 0.66667

Warehouse per km in hexagon

#>      Min.   1st Qu.    Median      Mean   3rd Qu.      Max. 
#> 0.0000000 0.0000000 0.0000000 0.0001701 0.0000000 0.0237134

Correlation Plots

library(corrplot)
#> corrplot 0.84 loaded
data <- tulsa_grid_all
st_geometry(data) <- NULL
data <- as.matrix(data)
str(data)
#>  num [1:873, 1:15] 1095 81 782 236 631 ...
#>  - attr(*, "dimnames")=List of 2
#>   ..$ : chr [1:873] "1" "2" "3" "4" ...
#>   ..$ : chr [1:15] "id" "poi" "km" "wh" ...
corrplot(cor(data))

Regression models

lm1 <- lm(wh ~ poi + km + avg_price, data=tulsa_grid_all)
summary(lm1)
#> 
#> Call:
#> lm(formula = wh ~ poi + km + avg_price, data = tulsa_grid_all)
#> 
#> Residuals:
#>     Min      1Q  Median      3Q     Max 
#> -2.3462  0.0098  0.0135  0.0157  5.5595 
#> 
#> Coefficients:
#>               Estimate Std. Error t value Pr(>|t|)    
#> (Intercept) -9.823e-03  1.795e-02  -0.547    0.584    
#> poi          1.074e-02  1.625e-03   6.608 6.77e-11 ***
#> km          -9.399e-05  2.599e-04  -0.362    0.718    
#> avg_price    4.997e+00  1.671e-01  29.899  < 2e-16 ***
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> Residual standard error: 0.2879 on 869 degrees of freedom
#> Multiple R-squared:  0.6515, Adjusted R-squared:  0.6503 
#> F-statistic: 541.4 on 3 and 869 DF,  p-value: < 2.2e-16
lm2 <- lm(wh ~ poi + avg_price, data=tulsa_grid_all)
summary(lm2)
#> 
#> Call:
#> lm(formula = wh ~ poi + avg_price, data = tulsa_grid_all)
#> 
#> Residuals:
#>     Min      1Q  Median      3Q     Max 
#> -2.3425  0.0152  0.0152  0.0152  5.5536 
#> 
#> Coefficients:
#>              Estimate Std. Error t value Pr(>|t|)    
#> (Intercept) -0.015223   0.009958  -1.529    0.127    
#> poi          0.010314   0.001133   9.106   <2e-16 ***
#> avg_price    4.980772   0.160642  31.005   <2e-16 ***
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> Residual standard error: 0.2878 on 870 degrees of freedom
#> Multiple R-squared:  0.6514, Adjusted R-squared:  0.6506 
#> F-statistic: 812.9 on 2 and 870 DF,  p-value: < 2.2e-16
lm3 <- lm(iwh ~ iprice, data=tulsa_grid_all)
summary(lm3)
#> 
#> Call:
#> lm(formula = iwh ~ iprice, data = tulsa_grid_all)
#> 
#> Residuals:
#>       Min        1Q    Median        3Q       Max 
#> -0.061701  0.000017  0.000017  0.000017  0.121506 
#> 
#> Coefficients:
#>               Estimate Std. Error t value Pr(>|t|)    
#> (Intercept) -1.661e-05  2.285e-04  -0.073    0.942    
#> iprice       5.968e-02  1.589e-03  37.552   <2e-16 ***
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> Residual standard error: 0.006689 on 871 degrees of freedom
#> Multiple R-squared:  0.6182, Adjusted R-squared:  0.6177 
#> F-statistic:  1410 on 1 and 871 DF,  p-value: < 2.2e-16
lm4 <- lm(iprice ~ ipoi, data=tulsa_grid_all)
summary(lm4)
#> 
#> Call:
#> lm(formula = iprice ~ ipoi, data = tulsa_grid_all)
#> 
#> Residuals:
#>      Min       1Q   Median       3Q      Max 
#> -0.70421 -0.00622 -0.00622 -0.00622  1.38706 
#> 
#> Coefficients:
#>              Estimate Std. Error t value Pr(>|t|)    
#> (Intercept)  0.006216   0.004404   1.411    0.159    
#> ipoi        11.573348   0.780197  14.834   <2e-16 ***
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> Residual standard error: 0.1274 on 871 degrees of freedom
#> Multiple R-squared:  0.2017, Adjusted R-squared:  0.2008 
#> F-statistic:   220 on 1 and 871 DF,  p-value: < 2.2e-16
lm5 <- lm(iprice ~ ikm, data=tulsa_grid_all)
summary(lm5)
#> 
#> Call:
#> lm(formula = iprice ~ ikm, data = tulsa_grid_all)
#> 
#> Residuals:
#>      Min       1Q   Median       3Q      Max 
#> -0.45869 -0.02815 -0.00499  0.01813  1.29744 
#> 
#> Coefficients:
#>              Estimate Std. Error t value Pr(>|t|)    
#> (Intercept) -0.058972   0.006178  -9.545   <2e-16 ***
#> ikm         68.482539   3.979960  17.207   <2e-16 ***
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> Residual standard error: 0.1232 on 871 degrees of freedom
#> Multiple R-squared:  0.2537, Adjusted R-squared:  0.2528 
#> F-statistic: 296.1 on 1 and 871 DF,  p-value: < 2.2e-16
lm6 <- lm(iprice ~ iwh + ikm +ipoi, data=tulsa_grid_all)
summary(lm6)
#> 
#> Call:
#> lm(formula = iprice ~ iwh + ikm + ipoi, data = tulsa_grid_all)
#> 
#> Residuals:
#>      Min       1Q   Median       3Q      Max 
#> -0.71555 -0.01402 -0.00477  0.00410  1.14917 
#> 
#> Coefficients:
#>              Estimate Std. Error t value Pr(>|t|)    
#> (Intercept) -0.020453   0.005326  -3.840 0.000132 ***
#> iwh          9.585743   0.320609  29.899  < 2e-16 ***
#> ikm         27.420207   4.522396   6.063 1.99e-09 ***
#> ipoi        -2.150736   0.863985  -2.489 0.012985 *  
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> Residual standard error: 0.08613 on 869 degrees of freedom
#> Multiple R-squared:  0.6361, Adjusted R-squared:  0.6349 
#> F-statistic: 506.4 on 3 and 869 DF,  p-value: < 2.2e-16
lm7 <- lm(iprice ~ iwh + ikm , data=tulsa_grid_all)
summary(lm7)
#> 
#> Call:
#> lm(formula = iprice ~ iwh + ikm, data = tulsa_grid_all)
#> 
#> Residuals:
#>      Min       1Q   Median       3Q      Max 
#> -0.67640 -0.01120 -0.00472  0.00189  1.16333 
#> 
#> Coefficients:
#>              Estimate Std. Error t value Pr(>|t|)    
#> (Intercept) -0.013661   0.004587  -2.978  0.00298 ** 
#> iwh          9.404558   0.313169  30.030  < 2e-16 ***
#> ikm         19.521115   3.231866   6.040 2.28e-09 ***
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> Residual standard error: 0.08639 on 870 degrees of freedom
#> Multiple R-squared:  0.6335, Adjusted R-squared:  0.6327 
#> F-statistic: 752.1 on 2 and 870 DF,  p-value: < 2.2e-16