Setting up my environment

packages <- c('rgdal', 'sf', 'spdep', 'tmap', 'tidyverse', 'dplyr')

for(p in packages){
  if(!require(p, character.only=T)){
    install.packages(p)
  }
  
  library(p,character.only=T)
}

Import bus stop polygon feature data in shape format

sf_busstop <- st_read(dsn="data/geospatial", layer="BusStop")
## Reading layer `BusStop' from data source `D:\download\SMU\[IS415] Geospatial Analytics and Applications\Take-home_Ex01\data\geospatial' using driver `ESRI Shapefile'
## Simple feature collection with 5040 features and 3 fields
## geometry type:  POINT
## dimension:      XY
## bbox:           xmin: 4427.938 ymin: 26482.1 xmax: 48282.5 ymax: 52983.82
## proj4string:    +proj=tmerc +lat_0=1.366666666666667 +lon_0=103.8333333333333 +k=1 +x_0=28001.642 +y_0=38744.572 +datum=WGS84 +units=m +no_defs

Import sub zone polygon feature data in shape format

mpsz <- st_read(dsn="data/geospatial", layer="MP14_SUBZONE_WEB_PL")
## Reading layer `MP14_SUBZONE_WEB_PL' from data source `D:\download\SMU\[IS415] Geospatial Analytics and Applications\Take-home_Ex01\data\geospatial' using driver `ESRI Shapefile'
## Simple feature collection with 323 features and 15 fields
## geometry type:  MULTIPOLYGON
## dimension:      XY
## bbox:           xmin: 2667.538 ymin: 15748.72 xmax: 56396.44 ymax: 50256.33
## proj4string:    +proj=tmerc +lat_0=1.366666666666667 +lon_0=103.8333333333333 +k=1 +x_0=28001.642 +y_0=38744.572 +datum=WGS84 +units=m +no_defs

Import passenger and population data as tibble DataFrame

passenger <- read_csv("data/aspatial/passenger volume by busstop.csv")
## Parsed with column specification:
## cols(
##   YEAR_MONTH = col_character(),
##   DAY_TYPE = col_character(),
##   TIME_PER_HOUR = col_double(),
##   PT_TYPE = col_character(),
##   PT_CODE = col_character(),
##   TOTAL_TAP_IN_VOLUME = col_double(),
##   TOTAL_TAP_OUT_VOLUME = col_double()
## )
population <- read_csv("data/aspatial/Resident Population by Planning AreaSubzone Age Group 2019.csv")
## Parsed with column specification:
## cols(
##   Time = col_double(),
##   PA = col_character(),
##   SZ = col_character(),
##   AG = col_character(),
##   Sex = col_character(),
##   TOD = col_character(),
##   Pop = col_double()
## )

View the passenger aspatial DataFrame content

list(passenger)
## [[1]]
## # A tibble: 197,389 x 7
##    YEAR_MONTH DAY_TYPE TIME_PER_HOUR PT_TYPE PT_CODE TOTAL_TAP_IN_VO~
##    <chr>      <chr>            <dbl> <chr>   <chr>              <dbl>
##  1 2020-01    WEEKEND~             6 BUS     67551                224
##  2 2020-01    WEEKDAY              6 BUS     67551               3922
##  3 2020-01    WEEKDAY              7 BUS     66541                648
##  4 2020-01    WEEKEND~             7 BUS     66541                127
##  5 2020-01    WEEKEND~            17 BUS     54209                736
##  6 2020-01    WEEKDAY             17 BUS     54209               1388
##  7 2020-01    WEEKEND~            12 BUS     61049                 92
##  8 2020-01    WEEKDAY             12 BUS     61049                140
##  9 2020-01    WEEKEND~            17 BUS     67611                442
## 10 2020-01    WEEKDAY             17 BUS     67611                765
## # ... with 197,379 more rows, and 1 more variable: TOTAL_TAP_OUT_VOLUME <dbl>

Viewing the content of a SpatialDataFrame

summary(sf_busstop)
##    BUS_STOP_N     BUS_ROOF_N                LOC_DESC             geometry   
##  51071  :   2   B01    : 694   BLK 101          :   7   POINT        :5040  
##  52059  :   2   B02    : 533   BLK 1            :   6   epsg:NA      :   0  
##  65331  :   2   B03    : 485   BLK 121          :   6   +proj=tmer...:   0  
##  65339  :   2   B04    : 417   BLK 2            :   6                       
##  68091  :   2   B05    : 339   OPP HONG SAN TERR:   6                       
##  68099  :   2   (Other):2570   (Other)          :4890                       
##  (Other):5028   NA's   :   2   NA's             : 119
head(sf_busstop)
## Simple feature collection with 6 features and 3 fields
## geometry type:  POINT
## dimension:      XY
## bbox:           xmin: 28404.77 ymin: 32981.18 xmax: 42227.96 ymax: 41300.92
## proj4string:    +proj=tmerc +lat_0=1.366666666666667 +lon_0=103.8333333333333 +k=1 +x_0=28001.642 +y_0=38744.572 +datum=WGS84 +units=m +no_defs 
##   BUS_STOP_N BUS_ROOF_N               LOC_DESC                  geometry
## 1      78221        B06                   <NA> POINT (42227.96 39563.16)
## 2      63359        B01      HOUGANG SWIM CPLX POINT (34065.75 39047.46)
## 3      64141        B13         AFT JLN TELAWI  POINT (36335.3 38525.74)
## 4      83139        B07       AFT JOO CHIAT PL POINT (36530.26 32981.18)
## 5      55231        B02 OPP SBST EAST DISTRICT POINT (29669.93 40841.51)
## 6      55351        B03      OPP FUDU WALK P/G POINT (28404.77 41300.92)
summary(population)
##       Time           PA                 SZ                 AG           
##  Min.   :2019   Length:98192       Length:98192       Length:98192      
##  1st Qu.:2019   Class :character   Class :character   Class :character  
##  Median :2019   Mode  :character   Mode  :character   Mode  :character  
##  Mean   :2019                                                           
##  3rd Qu.:2019                                                           
##  Max.   :2019                                                           
##      Sex                TOD                 Pop         
##  Length:98192       Length:98192       Min.   :   0.00  
##  Class :character   Class :character   1st Qu.:   0.00  
##  Mode  :character   Mode  :character   Median :   0.00  
##                                        Mean   :  41.08  
##                                        3rd Qu.:  20.00  
##                                        Max.   :2440.00

Plotting the bus stop Spatial Data

plot(sf_busstop)

Transform the coordinate reference system of bus stop and sub zone

sf_busstop3414 <- st_transform(sf_busstop, 3414)
st_crs(sf_busstop3414)
## Coordinate Reference System:
##   User input: EPSG:3414 
##   wkt:
## PROJCS["SVY21 / Singapore TM",
##     GEOGCS["SVY21",
##         DATUM["SVY21",
##             SPHEROID["WGS 84",6378137,298.257223563,
##                 AUTHORITY["EPSG","7030"]],
##             AUTHORITY["EPSG","6757"]],
##         PRIMEM["Greenwich",0,
##             AUTHORITY["EPSG","8901"]],
##         UNIT["degree",0.0174532925199433,
##             AUTHORITY["EPSG","9122"]],
##         AUTHORITY["EPSG","4757"]],
##     PROJECTION["Transverse_Mercator"],
##     PARAMETER["latitude_of_origin",1.366666666666667],
##     PARAMETER["central_meridian",103.8333333333333],
##     PARAMETER["scale_factor",1],
##     PARAMETER["false_easting",28001.642],
##     PARAMETER["false_northing",38744.572],
##     UNIT["metre",1,
##         AUTHORITY["EPSG","9001"]],
##     AUTHORITY["EPSG","3414"]]
mpsz_3414 <- st_transform(mpsz, 3414)
st_crs(mpsz_3414)
## Coordinate Reference System:
##   User input: EPSG:3414 
##   wkt:
## PROJCS["SVY21 / Singapore TM",
##     GEOGCS["SVY21",
##         DATUM["SVY21",
##             SPHEROID["WGS 84",6378137,298.257223563,
##                 AUTHORITY["EPSG","7030"]],
##             AUTHORITY["EPSG","6757"]],
##         PRIMEM["Greenwich",0,
##             AUTHORITY["EPSG","8901"]],
##         UNIT["degree",0.0174532925199433,
##             AUTHORITY["EPSG","9122"]],
##         AUTHORITY["EPSG","4757"]],
##     PROJECTION["Transverse_Mercator"],
##     PARAMETER["latitude_of_origin",1.366666666666667],
##     PARAMETER["central_meridian",103.8333333333333],
##     PARAMETER["scale_factor",1],
##     PARAMETER["false_easting",28001.642],
##     PARAMETER["false_northing",38744.572],
##     UNIT["metre",1,
##         AUTHORITY["EPSG","9001"]],
##     AUTHORITY["EPSG","3414"]]

Perform data wrangling and transformation on population

trans_population <- population %>%
  group_by(SZ) %>%
  summarise(Pop=sum(Pop)) %>%
  mutate_at(.vars = vars(SZ), .funs = funs(toupper))
## Warning: funs() is soft deprecated as of dplyr 0.8.0
## Please use a list of either functions or lambdas: 
## 
##   # Simple named list: 
##   list(mean = mean, median = median)
## 
##   # Auto named with `tibble::lst()`: 
##   tibble::lst(mean, median)
## 
##   # Using lambdas
##   list(~ mean(., trim = .2), ~ median(., na.rm = TRUE))
## This warning is displayed once per session.

Perform relational left join for sub zone and bus stop spatial data

subzone_bustop <- st_join(mpsz_3414, sf_busstop3414) %>%
  select(SUBZONE_N, BUS_STOP_N) %>%
  filter(!is.na(`BUS_STOP_N`))

Finding insights to passenger flow when tapping in and out volume data are compute together or separately

Transform passenger by totaling up tap in and out volume into tap volume

trans_passenger <- passenger %>%
  group_by(PT_CODE) %>%
  summarise(TAP_VOLUME=sum(TOTAL_TAP_IN_VOLUME, TOTAL_TAP_OUT_VOLUME))

Perform relational left join passenger tap volume with spatial data

subzone_passenger <- left_join(trans_passenger, subzone_bustop, by=c("PT_CODE" = "BUS_STOP_N")) %>%
  filter(!is.na(`SUBZONE_N`)) %>%
  group_by(SUBZONE_N) %>%
  summarise(TAP_VOLUME = sum(TAP_VOLUME))
## Warning: Column `PT_CODE`/`BUS_STOP_N` joining character vector and factor,
## coercing into character vector

Perform relational left join for spatial data with population count

subzone_passenger_pop <- left_join(subzone_passenger, trans_population, by=c("SUBZONE_N" = "SZ")) %>%
  mutate(`TAP_VOLUME` = round(TAP_VOLUME/1000, digits=1)) %>%
  filter(`Pop` > 0) %>%
  mutate(`Pop` = round(Pop/1000, digits=1))
## Warning: Column `SUBZONE_N`/`SZ` joining factor and character vector, coercing
## into character vector

Dropping sub zone with population 0 as those sub zone aren’t residential areas but factories or offices Tap volume and population are converted to represent in thousand

Create the linear regression to reveal the relation between public bus commuters’ flows and residential population at the planning sub-zone level

lm_subzone_passenger_pop_flow = lm(Pop~TAP_VOLUME, data=subzone_passenger_pop)
summary(lm_subzone_passenger_pop_flow)
## 
## Call:
## lm(formula = Pop ~ TAP_VOLUME, data = subzone_passenger_pop)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -47.814  -5.805  -0.993   5.047  46.639 
## 
## Coefficients:
##              Estimate Std. Error t value Pr(>|t|)    
## (Intercept) 3.2941784  1.1045386   2.982  0.00317 ** 
## TAP_VOLUME  0.0154371  0.0008376  18.431  < 2e-16 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 12.16 on 230 degrees of freedom
## Multiple R-squared:  0.5963, Adjusted R-squared:  0.5945 
## F-statistic: 339.7 on 1 and 230 DF,  p-value: < 2.2e-16

Based on the linear regression, I can infer that 59.45% of the variation in sub zone population is explained by the variation in the total tap in and out volume flow.

Plot linear regression graph

plot(Pop~TAP_VOLUME, data=subzone_passenger_pop)
abline(lm_subzone_passenger_pop_flow)

library(ggplot2)

ggplot(subzone_passenger_pop, aes(x=TAP_VOLUME, y=Pop)) + 
  geom_point() +
  stat_smooth(method="lm", col="red")
## `geom_smooth()` using formula 'y ~ x'

Plot the residuals graph

plot(lm_subzone_passenger_pop_flow$residuals, pch=16, col="red")
abline(h=0)

Based on the residual plot from tap in/out volume flows, it shows a fairly random pattern.

Finding insights to passenger flow when tapping in and out data compute separately

Transform passenger by totaling up tap in and out volume

trans_passenger <- passenger %>%
  group_by(PT_CODE) %>%
  summarise(TOTAL_TAP_IN_VOLUME=sum(TOTAL_TAP_IN_VOLUME), TOTAL_TAP_OUT_VOLUME=sum(TOTAL_TAP_OUT_VOLUME))

Perform relational left join passenger tap volume with spatial data

subzone_passenger <- left_join(trans_passenger, subzone_bustop, by=c("PT_CODE" = "BUS_STOP_N")) %>%
  filter(!is.na(`SUBZONE_N`)) %>%
  group_by(SUBZONE_N) %>%
  summarise(TOTAL_TAP_IN_VOLUME=sum(TOTAL_TAP_IN_VOLUME), TOTAL_TAP_OUT_VOLUME=sum(TOTAL_TAP_OUT_VOLUME))
## Warning: Column `PT_CODE`/`BUS_STOP_N` joining character vector and factor,
## coercing into character vector

Perform relational left join for spatial data with population count

subzone_passenger_pop <- left_join(subzone_passenger, trans_population, by=c("SUBZONE_N" = "SZ")) %>%
  mutate(`TOTAL_TAP_IN_VOLUME` = round(TOTAL_TAP_IN_VOLUME/1000, digits=1)) %>%
  mutate(`TOTAL_TAP_OUT_VOLUME` = round(TOTAL_TAP_OUT_VOLUME/1000, digits=1)) %>%
  filter(`Pop` > 0) %>%
  mutate(`Pop` = round(Pop/1000, digits=1))
## Warning: Column `SUBZONE_N`/`SZ` joining factor and character vector, coercing
## into character vector

Dropping sub zone with population 0 as those sub zone aren’t residential areas but factories or offices Tap in/out volume and population are converted to represent in thousand

Create the linear regression to reveal the relation between public bus commuters’ tap in flows and residential population at the planning sub-zone level

lm_subzone_passenger_pop_in_flow = lm(Pop~TOTAL_TAP_IN_VOLUME, data=subzone_passenger_pop)
summary(lm_subzone_passenger_pop_in_flow)
## 
## Call:
## lm(formula = Pop ~ TOTAL_TAP_IN_VOLUME, data = subzone_passenger_pop)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -45.950  -5.599  -1.059   5.215  48.974 
## 
## Coefficients:
##                     Estimate Std. Error t value Pr(>|t|)    
## (Intercept)         3.448438   1.107949   3.112  0.00209 ** 
## TOTAL_TAP_IN_VOLUME 0.030520   0.001674  18.237  < 2e-16 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 12.24 on 230 degrees of freedom
## Multiple R-squared:  0.5912, Adjusted R-squared:  0.5894 
## F-statistic: 332.6 on 1 and 230 DF,  p-value: < 2.2e-16

Based on the linear regression, I can infer that 58.94% of the variation in sub zone population is explained by the variation in the total tap in volume flow.

Create the linear regression to reveal the relation between public bus commuters’ tap out flows and residential population at the planning sub-zone level

lm_subzone_passenger_pop_out_flow = lm(Pop~TOTAL_TAP_OUT_VOLUME, data=subzone_passenger_pop)
summary(lm_subzone_passenger_pop_out_flow)
## 
## Call:
## lm(formula = Pop ~ TOTAL_TAP_OUT_VOLUME, data = subzone_passenger_pop)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -49.377  -5.627  -1.013   5.015  44.619 
## 
## Coefficients:
##                      Estimate Std. Error t value Pr(>|t|)    
## (Intercept)          3.278836   1.106568   2.963  0.00337 ** 
## TOTAL_TAP_OUT_VOLUME 0.030923   0.001681  18.400  < 2e-16 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 12.17 on 230 degrees of freedom
## Multiple R-squared:  0.5955, Adjusted R-squared:  0.5937 
## F-statistic: 338.6 on 1 and 230 DF,  p-value: < 2.2e-16

Based on the linear regression, I can infer that 59.37% of the variation in sub zone population is explained by the variation in the total tap in volume flow.

Plot linear regression graph for tap in volume

plot(Pop~TOTAL_TAP_IN_VOLUME, data=subzone_passenger_pop)
abline(lm_subzone_passenger_pop_in_flow)

library(ggplot2)

ggplot(subzone_passenger_pop, aes(x=TOTAL_TAP_IN_VOLUME, y=Pop)) + 
  geom_point() +
  stat_smooth(method="lm", col="red")
## `geom_smooth()` using formula 'y ~ x'

Plot the residuals graph for tap in volume

plot(lm_subzone_passenger_pop_in_flow$residuals, pch=16, col="red")
abline(h=0)

Plot linear regression graph for tap out volume

plot(Pop~TOTAL_TAP_OUT_VOLUME, data=subzone_passenger_pop)
abline(lm_subzone_passenger_pop_out_flow)

library(ggplot2)

ggplot(subzone_passenger_pop, aes(x=TOTAL_TAP_OUT_VOLUME, y=Pop)) + 
  geom_point() +
  stat_smooth(method="lm", col="red")
## `geom_smooth()` using formula 'y ~ x'

Plot the residuals graph for tap out volume

plot(lm_subzone_passenger_pop_out_flow$residuals, pch=16, col="red")
abline(h=0)

Based on the residual plot from tap in/out volume flows, it shows a fairly random pattern. I can infer from with the following observations: (1) The plot points are pretty symmetrically distributed, tending to cluster towards the middle of the plot (2) The plot points are clustered around the lower single digits of the y-axis (3) There is no clear patterns from the residual plot

Perform relational left join for sub zone and bus stop spatial data to get the coordinates and geometry

plot_subzone_passenger_pop <- left_join(mpsz_3414, subzone_passenger_pop, by=c("SUBZONE_N" = "SUBZONE_N")) %>%
  select(SUBZONE_N, X_ADDR, Y_ADDR, TOTAL_TAP_IN_VOLUME, TOTAL_TAP_OUT_VOLUME, Pop) %>%
  filter(!is.na(`Pop`))
## Warning: Column `SUBZONE_N` joining factor and character vector, coercing into
## character vector
coords <- coordinates(cbind(plot_subzone_passenger_pop$X_ADDR, plot_subzone_passenger_pop$Y_ADDR))

Turn on tmap interactive mode

tmap_mode("view")
## tmap mode set to interactive viewing

Plot the population in subzone level on choropleth map

qtm(plot_subzone_passenger_pop, fill="Pop")
## Warning: The shape plot_subzone_passenger_pop is invalid. See sf::st_is_valid

Based on the choropleth map, I can infer the top 3 highly populated subzone are in Tampines East (13.9k), followed by Woodlands East (98.6k), and Bedok North (82.7k).

Plot the tap in/out volume in the subzone on choropleth map

tap_in <- tm_shape(plot_subzone_passenger_pop)+
  tm_fill("TOTAL_TAP_IN_VOLUME", style="pretty")+
  tm_borders(alpha=0.5)
tap_out <- tm_shape(plot_subzone_passenger_pop)+
  tm_fill("TOTAL_TAP_OUT_VOLUME", style="pretty")+
  tm_borders(alpha=0.5)
tmap_arrange(tap_in, tap_out, asp=1, ncol=2)
## Warning: The shape plot_subzone_passenger_pop is invalid. See sf::st_is_valid

## Warning: The shape plot_subzone_passenger_pop is invalid. See sf::st_is_valid

Based on the choropleth map for tap in and out volume, I can infer that some sub zone level has more tap out volume such as Hougang central, Woodlands West, Frankel, Kaki Bukit, and Pasir Ris Central. I believe such high tap out volume is due to the citizens are commuting bus to work especially these areas are concentrated with factories and heavy industries within Singapore.

Switch tmap to plot mode

tmap_mode("plot")
## tmap mode set to plotting

Creating Queen contiguity weight matrix

wm_q <- poly2nb(plot_subzone_passenger_pop, queen=TRUE)
summary(wm_q)
## Neighbour list object:
## Number of regions: 232 
## Number of nonzero links: 1182 
## Percentage nonzero weights: 2.196046 
## Average number of links: 5.094828 
## Link number distribution:
## 
##  1  2  3  4  5  6  7  8  9 
##  4 10 26 35 69 41 31 12  4 
## 4 least connected regions:
## 13 202 220 231 with 1 link
## 4 most connected regions:
## 65 69 119 129 with 9 links

Based on the summary, there are 232 sub zone level in Singapore. The most connected sub zone has 9 neighbours. There are 4 area units with only one neighbour.

List the sub zone polygons in polygon 1

wm_q[[1]]
## [1]  2  6  7 12 22 24 25 26

Polygon 1 has 8 neighbors.

Finding Polygon 1 is associated with the subzone attribute PEARL’S HILL

plot_subzone_passenger_pop$SUBZONE_N[1]
## [1] "PEARL'S HILL"

The output reveals that Polygon ID=1 is PEARL’S HILL sub zone.

List the Polygon 1 neighboring polygons are associated with the sub zone

plot_subzone_passenger_pop$SUBZONE_N[c(2,6,7,12,22,24,25,26)]
## [1] "BOAT QUAY"      "BUKIT HO SWEE"  "CLARKE QUAY"    "ROBERTSON QUAY"
## [5] "PEOPLE'S PARK"  "CHINATOWN"      "CHINA SQUARE"   "TIONG BAHRU"

The output reveals that names of the sub zone associated with PEARL’S HILL sub zone.

List the complete weight matrix using str

str(wm_q)
## List of 232
##  $ : int [1:8] 2 6 7 12 22 24 25 26
##  $ : int [1:3] 1 7 25
##  $ : int [1:6] 4 6 10 17 23 27
##  $ : int [1:5] 3 5 10 23 69
##  $ : int [1:7] 4 9 10 21 23 29 69
##  $ : int [1:7] 1 3 10 12 26 27 65
##  $ : int [1:5] 1 2 12 25 60
##  $ : int [1:5] 19 30 35 52 55
##  $ : int [1:4] 5 21 29 46
##  $ : int [1:6] 3 4 5 6 65 69
##  $ : int [1:4] 12 28 34 60
##  $ : int [1:7] 1 6 7 11 34 60 65
##  $ : int 14
##  $ : int [1:6] 13 15 18 19 35 40
##  $ : int [1:6] 14 17 18 21 23 40
##  $ : int [1:3] 20 24 41
##  $ : int [1:7] 3 15 23 26 27 40 42
##  $ : int [1:4] 14 15 19 21
##  $ : int [1:4] 8 14 18 35
##  $ : int [1:2] 16 41
##  $ : int [1:5] 5 9 15 18 23
##  $ : int [1:2] 1 24
##  $ : int [1:7] 3 4 5 15 17 21 27
##  $ : int [1:6] 1 16 22 25 41 42
##  $ : int [1:4] 1 2 7 24
##  $ : int [1:4] 1 6 17 27
##  $ : int [1:5] 3 6 17 23 26
##  $ : int [1:5] 11 32 34 36 60
##  $ : int [1:6] 5 9 43 46 49 69
##  $ : int [1:4] 8 46 50 55
##  $ : int [1:5] 34 39 58 65 70
##  $ : int [1:6] 28 34 36 39 53 58
##  $ : int [1:6] 36 38 45 59 67 82
##  $ : int [1:8] 11 12 28 31 32 39 58 65
##  $ : int [1:4] 8 14 19 52
##  $ : int [1:5] 28 32 33 60 67
##  $ : int [1:3] 38 66 68
##  $ : int [1:4] 33 37 45 59
##  $ : int [1:5] 31 32 34 58 65
##  $ : int [1:4] 14 15 17 42
##  $ : int [1:3] 16 20 24
##  $ : int [1:3] 17 24 40
##  $ : int [1:5] 29 46 49 69 81
##  $ : int [1:3] 67 82 89
##  $ : int [1:4] 33 38 59 85
##  $ : int [1:7] 9 29 30 43 50 81 84
##  $ : int [1:4] 48 57 68 114
##  $ : int [1:5] 47 71 80 114 120
##  $ : int [1:5] 29 43 69 81 119
##  $ : int [1:5] 30 46 55 84 87
##  $ : int [1:7] 61 62 65 69 70 115 119
##  $ : int [1:5] 8 35 55 63 88
##  $ : int [1:4] 32 83 89 116
##  $ : int [1:3] 64 71 117
##  $ : int [1:7] 8 30 50 52 87 88 118
##  $ : int [1:3] 58 62 86
##  $ : int [1:5] 47 68 85 90 114
##  $ : int [1:8] 31 32 34 39 56 62 70 86
##  $ : int [1:6] 33 38 45 67 82 85
##  $ : int [1:5] 7 11 12 28 36
##  $ : int [1:4] 51 78 115 119
##  $ : int [1:8] 51 56 58 70 74 86 115 141
##  $ : int [1:4] 52 73 88 121
##  $ : int [1:4] 54 75 117 156
##  $ : int [1:9] 6 10 12 31 34 39 51 69 70
##  $ : int [1:2] 37 68
##  $ : int [1:5] 33 36 44 59 82
##  $ : int [1:5] 37 47 57 66 85
##  $ : int [1:9] 4 5 10 29 43 49 51 65 119
##  $ : int [1:5] 31 51 58 62 65
##  $ : int [1:4] 48 54 80 117
##  $ : int [1:5] 76 90 95 96 114
##  $ : int [1:3] 63 88 118
##  $ : int [1:7] 62 77 86 108 116 141 146
##  $ : int [1:5] 64 117 145 156 157
##  $ : int [1:7] 72 77 85 89 95 96 144
##  $ : int [1:6] 74 76 89 116 144 146
##  $ : int [1:6] 61 93 109 115 119 155
##  $ : int [1:6] 94 103 107 117 120 145
##  $ : int [1:4] 48 71 117 120
##  $ : int [1:6] 43 46 49 84 91 119
##  $ : int [1:6] 33 44 59 67 85 89
##  $ : int [1:3] 53 86 116
##  $ : int [1:5] 46 50 81 87 91
##  $ : int [1:7] 45 57 59 68 76 82 89
##  $ : int [1:6] 56 58 62 74 83 116
##  $ : int [1:6] 50 55 84 91 118 142
##  $ : int [1:5] 52 55 63 73 118
##  $ : int [1:7] 44 53 76 77 82 85 116
##  $ : int [1:3] 57 72 114
##  $ : int [1:6] 81 84 87 93 119 142
##  $ : int [1:3] 101 104 112
##  $ : int [1:6] 78 91 119 142 154 155
##  $ : int [1:7] 79 103 110 114 120 137 143
##  $ : int [1:6] 72 76 96 99 110 143
##  $ : int [1:7] 72 76 95 97 99 111 144
##  $ : int [1:5] 96 98 99 111 144
##  $ : int [1:5] 97 111 113 144 146
##  $ : int [1:7] 95 96 97 111 126 129 140
##   [list output truncated]
##  - attr(*, "class")= chr "nb"
##  - attr(*, "region.id")= chr [1:232] "1" "2" "3" "4" ...
##  - attr(*, "call")= language poly2nb(pl = plot_subzone_passenger_pop, queen = TRUE)
##  - attr(*, "type")= chr "queen"
##  - attr(*, "sym")= logi TRUE

Creating Rook contiguity weight matrix

wm_r <- poly2nb(plot_subzone_passenger_pop, queen=FALSE)
summary(wm_r)
## Neighbour list object:
## Number of regions: 232 
## Number of nonzero links: 1018 
## Percentage nonzero weights: 1.89135 
## Average number of links: 4.387931 
## Link number distribution:
## 
##  1  2  3  4  5  6  7  8 
##  7 17 38 67 49 32 18  4 
## 7 least connected regions:
## 13 202 207 210 220 228 231 with 1 link
## 4 most connected regions:
## 62 65 117 119 with 8 links

Based on the summary, there are 232 sub zone level in Singapore. The most connected sub zone has 8 neighbours. There are 7 area units with only one neighbour.

Plot Queen contiguity based neighbours map

plot(plot_subzone_passenger_pop$geometry, border="lightgrey")
plot(wm_q, coordinates(coords), pch=19, cex=0.6, add=TRUE, col="red", main="Queen Contiguity")

Plot Rook contiguity based neighbours map

plot(plot_subzone_passenger_pop$geometry, border="lightgrey")
plot(wm_r, coordinates(coords), pch=19, cex=0.6, add=TRUE, col="red", main="Rook Contiguity")

Based on Queen and Rook contiguity based neighbours map, in visually comparison from Rook contiguity map to Queen contiguity map, there is much lesser links connecting to each sub zone level.

Determine the upper limit for distance band

k1 <- knn2nb(knearneigh(coords))
k1dists <- unlist(nbdists(k1, coords))
summary(k1dists)
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##   182.5   616.6   879.3   914.3  1096.8  4597.9

Based on the summary, the largest first nearest neighbour distance is 4597.9 m. In order to be certain all units to have at least one neighbour, the computed distance used be used as the upper threshold.

Compute the fixed distance weight matrix using dnearneigh

wm_d4598 <- dnearneigh(coords, 0, 4598)
wm_d4598
## Neighbour list object:
## Number of regions: 232 
## Number of nonzero links: 8736 
## Percentage nonzero weights: 16.23068 
## Average number of links: 37.65517

Based on the result, neighbours within 4.598 km on on average have 38 number of links.

Plot the distance weight matrix

plot(plot_subzone_passenger_pop$geometry, border="lightgrey")
plot(wm_d4598, coords, add=TRUE, col="grey")
plot(k1, coords, add=TRUE, col="red", length=0.08)

Based on fixed distance weight matrix plot, the red lines show the links of 1st nearest neighbours and the grey lines show the links of neighbours within the cut-off distance of 4.598km (from 4598 meters).

Compute adaptive distance weight matrix

wm_knn4 <- knn2nb(knearneigh(coords, k=4))
wm_knn4
## Neighbour list object:
## Number of regions: 232 
## Number of nonzero links: 928 
## Percentage nonzero weights: 1.724138 
## Average number of links: 4 
## Non-symmetric neighbours list

The most regions has 4 neighbours, therefore choosing k-nearest neighbours as 4. Comparing with fixed distance weight matrix to adaptive distance weight matrix, the average number of links has 0.38 difference.

Display the content of the adaptive weight matrix for all regions with 4 neighbours

str(wm_knn4)
## List of 232
##  $ : int [1:4] 7 12 22 24
##  $ : int [1:4] 7 24 25 60
##  $ : int [1:4] 4 10 23 27
##  $ : int [1:4] 3 5 10 23
##  $ : int [1:4] 4 21 29 69
##  $ : int [1:4] 11 12 26 27
##  $ : int [1:4] 1 2 25 60
##  $ : int [1:4] 19 30 35 46
##  $ : int [1:4] 5 19 21 29
##  $ : int [1:4] 3 4 23 65
##  $ : int [1:4] 12 28 32 34
##  $ : int [1:4] 1 6 11 28
##  $ : int [1:4] 14 17 40 42
##  $ : int [1:4] 15 18 23 40
##  $ : int [1:4] 17 23 27 40
##  $ : int [1:4] 20 24 25 41
##  $ : int [1:4] 15 26 27 40
##  $ : int [1:4] 5 14 21 23
##  $ : int [1:4] 8 9 18 21
##  $ : int [1:4] 16 24 25 41
##  $ : int [1:4] 4 5 18 23
##  $ : int [1:4] 1 7 24 25
##  $ : int [1:4] 3 4 15 27
##  $ : int [1:4] 16 22 25 41
##  $ : int [1:4] 2 7 16 24
##  $ : int [1:4] 1 6 17 27
##  $ : int [1:4] 3 6 17 26
##  $ : int [1:4] 11 32 36 60
##  $ : int [1:4] 5 9 43 69
##  $ : int [1:4] 8 46 50 55
##  $ : int [1:4] 39 58 65 70
##  $ : int [1:4] 11 28 34 36
##  $ : int [1:4] 38 44 59 67
##  $ : int [1:4] 11 28 32 39
##  $ : int [1:4] 8 9 19 30
##  $ : int [1:4] 28 32 60 67
##  $ : int [1:4] 33 38 45 66
##  $ : int [1:4] 33 37 45 67
##  $ : int [1:4] 31 34 58 70
##  $ : int [1:4] 15 17 23 27
##  $ : int [1:4] 16 20 22 24
##  $ : int [1:4] 17 22 24 41
##  $ : int [1:4] 29 46 49 81
##  $ : int [1:4] 33 59 67 82
##  $ : int [1:4] 59 66 82 85
##  $ : int [1:4] 9 43 49 81
##  $ : int [1:4] 48 57 68 90
##  $ : int [1:4] 47 71 80 114
##  $ : int [1:4] 43 46 69 81
##  $ : int [1:4] 30 55 84 87
##  $ : int [1:4] 29 49 69 115
##  $ : int [1:4] 30 55 63 88
##  $ : int [1:4] 32 44 83 86
##  $ : int [1:4] 64 71 79 117
##  $ : int [1:4] 50 52 87 88
##  $ : int [1:4] 58 62 70 86
##  $ : int [1:4] 47 68 85 90
##  $ : int [1:4] 31 39 56 70
##  $ : int [1:4] 33 44 45 82
##  $ : int [1:4] 2 7 28 36
##  $ : int [1:4] 49 78 115 119
##  $ : int [1:4] 56 70 86 115
##  $ : int [1:4] 73 88 118 121
##  $ : int [1:4] 54 75 145 156
##  $ : int [1:4] 10 31 39 70
##  $ : int [1:4] 37 38 45 68
##  $ : int [1:4] 33 36 38 44
##  $ : int [1:4] 37 45 57 66
##  $ : int [1:4] 5 29 49 51
##  $ : int [1:4] 31 39 56 58
##  $ : int [1:4] 48 80 117 120
##  $ : int [1:4] 76 90 95 96
##  $ : int [1:4] 63 88 118 142
##  $ : int [1:4] 83 86 108 116
##  $ : int [1:4] 54 64 145 157
##  $ : int [1:4] 72 77 96 144
##  $ : int [1:4] 76 98 144 146
##  $ : int [1:4] 61 109 115 119
##  $ : int [1:4] 103 107 117 120
##  $ : int [1:4] 48 71 117 120
##  $ : int [1:4] 43 49 84 119
##  $ : int [1:4] 44 45 59 89
##  $ : int [1:4] 53 56 86 116
##  $ : int [1:4] 50 81 87 91
##  $ : int [1:4] 45 59 66 82
##  $ : int [1:4] 53 56 58 83
##  $ : int [1:4] 50 55 84 91
##  $ : int [1:4] 52 55 63 118
##  $ : int [1:4] 44 59 82 116
##  $ : int [1:4] 57 72 76 114
##  $ : int [1:4] 50 84 87 93
##  $ : int [1:4] 101 104 112 124
##  $ : int [1:4] 91 142 154 155
##  $ : int [1:4] 103 110 120 143
##  $ : int [1:4] 72 96 99 110
##  $ : int [1:4] 95 97 99 144
##  $ : int [1:4] 96 98 111 144
##  $ : int [1:4] 97 111 113 144
##  $ : int [1:4] 96 97 111 140
##   [list output truncated]
##  - attr(*, "region.id")= chr [1:232] "1" "2" "3" "4" ...
##  - attr(*, "call")= language knearneigh(x = coords, k = 4)
##  - attr(*, "sym")= logi FALSE
##  - attr(*, "type")= chr "knn"
##  - attr(*, "knn-k")= num 4
##  - attr(*, "class")= chr "nb"

Plot the adaptive weight distance based neighbours

plot(plot_subzone_passenger_pop$geometry, border="lightgrey")
plot(wm_knn4, coords, pch=19, cex=0.6, add=TRUE, col="red")

Plot the fixed distance weight matrix to be compared with adaptive distance weight matrix

plot(plot_subzone_passenger_pop$geometry, border="lightgrey")
plot(k1, coords, add=TRUE, col="red", length=0.08)

Based on fixed distance weight matrix plot, show the links of 1st nearest neighbours and the adaptive weight distance matrix plot show region links with 4 neighbours which explains the density of the links.

Compute Row-standardised weights matrix

rswm_q <- nb2listw(wm_q, style="C", zero.policy=TRUE)
summary(rswm_q)
## Characteristics of weights list object:
## Neighbour list object:
## Number of regions: 232 
## Number of nonzero links: 1182 
## Percentage nonzero weights: 2.196046 
## Average number of links: 5.094828 
## Link number distribution:
## 
##  1  2  3  4  5  6  7  8  9 
##  4 10 26 35 69 41 31 12  4 
## 4 least connected regions:
## 13 202 220 231 with 1 link
## 4 most connected regions:
## 65 69 119 129 with 9 links
## 
## Weights style: C 
## Weights constants summary:
##     n    nn  S0       S1       S2
## C 232 53824 232 91.07276 1024.761

The reason to choose C is globally standardised (sums over all links to n) to compute row-standarised weights matrix.

View the weight of the first polygon

rswm_q$weights[1]
## [[1]]
## [1] 0.1962775 0.1962775 0.1962775 0.1962775 0.1962775 0.1962775 0.1962775
## [8] 0.1962775

Each neighbor is assigned a 0.1962775 of the total weight. The average neighboring passenger tap volume, each neighbor’s passenger tap volume will be multiplied by 0.1962775 before being tallied.

Compute the average neighbor tap in volume value for each sub zone (spatial lagged values)

GDPPC.lag_tap_in <- lag.listw(rswm_q, plot_subzone_passenger_pop$TOTAL_TAP_IN_VOLUME)
head(GDPPC.lag_tap_in, n=33)
##  [1] 345.13435 126.81489 371.06261 310.25584 298.45956 409.55262 137.39425
##  [8] 250.35195 231.90186 377.97157  64.81083 214.33503 159.41658 242.65787
## [15] 422.60508 122.30051 472.49882 264.48393 320.01083  37.27310 311.00169
## [22] 148.87648 491.75364 205.30626 207.01387 277.45787 263.85584 194.31472
## [29] 342.87716 253.72792 244.20846 265.89712 303.03283

Compute the average neighbor tap out volume value for each sub zone (spatial lagged values)

GDPPC.lag_tap_out <- lag.listw(rswm_q, plot_subzone_passenger_pop$TOTAL_TAP_OUT_VOLUME)
head(GDPPC.lag_tap_out, n=33)
##  [1] 347.92149 104.85144 371.25888 314.61320 302.03181 378.08934 151.78139
##  [8] 241.44095 280.22538 372.69171  70.24772 191.54721 159.53435 240.98951
## [15] 458.38646 112.40812 464.45144 248.17327 337.30288  32.30728 345.99797
## [22] 119.37597 491.96954 213.43215 172.19425 261.81455 278.49814 192.45008
## [29] 354.49679 272.41354 231.86261 262.79594 286.11371

Append spatially lag tap in volume values

lag.list <- list(plot_subzone_passenger_pop$SUBZONE_N, lag.listw(rswm_q, plot_subzone_passenger_pop$TOTAL_TAP_IN_VOLUME))
lag.res <- as.data.frame(lag.list)
colnames(lag.res) <- c("SUBZONE_N", "lag tap_in")
plot_subzone_passenger_pop <- left_join(plot_subzone_passenger_pop, lag.res)
## Joining, by = "SUBZONE_N"
## Warning: Column `SUBZONE_N` joining character vector and factor, coercing into
## character vector

# Append spatially lag tap out volume values

lag.list <- list(plot_subzone_passenger_pop$SUBZONE_N, lag.listw(rswm_q, plot_subzone_passenger_pop$TOTAL_TAP_OUT_VOLUME))
lag.res <- as.data.frame(lag.list)
colnames(lag.res) <- c("SUBZONE_N", "lag tap_out")
plot_subzone_passenger_pop <- left_join(plot_subzone_passenger_pop, lag.res)
## Joining, by = "SUBZONE_N"
## Warning: Column `SUBZONE_N` joining character vector and factor, coercing into
## character vector

Turn on tmap interactive mode

tmap_mode("view")
## tmap mode set to interactive viewing

Plot tap in volume and spatial lag tap in volume for comparison

tap_in <- qtm(plot_subzone_passenger_pop, "TOTAL_TAP_IN_VOLUME")
## Warning: The shape plot_subzone_passenger_pop is invalid. See sf::st_is_valid
lag_tap_in <- qtm(plot_subzone_passenger_pop, "lag tap_in")
## Warning: The shape plot_subzone_passenger_pop is invalid. See sf::st_is_valid
tmap_arrange(tap_in, lag_tap_in, asp=1, ncol=2)

Plot tap out volume and spatial lag tap out volume for comparison

tap_out <- qtm(plot_subzone_passenger_pop, "TOTAL_TAP_OUT_VOLUME")
## Warning: The shape plot_subzone_passenger_pop is invalid. See sf::st_is_valid
lag_tap_out <- qtm(plot_subzone_passenger_pop, "lag tap_out")
## Warning: The shape plot_subzone_passenger_pop is invalid. See sf::st_is_valid
tmap_arrange(tap_out, lag_tap_out, asp=1, ncol=2)

Switch tmap to plot mode

tmap_mode("plot")
## tmap mode set to plotting

Computing Moran’s I for tap in volume

moran.test(plot_subzone_passenger_pop$TOTAL_TAP_IN_VOLUME, listw=rswm_q, zero.policy=TRUE, na.action=na.omit)
## 
##  Moran I test under randomisation
## 
## data:  plot_subzone_passenger_pop$TOTAL_TAP_IN_VOLUME  
## weights: rswm_q    
## 
## Moran I statistic standard deviate = 5.136, p-value = 1.403e-07
## alternative hypothesis: greater
## sample estimates:
## Moran I statistic       Expectation          Variance 
##       0.198231208      -0.004329004       0.001555444

Since p-value less than alpha value of 0.05, will reject null hypothesis. Therefore, passenger tap in volume in the sub zone in Singapore is not randomly distributed among other sub zones. Since we reject the null hypothesis and Moran I statistic is more than 0 it show signs of clustering.

Computing Moran’s I for tap out volume

moran.test(plot_subzone_passenger_pop$TOTAL_TAP_OUT_VOLUME, listw=rswm_q, zero.policy=TRUE, na.action=na.omit)
## 
##  Moran I test under randomisation
## 
## data:  plot_subzone_passenger_pop$TOTAL_TAP_OUT_VOLUME  
## weights: rswm_q    
## 
## Moran I statistic standard deviate = 5.4803, p-value = 2.123e-08
## alternative hypothesis: greater
## sample estimates:
## Moran I statistic       Expectation          Variance 
##       0.212084728      -0.004329004       0.001559405

Since p-value less than alpha value of 0.05, will reject null hypothesis. Therefore, passenger tap out volume in the sub zone in Singapore is not randomly distributed among other sub zones. Since we reject the null hypothesis and Moran I statistic is more than 0 it show signs of clustering.

Computing Monte Carlo Moran’s I for tap in volume

set.seed(1234)
bperm_tap_in= moran.mc(plot_subzone_passenger_pop$TOTAL_TAP_IN_VOLUME, listw=rswm_q, nsim=999, zero.policy=TRUE, na.action=na.omit)
bperm_tap_in
## 
##  Monte-Carlo simulation of Moran I
## 
## data:  plot_subzone_passenger_pop$TOTAL_TAP_IN_VOLUME 
## weights: rswm_q  
## number of simulations + 1: 1000 
## 
## statistic = 0.19823, observed rank = 1000, p-value = 0.001
## alternative hypothesis: greater

Visualising Monte Carlo Moran’s I for tap in volume

mean(bperm_tap_in$res[1:999])
## [1] -0.004342403
var(bperm_tap_in$res[1:999])
## [1] 0.001499091
summary(bperm_tap_in$res[1:999])
##      Min.   1st Qu.    Median      Mean   3rd Qu.      Max. 
## -0.110134 -0.030536 -0.006368 -0.004342  0.019623  0.193428

Computing Monte Carlo Moran’s I for tap out volume

set.seed(1234)
bperm_tap_out= moran.mc(plot_subzone_passenger_pop$TOTAL_TAP_OUT_VOLUME, listw=rswm_q, nsim=999, zero.policy=TRUE, na.action=na.omit)
bperm_tap_out
## 
##  Monte-Carlo simulation of Moran I
## 
## data:  plot_subzone_passenger_pop$TOTAL_TAP_OUT_VOLUME 
## weights: rswm_q  
## number of simulations + 1: 1000 
## 
## statistic = 0.21208, observed rank = 1000, p-value = 0.001
## alternative hypothesis: greater

Visualising Monte Carlo Moran’s I for tap out volume

mean(bperm_tap_out$res[1:999])
## [1] -0.004350665
var(bperm_tap_out$res[1:999])
## [1] 0.001549479
summary(bperm_tap_out$res[1:999])
##      Min.   1st Qu.    Median      Mean   3rd Qu.      Max. 
## -0.101971 -0.030935 -0.006101 -0.004351  0.021131  0.206109

Visualising Monte Carlo Moran’s I for tap in/out volume Histogram

par(mfrow=c(1,2))

hist(bperm_tap_in$res, freq=TRUE, breaks=20, xlab="Simulated Moran's I For Tap In Volume")
abline(v=0, col="red")

hist(bperm_tap_out$res, freq=TRUE, breaks=20, xlab="Simulated Moran's I For Tap Out Volume")
abline(v=0, col="red")

Based on the Moran’s I tap in/out volume, the historgram shows a fairly normal distribution.

Visualising spatial lag value using Moran scatterplot for tap in volume

MS_tap_in <- moran.plot(plot_subzone_passenger_pop$TOTAL_TAP_IN_VOLUME, rswm_q, zero.policy=TRUE, spChk=FALSE, labels=as.character(plot_subzone_passenger_pop$SUBZONE_N), xlab="TAP_IN_VOLUME", ylab="Spatially Lag TAP_IN_VOLUME")

Visualising spatial lag value using Moran scatterplot for tap out volume

MS_tap_out <- moran.plot(plot_subzone_passenger_pop$TOTAL_TAP_OUT_VOLUME, rswm_q, zero.policy=TRUE, spChk=FALSE, labels=as.character(plot_subzone_passenger_pop$SUBZONE_N), xlab="TAP_OUT_VOLUME", ylab="Spatially Lag TAP_OUT_VOLUME")

Based on both tap in/out Moran scatterplot, the top right corner indicates sub zones that have high tap in/out volume and are surrounded by other sub zones that have the average level of tap in/out volume.

Compute Moran’s I correlogram and plot for tap in volume

MI_corr_tap_in <- sp.correlogram(wm_q, plot_subzone_passenger_pop$TOTAL_TAP_IN_VOLUME, order=12, method="I", style="C")
plot(MI_corr_tap_in)

The Moran’s I correlogram on tap in volume, shows that as the lags increases between the pairs of spatial observations tends to be dispersed.

Compute Moran’s I correlogram and plot for tap out volume

MI_corr_tap_out <- sp.correlogram(wm_q, plot_subzone_passenger_pop$TOTAL_TAP_OUT_VOLUME, order=12, method="I", style="C")
plot(MI_corr_tap_out)

The Moran’s I correlogram on tap out volume, shows that as the lags increases between the pairs of spatial observations tends to be dispersed.

Computing local Moran’s I for tap in volume

fips <- order(plot_subzone_passenger_pop$SUBZONE_N)
localMI_tap_in <- localmoran(plot_subzone_passenger_pop$TOTAL_TAP_IN_VOLUME, rswm_q)
head(localMI_tap_in)
##            Ii         E.Ii    Var.Ii       Z.Ii Pr(z > 0)
## 1  0.29472656 -0.006797489 0.2804492  0.5693703 0.2845524
## 2  0.24833724 -0.002549058 0.1073621  0.7656874 0.2219312
## 3  0.05049090 -0.005098117 0.2120918  0.1207055 0.4519622
## 4  0.07030360 -0.004248431 0.1774744  0.1769667 0.4297673
## 5 -0.05926424 -0.005947803 0.2464168 -0.1074054 0.5427663
## 6  0.25169602 -0.005947803 0.2464168  0.5190206 0.3018732

Computing local Moran’s I for tap out volume

localMI_tap_out <- localmoran(plot_subzone_passenger_pop$TOTAL_TAP_OUT_VOLUME, rswm_q)
head(localMI_tap_out)
##            Ii         E.Ii    Var.Ii       Z.Ii Pr(z > 0)
## 1  0.39369046 -0.006797489 0.2811366  0.7553196 0.2250286
## 2  0.24708038 -0.002549058 0.1076318  0.7608965 0.2233595
## 3  0.08380089 -0.005098117 0.2126169  0.1927960 0.4235594
## 4  0.07501422 -0.004248431 0.1779159  0.1879149 0.4254717
## 5 -0.21236477 -0.005947803 0.2470238 -0.4153135 0.6610438
## 6  0.28825284 -0.005947803 0.2470238  0.5919353 0.2769469

View the local Moran matrix for tap in volume

printCoefmat(data.frame(localMI_tap_in[fips,], row.names=plot_subzone_passenger_pop$SUBZONE_N[fips]), check.names=FALSE)
##                                        Ii        E.Ii      Var.Ii        Z.Ii
## ADMIRALTY                      0.16581152 -0.00424843  0.17747438  0.40367719
## ALEXANDRA HILL                -0.05926424 -0.00594780  0.24641675 -0.10740537
## ALEXANDRA NORTH                0.27314502 -0.00509812  0.21209181  0.60417466
## ALJUNIED                       0.27066746 -0.00679749  0.28044922  0.52393935
## ANAK BUKIT                    -0.38345398 -0.00509812  0.21209181 -0.82155855
## ANCHORVALE                     0.01903741 -0.00339874  0.14256447  0.05942140
## ANG MO KIO TOWN CENTRE         0.04940097 -0.00594780  0.24641675  0.11149948
## BALESTIER                      0.23398415 -0.00509812  0.21209181  0.51914111
## BANGKIT                        0.00253904 -0.00254906  0.10736208  0.01552851
## BAYSHORE                      -0.10892847 -0.00339874  0.14256447 -0.27949184
## BEDOK NORTH                    6.39738481 -0.00679749  0.28044922 12.09307013
## BEDOK RESERVOIR                0.48631908 -0.00424843  0.17747438  1.16447708
## BEDOK SOUTH                    1.10851355 -0.00424843  0.17747438  2.64140164
## BENCOOLEN                      0.36631756 -0.00509812  0.21209181  0.80648868
## BENDEMEER                     -0.04558528 -0.00594780  0.24641675 -0.07984926
## BISHAN EAST                   -0.29352782 -0.00764718  0.31418919 -0.51002227
## BOAT QUAY                      0.24833724 -0.00254906  0.10736208  0.76568736
## BOON KENG                     -0.06328691 -0.00254906  0.10736208 -0.18536766
## BOON LAY PLACE                 0.62385429 -0.00424843  0.17747438  1.49094917
## BOON TECK                     -0.02760419 -0.00424843  0.17747438 -0.05544038
## BOULEVARD                     -0.60889821 -0.00679749  0.28044922 -1.13695175
## BRADDELL                      -0.15999095 -0.00424843  0.17747438 -0.36969141
## BRICKWORKS                    -0.01312568 -0.00339874  0.14256447 -0.02576146
## BUGIS                          0.01215364 -0.00254906  0.10736208  0.04487161
## BUKIT BATOK CENTRAL           -0.34933197 -0.00424843  0.17747438 -0.81913674
## BUKIT BATOK EAST              -0.00602182 -0.00339874  0.14256447 -0.00694713
## BUKIT BATOK SOUTH              0.01241601 -0.00594780  0.24641675  0.03699371
## BUKIT BATOK WEST              -0.04638200 -0.00509812  0.21209181 -0.08964347
## BUKIT HO SWEE                  0.25169602 -0.00594780  0.24641675  0.51902063
## BUKIT MERAH                    0.06035336 -0.00594780  0.24641675  0.13356296
## CECIL                          0.19420751 -0.00254906  0.10736208  0.60048723
## CENTRAL SUBZONE                0.22075152 -0.00169937  0.07186720  0.82979113
## CHANGI POINT                   0.06657080 -0.00084969  0.03607984  0.35494378
## CHANGI WEST                   -0.32694959 -0.00509812  0.21209181 -0.69886542
## CHATSWORTH                     0.56573405 -0.00764718  0.31418919  1.02293455
## CHENG SAN                      0.16068306 -0.00509812  0.21209181  0.35997576
## CHINA SQUARE                   0.21394314 -0.00339874  0.14256447  0.57562252
## CHINATOWN                     -0.04339313 -0.00509812  0.21209181 -0.08315346
## CHOA CHU KANG CENTRAL         -0.06296270 -0.00424843  0.17747438 -0.13937210
## CHOA CHU KANG NORTH           -0.08601234 -0.00424843  0.17747438 -0.19408582
## CHONG BOON                     0.31296868 -0.00594780  0.24641675  0.64245372
## CLARKE QUAY                    0.28386124 -0.00424843  0.17747438  0.68389589
## CLEMENTI CENTRAL              -0.52672403 -0.00424843  0.17747438 -1.24021842
## CLEMENTI NORTH                -0.01925959 -0.00424843  0.17747438 -0.03563250
## CLEMENTI WEST                  0.00876611 -0.00424843  0.17747438  0.03089306
## CLEMENTI WOODS                -0.01628770 -0.00594780  0.24641675 -0.02082961
## COMMONWEALTH                   0.17591220 -0.00424843  0.17747438  0.42765353
## COMPASSVALE                   -0.28619314 -0.00594780  0.24641675 -0.56455113
## CORONATION ROAD                0.29263085 -0.00509812  0.21209181  0.64648603
## CRAWFORD                       0.13742709 -0.00424843  0.17747438  0.33630009
## DAIRY FARM                    -0.01380698 -0.00424843  0.17747438 -0.02268946
## DEPOT ROAD                     0.21073964 -0.00424843  0.17747438  0.51032462
## DHOBY GHAUT                    0.17188790 -0.00424843  0.17747438  0.41810091
## DOVER                          0.13912533 -0.00424843  0.17747438  0.34033126
## DUNEARN                        0.36607102 -0.00424843  0.17747438  0.87904011
## EVERTON PARK                   0.08697627 -0.00254906  0.10736208  0.27322503
## FABER                         -0.21150219 -0.00254906  0.10736208 -0.63771030
## FAJAR                         -0.07947110 -0.00254906  0.10736208 -0.23476069
## FARRER COURT                   0.35151899 -0.00339874  0.14256447  0.93998743
## FARRER PARK                   -0.03281087 -0.00509812  0.21209181 -0.06017522
## FERNVALE                      -0.00018274 -0.00509812  0.21209181  0.01067320
## FLORA DRIVE                   -0.65759549 -0.00424843  0.17747438 -1.55087253
## FORT CANNING                   0.48299139 -0.00424843  0.17747438  1.15657803
## FRANKEL                        1.71720614 -0.00679749  0.28044922  3.25545024
## GEYLANG BAHRU                 -0.09212850 -0.00424843  0.17747438 -0.20860397
## GEYLANG EAST                   2.12018571 -0.00679749  0.28044922  4.01639988
## GHIM MOH                       0.27167966 -0.00424843  0.17747438  0.65498007
## GOMBAK                         0.03457511 -0.00679749  0.28044922  0.07812423
## GOODWOOD PARK                  0.29654480 -0.00509812  0.21209181  0.65498475
## GUILIN                         0.02094807 -0.00509812  0.21209181  0.05655645
## HENDERSON HILL                 0.05049090 -0.00509812  0.21209181  0.12070549
## HILLCREST                      0.40326919 -0.00424843  0.17747438  0.96733868
## HILLVIEW                       0.12439760 -0.00594780  0.24641675  0.26257937
## HOLLAND DRIVE                  0.28851366 -0.00509812  0.21209181  0.63754599
## HOLLAND ROAD                  -0.00341379 -0.00509812  0.21209181  0.00365734
## HONG KAH                       0.19217795 -0.00424843  0.17747438  0.46626410
## HONG KAH NORTH                 0.00392819 -0.00339874  0.14256447  0.01940514
## HOUGANG CENTRAL                0.36463875 -0.00424843  0.17747438  0.87564026
## HOUGANG EAST                  -0.06217511 -0.00424843  0.17747438 -0.13750257
## HOUGANG WEST                   0.38143498 -0.00594780  0.24641675  0.78037832
## INSTITUTION HILL               0.52481390 -0.00339874  0.14256447  1.39895305
## JELEBU                        -0.61442347 -0.00594780  0.24641675 -1.22576750
## JOO SENG                       0.02000109 -0.00424843  0.17747438  0.05756193
## JURONG GATEWAY                -0.20259447 -0.00254906  0.10736208 -0.61052456
## JURONG WEST CENTRAL            1.12466383 -0.00254906  0.10736208  3.44017465
## KAKI BUKIT                     1.71485107 -0.00424843  0.17747438  4.08068600
## KAMPONG BUGIS                 -0.20966522 -0.00424843  0.17747438 -0.48760495
## KAMPONG GLAM                   0.06909273 -0.00169937  0.07186720  0.26407021
## KAMPONG JAVA                  -0.05074192 -0.00594780  0.24641675 -0.09023726
## KAMPONG TIONG BAHRU            0.16571790 -0.00594780  0.24641675  0.34581865
## KAMPONG UBI                    0.54708525 -0.00594780  0.24641675  1.11407896
## KANGKAR                       -0.00162578 -0.00424843  0.17747438  0.00622548
## KATONG                        -0.24137305 -0.00339874  0.14256447 -0.63026677
## KEAT HONG                     -0.04151619 -0.00424843  0.17747438 -0.08846377
## KEBUN BAHRU                   -0.00070459 -0.00424843  0.17747438  0.00841213
## KEMBANGAN                      1.34815662 -0.00509812  0.21209181  2.93844527
## KHATIB                        -0.03054193 -0.00594780  0.24641675 -0.04954460
## KIM KEAT                      -0.29194303 -0.00509812  0.21209181 -0.62285248
## KOVAN                          0.01914721 -0.00594780  0.24641675  0.05055362
## LAKESIDE                      -0.53056436 -0.00509812  0.21209181 -1.14099271
## LAVENDER                      -0.16492172 -0.00594780  0.24641675 -0.32025120
## LEEDON PARK                    0.57136680 -0.00764718  0.31418919  1.03298360
## LEONIE HILL                    0.56592018 -0.00679749  0.28044922  1.08146749
## LIM CHU KANG                  -0.00394988 -0.00084969  0.03607984 -0.01632137
## LITTLE INDIA                   0.30468191 -0.00509812  0.21209181  0.67265360
## LORONG 8 TOA PAYOH             0.19236224 -0.00594780  0.24641675  0.39949338
## LORONG AH SOO                  0.46646150 -0.00509812  0.21209181  1.02394035
## LORONG CHUAN                  -0.35380892 -0.00594780  0.24641675 -0.70076238
## LOWER SELETAR                  0.00415065 -0.00424843  0.17747438  0.01993718
## LOYANG EAST                    0.29356304 -0.00254906  0.10736208  0.90371333
## LOYANG WEST                    0.23011768 -0.00424843  0.17747438  0.55632294
## MACKENZIE                      0.16411853 -0.00254906  0.10736208  0.50865778
## MACPHERSON                     0.19690133 -0.00509812  0.21209181  0.43861979
## MALCOLM                       -0.09916964 -0.00594780  0.24641675 -0.18779436
## MANDAI ESTATE                 -0.32445231 -0.00169937  0.07186720 -1.20393999
## MARGARET DRIVE                 0.28013749 -0.00764718  0.31418919  0.51341911
## MARINE PARADE                 -0.07757115 -0.00339874  0.14256447 -0.19644306
## MARITIME SQUARE               -0.45473525 -0.00509812  0.21209181 -0.97633807
## MARYMOUNT                      0.15330636 -0.00509812  0.21209181  0.34395806
## MATILDA                        0.32230209 -0.00679749  0.28044922  0.62144145
## MEI CHIN                       0.15439150 -0.00509812  0.21209181  0.34631434
## MIDVIEW                        0.05248415 -0.00254906  0.10736208  0.16795749
## MONK'S HILL                    0.14086873 -0.00339874  0.14256447  0.38208744
## MOULMEIN                      -0.03707452 -0.00509812  0.21209181 -0.06943327
## MOUNT PLEASANT                 0.00104900 -0.00424843  0.17747438  0.01257470
## MOUNTBATTEN                   -0.51560901 -0.00424843  0.17747438 -1.21383431
## NASSIM                         0.37546406 -0.00679749  0.28044922  0.72182763
## NATIONAL UNIVERSITY OF S'PORE  0.09307569 -0.00339874  0.14256447  0.25550922
## NATURE RESERVE                 0.14061320 -0.00339874  0.14256447  0.38141069
## NEE SOON                       0.27343591 -0.00254906  0.10736208  0.84228674
## NEWTON CIRCUS                  0.14957148 -0.00254906  0.10736208  0.46426122
## NORTH COAST                    0.17277637 -0.00084969  0.03607984  0.91407658
## NORTHLAND                      0.11798710 -0.00424843  0.17747438  0.29015472
## NORTHSHORE                     0.20656217 -0.00169937  0.07186720  0.77686172
## ONE NORTH                      0.19829710 -0.00594780  0.24641675  0.41144910
## ONE TREE HILL                  0.33971243 -0.00424843  0.17747438  0.81647180
## ORANGE GROVE                   0.12944278 -0.00254906  0.10736208  0.40282983
## OXLEY                          0.46080115 -0.00424843  0.17747438  1.10390429
## PASIR PANJANG 1                0.11845739 -0.00424843  0.17747438  0.29127105
## PASIR PANJANG 2                0.04142544 -0.00339874  0.14256447  0.11871531
## PASIR RIS CENTRAL              1.54575325 -0.00424843  0.17747438  3.67929264
## PASIR RIS DRIVE                1.11305089 -0.00509812  0.21209181  2.42793879
## PASIR RIS PARK                -0.21693620 -0.00339874  0.14256447 -0.56554661
## PASIR RIS WEST                -0.00280299 -0.00254906  0.10736208 -0.00077497
## PATERSON                       0.14556641 -0.00424843  0.17747438  0.35562066
## PEARL'S HILL                   0.29472656 -0.00679749  0.28044922  0.56937034
## PEI CHUN                       0.27396625 -0.00424843  0.17747438  0.66040781
## PENG SIANG                     0.02240242 -0.00339874  0.14256447  0.06833351
## PEOPLE'S PARK                  0.02464814 -0.00169937  0.07186720  0.09828207
## PORT                           0.05111216 -0.00339874  0.14256447  0.14437026
## POTONG PASIR                   0.23533602 -0.00594780  0.24641675  0.48606358
## PUNGGOL FIELD                  0.24930385 -0.00424843  0.17747438  0.60186584
## PUNGGOL TOWN CENTRE            0.09513805 -0.00424843  0.17747438  0.23591714
## QUEENSWAY                      0.18700841 -0.00339874  0.14256447  0.50428680
## REDHILL                        0.07030360 -0.00424843  0.17747438  0.17696674
## RIDOUT                         0.60626538 -0.00594780  0.24641675  1.23329667
## RIVERVALE                      0.57190933 -0.00509812  0.21209181  1.25290882
## ROBERTSON QUAY                 0.49003040 -0.00594780  0.24641675  0.99914259
## SAUJANA                       -0.06650717 -0.00254906  0.10736208 -0.19519567
## SELEGIE                        0.38930024 -0.00424843  0.17747438  0.93418010
## SELETAR                       -0.03065015 -0.00254906  0.10736208 -0.08576257
## SELETAR HILLS                 -0.16003187 -0.00424843  0.17747438 -0.36978855
## SEMBAWANG CENTRAL              0.13154282 -0.00339874  0.14256447  0.35738809
## SEMBAWANG EAST                -0.00883222 -0.00424843  0.17747438 -0.01088071
## SEMBAWANG HILLS                0.06346012 -0.00424843  0.17747438  0.16072213
## SEMBAWANG NORTH               -0.01013868 -0.00169937  0.07186720 -0.03148047
## SEMBAWANG SPRINGS             -0.19888613 -0.00424843  0.17747438 -0.46201825
## SEMBAWANG STRAITS              0.20346365 -0.00169937  0.07186720  0.76530353
## SENGKANG TOWN CENTRE           0.88295953 -0.00424843  0.17747438  2.10599625
## SENJA                         -0.03849127 -0.00339874  0.14256447 -0.09294135
## SENNETT                        0.08768856 -0.00509812  0.21209181  0.20147615
## SENTOSA                       -0.13627807 -0.00084969  0.03607984 -0.71298004
## SERANGOON CENTRAL              0.08840060 -0.00424843  0.17747438  0.21992420
## SERANGOON GARDEN               0.38815256 -0.00679749  0.28044922  0.74578743
## SERANGOON NORTH               -0.02241089 -0.00424843  0.17747438 -0.04311285
## SHANGRI-LA                    -0.11036139 -0.00509812  0.21209181 -0.22856773
## SIGLAP                        -0.15097524 -0.00254906  0.10736208 -0.45298629
## SIMEI                          2.29276907 -0.00509812  0.21209181  4.98956833
## SINGAPORE POLYTECHNIC          0.15164888 -0.00509812  0.21209181  0.34035903
## SOMERSET                      -0.06824971 -0.00509812  0.21209181 -0.13712680
## SPRINGLEAF                     0.23922357 -0.00424843  0.17747438  0.57793792
## SUNGEI ROAD                    0.16587561 -0.00339874  0.14256447  0.44831732
## SUNSET WAY                     0.01135076 -0.00509812  0.21209181  0.03571695
## SWISS CLUB                     0.14156964 -0.00424843  0.17747438  0.34613340
## TAGORE                         0.41540769 -0.00424843  0.17747438  0.99615225
## TAI SENG                      -0.02953136 -0.00424843  0.17747438 -0.06001497
## TAMAN JURONG                   0.34156162 -0.00254906  0.10736208  1.05020164
## TAMPINES EAST                  3.95428869 -0.00679749  0.28044922  7.47975163
## TAMPINES NORTH                -1.13876172 -0.00424843  0.17747438 -2.69303347
## TAMPINES WEST                  5.26039728 -0.00424843  0.17747438 12.49687176
## TANGLIN                        0.32887075 -0.00424843  0.17747438  0.79073653
## TANGLIN HALT                   0.14221567 -0.00424843  0.17747438  0.34766690
## TANJONG PAGAR                  0.22471735 -0.00254906  0.10736208  0.69360114
## TANJONG RHU                   -0.08150138 -0.00339874  0.14256447 -0.20685215
## TEBAN GARDENS                  0.02367698 -0.00169937  0.07186720  0.09465943
## TECK WHYE                      0.02196122 -0.00509812  0.21209181  0.05875641
## TELOK BLANGAH DRIVE            0.02715240 -0.00339874  0.14256447  0.08091367
## TELOK BLANGAH RISE             0.05324528 -0.00339874  0.14256447  0.15001975
## TELOK BLANGAH WAY              0.11078476 -0.00509812  0.21209181  0.25162705
## TIONG BAHRU                    0.08547226 -0.00339874  0.14256447  0.23537179
## TIONG BAHRU STATION           -0.23064406 -0.00424843  0.17747438 -0.53740315
## TOA PAYOH CENTRAL             -0.85593203 -0.00594780  0.24641675 -1.71228381
## TOA PAYOH WEST                -0.22593771 -0.00509812  0.21209181 -0.47952913
## TOH GUAN                      -0.02906920 -0.00339874  0.14256447 -0.06798733
## TOWNSVILLE                    -0.01779557 -0.00594780  0.24641675 -0.02386720
## TRAFALGAR                     -0.00257015 -0.00424843  0.17747438  0.00398379
## TURF CLUB                     -0.04590689 -0.00169937  0.07186720 -0.16490383
## TYERSALL                       0.42794596 -0.00594780  0.24641675  0.87407417
## ULU PANDAN                     0.43232947 -0.00509812  0.21209181  0.94982637
## UPPER PAYA LEBAR              -0.06018377 -0.00509812  0.21209181 -0.11961249
## UPPER THOMSON                 -0.14374594 -0.00339874  0.14256447 -0.37170473
## VICTORIA                      -0.05198980 -0.00339874  0.14256447 -0.12869175
## WATERWAY EAST                  0.02376295 -0.00339874  0.14256447  0.07193683
## WENYA                         -0.88968895 -0.00424843  0.17747438 -2.10180081
## WEST COAST                    -0.13267610 -0.00339874  0.14256447 -0.34238664
## WESTERN WATER CATCHMENT        0.00668394 -0.00594780  0.24641675  0.02544650
## WOODGROVE                      0.00514433 -0.00339874  0.14256447  0.02262605
## WOODLANDS EAST                 0.43847015 -0.00254906  0.10736208  1.34595968
## WOODLANDS SOUTH                0.04381237 -0.00254906  0.10736208  0.14149182
## WOODLANDS WEST                 0.14098957 -0.00254906  0.10736208  0.43806981
## WOODLEIGH                      0.30312986 -0.00594780  0.24641675  0.62263353
## XILIN                         -1.44474309 -0.00509812  0.21209181 -3.12603226
## YEW TEE                       -0.00737182 -0.00169937  0.07186720 -0.02115950
## YIO CHU KANG EAST             -0.21907268 -0.00254906  0.10736208 -0.66081489
## YIO CHU KANG WEST              0.00457508 -0.00339874  0.14256447  0.02111841
## YISHUN CENTRAL                 1.48041058 -0.00424843  0.17747438  3.52418648
## YISHUN EAST                    0.40755157 -0.00339874  0.14256447  1.08838779
## YISHUN SOUTH                   0.49471923 -0.00509812  0.21209181  1.08529893
## YISHUN WEST                    0.32964242 -0.00594780  0.24641675  0.67604278
## YUHUA EAST                     0.00627044 -0.00424843  0.17747438  0.02496902
## YUHUA WEST                     0.02485466 -0.00339874  0.14256447  0.07482817
## YUNNAN                         1.23757654 -0.00339874  0.14256447  3.28668040
##                               Pr.z...0.
## ADMIRALTY                        0.3432
## ALEXANDRA HILL                   0.5428
## ALEXANDRA NORTH                  0.2729
## ALJUNIED                         0.3002
## ANAK BUKIT                       0.7943
## ANCHORVALE                       0.4763
## ANG MO KIO TOWN CENTRE           0.4556
## BALESTIER                        0.3018
## BANGKIT                          0.4938
## BAYSHORE                         0.6101
## BEDOK NORTH                      0.0000
## BEDOK RESERVOIR                  0.1221
## BEDOK SOUTH                      0.0041
## BENCOOLEN                        0.2100
## BENDEMEER                        0.5318
## BISHAN EAST                      0.6950
## BOAT QUAY                        0.2219
## BOON KENG                        0.5735
## BOON LAY PLACE                   0.0680
## BOON TECK                        0.5221
## BOULEVARD                        0.8722
## BRADDELL                         0.6442
## BRICKWORKS                       0.5103
## BUGIS                            0.4821
## BUKIT BATOK CENTRAL              0.7936
## BUKIT BATOK EAST                 0.5028
## BUKIT BATOK SOUTH                0.4852
## BUKIT BATOK WEST                 0.5357
## BUKIT HO SWEE                    0.3019
## BUKIT MERAH                      0.4469
## CECIL                            0.2741
## CENTRAL SUBZONE                  0.2033
## CHANGI POINT                     0.3613
## CHANGI WEST                      0.7577
## CHATSWORTH                       0.1532
## CHENG SAN                        0.3594
## CHINA SQUARE                     0.2824
## CHINATOWN                        0.5331
## CHOA CHU KANG CENTRAL            0.5554
## CHOA CHU KANG NORTH              0.5769
## CHONG BOON                       0.2603
## CLARKE QUAY                      0.2470
## CLEMENTI CENTRAL                 0.8926
## CLEMENTI NORTH                   0.5142
## CLEMENTI WEST                    0.4877
## CLEMENTI WOODS                   0.5083
## COMMONWEALTH                     0.3345
## COMPASSVALE                      0.7138
## CORONATION ROAD                  0.2590
## CRAWFORD                         0.3683
## DAIRY FARM                       0.5091
## DEPOT ROAD                       0.3049
## DHOBY GHAUT                      0.3379
## DOVER                            0.3668
## DUNEARN                          0.1897
## EVERTON PARK                     0.3923
## FABER                            0.7382
## FAJAR                            0.5928
## FARRER COURT                     0.1736
## FARRER PARK                      0.5240
## FERNVALE                         0.4957
## FLORA DRIVE                      0.9395
## FORT CANNING                     0.1237
## FRANKEL                          0.0006
## GEYLANG BAHRU                    0.5826
## GEYLANG EAST                     0.0000
## GHIM MOH                         0.2562
## GOMBAK                           0.4689
## GOODWOOD PARK                    0.2562
## GUILIN                           0.4774
## HENDERSON HILL                   0.4520
## HILLCREST                        0.1667
## HILLVIEW                         0.3964
## HOLLAND DRIVE                    0.2619
## HOLLAND ROAD                     0.4985
## HONG KAH                         0.3205
## HONG KAH NORTH                   0.4923
## HOUGANG CENTRAL                  0.1906
## HOUGANG EAST                     0.5547
## HOUGANG WEST                     0.2176
## INSTITUTION HILL                 0.0809
## JELEBU                           0.8899
## JOO SENG                         0.4770
## JURONG GATEWAY                   0.7292
## JURONG WEST CENTRAL              0.0003
## KAKI BUKIT                       0.0000
## KAMPONG BUGIS                    0.6871
## KAMPONG GLAM                     0.3959
## KAMPONG JAVA                     0.5360
## KAMPONG TIONG BAHRU              0.3647
## KAMPONG UBI                      0.1326
## KANGKAR                          0.4975
## KATONG                           0.7357
## KEAT HONG                        0.5352
## KEBUN BAHRU                      0.4966
## KEMBANGAN                        0.0016
## KHATIB                           0.5198
## KIM KEAT                         0.7333
## KOVAN                            0.4798
## LAKESIDE                         0.8731
## LAVENDER                         0.6256
## LEEDON PARK                      0.1508
## LEONIE HILL                      0.1397
## LIM CHU KANG                     0.5065
## LITTLE INDIA                     0.2506
## LORONG 8 TOA PAYOH               0.3448
## LORONG AH SOO                    0.1529
## LORONG CHUAN                     0.7583
## LOWER SELETAR                    0.4920
## LOYANG EAST                      0.1831
## LOYANG WEST                      0.2890
## MACKENZIE                        0.3055
## MACPHERSON                       0.3305
## MALCOLM                          0.5745
## MANDAI ESTATE                    0.8857
## MARGARET DRIVE                   0.3038
## MARINE PARADE                    0.5779
## MARITIME SQUARE                  0.8356
## MARYMOUNT                        0.3654
## MATILDA                          0.2672
## MEI CHIN                         0.3646
## MIDVIEW                          0.4333
## MONK'S HILL                      0.3512
## MOULMEIN                         0.5277
## MOUNT PLEASANT                   0.4950
## MOUNTBATTEN                      0.8876
## NASSIM                           0.2352
## NATIONAL UNIVERSITY OF S'PORE    0.3992
## NATURE RESERVE                   0.3514
## NEE SOON                         0.1998
## NEWTON CIRCUS                    0.3212
## NORTH COAST                      0.1803
## NORTHLAND                        0.3858
## NORTHSHORE                       0.2186
## ONE NORTH                        0.3404
## ONE TREE HILL                    0.2071
## ORANGE GROVE                     0.3435
## OXLEY                            0.1348
## PASIR PANJANG 1                  0.3854
## PASIR PANJANG 2                  0.4528
## PASIR RIS CENTRAL                0.0001
## PASIR RIS DRIVE                  0.0076
## PASIR RIS PARK                   0.7141
## PASIR RIS WEST                   0.5003
## PATERSON                         0.3611
## PEARL'S HILL                     0.2846
## PEI CHUN                         0.2545
## PENG SIANG                       0.4728
## PEOPLE'S PARK                    0.4609
## PORT                             0.4426
## POTONG PASIR                     0.3135
## PUNGGOL FIELD                    0.2736
## PUNGGOL TOWN CENTRE              0.4067
## QUEENSWAY                        0.3070
## REDHILL                          0.4298
## RIDOUT                           0.1087
## RIVERVALE                        0.1051
## ROBERTSON QUAY                   0.1589
## SAUJANA                          0.5774
## SELEGIE                          0.1751
## SELETAR                          0.5342
## SELETAR HILLS                    0.6442
## SEMBAWANG CENTRAL                0.3604
## SEMBAWANG EAST                   0.5043
## SEMBAWANG HILLS                  0.4362
## SEMBAWANG NORTH                  0.5126
## SEMBAWANG SPRINGS                0.6780
## SEMBAWANG STRAITS                0.2220
## SENGKANG TOWN CENTRE             0.0176
## SENJA                            0.5370
## SENNETT                          0.4202
## SENTOSA                          0.7621
## SERANGOON CENTRAL                0.4130
## SERANGOON GARDEN                 0.2279
## SERANGOON NORTH                  0.5172
## SHANGRI-LA                       0.5904
## SIGLAP                           0.6747
## SIMEI                            0.0000
## SINGAPORE POLYTECHNIC            0.3668
## SOMERSET                         0.5545
## SPRINGLEAF                       0.2817
## SUNGEI ROAD                      0.3270
## SUNSET WAY                       0.4858
## SWISS CLUB                       0.3646
## TAGORE                           0.1596
## TAI SENG                         0.5239
## TAMAN JURONG                     0.1468
## TAMPINES EAST                    0.0000
## TAMPINES NORTH                   0.9965
## TAMPINES WEST                    0.0000
## TANGLIN                          0.2145
## TANGLIN HALT                     0.3640
## TANJONG PAGAR                    0.2440
## TANJONG RHU                      0.5819
## TEBAN GARDENS                    0.4623
## TECK WHYE                        0.4766
## TELOK BLANGAH DRIVE              0.4678
## TELOK BLANGAH RISE               0.4404
## TELOK BLANGAH WAY                0.4007
## TIONG BAHRU                      0.4070
## TIONG BAHRU STATION              0.7045
## TOA PAYOH CENTRAL                0.9566
## TOA PAYOH WEST                   0.6842
## TOH GUAN                         0.5271
## TOWNSVILLE                       0.5095
## TRAFALGAR                        0.4984
## TURF CLUB                        0.5655
## TYERSALL                         0.1910
## ULU PANDAN                       0.1711
## UPPER PAYA LEBAR                 0.5476
## UPPER THOMSON                    0.6449
## VICTORIA                         0.5512
## WATERWAY EAST                    0.4713
## WENYA                            0.9822
## WEST COAST                       0.6340
## WESTERN WATER CATCHMENT          0.4898
## WOODGROVE                        0.4910
## WOODLANDS EAST                   0.0892
## WOODLANDS SOUTH                  0.4437
## WOODLANDS WEST                   0.3307
## WOODLEIGH                        0.2668
## XILIN                            0.9991
## YEW TEE                          0.5084
## YIO CHU KANG EAST                0.7456
## YIO CHU KANG WEST                0.4916
## YISHUN CENTRAL                   0.0002
## YISHUN EAST                      0.1382
## YISHUN SOUTH                     0.1389
## YISHUN WEST                      0.2495
## YUHUA EAST                       0.4900
## YUHUA WEST                       0.4702
## YUNNAN                           0.0005

View the local Moran matrix for tap out volume

printCoefmat(data.frame(localMI_tap_out[fips,], row.names=plot_subzone_passenger_pop$SUBZONE_N[fips]), check.names=FALSE)
##                                        Ii        E.Ii      Var.Ii        Z.Ii
## ADMIRALTY                      0.13395651 -0.00424843  0.17791592  0.32765453
## ALEXANDRA HILL                -0.21236477 -0.00594780  0.24702376 -0.41531349
## ALEXANDRA NORTH                0.29945389 -0.00509812  0.21261688  0.66048445
## ALJUNIED                       0.17623973 -0.00679749  0.28113657  0.34520790
## ANAK BUKIT                    -0.30403866 -0.00509812  0.21261688 -0.64831482
## ANCHORVALE                     0.02235592 -0.00339874  0.14292088  0.06812525
## ANG MO KIO TOWN CENTRE         0.00363632 -0.00594780  0.24702376  0.01928337
## BALESTIER                      0.20133081 -0.00509812  0.21261688  0.44768413
## BANGKIT                       -0.00105269 -0.00254906  0.10763177  0.00456109
## BAYSHORE                      -0.19453475 -0.00339874  0.14292088 -0.50558557
## BEDOK NORTH                    7.36048444 -0.00679749  0.28113657 13.89468212
## BEDOK RESERVOIR                0.31289757 -0.00424843  0.17791592  0.75188573
## BEDOK SOUTH                    1.23206299 -0.00424843  0.17791592  2.93103148
## BENCOOLEN                      0.41160522 -0.00509812  0.21261688  0.90370797
## BENDEMEER                     -0.06863643 -0.00594780  0.24702376 -0.12613028
## BISHAN EAST                   -0.37720533 -0.00764718  0.31495531 -0.65850385
## BOAT QUAY                      0.24708038 -0.00254906  0.10763177  0.76089645
## BOON KENG                     -0.08593123 -0.00254906  0.10763177 -0.25415752
## BOON LAY PLACE                 0.63046857 -0.00424843  0.17791592  1.50477905
## BOON TECK                     -0.01105862 -0.00424843  0.17791592 -0.01614550
## BOULEVARD                     -0.86575532 -0.00679749  0.28113657 -1.61999312
## BRADDELL                      -0.20648224 -0.00424843  0.17791592 -0.47945336
## BRICKWORKS                    -0.01247322 -0.00339874  0.14292088 -0.02400346
## BUGIS                          0.00584097 -0.00254906  0.10763177  0.02557369
## BUKIT BATOK CENTRAL           -0.28683461 -0.00424843  0.17791592 -0.66995174
## BUKIT BATOK EAST              -0.01938812 -0.00339874  0.14292088 -0.04229449
## BUKIT BATOK SOUTH              0.01825344 -0.00594780  0.24702376  0.04869320
## BUKIT BATOK WEST              -0.03767706 -0.00509812  0.21261688 -0.07065422
## BUKIT HO SWEE                  0.28825284 -0.00594780  0.24702376  0.59193533
## BUKIT MERAH                    0.03154198 -0.00594780  0.24702376  0.07542990
## CECIL                          0.21485361 -0.00254906  0.10763177  0.66266590
## CENTRAL SUBZONE                0.19383037 -0.00169937  0.07204859  0.72845056
## CHANGI POINT                   0.08650502 -0.00084969  0.03617133  0.45930806
## CHANGI WEST                   -0.43961345 -0.00509812  0.21261688 -0.94233699
## CHATSWORTH                     0.63935754 -0.00764718  0.31495531  1.15287701
## CHENG SAN                      0.14017043 -0.00509812  0.21261688  0.31504510
## CHINA SQUARE                   0.23757495 -0.00339874  0.14292088  0.63741429
## CHINATOWN                      0.08559372 -0.00509812  0.21261688  0.19668413
## CHOA CHU KANG CENTRAL         -0.04326819 -0.00424843  0.17791592 -0.09250754
## CHOA CHU KANG NORTH           -0.10614067 -0.00424843  0.17791592 -0.24156483
## CHONG BOON                     0.48651024 -0.00594780  0.24702376  0.99083164
## CLARKE QUAY                    0.39058827 -0.00424843  0.17791592  0.93607386
## CLEMENTI CENTRAL              -0.40014088 -0.00424843  0.17791592 -0.93857680
## CLEMENTI NORTH                -0.06776822 -0.00424843  0.17791592 -0.15059192
## CLEMENTI WEST                  0.01372140 -0.00424843  0.17791592  0.04260264
## CLEMENTI WOODS                -0.01116020 -0.00594780  0.24702376 -0.01048740
## COMMONWEALTH                   0.23206255 -0.00424843  0.17791592  0.56024309
## COMPASSVALE                   -0.26398200 -0.00594780  0.24702376 -0.51916798
## CORONATION ROAD                0.33943128 -0.00509812  0.21261688  0.74718374
## CRAWFORD                       0.12304222 -0.00424843  0.17791592  0.30177905
## DAIRY FARM                     0.02552271 -0.00424843  0.17791592  0.07058105
## DEPOT ROAD                     0.15120220 -0.00424843  0.17791592  0.36854038
## DHOBY GHAUT                    0.13383204 -0.00424843  0.17791592  0.32735943
## DOVER                          0.11887149 -0.00424843  0.17791592  0.29189115
## DUNEARN                        0.46081196 -0.00424843  0.17791592  1.10255930
## EVERTON PARK                   0.08797597 -0.00254906  0.10763177  0.27592968
## FABER                         -0.18783634 -0.00254906  0.10763177 -0.56477487
## FAJAR                         -0.07346931 -0.00254906  0.10763177 -0.21617228
## FARRER COURT                   0.36637497 -0.00339874  0.14292088  0.97811111
## FARRER PARK                    0.01320833 -0.00509812  0.21261688  0.03970134
## FERNVALE                      -0.00261770 -0.00509812  0.21261688  0.00537931
## FLORA DRIVE                   -0.56496246 -0.00424843  0.17791592 -1.32933372
## FORT CANNING                   0.46928713 -0.00424843  0.17791592  1.12265212
## FRANKEL                        2.23976182 -0.00679749  0.28113657  4.23700732
## GEYLANG BAHRU                 -0.10077721 -0.00424843  0.17791592 -0.22884922
## GEYLANG EAST                   2.13725444 -0.00679749  0.28113657  4.04367856
## GHIM MOH                       0.25418123 -0.00424843  0.17791592  0.61268177
## GOMBAK                         0.00741255 -0.00679749  0.28113657  0.02680011
## GOODWOOD PARK                  0.29229983 -0.00509812  0.21261688  0.64496940
## GUILIN                         0.03534244 -0.00509812  0.21261688  0.08770378
## HENDERSON HILL                 0.08380089 -0.00509812  0.21261688  0.19279602
## HILLCREST                      0.43631287 -0.00424843  0.17791592  1.04447715
## HILLVIEW                       0.12166058 -0.00594780  0.24702376  0.25674964
## HOLLAND DRIVE                  0.29093587 -0.00509812  0.21261688  0.64201136
## HOLLAND ROAD                   0.03655363 -0.00509812  0.21261688  0.09033049
## HONG KAH                       0.25481740 -0.00424843  0.17791592  0.61419000
## HONG KAH NORTH                 0.03298066 -0.00339874  0.14292088  0.09622939
## HOUGANG CENTRAL                0.42036164 -0.00424843  0.17791592  1.00666017
## HOUGANG EAST                  -0.07784292 -0.00424843  0.17791592 -0.17447687
## HOUGANG WEST                   0.37162046 -0.00594780  0.24702376  0.75967200
## INSTITUTION HILL               0.50771511 -0.00339874  0.14292088  1.35197859
## JELEBU                        -0.65253167 -0.00594780  0.24702376 -1.30093470
## JOO SENG                       0.00834532 -0.00424843  0.17791592  0.02985710
## JURONG GATEWAY                -0.13385572 -0.00254906  0.10763177 -0.40023633
## JURONG WEST CENTRAL            1.06833538 -0.00254906  0.10763177  3.26416696
## KAKI BUKIT                     1.94212908 -0.00424843  0.17791592  4.61444719
## KAMPONG BUGIS                 -0.21606674 -0.00424843  0.17791592 -0.50217618
## KAMPONG GLAM                   0.05784031 -0.00169937  0.07204859  0.22181646
## KAMPONG JAVA                  -0.02364215 -0.00594780  0.24702376 -0.03560125
## KAMPONG TIONG BAHRU            0.14935403 -0.00594780  0.24702376  0.31246921
## KAMPONG UBI                    0.67027516 -0.00594780  0.24702376  1.36056892
## KANGKAR                       -0.02339076 -0.00424843  0.17791592 -0.04538240
## KATONG                        -0.21875304 -0.00339874  0.14292088 -0.56964685
## KEAT HONG                      0.00808775 -0.00424843  0.17791592  0.02924646
## KEBUN BAHRU                    0.00236159 -0.00424843  0.17791592  0.01567095
## KEMBANGAN                      1.38009367 -0.00509812  0.21261688  3.00407687
## KHATIB                         0.15042350 -0.00594780  0.24702376  0.31462098
## KIM KEAT                      -0.43037725 -0.00509812  0.21261688 -0.92230637
## KOVAN                         -0.01647154 -0.00594780  0.24702376 -0.02117388
## LAKESIDE                      -0.44933644 -0.00509812  0.21261688 -0.96342332
## LAVENDER                      -0.12261725 -0.00594780  0.24702376 -0.23474036
## LEEDON PARK                    0.66620250 -0.00764718  0.31495531  1.20071118
## LEONIE HILL                    0.62202176 -0.00679749  0.28113657  1.18595211
## LIM CHU KANG                  -0.02027978 -0.00084969  0.03617133 -0.10216278
## LITTLE INDIA                   0.36945132 -0.00509812  0.21261688  0.81228846
## LORONG 8 TOA PAYOH             0.10908111 -0.00594780  0.24702376  0.23143960
## LORONG AH SOO                  0.48614636 -0.00509812  0.21261688  1.06536595
## LORONG CHUAN                  -0.47040624 -0.00594780  0.24702376 -0.93449609
## LOWER SELETAR                 -0.02531522 -0.00424843  0.17791592 -0.04994488
## LOYANG EAST                    0.30858957 -0.00254906  0.10763177  0.94838285
## LOYANG WEST                    0.21354280 -0.00424843  0.17791592  0.51633669
## MACKENZIE                      0.19925838 -0.00254906  0.10763177  0.61513002
## MACPHERSON                     0.17960044 -0.00509812  0.21261688  0.40055728
## MALCOLM                       -0.05727225 -0.00594780  0.24702376 -0.10326542
## MANDAI ESTATE                 -0.43446709 -0.00169937  0.07204859 -1.61228614
## MARGARET DRIVE                 0.37602326 -0.00764718  0.31495531  0.68365008
## MARINE PARADE                 -0.01865276 -0.00339874  0.14292088 -0.04034934
## MARITIME SQUARE               -0.46661058 -0.00509812  0.21261688 -1.00088589
## MARYMOUNT                      0.11421511 -0.00509812  0.21261688  0.25875559
## MATILDA                        0.33226068 -0.00679749  0.28113657  0.63946317
## MEI CHIN                       0.09464394 -0.00509812  0.21261688  0.21631142
## MIDVIEW                        0.03989878 -0.00254906  0.10763177  0.12938543
## MONK'S HILL                    0.20623919 -0.00339874  0.14292088  0.55452615
## MOULMEIN                      -0.00826947 -0.00509812  0.21261688 -0.00687774
## MOUNT PLEASANT                 0.03136328 -0.00424843  0.17791592  0.08442779
## MOUNTBATTEN                   -0.47992544 -0.00424843  0.17791592 -1.12772904
## NASSIM                         0.42371825 -0.00679749  0.28113657  0.81195202
## NATIONAL UNIVERSITY OF S'PORE  0.08411510 -0.00339874  0.14292088  0.23148824
## NATURE RESERVE                 0.11661377 -0.00339874  0.14292088  0.31745244
## NEE SOON                       0.14052062 -0.00254906  0.10763177  0.43609123
## NEWTON CIRCUS                  0.20990795 -0.00254906  0.10763177  0.64759102
## NORTH COAST                    0.35471599 -0.00084969  0.03617133  1.86955213
## NORTHLAND                      0.09293748 -0.00424843  0.17791592  0.23040714
## NORTHSHORE                     0.20924487 -0.00169937  0.07204859  0.78587765
## ONE NORTH                      0.11182659 -0.00594780  0.24702376  0.23696352
## ONE TREE HILL                  0.36540510 -0.00424843  0.17791592  0.87636991
## ORANGE GROVE                   0.10114882 -0.00254906  0.10763177  0.31608188
## OXLEY                          0.47985028 -0.00424843  0.17791592  1.14769509
## PASIR PANJANG 1                0.11087747 -0.00424843  0.17791592  0.27293903
## PASIR PANJANG 2                0.02768063 -0.00339874  0.14292088  0.08220997
## PASIR RIS CENTRAL              1.65638423 -0.00424843  0.17791592  3.93700691
## PASIR RIS DRIVE                1.06429347 -0.00509812  0.21261688  2.31919837
## PASIR RIS PARK                -0.20795820 -0.00339874  0.14292088 -0.54109276
## PASIR RIS WEST                 0.00180040 -0.00254906  0.10763177  0.01325759
## PATERSON                       0.22951308 -0.00424843  0.17791592  0.55419883
## PEARL'S HILL                   0.39369046 -0.00679749  0.28113657  0.75531964
## PEI CHUN                       0.21030399 -0.00424843  0.17791592  0.50865816
## PENG SIANG                    -0.00426690 -0.00339874  0.14292088 -0.00229641
## PEOPLE'S PARK                  0.03490821 -0.00169937  0.07204859  0.13638239
## PORT                           0.05004365 -0.00339874  0.14292088  0.14136375
## POTONG PASIR                   0.18705273 -0.00594780  0.24702376  0.38831946
## PUNGGOL FIELD                  0.17011643 -0.00424843  0.17791592  0.41338201
## PUNGGOL TOWN CENTRE            0.09565785 -0.00424843  0.17791592  0.23685654
## QUEENSWAY                      0.12173748 -0.00339874  0.14292088  0.33100550
## REDHILL                        0.07501422 -0.00424843  0.17791592  0.18791488
## RIDOUT                         0.61446957 -0.00594780  0.24702376  1.24828739
## RIVERVALE                      0.58722429 -0.00509812  0.21261688  1.28457450
## ROBERTSON QUAY                 0.50987034 -0.00594780  0.24702376  1.03783245
## SAUJANA                       -0.08242707 -0.00254906  0.10763177 -0.24347647
## SELEGIE                        0.42022094 -0.00424843  0.17791592  1.00632662
## SELETAR                       -0.03780760 -0.00254906  0.10763177 -0.10747171
## SELETAR HILLS                 -0.09765324 -0.00424843  0.17791592 -0.22144293
## SEMBAWANG CENTRAL              0.17291198 -0.00339874  0.14292088  0.46637030
## SEMBAWANG EAST                 0.00987182 -0.00424843  0.17791592  0.03347611
## SEMBAWANG HILLS                0.06349032 -0.00424843  0.17791592  0.16059417
## SEMBAWANG NORTH               -0.00329727 -0.00169937  0.07204859 -0.00595302
## SEMBAWANG SPRINGS             -0.18328680 -0.00424843  0.17791592 -0.42446190
## SEMBAWANG STRAITS              0.17436111 -0.00169937  0.07204859  0.65591741
## SENGKANG TOWN CENTRE           0.87264322 -0.00424843  0.17791592  2.07892362
## SENJA                         -0.00823385 -0.00339874  0.14292088 -0.01278964
## SENNETT                        0.09290295 -0.00509812  0.21261688  0.21253573
## SENTOSA                       -0.13190178 -0.00084969  0.03617133 -0.68906743
## SERANGOON CENTRAL              0.16054978 -0.00424843  0.17791592  0.39070150
## SERANGOON GARDEN               0.39659458 -0.00679749  0.28113657  0.76079681
## SERANGOON NORTH                0.01018391 -0.00424843  0.17791592  0.03421600
## SHANGRI-LA                    -0.03235792 -0.00509812  0.21261688 -0.05911856
## SIGLAP                        -0.20051114 -0.00254906  0.10763177 -0.60340898
## SIMEI                          2.28210989 -0.00509812  0.21261688  4.96028690
## SINGAPORE POLYTECHNIC          0.19680944 -0.00509812  0.21261688  0.43787858
## SOMERSET                       0.03272827 -0.00509812  0.21261688  0.08203441
## SPRINGLEAF                     0.18853423 -0.00424843  0.17791592  0.45704670
## SUNGEI ROAD                    0.20420401 -0.00339874  0.14292088  0.54914278
## SUNSET WAY                     0.05520421 -0.00509812  0.21261688  0.13077815
## SWISS CLUB                     0.11845432 -0.00424843  0.17791592  0.29090212
## TAGORE                         0.41083585 -0.00424843  0.17791592  0.98407657
## TAI SENG                      -0.06697513 -0.00424843  0.17791592 -0.14871167
## TAMAN JURONG                   0.41462060 -0.00254906  0.10763177  1.27157642
## TAMPINES EAST                  4.05521688 -0.00679749  0.28113657  7.66095271
## TAMPINES NORTH                -1.41569370 -0.00424843  0.17791592 -3.34623659
## TAMPINES WEST                  5.77329732 -0.00424843  0.17791592 13.69733237
## TANGLIN                        0.30774851 -0.00424843  0.17791592  0.73967841
## TANGLIN HALT                   0.11386931 -0.00424843  0.17791592  0.28003205
## TANJONG PAGAR                  0.25289521 -0.00254906  0.10763177  0.77862064
## TANJONG RHU                   -0.11856822 -0.00339874  0.14292088 -0.30464184
## TEBAN GARDENS                 -0.01866362 -0.00169937  0.07204859 -0.06320070
## TECK WHYE                     -0.00343146 -0.00509812  0.21261688  0.00361449
## TELOK BLANGAH DRIVE           -0.00625071 -0.00339874  0.14292088 -0.00754391
## TELOK BLANGAH RISE             0.05034894 -0.00339874  0.14292088  0.14217130
## TELOK BLANGAH WAY              0.09151438 -0.00509812  0.21261688  0.20952433
## TIONG BAHRU                    0.09171418 -0.00339874  0.14292088  0.25158903
## TIONG BAHRU STATION           -0.16969064 -0.00424843  0.17791592 -0.39222830
## TOA PAYOH CENTRAL             -0.82903009 -0.00594780  0.24702376 -1.65605171
## TOA PAYOH WEST                -0.24121382 -0.00509812  0.21261688 -0.51206608
## TOH GUAN                      -0.02338523 -0.00339874  0.14292088 -0.05286749
## TOWNSVILLE                    -0.20058839 -0.00594780  0.24702376 -0.39161926
## TRAFALGAR                      0.01468636 -0.00424843  0.17791592  0.04489036
## TURF CLUB                     -0.07139144 -0.00169937  0.07204859 -0.25963942
## TYERSALL                       0.55274613 -0.00594780  0.24702376  1.12409908
## ULU PANDAN                     0.44488206 -0.00509812  0.21261688  0.97587573
## UPPER PAYA LEBAR              -0.02163547 -0.00509812  0.21261688 -0.03586469
## UPPER THOMSON                 -0.14362735 -0.00339874  0.14292088 -0.37092729
## VICTORIA                       0.03706712 -0.00339874  0.14292088  0.10703874
## WATERWAY EAST                  0.02624549 -0.00339874  0.14292088  0.07841378
## WENYA                         -0.91995115 -0.00424843  0.17791592 -2.17093642
## WEST COAST                    -0.10933553 -0.00339874  0.14292088 -0.28021989
## WESTERN WATER CATCHMENT        0.02550544 -0.00594780  0.24702376  0.06328432
## WOODGROVE                     -0.03827909 -0.00339874  0.14292088 -0.09226414
## WOODLANDS EAST                 0.38997205 -0.00254906  0.10763177  1.19644510
## WOODLANDS SOUTH                0.02231614 -0.00254906  0.10763177  0.07579170
## WOODLANDS WEST                 0.22485082 -0.00254906  0.10763177  0.69313844
## WOODLEIGH                      0.16272776 -0.00594780  0.24702376  0.33937731
## XILIN                         -1.30823277 -0.00509812  0.21261688 -2.82611889
## YEW TEE                       -0.01102117 -0.00169937  0.07204859 -0.03472857
## YIO CHU KANG EAST             -0.16196460 -0.00254906  0.10763177 -0.48591513
## YIO CHU KANG WEST              0.01399646 -0.00339874  0.14292088  0.04601313
## YISHUN CENTRAL                 1.63013895 -0.00424843  0.17791592  3.87478491
## YISHUN EAST                    0.31412929 -0.00339874  0.14292088  0.83991287
## YISHUN SOUTH                   0.24007704 -0.00509812  0.21261688  0.53171339
## YISHUN WEST                    0.47784991 -0.00594780  0.24702376  0.97340696
## YUHUA EAST                     0.00970685 -0.00424843  0.17791592  0.03308501
## YUHUA WEST                     0.02419228 -0.00339874  0.14292088  0.07298271
## YUNNAN                         1.21338701 -0.00339874  0.14292088  3.21859457
##                               Pr.z...0.
## ADMIRALTY                        0.3716
## ALEXANDRA HILL                   0.6610
## ALEXANDRA NORTH                  0.2545
## ALJUNIED                         0.3650
## ANAK BUKIT                       0.7416
## ANCHORVALE                       0.4728
## ANG MO KIO TOWN CENTRE           0.4923
## BALESTIER                        0.3272
## BANGKIT                          0.4982
## BAYSHORE                         0.6934
## BEDOK NORTH                      0.0000
## BEDOK RESERVOIR                  0.2261
## BEDOK SOUTH                      0.0017
## BENCOOLEN                        0.1831
## BENDEMEER                        0.5502
## BISHAN EAST                      0.7449
## BOAT QUAY                        0.2234
## BOON KENG                        0.6003
## BOON LAY PLACE                   0.0662
## BOON TECK                        0.5064
## BOULEVARD                        0.9474
## BRADDELL                         0.6842
## BRICKWORKS                       0.5096
## BUGIS                            0.4898
## BUKIT BATOK CENTRAL              0.7486
## BUKIT BATOK EAST                 0.5169
## BUKIT BATOK SOUTH                0.4806
## BUKIT BATOK WEST                 0.5282
## BUKIT HO SWEE                    0.2769
## BUKIT MERAH                      0.4699
## CECIL                            0.2538
## CENTRAL SUBZONE                  0.2332
## CHANGI POINT                     0.3230
## CHANGI WEST                      0.8270
## CHATSWORTH                       0.1245
## CHENG SAN                        0.3764
## CHINA SQUARE                     0.2619
## CHINATOWN                        0.4220
## CHOA CHU KANG CENTRAL            0.5369
## CHOA CHU KANG NORTH              0.5954
## CHONG BOON                       0.1609
## CLARKE QUAY                      0.1746
## CLEMENTI CENTRAL                 0.8260
## CLEMENTI NORTH                   0.5599
## CLEMENTI WEST                    0.4830
## CLEMENTI WOODS                   0.5042
## COMMONWEALTH                     0.2877
## COMPASSVALE                      0.6982
## CORONATION ROAD                  0.2275
## CRAWFORD                         0.3814
## DAIRY FARM                       0.4719
## DEPOT ROAD                       0.3562
## DHOBY GHAUT                      0.3717
## DOVER                            0.3852
## DUNEARN                          0.1351
## EVERTON PARK                     0.3913
## FABER                            0.7139
## FAJAR                            0.5856
## FARRER COURT                     0.1640
## FARRER PARK                      0.4842
## FERNVALE                         0.4979
## FLORA DRIVE                      0.9081
## FORT CANNING                     0.1308
## FRANKEL                          0.0000
## GEYLANG BAHRU                    0.5905
## GEYLANG EAST                     0.0000
## GHIM MOH                         0.2700
## GOMBAK                           0.4893
## GOODWOOD PARK                    0.2595
## GUILIN                           0.4651
## HENDERSON HILL                   0.4236
## HILLCREST                        0.1481
## HILLVIEW                         0.3987
## HOLLAND DRIVE                    0.2604
## HOLLAND ROAD                     0.4640
## HONG KAH                         0.2695
## HONG KAH NORTH                   0.4617
## HOUGANG CENTRAL                  0.1570
## HOUGANG EAST                     0.5693
## HOUGANG WEST                     0.2237
## INSTITUTION HILL                 0.0882
## JELEBU                           0.9034
## JOO SENG                         0.4881
## JURONG GATEWAY                   0.6555
## JURONG WEST CENTRAL              0.0005
## KAKI BUKIT                       0.0000
## KAMPONG BUGIS                    0.6922
## KAMPONG GLAM                     0.4122
## KAMPONG JAVA                     0.5142
## KAMPONG TIONG BAHRU              0.3773
## KAMPONG UBI                      0.0868
## KANGKAR                          0.5181
## KATONG                           0.7155
## KEAT HONG                        0.4883
## KEBUN BAHRU                      0.4937
## KEMBANGAN                        0.0013
## KHATIB                           0.3765
## KIM KEAT                         0.8218
## KOVAN                            0.5084
## LAKESIDE                         0.8323
## LAVENDER                         0.5928
## LEEDON PARK                      0.1149
## LEONIE HILL                      0.1178
## LIM CHU KANG                     0.5407
## LITTLE INDIA                     0.2083
## LORONG 8 TOA PAYOH               0.4085
## LORONG AH SOO                    0.1434
## LORONG CHUAN                     0.8250
## LOWER SELETAR                    0.5199
## LOYANG EAST                      0.1715
## LOYANG WEST                      0.3028
## MACKENZIE                        0.2692
## MACPHERSON                       0.3444
## MALCOLM                          0.5411
## MANDAI ESTATE                    0.9466
## MARGARET DRIVE                   0.2471
## MARINE PARADE                    0.5161
## MARITIME SQUARE                  0.8416
## MARYMOUNT                        0.3979
## MATILDA                          0.2613
## MEI CHIN                         0.4144
## MIDVIEW                          0.4485
## MONK'S HILL                      0.2896
## MOULMEIN                         0.5027
## MOUNT PLEASANT                   0.4664
## MOUNTBATTEN                      0.8703
## NASSIM                           0.2084
## NATIONAL UNIVERSITY OF S'PORE    0.4085
## NATURE RESERVE                   0.3755
## NEE SOON                         0.3314
## NEWTON CIRCUS                    0.2586
## NORTH COAST                      0.0308
## NORTHLAND                        0.4089
## NORTHSHORE                       0.2160
## ONE NORTH                        0.4063
## ONE TREE HILL                    0.1904
## ORANGE GROVE                     0.3760
## OXLEY                            0.1255
## PASIR PANJANG 1                  0.3925
## PASIR PANJANG 2                  0.4672
## PASIR RIS CENTRAL                0.0000
## PASIR RIS DRIVE                  0.0102
## PASIR RIS PARK                   0.7058
## PASIR RIS WEST                   0.4947
## PATERSON                         0.2897
## PEARL'S HILL                     0.2250
## PEI CHUN                         0.3055
## PENG SIANG                       0.5009
## PEOPLE'S PARK                    0.4458
## PORT                             0.4438
## POTONG PASIR                     0.3489
## PUNGGOL FIELD                    0.3397
## PUNGGOL TOWN CENTRE              0.4064
## QUEENSWAY                        0.3703
## REDHILL                          0.4255
## RIDOUT                           0.1060
## RIVERVALE                        0.0995
## ROBERTSON QUAY                   0.1497
## SAUJANA                          0.5962
## SELEGIE                          0.1571
## SELETAR                          0.5428
## SELETAR HILLS                    0.5876
## SEMBAWANG CENTRAL                0.3205
## SEMBAWANG EAST                   0.4866
## SEMBAWANG HILLS                  0.4362
## SEMBAWANG NORTH                  0.5024
## SEMBAWANG SPRINGS                0.6644
## SEMBAWANG STRAITS                0.2559
## SENGKANG TOWN CENTRE             0.0188
## SENJA                            0.5051
## SENNETT                          0.4158
## SENTOSA                          0.7546
## SERANGOON CENTRAL                0.3480
## SERANGOON GARDEN                 0.2234
## SERANGOON NORTH                  0.4864
## SHANGRI-LA                       0.5236
## SIGLAP                           0.7269
## SIMEI                            0.0000
## SINGAPORE POLYTECHNIC            0.3307
## SOMERSET                         0.4673
## SPRINGLEAF                       0.3238
## SUNGEI ROAD                      0.2915
## SUNSET WAY                       0.4480
## SWISS CLUB                       0.3856
## TAGORE                           0.1625
## TAI SENG                         0.5591
## TAMAN JURONG                     0.1018
## TAMPINES EAST                    0.0000
## TAMPINES NORTH                   0.9996
## TAMPINES WEST                    0.0000
## TANGLIN                          0.2297
## TANGLIN HALT                     0.3897
## TANJONG PAGAR                    0.2181
## TANJONG RHU                      0.6197
## TEBAN GARDENS                    0.5252
## TECK WHYE                        0.4986
## TELOK BLANGAH DRIVE              0.5030
## TELOK BLANGAH RISE               0.4435
## TELOK BLANGAH WAY                0.4170
## TIONG BAHRU                      0.4007
## TIONG BAHRU STATION              0.6526
## TOA PAYOH CENTRAL                0.9511
## TOA PAYOH WEST                   0.6957
## TOH GUAN                         0.5211
## TOWNSVILLE                       0.6523
## TRAFALGAR                        0.4821
## TURF CLUB                        0.6024
## TYERSALL                         0.1305
## ULU PANDAN                       0.1646
## UPPER PAYA LEBAR                 0.5143
## UPPER THOMSON                    0.6447
## VICTORIA                         0.4574
## WATERWAY EAST                    0.4687
## WENYA                            0.9850
## WEST COAST                       0.6103
## WESTERN WATER CATCHMENT          0.4748
## WOODGROVE                        0.5368
## WOODLANDS EAST                   0.1158
## WOODLANDS SOUTH                  0.4698
## WOODLANDS WEST                   0.2441
## WOODLEIGH                        0.3672
## XILIN                            0.9976
## YEW TEE                          0.5139
## YIO CHU KANG EAST                0.6865
## YIO CHU KANG WEST                0.4816
## YISHUN CENTRAL                   0.0001
## YISHUN EAST                      0.2005
## YISHUN SOUTH                     0.2975
## YISHUN WEST                      0.1652
## YUHUA EAST                       0.4868
## YUHUA WEST                       0.4709
## YUNNAN                           0.0006

Append the local Moran’s I localMI tap in/out dataframe onto subzone_passenger_pop SpatialPolygonDataFrame

plot_subzone_passenger_pop.localMI_tap_in <- cbind(plot_subzone_passenger_pop, localMI_tap_in)
plot_subzone_passenger_pop.localMI_tap_out <- cbind(plot_subzone_passenger_pop, localMI_tap_out)

Turn on tmap interactive mode

tmap_mode("view")
## tmap mode set to interactive viewing

Mapping both local Moran’s I values and p-values for tap in volume

localMI_tap_in.map <- tm_shape(plot_subzone_passenger_pop.localMI_tap_in)+
  tm_fill(col="Ii", style="pretty", title="local moran statistics")+
  tm_borders(alpha=0.5)

localMI_tap_in_pvalue.map <- tm_shape(plot_subzone_passenger_pop.localMI_tap_in) +
  tm_fill(col = "Pr.z...0.", breaks=c(-Inf, 0.001, 0.01, 0.05, 0.1, Inf), palette="-Blues", title="local Moran's I p-vaiues")+
  tm_borders(alpha = 0.5)

tmap_arrange(localMI_tap_in.map, localMI_tap_in_pvalue.map, asp=1, ncol=2)
## Warning: The shape plot_subzone_passenger_pop.localMI_tap_in is invalid. See
## sf::st_is_valid
## Variable(s) "Ii" contains positive and negative values, so midpoint is set to 0. Set midpoint = NA to show the full spectrum of the color palette.
## Warning: The shape plot_subzone_passenger_pop.localMI_tap_in is invalid. See
## sf::st_is_valid

Based on the local Moran’s I values and p-values choropleth map for tap in volume, I can infer that when sub zones such as Tampines East/West, Simei, Bedok North, Geylang East in green (positive) or Moran’s I value is more than 0 shows sign of clustering compared to other sub zones.

While Moran’s I p-value also indicates that mostly eastern region of singapore show sign of clustering in dark blue (p-value is statistically significant and smaller than alpha value of 0.05), sub zones such as Pasir Ris Central, Frankel, Kaki Bukit, as well as Yishun Central, Sengkang Town Centre, Jurong West Central, and Yunnan.

Mapping both local Moran’s I values and p-values for tap out volume

localMI_tap_out.map <- tm_shape(plot_subzone_passenger_pop.localMI_tap_out)+
  tm_fill(col="Ii", style="pretty", title="local moran statistics")+
  tm_borders(alpha=0.5)

localMI_tap_out_pvalue.map <- tm_shape(plot_subzone_passenger_pop.localMI_tap_out) +
  tm_fill(col = "Pr.z...0.", breaks=c(-Inf, 0.001, 0.01, 0.05, 0.1, Inf), palette="-Blues", title="local Moran's I p-vaiues")+
  tm_borders(alpha = 0.5)

tmap_arrange(localMI_tap_out.map, localMI_tap_out_pvalue.map, asp=1, ncol=2)
## Warning: The shape plot_subzone_passenger_pop.localMI_tap_out is invalid. See
## sf::st_is_valid
## Variable(s) "Ii" contains positive and negative values, so midpoint is set to 0. Set midpoint = NA to show the full spectrum of the color palette.
## Warning: The shape plot_subzone_passenger_pop.localMI_tap_out is invalid. See
## sf::st_is_valid

Based on the local Moran’s I values and p-values choropleth map for tap out volume, I can infer that when sub zones such as Tampines East/West, Simei, Bedok North, Geylang East, and Frankel in green (positive) or Moran’s I value is more than 0 shows sign of clustering compared to other sub zones.

While Moran’s I p-value also indicates that mostly eastern region of singapore show sign of clustering in dark blue (p-value is statistically significant and smaller than alpha value of 0.05), sub zones such as Pasir Ris Central, Simei, Frankel, Kaki Bukit, as well as North Coast, Yishun Central, Sengkang Town Centre, Jurong West Central, and Yunnan.

Switch tmap to plot mode

tmap_mode("plot")
## tmap mode set to plotting

Scaling the tap in/out volume for Moran scatterplot

plot_subzone_passenger_pop$Z.TOTAL_TAP_IN_VOLUME <- scale(plot_subzone_passenger_pop$TOTAL_TAP_IN_VOLUME) %>% as.vector
plot_subzone_passenger_pop$Z.TOTAL_TAP_OUT_VOLUME <- scale(plot_subzone_passenger_pop$TOTAL_TAP_OUT_VOLUME) %>% as.vector 

Plotting Moran scatterplot for tap in volume

nci_tap_in <- moran.plot(plot_subzone_passenger_pop$Z.TOTAL_TAP_IN_VOLUME, rswm_q, labels=as.character(plot_subzone_passenger_pop$SUBZONE_N), xlab="z-TAP_IN_VOLUME", ylab="Spatially Lag z-TAP_IN_VOLUME")

Plotting Moran scatterplot for tap out volume

nci_tap_out <- moran.plot(plot_subzone_passenger_pop$Z.TOTAL_TAP_OUT_VOLUME, rswm_q, labels=as.character(plot_subzone_passenger_pop$SUBZONE_N), xlab="z-TAP_OUT_VOLUME", ylab="Spatially Lag z-TAP_OUT_VOLUME")

Based on both tap in/out Moran scaled scatterplot, the top right corner indicates sub zones that have high tap in/out volume and are surrounded by other sub zones that have the average level of tap in/out volume.

Peparing a LISA cluster map for tap in volume

quadrant <- vector(mode="numeric",length=nrow(localMI_tap_in))

Centers the variable of interest around its mean

DV <- plot_subzone_passenger_pop$TOTAL_TAP_IN_VOLUME - mean(plot_subzone_passenger_pop$TOTAL_TAP_IN_VOLUME)

Centering the local Moran’s around the mean

C_mI <- localMI_tap_in[,1] - mean(localMI_tap_in[,1])

Set a statistical significance level for the local Moran

signif <- 0.05

Define the HH, LL, LH and HL categories

quadrant[DV >0 & C_mI>0] <- 4      
quadrant[DV <0 & C_mI<0] <- 1      
quadrant[DV <0 & C_mI>0] <- 2
quadrant[DV >0 & C_mI<0] <- 3

Indicate that non-significant Moran in the category 0

quadrant[localMI_tap_in[,5]>signif] <- 0

Turn on tmap interactive mode

tmap_mode("view")
## tmap mode set to interactive viewing

Create the LISA map for tap in volume

plot_subzone_passenger_pop.localMI_tap_in$quadrant <- quadrant
colors <- c("#ffffff", "#2c7bb6", "#abd9e9", "#fdae61", "#d7191c")
clusters <- c("insignificant", "low-low", "low-high", "high-low", "high-high")

tm_shape(plot_subzone_passenger_pop.localMI_tap_in)+
  tm_fill(col="quadrant", style="cat", palette=colors[c(sort(unique(quadrant)))+1], labels=clusters[c(sort(unique(quadrant)))+1], popup.vars=c("SUBZONE_N"))+
  tm_view(set.zoom.limits = c(11,17))+
  tm_borders(alpha=0.5)
## Warning: The shape plot_subzone_passenger_pop.localMI_tap_in is invalid. See
## sf::st_is_valid

Peparing a LISA cluster map for tap out volume

quadrant <- vector(mode="numeric",length=nrow(localMI_tap_out))

Centers the variable of interest around its mean

DV <- plot_subzone_passenger_pop$TOTAL_TAP_OUT_VOLUME - mean(plot_subzone_passenger_pop$TOTAL_TAP_OUT_VOLUME)

Centering the local Moran’s around the mean

C_mI <- localMI_tap_out[,1] - mean(localMI_tap_out[,1])

Set a statistical significance level for the local Moran

signif <- 0.05

Define the HH, LL, LH and HL categories

quadrant[DV >0 & C_mI>0] <- 4      
quadrant[DV <0 & C_mI<0] <- 1      
quadrant[DV <0 & C_mI>0] <- 2
quadrant[DV >0 & C_mI<0] <- 3

Indicate that non-significant Moran in the category 0

quadrant[localMI_tap_out[,5]>signif] <- 0

Create the LISA map for tap out volume

plot_subzone_passenger_pop.localMI_tap_out$quadrant <- quadrant
colors <- c("#ffffff", "#2c7bb6", "#abd9e9", "#fdae61", "#d7191c")
clusters <- c("insignificant", "low-low", "low-high", "high-low", "high-high")

tm_shape(plot_subzone_passenger_pop.localMI_tap_out)+
  tm_fill(col="quadrant", style="cat", palette=colors[c(sort(unique(quadrant)))+1], labels=clusters[c(sort(unique(quadrant)))+1], popup.vars=c("SUBZONE_N"))+
  tm_view(set.zoom.limits = c(11,17))+
  tm_borders(alpha=0.5)
## Warning: The shape plot_subzone_passenger_pop.localMI_tap_out is invalid. See
## sf::st_is_valid

Both tap in/out volume on LISA map don’t show much insights as it only highlight sub zones that is high-high cluster but not the cluster. The results is similar to the local Moran’s I values and p-value choropleth map for the sub zones in high-high cluster.

Switch tmap to plot mode

tmap_mode("plot")
## tmap mode set to plotting

Creating fixed distance proximity matrix

dnb <- dnearneigh(coordinates(coords), 0, 4598)
dnb
## Neighbour list object:
## Number of regions: 232 
## Number of nonzero links: 8736 
## Percentage nonzero weights: 16.23068 
## Average number of links: 37.65517

Based on the upper limit for distance band, the fixed distance is 4598 m. In order to be certain all units to have at least one neighbour, the computed distance used be used as the upper threshold.

Plot the data and neighbours

plot(plot_subzone_passenger_pop$geometry, border='lightgrey')
plot(dnb, coordinates(coords), add=TRUE, col='grey')

Compute Row-standardised weights matrix

dnb_lw <- nb2listw(dnb, style = 'C')
summary(dnb_lw)
## Characteristics of weights list object:
## Neighbour list object:
## Number of regions: 232 
## Number of nonzero links: 8736 
## Percentage nonzero weights: 16.23068 
## Average number of links: 37.65517 
## Link number distribution:
## 
##  1  2  6  7  8 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 
##  1  1  2  1  2  3  3  6  4  4  8  7  9  4  6  6  5  4  4  2  3  2  8  4  1  4 
## 31 32 34 35 36 37 39 40 41 42 43 44 45 46 47 48 50 51 52 53 54 55 56 57 58 59 
##  8  4  5  4  6  6  1  3  1  2  1  1  1  2  1  3  2  1  3  2  7  4  2  1  2  2 
## 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 78 79 
##  5  1  6  3  2  2  7  2  3  3  2  3  3  2  2  1  2  3  1 
## 1 least connected region:
## 220 with 1 link
## 1 most connected region:
## 58 with 79 links
## 
## Weights style: C 
## Weights constants summary:
##     n    nn  S0       S1       S2
## C 232 53824 232 12.32234 1213.773

Creating adaptive proximity matrix

knb <- knn2nb(knearneigh(coords, k=4), row.names=row.names(plot_subzone_passenger_pop$SUBZONE_N))
knb_lw <- nb2listw(knb, style='C')
summary(knb_lw)
## Characteristics of weights list object:
## Neighbour list object:
## Number of regions: 232 
## Number of nonzero links: 928 
## Percentage nonzero weights: 1.724138 
## Average number of links: 4 
## Non-symmetric neighbours list
## Link number distribution:
## 
##   4 
## 232 
## 232 least connected regions:
## 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 with 4 links
## 232 most connected regions:
## 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 with 4 links
## 
## Weights style: C 
## Weights constants summary:
##     n    nn  S0    S1  S2
## C 232 53824 232 102.5 961

Plot the centroids of the sub zone and neighbours

plot(plot_subzone_passenger_pop$geometry, border="lightgrey")
plot(knb, coordinates(coords), pch=19, cex=0.6, add=TRUE, col="red")

Computing Gi statistics using fixed distance for tap in volume

fips <- order(plot_subzone_passenger_pop$SUBZONE_N)
gi.fixed <- localG(plot_subzone_passenger_pop$TOTAL_TAP_IN_VOLUME, dnb_lw)
head(gi.fixed, n=33)
##  [1] -4.262214 -3.672954 -4.605255 -4.429483 -4.294648 -4.263026 -3.767934
##  [8] -1.932276 -3.233768 -4.563993 -3.800769 -4.048111 -1.591414 -3.488821
## [15] -4.011388 -3.831087 -4.197856 -3.783762 -2.710402 -3.694104 -3.924517
## [22] -4.123956 -4.208757 -4.071573 -3.787791 -4.235386 -4.579749 -3.814407
## [29] -3.820264 -2.141628 -4.135930 -4.078367 -3.781212

Join the Gi values to the correponding subzone SpatialPolygonDataFrame for tap in volume

tap_in.gi <- cbind(plot_subzone_passenger_pop, as.matrix(gi.fixed))
names(tap_in.gi)[11] <- "tap_in_gstat"

Computing Gi statistics using fixed distance for tap out volume

fips <- order(plot_subzone_passenger_pop$SUBZONE_N)
gi.fixed <- localG(plot_subzone_passenger_pop$TOTAL_TAP_OUT_VOLUME, dnb_lw)
head(gi.fixed, n=33)
##  [1] -4.336855 -3.766944 -4.713036 -4.543085 -4.428210 -4.373942 -3.847417
##  [8] -1.911896 -3.270477 -4.685062 -3.931745 -4.162444 -1.569591 -3.501689
## [15] -4.103939 -3.904429 -4.310560 -3.851228 -2.677874 -3.846442 -3.963817
## [22] -4.202248 -4.313415 -4.148063 -3.872289 -4.356454 -4.652908 -3.922778
## [29] -3.930844 -2.126662 -4.271830 -4.181863 -3.888983

Join the Gi values to the correponding subzone SpatialPolygonDataFrame for tap out volume

tap_out.gi <- cbind(plot_subzone_passenger_pop, as.matrix(gi.fixed))
names(tap_out.gi)[11] <- "tap_out_gstat"

Turn on tmap interactive mode

tmap_mode("view")
## tmap mode set to interactive viewing

Plot Gi values with fixed distance weights for tap in/out volume

lgi_tap_in <- tm_shape(tap_in.gi)+
  tm_fill(col="tap_in_gstat", style="pretty", palette="-RdBu", title="local Gi for tap in vol")+
  tm_borders(alpha = 0.5)

lgi_tap_out <- tm_shape(tap_out.gi)+
  tm_fill(col="tap_out_gstat", style="pretty", palette="-RdBu", title="local Gi for tap out vol")+
  tm_borders(alpha = 0.5)

tmap_arrange(lgi_tap_in, lgi_tap_out, asp=1, ncol=2)
## Warning: The shape tap_in.gi is invalid. See sf::st_is_valid
## Variable(s) "tap_in_gstat" contains positive and negative values, so midpoint is set to 0. Set midpoint = NA to show the full spectrum of the color palette.
## Warning: The shape tap_out.gi is invalid. See sf::st_is_valid
## Variable(s) "tap_out_gstat" contains positive and negative values, so midpoint is set to 0. Set midpoint = NA to show the full spectrum of the color palette.

As the colours grow darker it would reresent the intensity of the Gi values as well.

In conclusion, based on the local Gi tap in/out vol choropleth map above sub zones shaded in range of red are hot spot of passenger volume and those sub zones shaded in range of blue are the cold spot areas in Singapore.

The hot spot areas are mainly centre in the east sub zones of Singapore and some in the west sub zones. While the cold spot areas, mainly comprise of sub zones in the central of Singapore as these sub zones have the most landed property and I believe most of the citizens in these sub zones don’t commute by bus as much as other citizens. This would explain why the cold spot areas are concentrated in the central sub zones instead.

Extra: Prepare data for Viewing all bus stop location tap volume in Singapore

Transform passenger by totaling up tap in and out volume into tap volume

trans_passenger <- passenger %>%
  group_by(PT_CODE) %>%
  summarise(TAP_VOLUME=sum(TOTAL_TAP_IN_VOLUME, TOTAL_TAP_OUT_VOLUME)) %>%
  mutate(`TAP_VOLUME` = round(TAP_VOLUME/1000, digits=1))

Perform relational left join passenger flow with spatial data

subzone_passenger <- left_join(sf_busstop3414, trans_passenger, by=c("BUS_STOP_N" = "PT_CODE")) %>%
  select(`LOC_DESC`, `BUS_STOP_N`, `BUS_ROOF_N`, `TAP_VOLUME`, `geometry`) %>%
  filter(!is.na(`LOC_DESC`))
## Warning: Column `BUS_STOP_N`/`PT_CODE` joining factor and character vector,
## coercing into character vector

Create a proportional symbol map to view bus stop location volume in sub zone

tm_shape(subzone_passenger)+
  tm_bubbles(col="red", size="TAP_VOLUME", border.col="black", border.lwd=0.1)
## Legend for symbol sizes not available in view mode.

Switch tmap to plot mode

tmap_mode("plot")
## tmap mode set to plotting