1.0 Overview

Since 2013, Singapore has an active Open Data initiative. It aims to enhance transparency, public participation, and collaboration in the nation. The nation has big data ambitions and believes that the bountiful pool of available data should be used to gain new insight that will improve economic welfare. With the inception of The Smart Nation vision in 2017, Open Data is seen as a necessary component of this initiative, especially in the promotion of public-private collaborations (co-innovation). However, most of the effort to date tend to focus on hosting online open data portal by various government agency such as data.gov.sg, SLA OneMap, URA SPACE and LTA LTA DataMall , just to mention a few of them. There are very little work on how to integrate information shared by these agencies to gain better understanding on national development or public services issues.

2.0 Objective

In view of this, we are going to conduct a use-case to demonstrate the potential contribution of geospatial analytics in R to integrate, analyse and communicate the analysis results by using open data provided by different government agencies. The specific objectives of the study are as follow:

  1. Calibrating a simple linear regression to reveal the relation between public bus commuters’ flows (i.e. tap-in or tap-out) data and residential population at the planning sub-zone level.

  2. Performing spatial autocorrelation analysis on the residual of the regression model to test if the model conforms to the randomization assumption.

  3. Performing localized geospatial statistics analysis by using commuters’ tap-in and tap-out data to identify geographical clustering.

3.0 Data Sets

As listed below, they are the datasets that I have used for the take-home Exercise 01:
a.Spatial
- Passenger volume by busstop for January 2020
- Residential Data by Subzone (2011 to 2019) <Dataset>

b. Geospatial
- Singapore’s Master Plan 2014 Subzone <Dataset>
- Singapore’s busstop information

3.1 Downloading of packages necessary for analysis

packages = c('sf','tmap','tidyverse','sp','readr','dplyr','ggplot2','spdep','rgdal','tmap')
for (p in packages){
  if(!require(p,character.only = T)){
    install.packages(p)
  }
  library(p,character.only = T)
}

3.2 Importing the datasets required

subzones <- read_csv("data/aspatial/data_for_subzone.csv")
## Parsed with column specification:
## cols(
##   PA = col_character(),
##   SZ = col_character(),
##   AG = col_character(),
##   Sex = col_character(),
##   TOD = col_character(),
##   Pop = col_double(),
##   Time = col_double()
## )
passenger_vol <- 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()
## )

To read subzone data

bus_stop_location = st_read(dsn = "data/geospatial", layer="BusStop")
## Reading layer `BusStop' from data source `/Users/danstongoh/Desktop/SMU/Term 3A/Geospatial/Take Home Exercises/IS415_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
zone_layer = st_read(dsn="data/geospatial", layer="MP14_SUBZONE_WEB_PL")
## Reading layer `MP14_SUBZONE_WEB_PL' from data source `/Users/danstongoh/Desktop/SMU/Term 3A/Geospatial/Take Home Exercises/IS415_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

4.0 Data Wrangling

4.1 Filtering and Merging of Data Files

Data has been filtered to include only the latest data (2019) and the naming for the subzones from two different files are being converted to upper case to ensure the data matches as we filter.

subzones_filtered <- subzones %>%
  filter(Time=="2019") %>%
  group_by (PA,SZ) %>%
  summarise (residential_pop = sum(Pop)) %>%
  mutate(SZ = toupper(SZ))

Both of the files “zone_layer” and “subzones_filtered” as well as “bus_stop_location” and “passenger_vol” are merged to become one data file for analysis purposes, with subzones being matched as the criteria.

subzones_with_layer <- full_join (zone_layer, subzones_filtered,by = c("SUBZONE_N" = "SZ"))
busstop_with_passenger_vol <- full_join (bus_stop_location, passenger_vol, by = c("BUS_STOP_N" = "PT_CODE"))

4.2 Converting joined data to SF object and park under “singapore_layer”

The codes below ensure that the objects are of the same class and join the variables together for further analysis.

singapore_layer <- st_set_crs(zone_layer,3414)
## Warning: st_crs<- : replacing crs does not reproject data; use st_transform for
## that
busstop_with_pv_coordinates_in_sf <- st_as_sf(busstop_with_passenger_vol)

busstop_with_pv_coordinates_in_sf <- st_set_crs(busstop_with_pv_coordinates_in_sf, 3414)
## Warning: st_crs<- : replacing crs does not reproject data; use st_transform for
## that
final_busstop_with_pv_coordinates <- st_join(singapore_layer,busstop_with_pv_coordinates_in_sf)

4.3 Consolidation of Data

The “tap_in_data” and “tap_out_data” have been consolidated as final datasets that will be utilized for the computations and visualizations. Residential data is only joined here to avoid double counting of the values which can make the data inaccurate for analysis.

tap_in_data <- final_busstop_with_pv_coordinates %>%
  group_by(SUBZONE_N)%>%
  summarise(total_count_of_tap_in = sum(TOTAL_TAP_IN_VOLUME))
tap_in_data <- left_join(tap_in_data,subzones_filtered, by=c("SUBZONE_N"="SZ"))
tap_out_data <- final_busstop_with_pv_coordinates %>%
  group_by(SUBZONE_N)%>%
  summarise(total_count_of_tap_out = sum(TOTAL_TAP_OUT_VOLUME))
tap_out_data <- left_join(tap_out_data,subzones_filtered, by=c("SUBZONE_N"="SZ"))

4.4 Eliminating NA values from our final data

Elimination of NA values will be essential for the final data as it ensures that only the relevant data is being included for accurate computations as missing values may result in a different conclusion in analysis.

tap_in_data <- na.omit(tap_in_data, cols=c("TOTAL_TAP_IN_VOLUME","residential_pop"))
tap_out_data <- na.omit(tap_out_data, cols=c("TOTAL_TAP_OUT_VOLUME","residential_pop"))
#tmap_mode("view") #There was an error for me to publish onto RPubs because of the the tmap_mode. Therefore, I commented it off. 

Visual representation of the tap-in and tap-out data for commuters are being displayed below. For each of the tap-in and tap-out, there are 2 maps respectively, 1 showing with zero values and 1 showing the map after the zero values are being removed. Since the assignment requires us to find out the relationship between commuter flows and residential population, residential population with a value of 0 should also be included as there are still commuter flows in the residence.

Tap-in data for Commuters

tm_shape(st_make_valid(tap_in_data))+
  tm_fill("residential_pop",
          n = 6,
          style = "quantile",
          palette = "Blues") +
  tm_borders(alpha = 0.5)

tap_in_data_without_zero_values <- tap_in_data[tap_in_data$residential_pop != 0, ]

tm_shape(st_make_valid(tap_in_data_without_zero_values))+
  tm_fill("residential_pop",
          n = 6,
          style = "quantile",
          palette = "Blues") +
  tm_borders(alpha = 0.5)

Tap-Out Data for Commuters

tm_shape(st_make_valid(tap_out_data))+
  tm_fill("residential_pop",
          n = 6,
          style = "quantile",
          palette = "Blues") +
  tm_borders(alpha = 0.5)

tap_out_data_without_zero_values <- tap_out_data[tap_out_data$residential_pop != 0, ]

tm_shape(st_make_valid(tap_out_data_without_zero_values))+
  tm_fill("residential_pop",
          n = 6,
          style = "quantile",
          palette = "Blues") +
  tm_borders(alpha = 0.5)

5.0 Computing the Linear Regression

Tap-in data for commuters

linear_model <- lm(residential_pop~total_count_of_tap_in, data=tap_in_data)
print(linear_model)
## 
## Call:
## lm(formula = residential_pop ~ total_count_of_tap_in, data = tap_in_data)
## 
## Coefficients:
##           (Intercept)  total_count_of_tap_in  
##             1622.5011                 0.0314
summary(linear_model)
## 
## Call:
## lm(formula = residential_pop ~ total_count_of_tap_in, data = tap_in_data)
## 
## Residuals:
##    Min     1Q Median     3Q    Max 
## -66770  -4550  -1643   4113  49497 
## 
## Coefficients:
##                        Estimate Std. Error t value Pr(>|t|)    
## (Intercept)           1.623e+03  9.766e+02   1.661   0.0978 .  
## total_count_of_tap_in 3.139e-02  1.973e-03  15.914   <2e-16 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 11590 on 268 degrees of freedom
## Multiple R-squared:  0.4858, Adjusted R-squared:  0.4839 
## F-statistic: 253.2 on 1 and 268 DF,  p-value: < 2.2e-16

Assumptions made for the Linear Regression
Assumption 1: Residuals are normally distributed
This shows that the residuals are not normally distributed as the histogram has shown that the residuals are slightly skewed. Thus, the assumption is proven to be untrue.

hist(linear_model$residuals, main="Histogram of linear model residuals")

Assumption 2: No autocorrelation of Residuals
As seen from the acf plot, the residuals show that they are not autocorrelated. The correlation on the Y-axis from the immediate next line onwards has dropped to a near zero value below the blue line which is the significance level. This helps to conclude that the residuals are not autocorrelated, making the assumption true.

acf(linear_model$residuals)

Assumption 3: The residuals have homoscedasticity (to show if residuals are equally distributed across the regression line).
Scale-Location plot helps to test the linear regression assumption of equal variance, to check if the residuals have equal variance along the regression line (in red). The plot is narrower at the bottom and much wider at the top part, showing that the residuals do not actually have constant variance and the line is not horizontal. Thus, there is little homoscedasticity of the residuals.

plot(linear_model, which = 3, col=c("red"))

Overall View of the Linear Regression Model for the tap_in_data.

ggplotRegression <- function (fit) {

require(ggplot2)

ggplot(fit$model, aes_string(x = names(fit$model)[2], y = names(fit$model)[1])) + 
  geom_point() +
  stat_smooth(method = "lm", col = "red") +
  labs(title = paste("Adj R2 = ",signif(summary(fit)$adj.r.squared, 5),
                     "Intercept =",signif(fit$coef[[1]],5 ),
                     " Slope =",signif(fit$coef[[2]], 5),
                     " P =",signif(summary(fit)$coef[2,4], 5)))
}

tap_in_data_plot <- lm(residential_pop ~ total_count_of_tap_in, data = tap_in_data)
ggplotRegression(tap_in_data_plot)

summary(tap_in_data_plot)
## 
## Call:
## lm(formula = residential_pop ~ total_count_of_tap_in, data = tap_in_data)
## 
## Residuals:
##    Min     1Q Median     3Q    Max 
## -66770  -4550  -1643   4113  49497 
## 
## Coefficients:
##                        Estimate Std. Error t value Pr(>|t|)    
## (Intercept)           1.623e+03  9.766e+02   1.661   0.0978 .  
## total_count_of_tap_in 3.139e-02  1.973e-03  15.914   <2e-16 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 11590 on 268 degrees of freedom
## Multiple R-squared:  0.4858, Adjusted R-squared:  0.4839 
## F-statistic: 253.2 on 1 and 268 DF,  p-value: < 2.2e-16

Tap-out data for commuters

linear_model_out <- lm(residential_pop~total_count_of_tap_out, data=tap_out_data)
print(linear_model_out)
## 
## Call:
## lm(formula = residential_pop ~ total_count_of_tap_out, data = tap_out_data)
## 
## Coefficients:
##            (Intercept)  total_count_of_tap_out  
##              1.111e+03               3.297e-02
summary(linear_model_out)
## 
## Call:
## lm(formula = residential_pop ~ total_count_of_tap_out, data = tap_out_data)
## 
## Residuals:
##    Min     1Q Median     3Q    Max 
## -59443  -4241  -1359   3201  43452 
## 
## Coefficients:
##                         Estimate Std. Error t value Pr(>|t|)    
## (Intercept)            1.111e+03  9.549e+02   1.164    0.246    
## total_count_of_tap_out 3.297e-02  1.950e-03  16.907   <2e-16 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 11250 on 268 degrees of freedom
## Multiple R-squared:  0.5161, Adjusted R-squared:  0.5143 
## F-statistic: 285.8 on 1 and 268 DF,  p-value: < 2.2e-16

Assumptions made for the Linear Regression
Assumption 1: Residuals are normally distributed
This shows that the residuals are not normally distributed as the histogram has shown that the residuals are slightly skewed. Thus, the assumption is proven to be untrue.

hist(linear_model_out$residuals, main="Histogram of linear model residuals")

Assumption 2: No autocorrelation of Residuals
As seen from the acf plot, the residuals show that they are not autocorrelated. The correlation on the Y-axis from the immediate next line onwards has dropped to a near zero value below the blue line which is the significance level. This helps to conclude that the residuals are not autocorrelated, making the assumption true.

acf(linear_model_out$residuals)

Assumption 3: The residuals have homoscedasticity (to show if residuals are equally distributed across the regression line).
Scale-Location plot helps to test the linear regression assumption of equal variance, to check if the residuals have equal variance along the regression line (in red). The plot is narrower at the bottom and much wider at the top part, showing that the residuals do not actually have constant variance and the line is not horizontal. Thus, there is little homoscedasticity of the residuals.

plot(linear_model_out, which = 3, col=c("blue"))

Overall View of the Linear Regression Model for the tap_out_data.

ggplotRegression <- function (fit) {

require(ggplot2)

ggplot(fit$model, aes_string(x = names(fit$model)[2], y = names(fit$model)[1])) + 
  geom_point() +
  stat_smooth(method = "lm", col = "red") +
  labs(title = paste("Adj R2 = ",signif(summary(fit)$adj.r.squared, 5),
                     "Intercept =",signif(fit$coef[[1]],5 ),
                     " Slope =",signif(fit$coef[[2]], 5),
                     " P =",signif(summary(fit)$coef[2,4], 5)))
}

tap_out_data_plot <- lm(residential_pop ~ total_count_of_tap_out, data = tap_out_data)
ggplotRegression(tap_out_data_plot)

summary(tap_out_data_plot)
## 
## Call:
## lm(formula = residential_pop ~ total_count_of_tap_out, data = tap_out_data)
## 
## Residuals:
##    Min     1Q Median     3Q    Max 
## -59443  -4241  -1359   3201  43452 
## 
## Coefficients:
##                         Estimate Std. Error t value Pr(>|t|)    
## (Intercept)            1.111e+03  9.549e+02   1.164    0.246    
## total_count_of_tap_out 3.297e-02  1.950e-03  16.907   <2e-16 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 11250 on 268 degrees of freedom
## Multiple R-squared:  0.5161, Adjusted R-squared:  0.5143 
## F-statistic: 285.8 on 1 and 268 DF,  p-value: < 2.2e-16

6.0 Define Neighbouring Polygon


- The confidence level is being set to 95%.
- The null hypothesis is the residuals are randomly distributed.
- The alternative hypothesis is that the residuals are not randomly distributed.

6.1 QUEEN Contiguity Based Neighbour

The code chunk below is used to compute Queen Contiguity based neighbour, however, as seen from the summary results, there is 1 region with no links (Index = 79) and it is an outlier of the distribution. With that, it will be difficult to use the queen contiguity based neighbouring polygon as it is only effective when polygons are similar in size and distribution. Thus, this is also not effective for analysis.

Tap-in data for commuters

queen_contiguity <- poly2nb(tap_in_data, queen=TRUE)
summary(queen_contiguity)
## Neighbour list object:
## Number of regions: 270 
## Number of nonzero links: 1418 
## Percentage nonzero weights: 1.94513 
## Average number of links: 5.251852 
## 1 region with no links:
## 79
## Link number distribution:
## 
##  0  1  2  3  4  5  6  7  8  9 10 11 15 
##  1  3  7 25 56 66 53 35 16  5  1  1  1 
## 3 least connected regions:
## 2 121 204 with 1 link
## 1 most connected region:
## 34 with 15 links

Tap-out data for commuters

queen_contiguity_out <- poly2nb(tap_out_data, queen=TRUE)
summary(queen_contiguity_out)
## Neighbour list object:
## Number of regions: 270 
## Number of nonzero links: 1418 
## Percentage nonzero weights: 1.94513 
## Average number of links: 5.251852 
## 1 region with no links:
## 79
## Link number distribution:
## 
##  0  1  2  3  4  5  6  7  8  9 10 11 15 
##  1  3  7 25 56 66 53 35 16  5  1  1  1 
## 3 least connected regions:
## 2 121 204 with 1 link
## 1 most connected region:
## 34 with 15 links

6.2 ROOKS Contiguity Based Neighbour

The code chunk below is used to compute the Rooks Contiguity based neighbour. As seen from the results, there is a region that has no link (Index = 79), thus this is also not effective to be used.

Tap-in data for commuters

rooks_contiguity <- poly2nb(tap_in_data, queen=FALSE)
summary(rooks_contiguity)
## Neighbour list object:
## Number of regions: 270 
## Number of nonzero links: 1228 
## Percentage nonzero weights: 1.684499 
## Average number of links: 4.548148 
## 1 region with no links:
## 79
## Link number distribution:
## 
##  0  1  2  3  4  5  6  7  8  9 12 
##  1  4 15 38 79 72 38 14  6  2  1 
## 4 least connected regions:
## 2 121 204 267 with 1 link
## 1 most connected region:
## 34 with 12 links

Tap-out data for commuters

rooks_contiguity_out <- poly2nb(tap_out_data, queen=FALSE)
summary(rooks_contiguity_out)
## Neighbour list object:
## Number of regions: 270 
## Number of nonzero links: 1228 
## Percentage nonzero weights: 1.684499 
## Average number of links: 4.548148 
## 1 region with no links:
## 79
## Link number distribution:
## 
##  0  1  2  3  4  5  6  7  8  9 12 
##  1  4 15 38 79 72 38 14  6  2  1 
## 4 least connected regions:
## 2 121 204 267 with 1 link
## 1 most connected region:
## 34 with 12 links

6.3 Distance Based Neighbour

6.3.1 Fixed Distance Weight Matrix

Tap-in Data for Commuters
Fixed distance method works well for point data. It is one of the possible approach due to a large variation in polygon sizes. However, as seen from the visualized diagram, too many points are connected to one another and it does not help in analysing the data efficiently, thus it is not the most suitable approach.

The geospatial data for “MP14_SUBZONE_WEB_PL” has been imported with the function “readOGR”.

singapore <- readOGR(dsn = "data/geospatial", layer = "MP14_SUBZONE_WEB_PL")
## OGR data source with driver: ESRI Shapefile 
## Source: "/Users/danstongoh/Desktop/SMU/Term 3A/Geospatial/Take Home Exercises/IS415_Take-Home_Ex01/data/geospatial", layer: "MP14_SUBZONE_WEB_PL"
## with 323 features
## It has 15 fields

Next, convert the tap-in data to a spatial object.

spatial_tap_in_data <- as_Spatial(tap_in_data)

With the previous steps, the cut-off distance can then be determined. Since the SI unit for the measurement is in metres, the longlat = FALSE.

coords <- coordinates(spatial_tap_in_data)
k1 <- knn2nb(knearneigh(coords))
k1dists <- unlist(nbdists(k1, coords, longlat = FALSE))
summary(k1dists)
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##   182.5   616.3   891.7   956.8  1187.4  5403.9
wm_d62 <- dnearneigh(coords, 0, 5404, longlat = FALSE)
wm_d62
## Neighbour list object:
## Number of regions: 270 
## Number of nonzero links: 13528 
## Percentage nonzero weights: 18.55693 
## Average number of links: 50.1037

As seen from the visualisation diagram below, the points are too clustered together which does not reflect well on the statistics.

plot(singapore, border="orange")
plot(wm_d62, coords, add=TRUE)
plot(k1, coords, add=TRUE, col="red", length=0.08)

Tap-out Data for Commuters
The geospatial data for “MP14_SUBZONE_WEB_PL” has been imported with the function “readOGR”.

singapore <- readOGR(dsn = "data/geospatial", layer = "MP14_SUBZONE_WEB_PL")
## OGR data source with driver: ESRI Shapefile 
## Source: "/Users/danstongoh/Desktop/SMU/Term 3A/Geospatial/Take Home Exercises/IS415_Take-Home_Ex01/data/geospatial", layer: "MP14_SUBZONE_WEB_PL"
## with 323 features
## It has 15 fields

Next, convert the tap-out data to a spatial object.

spatial_tap_out_data <- as_Spatial(tap_out_data)

With the previous steps, the cut-off distance can then be determined. Since the SI unit for the measurement is in metres, the longlat = FALSE.

coords_out <- coordinates(spatial_tap_out_data)
k1_out <- knn2nb(knearneigh(coords_out))
k1dists_out <- unlist(nbdists(k1_out, coords_out, longlat = FALSE))
summary(k1dists_out)
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##   182.5   616.3   891.7   956.8  1187.4  5403.9
wm_d62_out <- dnearneigh(coords_out, 0, 5404, longlat = FALSE)
wm_d62_out
## Neighbour list object:
## Number of regions: 270 
## Number of nonzero links: 13528 
## Percentage nonzero weights: 18.55693 
## Average number of links: 50.1037

As seen from the visualisation diagram below, the points are too clustered together which does not reflect well on the statistics.

plot(singapore, border="grey")
plot(wm_d62_out, coords_out, add=TRUE)
plot(k1_out, coords_out, add=TRUE, col="red", length=0.08)

6.3.2 Adaptive Distance Weight Matrix (K Nearest Neighbour)

As seen from the summary below, adaptive distance weight matrix will be the most suitable as the values of total_count_of_tap_in is skewed as the max is very far from the 1st quarter value, median, and 3rd quality value. If it is not normally distributed, as explained in the slides, the k value should be of 8 and above. Thus, I have decided on k=8.

Tap-in Data for Commuters

summary(tap_in_data)
##   SUBZONE_N         total_count_of_tap_in          geometry  
##  Length:270         Min.   :     70       MULTIPOLYGON :270  
##  Class :character   1st Qu.:  92242       epsg:3414    :  0  
##  Mode  :character   Median : 225026       +proj=tmer...:  0  
##                     Mean   : 342249                          
##                     3rd Qu.: 463230                          
##                     Max.   :2075105                          
##       PA            residential_pop
##  Length:270         Min.   :    0  
##  Class :character   1st Qu.:   90  
##  Mode  :character   Median : 6530  
##                     Mean   :12367  
##                     3rd Qu.:16218  
##                     Max.   :98620
par(mfrow=c(1,2))
hist(tap_in_data$residential_pop, main="Residents' Population", col=c("red","orange"))
hist(tap_in_data$total_count_of_tap_in, main="Tap in data", col=c("blue","yellow"))

Import Singapore map - with Subzones - as layout with readOGR() - The geospatial data for “MP14_SUBZONE_WEB_PL” has been imported with the function “readOGR”. For the data wrangling process done earlier, st_read was used to import the same data. However, this does not allow geometric features to be read due to it being an SF object. Thus, it is necessary to import the data again by using “readOGR” for the analysis here.

singapore <- readOGR(dsn = "data/geospatial", layer = "MP14_SUBZONE_WEB_PL")
## OGR data source with driver: ESRI Shapefile 
## Source: "/Users/danstongoh/Desktop/SMU/Term 3A/Geospatial/Take Home Exercises/IS415_Take-Home_Ex01/data/geospatial", layer: "MP14_SUBZONE_WEB_PL"
## with 323 features
## It has 15 fields

The codes below are used to visualise the output for the adaptive weight matrix. The tap_in_data is also converted from sf to spatial vector object for analysis use by using the function “as_Spatial()”. Given that the values are not normally distributed (skewed), it is important that each feature is evaluated within the context of at leaser eight or so neighbours. Therefore, the k value is set to 8.

tap_in_data_spatial <- as_Spatial(tap_in_data)
coords2 <- coordinates(tap_in_data_spatial)
tap_in_data_kn <- knn2nb(knearneigh(coords2, k=8))
plot(singapore, border="orange")
plot(tap_in_data_kn, coords2, pch = 19, cex = 0.6, add = TRUE, col = "red")

rswm_k <- nb2listw(tap_in_data_kn, style="B", zero.policy = TRUE)
rswm_k
## Characteristics of weights list object:
## Neighbour list object:
## Number of regions: 270 
## Number of nonzero links: 2160 
## Percentage nonzero weights: 2.962963 
## Average number of links: 8 
## Non-symmetric neighbours list
## 
## Weights style: B 
## Weights constants summary:
##     n    nn   S0   S1    S2
## B 270 72900 2160 3896 70696

Tap-out Data for Commuters

summary(tap_out_data)
##   SUBZONE_N         total_count_of_tap_out          geometry  
##  Length:270         Min.   :    154        MULTIPOLYGON :270  
##  Class :character   1st Qu.:  90080        epsg:3414    :  0  
##  Mode  :character   Median : 223458        +proj=tmer...:  0  
##                     Mean   : 341403                           
##                     3rd Qu.: 445960                           
##                     Max.   :1769252                           
##       PA            residential_pop
##  Length:270         Min.   :    0  
##  Class :character   1st Qu.:   90  
##  Mode  :character   Median : 6530  
##                     Mean   :12367  
##                     3rd Qu.:16218  
##                     Max.   :98620
par(mfrow=c(1,2))
hist(tap_out_data$residential_pop, main="Residents' Population", col=c("red","orange"))
hist(tap_out_data$total_count_of_tap_out, main="Tap out data", col=c("blue","yellow"))

The codes below are used to visualise the output for the adaptive weight matrix. The tap_out_data is also converted from sf to spatial vector object for analysis use by using the function “as_Spatial()”.

tap_out_data_spatial <- as_Spatial(tap_out_data)
coords_out <- coordinates(tap_out_data_spatial)
tap_out_data_kn <- knn2nb(knearneigh(coords_out, k=8))
plot(singapore, border="orange")
plot(tap_out_data_kn, coords_out, pch = 19, cex = 0.6, add = TRUE, col = "blue")

rswm_k_out <- nb2listw(tap_out_data_kn, style="B", zero.policy = TRUE)
rswm_k_out
## Characteristics of weights list object:
## Neighbour list object:
## Number of regions: 270 
## Number of nonzero links: 2160 
## Percentage nonzero weights: 2.962963 
## Average number of links: 8 
## Non-symmetric neighbours list
## 
## Weights style: B 
## Weights constants summary:
##     n    nn   S0   S1    S2
## B 270 72900 2160 3896 70696

7.0 Application of Spatial Weight Matrix

Tap-in data for commuters
In this step, the lag vectors are computed and stored in a list.

linear_mod.lag <- lag.listw(rswm_k, linear_model$residuals)
linear_mod.lag
##   [1]   7524.1740   3702.8172  -7197.7234 -23114.9700 -51156.4811    545.4608
##   [7] 135613.9433  12228.2008 -33916.7224  35495.0208 -33369.5713  75715.2272
##  [13]  63992.6584  60369.6320 -57734.7338 -24565.6044 -12678.1233  24188.0754
##  [19] -34961.5009 -28489.7013  39234.8239   3602.8639 -39801.1708  18443.5824
##  [25]  22955.3618 -34799.2676  37027.9312  30976.2849   1729.5195 -23030.8026
##  [31] -14996.9235  -7634.9843 -26891.3679  21161.8241  20267.9029  10236.5158
##  [37]   9073.1451  -7487.8383 -24195.9579  39213.7901 -41381.8430 -33659.8680
##  [43] 101140.0539  60683.0096 -10853.0358 -11192.9763 -29984.0323   1288.7317
##  [49] -28359.1272 -42236.1264 -37135.1345 -32487.2775  12454.7199 128704.8440
##  [55]  -3916.9742 -64811.1926 -10411.6658 -53361.8958  -3510.7486  -7052.6805
##  [61] -19535.8616 -21903.3543 -71174.5080  20765.5120  -7285.7884 -27805.7574
##  [67]  56526.2534  13570.9440 -45972.2644  13129.1227  59147.9393 -24471.2539
##  [73] -21073.0252  -5489.6411  37803.3553 -48611.8693  15407.4194  27336.9663
##  [79] -38817.6585 -10178.9039 -13938.1038   7644.1432  20497.7540    238.9814
##  [85]  11300.0293  40802.8263  76636.4279  52429.2563  39874.5979 -32625.8161
##  [91] -26473.1410 -66169.3730  64789.4086   6822.1103 -20275.8399  -5212.9946
##  [97] -11424.4781 -46627.0593 -11987.1138  -5288.3874 -28510.4200 -51999.3665
## [103] -44685.3540  -6814.3326 -29868.4279   3944.6964 -31537.1148  36920.7114
## [109] -28822.9041 -24627.5083  -6865.8602  20498.4578  15506.7810  16487.5807
## [115]   8832.2375 -87523.6291 -24156.0147 -34260.1074  10826.0407 -49759.4878
## [121]  -3336.9147 -61138.9060  -7406.3630  11741.1570  -2019.6067  -8720.2884
## [127]  38734.2678   3333.3102  28867.9455 -36249.7291 -46837.4890  91670.6718
## [133]  16963.0963  32826.5996 -50492.6188 -27273.8590 -32673.8413 -20684.7799
## [139]  15121.3325 183080.4476 -37440.4989 -16883.6293  -6374.8796 -80154.3829
## [145] -34167.1745 -40825.5972 -13152.6405   9874.8697  30567.4551 -60557.4971
## [151]  40667.2341 -55536.4315 -47241.7887 -47885.5832 -14508.3669   6705.8888
## [157] -24507.9811 -12437.1560  18495.7451  25057.2147 102432.5618  38506.2329
## [163] -47715.0894  17510.4852  28438.1755  19858.4392 -30741.0474   7171.1459
## [169]  65895.2079 -33231.3076 -28839.5975 -39052.6699 -17226.4853 -23668.3720
## [175]   5092.4199 141120.4456  -1833.9472 -31821.2113 -26082.6357  19196.7830
## [181]  -4236.8879 149895.5598  -5227.1980 -52213.2702   5388.9677 -40761.9826
## [187]  21681.4753 -66009.5114 125155.8322 105472.7221  28449.8599  59160.5447
## [193]  15052.0475 -15311.1585  -4445.3795  16809.8538  15116.2309 188235.3741
## [199]  31909.3629  -3845.4129  54383.1413  78043.2384 -32440.8374 -12236.6123
## [205]  27537.5838  -4154.7589  29654.6560  10408.5049   2350.6146  10463.6741
## [211]  75769.9805 -13690.5787 -47290.8512   5811.6376 -27995.3531 -65436.3333
## [217]  -1471.2300 -23504.3628 -36630.0284  11604.7062  69561.1297  34819.4302
## [223] -37751.7174   2098.6521 -35113.8390 -43675.9736 -79597.8037  73663.3595
## [229] -22456.9450 -18206.5697 -10197.5197  74360.1407  -8588.1596  17950.1584
## [235] -18828.1642   2023.2236   6040.6509 -44325.1582 -41935.9831 -11250.0152
## [241]  88539.7169  -5560.0171  -4513.1507 -36972.2601 -37896.2465  -8305.7985
## [247]  26143.3614 -10465.5164   3562.9186 -25677.3224  -2569.1054 -43379.2220
## [253] 124732.1805  46941.1823 -32299.7422 -38122.3552 -42013.9652  78283.7982
## [259]  16202.4949 -50275.5616   5163.5856  35482.8665  25538.7183  -6534.3751
## [265] -31547.5125 -35955.5627  -7337.4443 -39814.6041  29257.4975  -7929.1465

Then, append the spatially lag values obtained from above to the tap-in dataframe Tap_in.

lag.list <- list(tap_in_data$SUBZONE_N, linear_mod.lag)
lag.res <- as.data.frame(lag.list)
colnames(lag.res) <- c("SUBZONE_N", "lag residuals")
tap_in_data <- left_join(tap_in_data,lag.res)
## Joining, by = "SUBZONE_N"

With the information obtained above, plot the residuals and the lag residuals computed for comparison through diagram visualisation.

tap_in_data$residuals <- linear_model$residuals
residuals_in <- qtm(tap_in_data, "residuals")
## Warning: The shape tap_in_data is invalid. See sf::st_is_valid
lag_residuals_in <- qtm(tap_in_data, "lag residuals")
## Warning: The shape tap_in_data is invalid. See sf::st_is_valid
tmap_arrange(residuals_in, lag_residuals_in, asp=1, ncol=2)
## Variable(s) "residuals" contains positive and negative values, so midpoint is set to 0. Set midpoint = NA to show the full spectrum of the color palette.
## Variable(s) "lag residuals" contains positive and negative values, so midpoint is set to 0. Set midpoint = NA to show the full spectrum of the color palette.

Tap-out data for commuters
In this step, the lag vectors are computed and stored in a list.

linear_mod_out.lag <- lag.listw(rswm_k_out, linear_model_out$residuals)
linear_mod_out.lag
##   [1]   9323.32363  -1751.30713 -10328.55074 -24488.51712 -50379.91845
##   [6]  -2013.15908 132788.95692  13282.96154 -33186.44084  38671.11802
##  [11] -33505.93945  62908.76478  52067.81395  51222.38500 -53381.76855
##  [16] -23554.82809 -11822.59729  17440.67804 -28718.69582 -35462.46427
##  [21]  33027.30103  -3900.87150 -28759.68023  14257.20790  22530.61058
##  [26] -30076.74815  34976.28548  28087.13240   -934.85315 -23203.49315
##  [31]  -9966.89913  -3108.00023 -23320.20481  20969.43936  20948.85266
##  [36]   9861.25424   4988.14443   1198.63459 -25396.91294  31175.93801
##  [41] -37067.56471 -31472.19465 102086.55385  59547.52801  -6335.88405
##  [46]  -8454.91062 -32496.64027    923.54077 -24355.77477 -37521.69880
##  [51] -33482.91993 -33063.38691  11420.18694 125239.36165   -107.16277
##  [56] -61671.16458 -16579.34611 -43986.98228  -2729.36302  -3206.41706
##  [61] -25094.46136 -20794.15700 -69992.22980  27876.73083   1229.11867
##  [66] -23565.84839  54958.86996  15980.16577 -41585.42293  20314.38829
##  [71]  61105.22564 -31693.05893 -33334.88247  -1714.79505  35365.69500
##  [76] -47338.70503  12434.85497  32639.93620 -37804.63018  -9309.28499
##  [81]  -8975.41392  13639.71751  18637.03871   1418.20763   5229.00190
##  [86]  37859.08409  77707.62169  48527.94705  34182.45531 -24300.10122
##  [91] -30827.22240 -57642.13455  67395.47954   5807.18007 -22937.63486
##  [96]  -9626.87342 -16775.37364 -51727.93033 -11874.51496 -10142.00132
## [101] -29315.50959 -48318.67186 -38799.24398  -5587.27756 -28879.19677
## [106]    540.20933 -40414.65417  46415.65622 -24766.25083 -25743.02664
## [111] -14500.06628  30781.99831  14176.52395   9986.41693   2923.32291
## [116] -85301.71854 -26350.99865 -35683.65116  14611.75048 -44886.16906
## [121]  -2628.66387 -53021.07018 -13011.09125   2892.85566  -2414.51887
## [126] -17533.09833  35791.26053    725.67964  33885.84522 -30789.42872
## [131] -43185.34686  77608.07174  14400.99146  25752.35605 -46561.93724
## [136] -32545.29996 -31676.90027 -27506.51462   2056.34924 182573.25080
## [141] -33717.58212 -18814.45708  -9431.06574 -76156.09316 -29376.63951
## [146] -40218.95970 -12853.84796   6116.10440  28328.03951 -57594.26909
## [151]  34974.26319 -49215.28298 -41220.20073 -43009.93269 -15783.05708
## [156]   7843.57112 -21572.76586 -19616.34870  21110.09277  28948.60589
## [161] 103452.92262  34834.77044 -46546.69664  17687.29076  31083.22216
## [166]  16739.76910 -28157.27599  -1459.67168  68947.10673 -33504.11747
## [171] -21378.70768 -33625.06131 -17956.53151 -22233.57437   5666.19051
## [176] 135207.42708  -6980.22880 -30083.77894 -25882.01877   9445.65880
## [181]  -1612.78085 148108.25720    -93.58317 -48382.44262   5169.32740
## [186] -40691.85438  28830.62201 -60515.23129 124263.73771 106539.99815
## [191]  32128.97657  53854.79232  17986.93996 -11619.67936  -2052.03403
## [196]  18091.98618  14950.22489 184837.97291  31405.13102  -4312.90014
## [201]  49832.80086  71719.19577 -29837.45255  -8060.42717  21115.39621
## [206]   -101.72012  30144.55470   5192.18158  15217.84016   8964.82542
## [211]  73486.72973 -12779.90310 -45251.56665    908.20025 -23254.75107
## [216] -59871.18997   3177.86487 -23260.89144 -37396.73963   7738.56293
## [221]  63691.61437  38818.98184 -34171.02147   4083.55188 -33365.57220
## [226] -50798.41191 -72814.75270  77054.25188 -23184.02461 -18479.90508
## [231] -13168.76002  72130.60125  -7870.20881  16462.17334 -17689.02996
## [236]   2020.19826    897.72016 -46558.73897 -39527.27903 -17108.72589
## [241]  81845.26157  -4893.57073  -4948.59719 -32497.92317 -35312.81181
## [246] -13174.02760  17228.95994  -3325.65676   6604.51866 -21181.08559
## [251]  -2869.64612 -42608.22505 121415.51675  39339.87829 -32721.17058
## [256] -42675.54919 -29042.62793  68051.57229  11940.94897 -35369.56734
## [261]   4272.39816  31744.87160  30528.28358  -2997.42684 -24626.41012
## [266] -33431.42100 -16642.57240 -40150.36321  19670.05899  -8361.00642

Then, append the spatially lag values obtained from above to the tap-out dataframe Tap_out.

lag_out.list <- list(tap_out_data$SUBZONE_N, linear_mod_out.lag)
lag_out.res <- as.data.frame(lag.list)
colnames(lag.res) <- c("SUBZONE_N", "lag residuals")
tap_out_data <- left_join(tap_out_data,lag.res)
## Joining, by = "SUBZONE_N"

With the information obtained above, plot the residuals and the lag residuals computed for comparison through diagram visualisation.

tap_out_data$residuals <- linear_model_out$residuals
residuals_out <- qtm(tap_out_data, "residuals")
## Warning: The shape tap_out_data is invalid. See sf::st_is_valid
lag_residuals_out <- qtm(tap_out_data, "lag residuals")
## Warning: The shape tap_out_data is invalid. See sf::st_is_valid
tmap_arrange(residuals_out, lag_residuals_out, asp=1, ncol=2)
## Variable(s) "residuals" contains positive and negative values, so midpoint is set to 0. Set midpoint = NA to show the full spectrum of the color palette.
## Variable(s) "lag residuals" contains positive and negative values, so midpoint is set to 0. Set midpoint = NA to show the full spectrum of the color palette.

8.0 Perform spatial correlation on residuals of regression model

8.1 Computation of Moran I’s

Commuters’ tap-in data
From the output below, the p-value is 0.00001254 which is lesser than alpha value (given the confidence interval set at 95%), therefore we reject the null hypothesis. Thus, the conclusion is that the distribution of the residuals are not randomly distributed.

lm.morantest(linear_model, rswm_k, zero.policy = TRUE)
## 
##  Global Moran I for regression residuals
## 
## data:  
## model: lm(formula = residential_pop ~ total_count_of_tap_in, data =
## tap_in_data)
## weights: rswm_k
## 
## Moran I statistic standard deviate = 4.2141, p-value = 1.254e-05
## alternative hypothesis: greater
## sample estimates:
## Observed Moran I      Expectation         Variance 
##     0.1149044672    -0.0043732598     0.0008011463

Commuters’ tap-out data
From the output below, the p-value is 0.000003699 which is lesser than alpha value (given the confidence interval set at 95%), therefore we reject the null hypothesis. Thus, the conclusion is that the distribution of the residuals are not randomly distributed.

lm.morantest(linear_model_out, rswm_k_out, zero.policy = TRUE)
## 
##  Global Moran I for regression residuals
## 
## data:  
## model: lm(formula = residential_pop ~ total_count_of_tap_out, data =
## tap_out_data)
## weights: rswm_k_out
## 
## Moran I statistic standard deviate = 4.4819, p-value = 3.699e-06
## alternative hypothesis: greater
## sample estimates:
## Observed Moran I      Expectation         Variance 
##     0.1224616468    -0.0043725678     0.0008008377

8.2 Visualisation of results - Spatial Correlogram

Moran’s I correlogram and plot

Commuters’ tap-in data
Given the consistent downwards trend observed, it is observed that the low Moran’s I values are indicators of non-correlation. This is aligned with the second assumption of the linear regression model.

MI_corr <- sp.correlogram(tap_in_data_kn, linear_model$residuals, order=6, method="I", style="B")
plot(MI_corr)

Commuters’ tap-out data
Given the consistent downwards trend observed, it is observed that the low Moran’s I values are indicators of non-correlation. This is aligned with the second assumption of the linear regression model as well.

MI_corr_out <- sp.correlogram(tap_out_data_kn, linear_model_out$residuals, order=6, method="I", style="B")
plot(MI_corr_out)

9.0 Local spatial statistics and analysis

9.1 Analysis of the Cluster and Outlier

9.1.1 Computation of Local Spatial Statistics

Commuters’ tap-in data
First, compute the local Moran’s I.

fips <- order(tap_in_data$SUBZONE_N)
localMI <- localmoran(tap_in_data$total_count_of_tap_in, rswm_k)
head(localMI)
##           Ii        E.Ii   Var.Ii        Z.Ii    Pr(z > 0)
## 1  0.9989423 -0.02973978 7.641142  0.37213633 0.3548956754
## 2 -1.7494090 -0.02973978 7.641142 -0.62210803 0.7330645828
## 3 -0.8847403 -0.02973978 7.641142 -0.30930524 0.6214553268
## 4 -0.1553549 -0.02973978 7.641142 -0.04544256 0.5181227217
## 5  9.6018162 -0.02973978 7.641142  3.48431438 0.0002466998
## 6 -0.3842611 -0.02973978 7.641142 -0.12825175 0.5510251258
printCoefmat(data.frame(localMI[fips,], row.names=tap_in_data$SUBZONE_N[fips]), check.names=FALSE)
##                                        Ii        E.Ii      Var.Ii        Z.Ii
## ADMIRALTY                      0.99894233 -0.02973978  7.64114150  0.37213633
## AIRPORT ROAD                  -1.74940904 -0.02973978  7.64114150 -0.62210803
## ALEXANDRA HILL                -0.88474033 -0.02973978  7.64114150 -0.30930524
## ALEXANDRA NORTH               -0.15535490 -0.02973978  7.64114150 -0.04544256
## ALJUNIED                       9.60181622 -0.02973978  7.64114150  3.48431438
## ANAK BUKIT                    -0.38426115 -0.02973978  7.64114150 -0.12825175
## ANCHORVALE                     2.85327143 -0.02973978  7.64114150  1.04295894
## ANG MO KIO TOWN CENTRE         6.33489961 -0.02973978  7.64114150  2.30247371
## ANSON                          2.93140880 -0.02973978  7.64114150  1.07122593
## BANGKIT                        0.32524281 -0.02973978  7.64114150  0.12841860
## BAYFRONT SUBZONE               4.42269768 -0.02973978  7.64114150  1.61071501
## BAYSHORE                      -5.13263772 -0.02973978  7.64114150 -1.84602578
## BEDOK RESERVOIR                4.66231370 -0.02973978  7.64114150  1.69739857
## BEDOK SOUTH                   10.80176811 -0.02973978  7.64114150  3.91840931
## BENCOOLEN                      2.00707167 -0.02973978  7.64114150  0.73683747
## BENDEMEER                     -0.76904958 -0.02973978  7.64114150 -0.26745292
## BIDADARI                      -0.33137126 -0.02973978  7.64114150 -0.10911829
## BISHAN EAST                   -0.15062796 -0.02973978  7.64114150 -0.04373254
## BOAT QUAY                      3.74003201 -0.02973978  7.64114150  1.36375369
## BOON KENG                      0.07143346 -0.02973978  7.64114150  0.03660046
## BOON LAY PLACE                 3.86281177 -0.02973978  7.64114150  1.40817053
## BOON TECK                      0.23115457 -0.02973978  7.64114150  0.09438121
## BOULEVARD                     -5.00672631 -0.02973978  7.64114150 -1.80047603
## BRADDELL                      -0.08633925 -0.02973978  7.64114150 -0.02047544
## BRICKWORKS                    -0.18892013 -0.02973978  7.64114150 -0.05758513
## BUGIS                         -0.99385566 -0.02973978  7.64114150 -0.34877883
## BUKIT BATOK CENTRAL            0.19257853 -0.02973978  7.64114150  0.08042593
## BUKIT BATOK EAST              -0.13126327 -0.02973978  7.64114150 -0.03672717
## BUKIT BATOK SOUTH              0.00916415 -0.02973978  7.64114150  0.01407389
## BUKIT BATOK WEST              -1.13473656 -0.02973978  7.64114150 -0.39974394
## BUKIT HO SWEE                  0.74779520 -0.02973978  7.64114150  0.28128127
## BUKIT MERAH                   -0.03003288 -0.02973978  7.64114150 -0.00010603
## CECIL                          2.84604553 -0.02973978  7.64114150  1.04034489
## CENTRAL WATER CATCHMENT        0.51804676 -0.02973978  7.64114150  0.19816741
## CHANGI AIRPORT                -0.33763012 -0.02973978  7.64114150 -0.11138250
## CHANGI POINT                  -0.44207004 -0.02973978  7.64114150 -0.14916471
## CHANGI WEST                   -0.37132139 -0.02973978  7.64114150 -0.12357066
## CHATSWORTH                     1.23869223 -0.02973978  7.64114150  0.45886832
## CHENG SAN                      6.16010395 -0.02973978  7.64114150  2.23923959
## CHIN BEE                      -3.63113080 -0.02973978  7.64114150 -1.30284022
## CHINA SQUARE                   2.45174087 -0.02973978  7.64114150  0.89770113
## CHINATOWN                     -2.01204475 -0.02973978  7.64114150 -0.71711920
## CHOA CHU KANG CENTRAL          7.45768615 -0.02973978  7.64114150  2.70865328
## CHOA CHU KANG NORTH           -0.00373669 -0.02973978  7.64114150  0.00940689
## CHONG BOON                     5.85477068 -0.02973978  7.64114150  2.12878214
## CITY TERMINALS                 3.07102761 -0.02973978  7.64114150  1.12173447
## CLARKE QUAY                    1.31632944 -0.02973978  7.64114150  0.48695437
## CLEMENTI CENTRAL              -4.05825823 -0.02973978  7.64114150 -1.45735795
## CLEMENTI NORTH                -0.19455423 -0.02973978  7.64114150 -0.05962332
## CLEMENTI WEST                 -0.13431112 -0.02973978  7.64114150 -0.03782976
## CLEMENTI WOODS                 0.25374815 -0.02973978  7.64114150  0.10255467
## CLIFFORD PIER                  3.94042021 -0.02973978  7.64114150  1.43624618
## COMMONWEALTH                   0.76976992 -0.02973978  7.64114150  0.28923085
## COMPASSVALE                   -0.72231020 -0.02973978  7.64114150 -0.25054447
## CORONATION ROAD                0.99021939 -0.02973978  7.64114150  0.36898071
## CRAWFORD                       0.34359752 -0.02973978  7.64114150  0.13505860
## DEPOT ROAD                     0.29965596 -0.02973978  7.64114150  0.11916229
## DHOBY GHAUT                    0.21977864 -0.02973978  7.64114150  0.09026585
## DOVER                          0.39549203 -0.02973978  7.64114150  0.15383198
## DUNEARN                        2.30013382 -0.02973978  7.64114150  0.84285572
## EAST COAST                    -8.95499364 -0.02973978  7.64114150 -3.22880232
## EVERTON PARK                   1.65375408 -0.02973978  7.64114150  0.60902121
## FABER                         -2.30349499 -0.02973978  7.64114150 -0.82255432
## FAJAR                         -1.04109688 -0.02973978  7.64114150 -0.36586883
## FARRER COURT                   2.46814397 -0.02973978  7.64114150  0.90363512
## FARRER PARK                   -1.50871730 -0.02973978  7.64114150 -0.53503532
## FERNVALE                      -0.24908196 -0.02973978  7.64114150 -0.07934929
## FLORA DRIVE                    0.06956980 -0.02973978  7.64114150  0.03592626
## FORT CANNING                   3.14688043 -0.02973978  7.64114150  1.14917501
## FRANKEL                       11.42625157 -0.02973978  7.64114150  4.14432262
## GALI BATU                     -0.51458329 -0.02973978  7.64114150 -0.17539712
## GEYLANG BAHRU                 -0.10790123 -0.02973978  7.64114150 -0.02827571
## GEYLANG EAST                  24.03746974 -0.02973978  7.64114150  8.70656041
## GHIM MOH                       1.01125520 -0.02973978  7.64114150  0.37659063
## GOMBAK                        -0.85838181 -0.02973978  7.64114150 -0.29976977
## GOODWOOD PARK                  1.93414304 -0.02973978  7.64114150  0.71045479
## GREENWOOD PARK                -9.45156273 -0.02973978  7.64114150 -3.40844129
## GUILIN                        -0.30787058 -0.02973978  7.64114150 -0.10061668
## GUL BASIN                      4.91332581 -0.02973978  7.64114150  1.78820478
## HENDERSON HILL                -0.13714981 -0.02973978  7.64114150 -0.03885668
## HILLCREST                      1.69323316 -0.02973978  7.64114150  0.62330317
## HILLVIEW                      -0.19793219 -0.02973978  7.64114150 -0.06084533
## HOLLAND DRIVE                  1.04260051 -0.02973978  7.64114150  0.38793012
## HOLLAND ROAD                  -0.13595248 -0.02973978  7.64114150 -0.03842354
## HONG KAH                       2.97494668 -0.02973978  7.64114150  1.08697621
## HONG KAH NORTH                 0.25984550 -0.02973978  7.64114150  0.10476045
## HOUGANG CENTRAL                7.67327255 -0.02973978  7.64114150  2.78664388
## HOUGANG EAST                   1.01818975 -0.02973978  7.64114150  0.37909928
## HOUGANG WEST                   9.96689747 -0.02973978  7.64114150  3.61638627
## INSTITUTION HILL               2.78020715 -0.02973978  7.64114150  1.01652718
## INTERNATIONAL BUSINESS PARK   -0.98362927 -0.02973978  7.64114150 -0.34507933
## ISTANA NEGARA                  2.23994256 -0.02973978  7.64114150  0.82108091
## JELEBU                         5.28622402 -0.02973978  7.64114150  1.92310454
## JOO KOON                      -0.78945177 -0.02973978  7.64114150 -0.27483362
## JOO SENG                       0.49229940 -0.02973978  7.64114150  0.18885304
## JURONG GATEWAY                 0.86507817 -0.02973978  7.64114150  0.32370959
## JURONG PORT                    2.15749238 -0.02973978  7.64114150  0.79125371
## JURONG RIVER                  -0.47362069 -0.02973978  7.64114150 -0.16057848
## KALLANG BAHRU                  0.10719295 -0.02973978  7.64114150  0.04953682
## KALLANG WAY                   -1.01558353 -0.02973978  7.64114150 -0.35663911
## KAMPONG BUGIS                  0.93608494 -0.02973978  7.64114150  0.34939702
## KAMPONG GLAM                   1.25955710 -0.02973978  7.64114150  0.46641640
## KAMPONG JAVA                   0.95188533 -0.02973978  7.64114150  0.35511297
## KAMPONG TIONG BAHRU            0.15021001 -0.02973978  7.64114150  0.06509869
## KAMPONG UBI                    6.09030637 -0.02973978  7.64114150  2.21398960
## KANGKAR                        0.73924921 -0.02973978  7.64114150  0.27818967
## KATONG                        -1.65565705 -0.02973978  7.64114150 -0.58819229
## KEAT HONG                      0.51212441 -0.02973978  7.64114150  0.19602494
## KEBUN BAHRU                    0.79515928 -0.02973978  7.64114150  0.29841571
## KEMBANGAN                      7.74609503 -0.02973978  7.64114150  2.81298816
## KENT RIDGE                     1.14523987 -0.02973978  7.64114150  0.42506096
## KHATIB                        -0.26621328 -0.02973978  7.64114150 -0.08554672
## KIAN TECK                     -1.41808226 -0.02973978  7.64114150 -0.50224716
## KIM KEAT                       0.73764620 -0.02973978  7.64114150  0.27760976
## KOVAN                          3.56553365 -0.02973978  7.64114150  1.30062712
## KRANJI                        -2.83919486 -0.02973978  7.64114150 -1.01634925
## LAKESIDE                      -1.72790557 -0.02973978  7.64114150 -0.61432893
## LAVENDER                      -2.38364993 -0.02973978  7.64114150 -0.85155119
## LEEDON PARK                    1.83342556 -0.02973978  7.64114150  0.67401921
## LEONIE HILL                    1.75466211 -0.02973978  7.64114150  0.64552572
## LIM CHU KANG                  -0.08662523 -0.02973978  7.64114150 -0.02057890
## LITTLE INDIA                   1.54662676 -0.02973978  7.64114150  0.57026680
## LIU FANG                       1.43108527 -0.02973978  7.64114150  0.52846847
## LORONG 8 TOA PAYOH             0.34641484 -0.02973978  7.64114150  0.13607780
## LORONG AH SOO                  9.84545000 -0.02973978  7.64114150  3.57245140
## LORONG CHUAN                  -2.46987701 -0.02973978  7.64114150 -0.88274472
## LORONG HALUS                  -2.51348855 -0.02973978  7.64114150 -0.89852165
## LOYANG EAST                   -1.18869997 -0.02973978  7.64114150 -0.41926576
## LOYANG WEST                    0.51269891 -0.02973978  7.64114150  0.19623277
## MACKENZIE                      2.09144142 -0.02973978  7.64114150  0.76735910
## MALCOLM                        1.08297274 -0.02973978  7.64114150  0.40253519
## MANDAI EAST                   -2.34430454 -0.02973978  7.64114150 -0.83731759
## MANDAI ESTATE                  0.29034094 -0.02973978  7.64114150  0.11579249
## MANDAI WEST                   -9.19993823 -0.02973978  7.64114150 -3.31741354
## MARINA CENTRE                  1.21398278 -0.02973978  7.64114150  0.44992942
## MARINA EAST (MP)               0.10695335 -0.02973978  7.64114150  0.04945014
## MARINA SOUTH                   5.47210794 -0.02973978  7.64114150  1.99034996
## MARINE PARADE                  9.64463295 -0.02973978  7.64114150  3.49980377
## MARYMOUNT                      3.51043010 -0.02973978  7.64114150  1.28069284
## MATILDA                        8.32516308 -0.02973978  7.64114150  3.02247198
## MAXWELL                        3.93714761 -0.02973978  7.64114150  1.43506229
## MEI CHIN                       0.53416272 -0.02973978  7.64114150  0.20399752
## MIDVIEW                        5.29856311 -0.02973978  7.64114150  1.92756833
## MONK'S HILL                    0.62464041 -0.02973978  7.64114150  0.23672876
## MOULMEIN                      -1.78099328 -0.02973978  7.64114150 -0.63353396
## NASSIM                         0.88590867 -0.02973978  7.64114150  0.33124524
## NATIONAL UNIVERSITY OF S'PORE  0.57502088 -0.02973978  7.64114150  0.21877838
## NATURE RESERVE                -1.91502560 -0.02973978  7.64114150 -0.68202152
## NEE SOON                       1.59764614 -0.02973978  7.64114150  0.58872358
## NEWTON CIRCUS                  0.60387839 -0.02973978  7.64114150  0.22921788
## NORTH COAST                   23.85079378 -0.02973978  7.64114150  8.63902846
## ONE TREE HILL                  1.94493634 -0.02973978  7.64114150  0.71435938
## ORANGE GROVE                   3.06007509 -0.02973978  7.64114150  1.11777228
## OXLEY                          3.14266096 -0.02973978  7.64114150  1.14764857
## PANDAN                        -1.36983385 -0.02973978  7.64114150 -0.48479280
## PANG SUA                      -1.27507040 -0.02973978  7.64114150 -0.45051115
## PASIR PANJANG 1                0.20321078 -0.02973978  7.64114150  0.08427226
## PASIR PANJANG 2                0.92235766 -0.02973978  7.64114150  0.34443103
## PASIR RIS DRIVE               -1.96456603 -0.02973978  7.64114150 -0.69994328
## PASIR RIS PARK                 0.60510095 -0.02973978  7.64114150  0.22966016
## PASIR RIS WAFER FAB PARK      -0.25502081 -0.02973978  7.64114150 -0.08149773
## PASIR RIS WEST                 0.47526192 -0.02973978  7.64114150  0.18268955
## PATERSON                       1.16256595 -0.02973978  7.64114150  0.43132885
## PAYA LEBAR EAST                0.69638616 -0.02973978  7.64114150  0.26268352
## PAYA LEBAR NORTH               1.62166716 -0.02973978  7.64114150  0.59741343
## PAYA LEBAR WEST               -0.25931046 -0.02973978  7.64114150 -0.08304956
## PEARL'S HILL                   0.63268349 -0.02973978  7.64114150  0.23963843
## PEI CHUN                       0.48848440 -0.02973978  7.64114150  0.18747292
## PENG SIANG                     1.19252019 -0.02973978  7.64114150  0.44216511
## PENJURU CRESCENT               0.74510597 -0.02973978  7.64114150  0.28030841
## PEOPLE'S PARK                  0.80234441 -0.02973978  7.64114150  0.30101501
## PHILLIP                        4.02818385 -0.02973978  7.64114150  1.46799558
## PLAB                           1.46784086 -0.02973978  7.64114150  0.54176519
## PORT                           1.41875519 -0.02973978  7.64114150  0.52400794
## POTONG PASIR                   0.59174133 -0.02973978  7.64114150  0.22482718
## PUNGGOL FIELD                  4.36601917 -0.02973978  7.64114150  1.59021098
## QUEENSWAY                      1.16608649 -0.02973978  7.64114150  0.43260244
## RAFFLES PLACE                  3.93862330 -0.02973978  7.64114150  1.43559613
## REDHILL                        0.00492902 -0.02973978  7.64114150  0.01254179
## RESERVOIR VIEW                 0.68633741 -0.02973978  7.64114150  0.25904828
## RIDOUT                         2.58053549 -0.02973978  7.64114150  0.94429391
## RIVERVALE                      7.66622293 -0.02973978  7.64114150  2.78409361
## ROBERTSON QUAY                 2.04676495 -0.02973978  7.64114150  0.75119693
## ROCHOR CANAL                   1.28505796 -0.02973978  7.64114150  0.47564159
## SAFTI                          0.49968998 -0.02973978  7.64114150  0.19152666
## SAMULUN                        4.80635753 -0.02973978  7.64114150  1.74950791
## SAUJANA                       -1.51605323 -0.02973978  7.64114150 -0.53768917
## SELEGIE                        1.49292671 -0.02973978  7.64114150  0.55084025
## SELETAR                       -3.00083317 -0.02973978  7.64114150 -1.07482357
## SELETAR AEROSPACE PARK        -0.70329064 -0.02973978  7.64114150 -0.24366395
## SELETAR HILLS                 -1.30927136 -0.02973978  7.64114150 -0.46288370
## SEMBAWANG CENTRAL              0.08499459 -0.02973978  7.64114150  0.04150634
## SEMBAWANG EAST                 1.13567450 -0.02973978  7.64114150  0.42160059
## SEMBAWANG HILLS               -2.76012641 -0.02973978  7.64114150 -0.98774543
## SEMBAWANG NORTH               -0.04066985 -0.02973978  7.64114150 -0.00395407
## SEMBAWANG SPRINGS              1.04818329 -0.02973978  7.64114150  0.38994975
## SEMBAWANG STRAITS              1.55158200 -0.02973978  7.64114150  0.57205941
## SENGKANG TOWN CENTRE          19.04028728 -0.02973978  7.64114150  6.89877829
## SENGKANG WEST                  0.72537791 -0.02973978  7.64114150  0.27317158
## SENNETT                        0.33866853 -0.02973978  7.64114150  0.13327549
## SENOKO NORTH                  -1.02654769 -0.02973978  7.64114150 -0.36060551
## SENOKO SOUTH                  -1.18823722 -0.02973978  7.64114150 -0.41909836
## SENOKO WEST                   -5.09832148 -0.02973978  7.64114150 -1.83361153
## SENTOSA                        3.01689263 -0.02973978  7.64114150  1.10215059
## SERANGOON CENTRAL              0.56398380 -0.02973978  7.64114150  0.21478561
## SERANGOON GARDEN               4.46496792 -0.02973978  7.64114150  1.62600671
## SERANGOON NORTH                1.50788225 -0.02973978  7.64114150  0.55625057
## SERANGOON NORTH IND ESTATE    -3.81194124 -0.02973978  7.64114150 -1.36825025
## SHANGRI-LA                    -0.64702332 -0.02973978  7.64114150 -0.22330867
## SIGLAP                        -4.20814258 -0.02973978  7.64114150 -1.51158016
## SIMEI                          7.33077038 -0.02973978  7.64114150  2.66274020
## SINGAPORE POLYTECHNIC         -0.36442227 -0.02973978  7.64114150 -0.12107483
## SOMERSET                      -1.78625099 -0.02973978  7.64114150 -0.63543598
## SPRINGLEAF                     0.74424445 -0.02973978  7.64114150  0.27999675
## STRAITS VIEW                   5.82964838 -0.02973978  7.64114150  2.11969389
## SUNGEI ROAD                    0.76339083 -0.02973978  7.64114150  0.28692315
## SWISS CLUB                     1.00354205 -0.02973978  7.64114150  0.37380032
## TAGORE                        -0.27122322 -0.02973978  7.64114150 -0.08735912
## TAI SENG                       0.23843550 -0.02973978  7.64114150  0.09701516
## TAMAN JURONG                   3.13754406 -0.02973978  7.64114150  1.14579748
## TAMPINES NORTH                -0.80145219 -0.02973978  7.64114150 -0.27917490
## TAMPINES WEST                  5.15551482 -0.02973978  7.64114150  1.87581914
## TANGLIN                        2.88745283 -0.02973978  7.64114150  1.05532441
## TANGLIN HALT                   0.73946350 -0.02973978  7.64114150  0.27826719
## TANJONG PAGAR                  3.24856696 -0.02973978  7.64114150  1.18596116
## TANJONG RHU                   -0.26413070 -0.02973978  7.64114150 -0.08479332
## TEBAN GARDENS                  0.13537666 -0.02973978  7.64114150  0.05973257
## TECK WHYE                      1.74022995 -0.02973978  7.64114150  0.64030474
## TELOK BLANGAH DRIVE           -0.22169053 -0.02973978  7.64114150 -0.06944016
## TELOK BLANGAH RISE             0.13478822 -0.02973978  7.64114150  0.05951969
## TELOK BLANGAH WAY             -0.15749018 -0.02973978  7.64114150 -0.04621502
## TENGAH                        -2.77260075 -0.02973978  7.64114150 -0.99225815
## TENGEH                         1.85880135 -0.02973978  7.64114150  0.68319916
## THE WHARVES                    1.45701325 -0.02973978  7.64114150  0.53784819
## TIONG BAHRU                    0.31064329 -0.02973978  7.64114150  0.12313707
## TIONG BAHRU STATION           -1.67435614 -0.02973978  7.64114150 -0.59495687
## TOA PAYOH WEST                -0.09033899 -0.02973978  7.64114150 -0.02192239
## TOH GUAN                       0.24752499 -0.02973978  7.64114150  0.10030338
## TOH TUCK                      -0.99933545 -0.02973978  7.64114150 -0.35076120
## TOWNSVILLE                     2.54916896 -0.02973978  7.64114150  0.93294674
## TRAFALGAR                      5.94344509 -0.02973978  7.64114150  2.16086102
## TUAS NORTH                     1.50823833 -0.02973978  7.64114150  0.55637939
## TUAS PROMENADE                 1.35321307 -0.02973978  7.64114150  0.50029741
## TUAS VIEW                      4.22071610 -0.02973978  7.64114150  1.53764610
## TUAS VIEW EXTENSION            4.60508229 -0.02973978  7.64114150  1.67669452
## TUKANG                         1.52134850 -0.02973978  7.64114150  0.56112213
## TURF CLUB                      0.31094566 -0.02973978  7.64114150  0.12324646
## TYERSALL                       1.47357310 -0.02973978  7.64114150  0.54383888
## ULU PANDAN                     0.15104154 -0.02973978  7.64114150  0.06539950
## UPPER PAYA LEBAR              -0.54810382 -0.02973978  7.64114150 -0.18752352
## UPPER THOMSON                  6.01548510 -0.02973978  7.64114150  2.18692223
## VICTORIA                      -1.97592740 -0.02973978  7.64114150 -0.70405338
## WATERWAY EAST                 -2.02506845 -0.02973978  7.64114150 -0.72183065
## WENYA                         -2.57151144 -0.02973978  7.64114150 -0.91951202
## WEST COAST                    -1.29217239 -0.02973978  7.64114150 -0.45669797
## WOODGROVE                      1.87184454 -0.02973978  7.64114150  0.68791767
## WOODLANDS EAST                15.68050631 -0.02973978  7.64114150  5.68334299
## WOODLANDS REGIONAL CENTRE     33.55616367 -0.02973978  7.64114150 12.15004577
## WOODLANDS SOUTH                3.40595724 -0.02973978  7.64114150  1.24289871
## WOODLANDS WEST                 6.71962925 -0.02973978  7.64114150  2.44165361
## WOODLEIGH                      2.52430440 -0.02973978  7.64114150  0.92395173
## XILIN                         -2.42797661 -0.02973978  7.64114150 -0.86758682
## YEW TEE                        0.76670798 -0.02973978  7.64114150  0.28812316
## YIO CHU KANG                   1.07813906 -0.02973978  7.64114150  0.40078655
## YIO CHU KANG EAST             -1.47628003 -0.02973978  7.64114150 -0.52330080
## YIO CHU KANG WEST              0.20780980 -0.02973978  7.64114150  0.08593600
## YISHUN SOUTH                  -6.26730790 -0.02973978  7.64114150 -2.25650438
## YUHUA EAST                     1.23224115 -0.02973978  7.64114150  0.45653457
## YUHUA WEST                     1.79385323 -0.02973978  7.64114150  0.65970351
## YUNNAN                         0.21445443 -0.02973978  7.64114150  0.08833976
##                               Pr.z...0.
## ADMIRALTY                        0.3549
## AIRPORT ROAD                     0.7331
## ALEXANDRA HILL                   0.6215
## ALEXANDRA NORTH                  0.5181
## ALJUNIED                         0.0002
## ANAK BUKIT                       0.5510
## ANCHORVALE                       0.1485
## ANG MO KIO TOWN CENTRE           0.0107
## ANSON                            0.1420
## BANGKIT                          0.4489
## BAYFRONT SUBZONE                 0.0536
## BAYSHORE                         0.9676
## BEDOK RESERVOIR                  0.0448
## BEDOK SOUTH                      0.0000
## BENCOOLEN                        0.2306
## BENDEMEER                        0.6054
## BIDADARI                         0.5434
## BISHAN EAST                      0.5174
## BOAT QUAY                        0.0863
## BOON KENG                        0.4854
## BOON LAY PLACE                   0.0795
## BOON TECK                        0.4624
## BOULEVARD                        0.9641
## BRADDELL                         0.5082
## BRICKWORKS                       0.5230
## BUGIS                            0.6364
## BUKIT BATOK CENTRAL              0.4679
## BUKIT BATOK EAST                 0.5146
## BUKIT BATOK SOUTH                0.4944
## BUKIT BATOK WEST                 0.6553
## BUKIT HO SWEE                    0.3892
## BUKIT MERAH                      0.5000
## CECIL                            0.1491
## CENTRAL WATER CATCHMENT          0.4215
## CHANGI AIRPORT                   0.5443
## CHANGI POINT                     0.5593
## CHANGI WEST                      0.5492
## CHATSWORTH                       0.3232
## CHENG SAN                        0.0126
## CHIN BEE                         0.9037
## CHINA SQUARE                     0.1847
## CHINATOWN                        0.7633
## CHOA CHU KANG CENTRAL            0.0034
## CHOA CHU KANG NORTH              0.4962
## CHONG BOON                       0.0166
## CITY TERMINALS                   0.1310
## CLARKE QUAY                      0.3131
## CLEMENTI CENTRAL                 0.9275
## CLEMENTI NORTH                   0.5238
## CLEMENTI WEST                    0.5151
## CLEMENTI WOODS                   0.4592
## CLIFFORD PIER                    0.0755
## COMMONWEALTH                     0.3862
## COMPASSVALE                      0.5989
## CORONATION ROAD                  0.3561
## CRAWFORD                         0.4463
## DEPOT ROAD                       0.4526
## DHOBY GHAUT                      0.4640
## DOVER                            0.4389
## DUNEARN                          0.1997
## EAST COAST                       0.9994
## EVERTON PARK                     0.2713
## FABER                            0.7946
## FAJAR                            0.6428
## FARRER COURT                     0.1831
## FARRER PARK                      0.7037
## FERNVALE                         0.5316
## FLORA DRIVE                      0.4857
## FORT CANNING                     0.1252
## FRANKEL                          0.0000
## GALI BATU                        0.5696
## GEYLANG BAHRU                    0.5113
## GEYLANG EAST                     0.0000
## GHIM MOH                         0.3532
## GOMBAK                           0.6178
## GOODWOOD PARK                    0.2387
## GREENWOOD PARK                   0.9997
## GUILIN                           0.5401
## GUL BASIN                        0.0369
## HENDERSON HILL                   0.5155
## HILLCREST                        0.2665
## HILLVIEW                         0.5243
## HOLLAND DRIVE                    0.3490
## HOLLAND ROAD                     0.5153
## HONG KAH                         0.1385
## HONG KAH NORTH                   0.4583
## HOUGANG CENTRAL                  0.0027
## HOUGANG EAST                     0.3523
## HOUGANG WEST                     0.0001
## INSTITUTION HILL                 0.1547
## INTERNATIONAL BUSINESS PARK      0.6350
## ISTANA NEGARA                    0.2058
## JELEBU                           0.0272
## JOO KOON                         0.6083
## JOO SENG                         0.4251
## JURONG GATEWAY                   0.3731
## JURONG PORT                      0.2144
## JURONG RIVER                     0.5638
## KALLANG BAHRU                    0.4802
## KALLANG WAY                      0.6393
## KAMPONG BUGIS                    0.3634
## KAMPONG GLAM                     0.3205
## KAMPONG JAVA                     0.3613
## KAMPONG TIONG BAHRU              0.4740
## KAMPONG UBI                      0.0134
## KANGKAR                          0.3904
## KATONG                           0.7218
## KEAT HONG                        0.4223
## KEBUN BAHRU                      0.3827
## KEMBANGAN                        0.0025
## KENT RIDGE                       0.3354
## KHATIB                           0.5341
## KIAN TECK                        0.6923
## KIM KEAT                         0.3907
## KOVAN                            0.0967
## KRANJI                           0.8453
## LAKESIDE                         0.7305
## LAVENDER                         0.8028
## LEEDON PARK                      0.2501
## LEONIE HILL                      0.2593
## LIM CHU KANG                     0.5082
## LITTLE INDIA                     0.2842
## LIU FANG                         0.2986
## LORONG 8 TOA PAYOH               0.4459
## LORONG AH SOO                    0.0002
## LORONG CHUAN                     0.8113
## LORONG HALUS                     0.8155
## LOYANG EAST                      0.6625
## LOYANG WEST                      0.4222
## MACKENZIE                        0.2214
## MALCOLM                          0.3436
## MANDAI EAST                      0.7988
## MANDAI ESTATE                    0.4539
## MANDAI WEST                      0.9995
## MARINA CENTRE                    0.3264
## MARINA EAST (MP)                 0.4803
## MARINA SOUTH                     0.0233
## MARINE PARADE                    0.0002
## MARYMOUNT                        0.1002
## MATILDA                          0.0013
## MAXWELL                          0.0756
## MEI CHIN                         0.4192
## MIDVIEW                          0.0270
## MONK'S HILL                      0.4064
## MOULMEIN                         0.7368
## NASSIM                           0.3702
## NATIONAL UNIVERSITY OF S'PORE    0.4134
## NATURE RESERVE                   0.7524
## NEE SOON                         0.2780
## NEWTON CIRCUS                    0.4093
## NORTH COAST                      0.0000
## ONE TREE HILL                    0.2375
## ORANGE GROVE                     0.1318
## OXLEY                            0.1256
## PANDAN                           0.6861
## PANG SUA                         0.6738
## PASIR PANJANG 1                  0.4664
## PASIR PANJANG 2                  0.3653
## PASIR RIS DRIVE                  0.7580
## PASIR RIS PARK                   0.4092
## PASIR RIS WAFER FAB PARK         0.5325
## PASIR RIS WEST                   0.4275
## PATERSON                         0.3331
## PAYA LEBAR EAST                  0.3964
## PAYA LEBAR NORTH                 0.2751
## PAYA LEBAR WEST                  0.5331
## PEARL'S HILL                     0.4053
## PEI CHUN                         0.4256
## PENG SIANG                       0.3292
## PENJURU CRESCENT                 0.3896
## PEOPLE'S PARK                    0.3817
## PHILLIP                          0.0711
## PLAB                             0.2940
## PORT                             0.3001
## POTONG PASIR                     0.4111
## PUNGGOL FIELD                    0.0559
## QUEENSWAY                        0.3327
## RAFFLES PLACE                    0.0756
## REDHILL                          0.4950
## RESERVOIR VIEW                   0.3978
## RIDOUT                           0.1725
## RIVERVALE                        0.0027
## ROBERTSON QUAY                   0.2263
## ROCHOR CANAL                     0.3172
## SAFTI                            0.4241
## SAMULUN                          0.0401
## SAUJANA                          0.7046
## SELEGIE                          0.2909
## SELETAR                          0.8588
## SELETAR AEROSPACE PARK           0.5963
## SELETAR HILLS                    0.6783
## SEMBAWANG CENTRAL                0.4834
## SEMBAWANG EAST                   0.3367
## SEMBAWANG HILLS                  0.8384
## SEMBAWANG NORTH                  0.5016
## SEMBAWANG SPRINGS                0.3483
## SEMBAWANG STRAITS                0.2836
## SENGKANG TOWN CENTRE             0.0000
## SENGKANG WEST                    0.3924
## SENNETT                          0.4470
## SENOKO NORTH                     0.6408
## SENOKO SOUTH                     0.6624
## SENOKO WEST                      0.9666
## SENTOSA                          0.1352
## SERANGOON CENTRAL                0.4150
## SERANGOON GARDEN                 0.0520
## SERANGOON NORTH                  0.2890
## SERANGOON NORTH IND ESTATE       0.9144
## SHANGRI-LA                       0.5884
## SIGLAP                           0.9347
## SIMEI                            0.0039
## SINGAPORE POLYTECHNIC            0.5482
## SOMERSET                         0.7374
## SPRINGLEAF                       0.3897
## STRAITS VIEW                     0.0170
## SUNGEI ROAD                      0.3871
## SWISS CLUB                       0.3543
## TAGORE                           0.5348
## TAI SENG                         0.4614
## TAMAN JURONG                     0.1259
## TAMPINES NORTH                   0.6099
## TAMPINES WEST                    0.0303
## TANGLIN                          0.1456
## TANGLIN HALT                     0.3904
## TANJONG PAGAR                    0.1178
## TANJONG RHU                      0.5338
## TEBAN GARDENS                    0.4762
## TECK WHYE                        0.2610
## TELOK BLANGAH DRIVE              0.5277
## TELOK BLANGAH RISE               0.4763
## TELOK BLANGAH WAY                0.5184
## TENGAH                           0.8395
## TENGEH                           0.2472
## THE WHARVES                      0.2953
## TIONG BAHRU                      0.4510
## TIONG BAHRU STATION              0.7241
## TOA PAYOH WEST                   0.5087
## TOH GUAN                         0.4601
## TOH TUCK                         0.6371
## TOWNSVILLE                       0.1754
## TRAFALGAR                        0.0154
## TUAS NORTH                       0.2890
## TUAS PROMENADE                   0.3084
## TUAS VIEW                        0.0621
## TUAS VIEW EXTENSION              0.0468
## TUKANG                           0.2874
## TURF CLUB                        0.4510
## TYERSALL                         0.2933
## ULU PANDAN                       0.4739
## UPPER PAYA LEBAR                 0.5744
## UPPER THOMSON                    0.0144
## VICTORIA                         0.7593
## WATERWAY EAST                    0.7648
## WENYA                            0.8211
## WEST COAST                       0.6761
## WOODGROVE                        0.2458
## WOODLANDS EAST                   0.0000
## WOODLANDS REGIONAL CENTRE        0.0000
## WOODLANDS SOUTH                  0.1070
## WOODLANDS WEST                   0.0073
## WOODLEIGH                        0.1778
## XILIN                            0.8072
## YEW TEE                          0.3866
## YIO CHU KANG                     0.3443
## YIO CHU KANG EAST                0.6996
## YIO CHU KANG WEST                0.4658
## YISHUN SOUTH                     0.9880
## YUHUA EAST                       0.3240
## YUHUA WEST                       0.2547
## YUNNAN                           0.4648
tap_in_data.localMI <- cbind(tap_in_data,localMI)

Commuters’ tap-out data

fips_out <- order(tap_out_data$SUBZONE_N)
localMI_out <- localmoran(tap_out_data$total_count_of_tap_out, rswm_k_out)
head(localMI_out)
##            Ii        E.Ii   Var.Ii        Z.Ii    Pr(z > 0)
## 1  0.72842699 -0.02973978 7.659402  0.27394748 0.3920624919
## 2 -2.14037615 -0.02973978 7.659402 -0.76263368 0.7771590543
## 3 -1.27568088 -0.02973978 7.659402 -0.45019439 0.6737148582
## 4 -0.26439611 -0.02973978 7.659402 -0.08478809 0.5337850679
## 5  9.91164282 -0.02973978 7.659402  3.59210772 0.0001640071
## 6 -0.08120392 -0.02973978 7.659402 -0.01859548 0.5074180944
printCoefmat(data.frame(localMI_out[fips_out,], row.names=tap_out_data$SUBZONE_N[fips_out]), check.names=FALSE)
##                                        Ii        E.Ii      Var.Ii        Z.Ii
## ADMIRALTY                      0.72842699 -0.02973978  7.65940216  0.27394748
## AIRPORT ROAD                  -2.14037615 -0.02973978  7.65940216 -0.76263368
## ALEXANDRA HILL                -1.27568088 -0.02973978  7.65940216 -0.45019439
## ALEXANDRA NORTH               -0.26439611 -0.02973978  7.65940216 -0.08478809
## ALJUNIED                       9.91164282 -0.02973978  7.65940216  3.59210772
## ANAK BUKIT                    -0.08120392 -0.02973978  7.65940216 -0.01859548
## ANCHORVALE                     2.97945867 -0.02973978  7.65940216  1.08731003
## ANG MO KIO TOWN CENTRE         5.69234113 -0.02973978  7.65940216  2.06755256
## ANSON                          3.09254545 -0.02973978  7.65940216  1.12817154
## BANGKIT                        0.15758115 -0.02973978  7.65940216  0.06768444
## BAYFRONT SUBZONE               4.26630302 -0.02973978  7.65940216  1.55228393
## BAYSHORE                      -7.42144803 -0.02973978  7.65940216 -2.67083698
## BEDOK RESERVOIR                4.22923393 -0.02973978  7.65940216  1.53888980
## BEDOK SOUTH                   12.23513665 -0.02973978  7.65940216  4.43165293
## BENCOOLEN                      2.34537512 -0.02973978  7.65940216  0.85819739
## BENDEMEER                     -0.91888559 -0.02973978  7.65940216 -0.32127398
## BIDADARI                      -0.30267272 -0.02973978  7.65940216 -0.09861853
## BISHAN EAST                    1.11587082 -0.02973978  7.65940216  0.41394209
## BOAT QUAY                      3.25360798 -0.02973978  7.65940216  1.18636806
## BOON KENG                     -0.08405739 -0.02973978  7.65940216 -0.01962652
## BOON LAY PLACE                 4.27608560 -0.02973978  7.65940216  1.55581866
## BOON TECK                      0.01344367 -0.02973978  7.65940216  0.01560342
## BOULEVARD                     -7.27462624 -0.02973978  7.65940216 -2.61778604
## BRADDELL                      -0.17926577 -0.02973978  7.65940216 -0.05402805
## BRICKWORKS                    -0.11830955 -0.02973978  7.65940216 -0.03200281
## BUGIS                         -1.29370946 -0.02973978  7.65940216 -0.45670863
## BUKIT BATOK CENTRAL            0.46610021 -0.02973978  7.65940216  0.17916126
## BUKIT BATOK EAST              -0.38473475 -0.02973978  7.65940216 -0.12826990
## BUKIT BATOK SOUTH              0.07626305 -0.02973978  7.65940216  0.03830187
## BUKIT BATOK WEST              -0.66562772 -0.02973978  7.65940216 -0.22976462
## BUKIT HO SWEE                  0.90134941 -0.02973978  7.65940216  0.33642933
## BUKIT MERAH                   -0.24429272 -0.02973978  7.65940216 -0.07752416
## CECIL                          3.06466770 -0.02973978  7.65940216  1.11809850
## CENTRAL WATER CATCHMENT        0.53011757 -0.02973978  7.65940216  0.20229258
## CHANGI AIRPORT                -0.43650682 -0.02973978  7.65940216 -0.14697664
## CHANGI POINT                  -0.43698744 -0.02973978  7.65940216 -0.14715030
## CHANGI WEST                   -0.78293349 -0.02973978  7.65940216 -0.27215057
## CHATSWORTH                     1.59653668 -0.02973978  7.65940216  0.58762050
## CHENG SAN                      4.57685398 -0.02973978  7.65940216  1.66449494
## CHIN BEE                      -3.72594269 -0.02973978  7.65940216 -1.33554452
## CHINA SQUARE                   2.18614720 -0.02973978  7.65940216  0.80066376
## CHINATOWN                     -0.77582955 -0.02973978  7.65940216 -0.26958371
## CHOA CHU KANG CENTRAL          6.44665900 -0.02973978  7.65940216  2.34010932
## CHOA CHU KANG NORTH           -0.26278759 -0.02973978  7.65940216 -0.08420688
## CHONG BOON                     8.26559773 -0.02973978  7.65940216  2.99734424
## CITY TERMINALS                 2.99848324 -0.02973978  7.65940216  1.09418415
## CLARKE QUAY                    2.35991552 -0.02973978  7.65940216  0.86345125
## CLEMENTI CENTRAL              -3.33936989 -0.02973978  7.65940216 -1.19586464
## CLEMENTI NORTH                -0.55295785 -0.02973978  7.65940216 -0.18905375
## CLEMENTI WEST                  0.09228685 -0.02973978  7.65940216  0.04409173
## CLEMENTI WOODS                 0.16337703 -0.02973978  7.65940216  0.06977866
## CLIFFORD PIER                  3.88523186 -0.02973978  7.65940216  1.41459195
## COMMONWEALTH                   1.30434022 -0.02973978  7.65940216  0.48204151
## COMPASSVALE                   -0.61890113 -0.02973978  7.65940216 -0.21288096
## CORONATION ROAD                1.38096998 -0.02973978  7.65940216  0.50973005
## CRAWFORD                       0.26809916 -0.02973978  7.65940216  0.10761778
## DEPOT ROAD                    -0.06702865 -0.02973978  7.65940216 -0.01347354
## DHOBY GHAUT                   -0.19359149 -0.02973978  7.65940216 -0.05920434
## DOVER                          0.21951215 -0.02973978  7.65940216  0.09006190
## DUNEARN                        3.18963691 -0.02973978  7.65940216  1.16325347
## EAST COAST                    -9.33665382 -0.02973978  7.65940216 -3.36285596
## EVERTON PARK                   1.29529567 -0.02973978  7.65940216  0.47877345
## FABER                         -2.28378734 -0.02973978  7.65940216 -0.81445227
## FAJAR                         -0.89084565 -0.02973978  7.65940216 -0.31114234
## FARRER COURT                   2.80902908 -0.02973978  7.65940216  1.02572891
## FARRER PARK                   -1.24365514 -0.02973978  7.65940216 -0.43862257
## FERNVALE                      -0.17954411 -0.02973978  7.65940216 -0.05412862
## FLORA DRIVE                    0.13526939 -0.02973978  7.65940216  0.05962256
## FORT CANNING                   3.06870224 -0.02973978  7.65940216  1.11955630
## FRANKEL                       13.48240582 -0.02973978  7.65940216  4.88232718
## GALI BATU                     -0.41083051 -0.02973978  7.65940216 -0.13769905
## GEYLANG BAHRU                 -0.06993433 -0.02973978  7.65940216 -0.01452345
## GEYLANG EAST                  23.28955939 -0.02973978  7.65940216  8.42593409
## GHIM MOH                       1.08621890 -0.02973978  7.65940216  0.40322800
## GOMBAK                        -2.43979480 -0.02973978  7.65940216 -0.87082226
## GOODWOOD PARK                  1.88782299 -0.02973978  7.65940216  0.69287063
## GREENWOOD PARK                -9.15805538 -0.02973978  7.65940216 -3.29832321
## GUILIN                        -0.00091332 -0.02973978  7.65940216  0.01041583
## GUL BASIN                      4.37223284 -0.02973978  7.65940216  1.59055943
## HENDERSON HILL                 0.00292384 -0.02973978  7.65940216  0.01180231
## HILLCREST                      2.03477116 -0.02973978  7.65940216  0.74596723
## HILLVIEW                      -0.06704668 -0.02973978  7.65940216 -0.01348006
## HOLLAND DRIVE                  1.03036933 -0.02973978  7.65940216  0.38304794
## HOLLAND ROAD                  -0.11504665 -0.02973978  7.65940216 -0.03082383
## HONG KAH                       4.32432045 -0.02973978  7.65940216  1.57324730
## HONG KAH NORTH                 0.11554948 -0.02973978  7.65940216  0.05249719
## HOUGANG CENTRAL                8.67315473 -0.02973978  7.65940216  3.14460632
## HOUGANG EAST                   0.88131637 -0.02973978  7.65940216  0.32919081
## HOUGANG WEST                   9.86705296 -0.02973978  7.65940216  3.57599612
## INSTITUTION HILL               3.21044205 -0.02973978  7.65940216  1.17077097
## INTERNATIONAL BUSINESS PARK   -1.29474274 -0.02973978  7.65940216 -0.45708199
## ISTANA NEGARA                  2.92234975 -0.02973978  7.65940216  1.06667493
## JELEBU                         4.64969300 -0.02973978  7.65940216  1.69081377
## JOO KOON                      -0.27464681 -0.02973978  7.65940216 -0.08849196
## JOO SENG                       0.38421309 -0.02973978  7.65940216  0.14957309
## JURONG GATEWAY                 1.55815663 -0.02973978  7.65940216  0.57375268
## JURONG PORT                    1.60032097 -0.02973978  7.65940216  0.58898787
## JURONG RIVER                  -0.79534866 -0.02973978  7.65940216 -0.27663653
## KALLANG BAHRU                 -0.13894027 -0.02973978  7.65940216 -0.03945728
## KALLANG WAY                   -1.46735524 -0.02973978  7.65940216 -0.51945185
## KAMPONG BUGIS                  0.79275984 -0.02973978  7.65940216  0.29719279
## KAMPONG GLAM                   1.49841809 -0.02973978  7.65940216  0.55216743
## KAMPONG JAVA                   0.93109581 -0.02973978  7.65940216  0.34717756
## KAMPONG TIONG BAHRU            0.13419402 -0.02973978  7.65940216  0.05923400
## KAMPONG UBI                    6.84716384 -0.02973978  7.65940216  2.48482324
## KANGKAR                        0.70363332 -0.02973978  7.65940216  0.26498881
## KATONG                        -1.28293056 -0.02973978  7.65940216 -0.45281390
## KEAT HONG                      1.87670629 -0.02973978  7.65940216  0.68885384
## KEBUN BAHRU                    0.02483470 -0.02973978  7.65940216  0.01971933
## KEMBANGAN                      7.65254558 -0.02973978  7.65940216  2.77583085
## KENT RIDGE                     0.67345120 -0.02973978  7.65940216  0.25408314
## KHATIB                        -2.74381226 -0.02973978  7.65940216 -0.98067252
## KIAN TECK                     -1.18179357 -0.02973978  7.65940216 -0.41627020
## KIM KEAT                       0.65177826 -0.02973978  7.65940216  0.24625209
## KOVAN                          3.21882814 -0.02973978  7.65940216  1.17380111
## KRANJI                        -2.42351127 -0.02973978  7.65940216 -0.86493855
## LAKESIDE                      -1.24786128 -0.02973978  7.65940216 -0.44014237
## LAVENDER                      -1.98087071 -0.02973978  7.65940216 -0.70499977
## LEEDON PARK                    2.15131775 -0.02973978  7.65940216  0.78807887
## LEONIE HILL                    2.08284250 -0.02973978  7.65940216  0.76333679
## LIM CHU KANG                  -0.03123251 -0.02973978  7.65940216 -0.00053937
## LITTLE INDIA                   2.12490652 -0.02973978  7.65940216  0.77853573
## LIU FANG                       1.07442573 -0.02973978  7.65940216  0.39896678
## LORONG 8 TOA PAYOH             0.09439815 -0.02973978  7.65940216  0.04485461
## LORONG AH SOO                 10.32207088 -0.02973978  7.65940216  3.74040719
## LORONG CHUAN                  -2.91587273 -0.02973978  7.65940216 -1.04284292
## LORONG HALUS                  -2.70542146 -0.02973978  7.65940216 -0.96680082
## LOYANG EAST                   -1.45218885 -0.02973978  7.65940216 -0.51397180
## LOYANG WEST                    0.63175951 -0.02973978  7.65940216  0.23901874
## MACKENZIE                      2.96176959 -0.02973978  7.65940216  1.08091845
## MALCOLM                        0.97616801 -0.02973978  7.65940216  0.36346344
## MANDAI EAST                   -3.70611197 -0.02973978  7.65940216 -1.32837911
## MANDAI ESTATE                  0.09347683 -0.02973978  7.65940216  0.04452171
## MANDAI WEST                   -9.65178992 -0.02973978  7.65940216 -3.47672371
## MARINA CENTRE                  1.20953531 -0.02973978  7.65940216  0.44778576
## MARINA EAST (MP)              -0.33732582 -0.02973978  7.65940216 -0.11113969
## MARINA SOUTH                   5.44211867 -0.02973978  7.65940216  1.97713998
## MARINE PARADE                  8.65850727 -0.02973978  7.65940216  3.13931377
## MARYMOUNT                      3.12354518 -0.02973978  7.65940216  1.13937263
## MATILDA                        9.41542770 -0.02973978  7.65940216  3.41281091
## MAXWELL                        4.06460058 -0.02973978  7.65940216  1.47940303
## MEI CHIN                       0.02723032 -0.02973978  7.65940216  0.02058494
## MIDVIEW                        4.96135498 -0.02973978  7.65940216  1.80342622
## MONK'S HILL                    0.92987263 -0.02973978  7.65940216  0.34673559
## MOULMEIN                      -1.53756089 -0.02973978  7.65940216 -0.54481917
## NASSIM                         1.18285553 -0.02973978  7.65940216  0.43814559
## NATIONAL UNIVERSITY OF S'PORE  0.68156547 -0.02973978  7.65940216  0.25701506
## NATURE RESERVE                -2.06668646 -0.02973978  7.65940216 -0.73600748
## NEE SOON                       1.40791887 -0.02973978  7.65940216  0.51946746
## NEWTON CIRCUS                  1.18969099 -0.02973978  7.65940216  0.44061544
## NORTH COAST                   21.43223324 -0.02973978  7.65940216  7.75482868
## ONE TREE HILL                  2.33240247 -0.02973978  7.65940216  0.85350999
## ORANGE GROVE                   3.39083244 -0.02973978  7.65940216  1.23595121
## OXLEY                          3.54685224 -0.02973978  7.65940216  1.29232566
## PANDAN                        -1.51368046 -0.02973978  7.65940216 -0.53619049
## PANG SUA                      -1.16297959 -0.02973978  7.65940216 -0.40947217
## PASIR PANJANG 1                0.07075478 -0.02973978  7.65940216  0.03631158
## PASIR PANJANG 2                0.94118674 -0.02973978  7.65940216  0.35082370
## PASIR RIS DRIVE               -2.19216111 -0.02973978  7.65940216 -0.78134508
## PASIR RIS PARK                 0.65061954 -0.02973978  7.65940216  0.24583341
## PASIR RIS WAFER FAB PARK      -0.16387826 -0.02973978  7.65940216 -0.04846810
## PASIR RIS WEST                 0.60551076 -0.02973978  7.65940216  0.22953431
## PATERSON                       2.30466248 -0.02973978  7.65940216  0.84348674
## PAYA LEBAR EAST                0.69716413 -0.02973978  7.65940216  0.26265131
## PAYA LEBAR NORTH               1.72149854 -0.02973978  7.65940216  0.63277282
## PAYA LEBAR WEST               -0.49704585 -0.02973978  7.65940216 -0.16885114
## PEARL'S HILL                   1.23602716 -0.02973978  7.65940216  0.45735803
## PEI CHUN                       0.13872140 -0.02973978  7.65940216  0.06086987
## PENG SIANG                     0.68023055 -0.02973978  7.65940216  0.25653272
## PENJURU CRESCENT               0.70309916 -0.02973978  7.65940216  0.26479580
## PEOPLE'S PARK                  0.23448999 -0.02973978  7.65940216  0.09547382
## PHILLIP                        4.29191238 -0.02973978  7.65940216  1.56153733
## PLAB                           1.50576965 -0.02973978  7.65940216  0.55482376
## PORT                           1.53069335 -0.02973978  7.65940216  0.56382941
## POTONG PASIR                   0.36052117 -0.02973978  7.65940216  0.14101252
## PUNGGOL FIELD                  3.71875089 -0.02973978  7.65940216  1.35443759
## QUEENSWAY                      0.91500782 -0.02973978  7.65940216  0.34136450
## RAFFLES PLACE                  4.26380906 -0.02973978  7.65940216  1.55138279
## REDHILL                        0.01560403 -0.02973978  7.65940216  0.01638402
## RESERVOIR VIEW                -0.05562768 -0.02973978  7.65940216 -0.00935405
## RIDOUT                         2.38439995 -0.02973978  7.65940216  0.87229818
## RIVERVALE                      8.30680523 -0.02973978  7.65940216  3.01223370
## ROBERTSON QUAY                 2.10222009 -0.02973978  7.65940216  0.77033847
## ROCHOR CANAL                   1.51439035 -0.02973978  7.65940216  0.55793867
## SAFTI                          0.51220516 -0.02973978  7.65940216  0.19582031
## SAMULUN                        4.26724951 -0.02973978  7.65940216  1.55262593
## SAUJANA                       -1.26689437 -0.02973978  7.65940216 -0.44701957
## SELEGIE                        1.85627374 -0.02973978  7.65940216  0.68147098
## SELETAR                       -2.97598479 -0.02973978  7.65940216 -1.06456314
## SELETAR AEROSPACE PARK        -0.60120817 -0.02973978  7.65940216 -0.20648798
## SELETAR HILLS                 -0.79003730 -0.02973978  7.65940216 -0.27471738
## SEMBAWANG CENTRAL              0.63307227 -0.02973978  7.65940216  0.23949307
## SEMBAWANG EAST                 0.94453429 -0.02973978  7.65940216  0.35203327
## SEMBAWANG HILLS               -2.07389857 -0.02973978  7.65940216 -0.73861342
## SEMBAWANG NORTH               -0.49861721 -0.02973978  7.65940216 -0.16941892
## SEMBAWANG SPRINGS              1.14803252 -0.02973978  7.65940216  0.42556304
## SEMBAWANG STRAITS              1.52633142 -0.02973978  7.65940216  0.56225332
## SENGKANG TOWN CENTRE          18.58495132 -0.02973978  7.65940216  6.72602376
## SENGKANG WEST                  0.67199411 -0.02973978  7.65940216  0.25355665
## SENNETT                        0.71723797 -0.02973978  7.65940216  0.26990456
## SENOKO NORTH                  -1.06888151 -0.02973978  7.65940216 -0.37547182
## SENOKO SOUTH                  -1.67139773 -0.02973978  7.65940216 -0.59317828
## SENOKO WEST                   -4.99289815 -0.02973978  7.65940216 -1.79333200
## SENTOSA                        3.08753784 -0.02973978  7.65940216  1.12636214
## SERANGOON CENTRAL              1.89341871 -0.02973978  7.65940216  0.69489252
## SERANGOON GARDEN               4.09199978 -0.02973978  7.65940216  1.48930316
## SERANGOON NORTH                2.32439438 -0.02973978  7.65940216  0.85061644
## SERANGOON NORTH IND ESTATE    -4.00411787 -0.02973978  7.65940216 -1.43605722
## SHANGRI-LA                     0.60184392 -0.02973978  7.65940216  0.22820937
## SIGLAP                        -5.34242363 -0.02973978  7.65940216 -1.91962561
## SIMEI                          7.37214430 -0.02973978  7.65940216  2.67451380
## SINGAPORE POLYTECHNIC         -0.69985009 -0.02973978  7.65940216 -0.24213014
## SOMERSET                      -0.93737901 -0.02973978  7.65940216 -0.32795618
## SPRINGLEAF                     0.34889360 -0.02973978  7.65940216  0.13681114
## STRAITS VIEW                   6.09840952 -0.02973978  7.65940216  2.21427675
## SUNGEI ROAD                    1.02885177 -0.02973978  7.65940216  0.38249960
## SWISS CLUB                     0.55940165 -0.02973978  7.65940216  0.21287376
## TAGORE                        -0.24531738 -0.02973978  7.65940216 -0.07789439
## TAI SENG                      -0.17837711 -0.02973978  7.65940216 -0.05370695
## TAMAN JURONG                   4.08507552 -0.02973978  7.65940216  1.48680122
## TAMPINES NORTH                -1.37786773 -0.02973978  7.65940216 -0.48711744
## TAMPINES WEST                  4.37221866 -0.02973978  7.65940216  1.59055430
## TANGLIN                        3.14008285 -0.02973978  7.65940216  1.14534817
## TANGLIN HALT                   0.30356144 -0.02973978  7.65940216  0.12043132
## TANJONG PAGAR                  3.54406640 -0.02973978  7.65940216  1.29131905
## TANJONG RHU                   -0.55368335 -0.02973978  7.65940216 -0.18931589
## TEBAN GARDENS                  0.01970119 -0.02973978  7.65940216  0.01786445
## TECK WHYE                      1.22557685 -0.02973978  7.65940216  0.45358204
## TELOK BLANGAH DRIVE           -0.57446889 -0.02973978  7.65940216 -0.19682631
## TELOK BLANGAH RISE             0.13489815 -0.02973978  7.65940216  0.05948842
## TELOK BLANGAH WAY             -0.32580333 -0.02973978  7.65940216 -0.10697629
## TENGAH                        -2.60474254 -0.02973978  7.65940216 -0.93042262
## TENGEH                         1.89375693 -0.02973978  7.65940216  0.69501473
## THE WHARVES                    1.54144787 -0.02973978  7.65940216  0.56771533
## TIONG BAHRU                    0.26903830 -0.02973978  7.65940216  0.10795712
## TIONG BAHRU STATION           -1.40292351 -0.02973978  7.65940216 -0.49617081
## TOA PAYOH WEST                -0.17858211 -0.02973978  7.65940216 -0.05378102
## TOH GUAN                       0.36388481 -0.02973978  7.65940216  0.14222790
## TOH TUCK                      -0.58387374 -0.02973978  7.65940216 -0.20022455
## TOWNSVILLE                    -0.16706313 -0.02973978  7.65940216 -0.04961888
## TRAFALGAR                      6.05958698 -0.02973978  7.65940216  2.20024905
## TUAS NORTH                     1.56589605 -0.02973978  7.65940216  0.57654916
## TUAS PROMENADE                 1.57315714 -0.02973978  7.65940216  0.57917280
## TUAS VIEW                      3.41387266 -0.02973978  7.65940216  1.24427630
## TUAS VIEW EXTENSION            4.60633680 -0.02973978  7.65940216  1.67514793
## TUKANG                         1.08316132 -0.02973978  7.65940216  0.40212320
## TURF CLUB                      0.09360128 -0.02973978  7.65940216  0.04456667
## TYERSALL                       2.33993107 -0.02973978  7.65940216  0.85623029
## ULU PANDAN                     0.30626313 -0.02973978  7.65940216  0.12140752
## UPPER PAYA LEBAR               0.02941697 -0.02973978  7.65940216  0.02137503
## UPPER THOMSON                  5.96310519 -0.02973978  7.65940216  2.16538740
## VICTORIA                      -0.90582282 -0.02973978  7.65940216 -0.31655403
## WATERWAY EAST                 -1.46095570 -0.02973978  7.65940216 -0.51713951
## WENYA                         -2.94851883 -0.02973978  7.65940216 -1.05463890
## WEST COAST                    -1.09969117 -0.02973978  7.65940216 -0.38660424
## WOODGROVE                      0.33313707 -0.02973978  7.65940216  0.13111785
## WOODLANDS EAST                13.04439391 -0.02973978  7.65940216  4.72406087
## WOODLANDS REGIONAL CENTRE     30.93069608 -0.02973978  7.65940216 11.18689674
## WOODLANDS SOUTH                3.04927527 -0.02973978  7.65940216  1.11253677
## WOODLANDS WEST                10.40287785 -0.02973978  7.65940216  3.76960507
## WOODLEIGH                      1.97308292 -0.02973978  7.65940216  0.72367750
## XILIN                         -2.20090442 -0.02973978  7.65940216 -0.78450429
## YEW TEE                        0.62511157 -0.02973978  7.65940216  0.23661664
## YIO CHU KANG                   0.89248666 -0.02973978  7.65940216  0.33322696
## YIO CHU KANG EAST             -0.90605854 -0.02973978  7.65940216 -0.31663920
## YIO CHU KANG WEST              0.02142000 -0.02973978  7.65940216  0.01848550
## YISHUN SOUTH                  -2.81406160 -0.02973978  7.65940216 -1.00605563
## YUHUA EAST                     1.40075322 -0.02973978  7.65940216  0.51687830
## YUHUA WEST                     1.98280101 -0.02973978  7.65940216  0.72718892
## YUNNAN                         0.29219264 -0.02973978  7.65940216  0.11632345
##                               Pr.z...0.
## ADMIRALTY                        0.3921
## AIRPORT ROAD                     0.7772
## ALEXANDRA HILL                   0.6737
## ALEXANDRA NORTH                  0.5338
## ALJUNIED                         0.0002
## ANAK BUKIT                       0.5074
## ANCHORVALE                       0.1384
## ANG MO KIO TOWN CENTRE           0.0193
## ANSON                            0.1296
## BANGKIT                          0.4730
## BAYFRONT SUBZONE                 0.0603
## BAYSHORE                         0.9962
## BEDOK RESERVOIR                  0.0619
## BEDOK SOUTH                      0.0000
## BENCOOLEN                        0.1954
## BENDEMEER                        0.6260
## BIDADARI                         0.5393
## BISHAN EAST                      0.3395
## BOAT QUAY                        0.1177
## BOON KENG                        0.5078
## BOON LAY PLACE                   0.0599
## BOON TECK                        0.4938
## BOULEVARD                        0.9956
## BRADDELL                         0.5215
## BRICKWORKS                       0.5128
## BUGIS                            0.6761
## BUKIT BATOK CENTRAL              0.4289
## BUKIT BATOK EAST                 0.5510
## BUKIT BATOK SOUTH                0.4847
## BUKIT BATOK WEST                 0.5909
## BUKIT HO SWEE                    0.3683
## BUKIT MERAH                      0.5309
## CECIL                            0.1318
## CENTRAL WATER CATCHMENT          0.4198
## CHANGI AIRPORT                   0.5584
## CHANGI POINT                     0.5585
## CHANGI WEST                      0.6072
## CHATSWORTH                       0.2784
## CHENG SAN                        0.0480
## CHIN BEE                         0.9092
## CHINA SQUARE                     0.2117
## CHINATOWN                        0.6063
## CHOA CHU KANG CENTRAL            0.0096
## CHOA CHU KANG NORTH              0.5336
## CHONG BOON                       0.0014
## CITY TERMINALS                   0.1369
## CLARKE QUAY                      0.1939
## CLEMENTI CENTRAL                 0.8841
## CLEMENTI NORTH                   0.5750
## CLEMENTI WEST                    0.4824
## CLEMENTI WOODS                   0.4722
## CLIFFORD PIER                    0.0786
## COMMONWEALTH                     0.3149
## COMPASSVALE                      0.5843
## CORONATION ROAD                  0.3051
## CRAWFORD                         0.4571
## DEPOT ROAD                       0.5054
## DHOBY GHAUT                      0.5236
## DOVER                            0.4641
## DUNEARN                          0.1224
## EAST COAST                       0.9996
## EVERTON PARK                     0.3160
## FABER                            0.7923
## FAJAR                            0.6222
## FARRER COURT                     0.1525
## FARRER PARK                      0.6695
## FERNVALE                         0.5216
## FLORA DRIVE                      0.4762
## FORT CANNING                     0.1315
## FRANKEL                          0.0000
## GALI BATU                        0.5548
## GEYLANG BAHRU                    0.5058
## GEYLANG EAST                     0.0000
## GHIM MOH                         0.3434
## GOMBAK                           0.8081
## GOODWOOD PARK                    0.2442
## GREENWOOD PARK                   0.9995
## GUILIN                           0.4958
## GUL BASIN                        0.0559
## HENDERSON HILL                   0.4953
## HILLCREST                        0.2278
## HILLVIEW                         0.5054
## HOLLAND DRIVE                    0.3508
## HOLLAND ROAD                     0.5123
## HONG KAH                         0.0578
## HONG KAH NORTH                   0.4791
## HOUGANG CENTRAL                  0.0008
## HOUGANG EAST                     0.3710
## HOUGANG WEST                     0.0002
## INSTITUTION HILL                 0.1208
## INTERNATIONAL BUSINESS PARK      0.6762
## ISTANA NEGARA                    0.1431
## JELEBU                           0.0454
## JOO KOON                         0.5353
## JOO SENG                         0.4406
## JURONG GATEWAY                   0.2831
## JURONG PORT                      0.2779
## JURONG RIVER                     0.6090
## KALLANG BAHRU                    0.5157
## KALLANG WAY                      0.6983
## KAMPONG BUGIS                    0.3832
## KAMPONG GLAM                     0.2904
## KAMPONG JAVA                     0.3642
## KAMPONG TIONG BAHRU              0.4764
## KAMPONG UBI                      0.0065
## KANGKAR                          0.3955
## KATONG                           0.6747
## KEAT HONG                        0.2455
## KEBUN BAHRU                      0.4921
## KEMBANGAN                        0.0028
## KENT RIDGE                       0.3997
## KHATIB                           0.8366
## KIAN TECK                        0.6614
## KIM KEAT                         0.4027
## KOVAN                            0.1202
## KRANJI                           0.8065
## LAKESIDE                         0.6701
## LAVENDER                         0.7596
## LEEDON PARK                      0.2153
## LEONIE HILL                      0.2226
## LIM CHU KANG                     0.5002
## LITTLE INDIA                     0.2181
## LIU FANG                         0.3450
## LORONG 8 TOA PAYOH               0.4821
## LORONG AH SOO                    0.0001
## LORONG CHUAN                     0.8515
## LORONG HALUS                     0.8332
## LOYANG EAST                      0.6964
## LOYANG WEST                      0.4055
## MACKENZIE                        0.1399
## MALCOLM                          0.3581
## MANDAI EAST                      0.9080
## MANDAI ESTATE                    0.4822
## MANDAI WEST                      0.9997
## MARINA CENTRE                    0.3272
## MARINA EAST (MP)                 0.5442
## MARINA SOUTH                     0.0240
## MARINE PARADE                    0.0008
## MARYMOUNT                        0.1273
## MATILDA                          0.0003
## MAXWELL                          0.0695
## MEI CHIN                         0.4918
## MIDVIEW                          0.0357
## MONK'S HILL                      0.3644
## MOULMEIN                         0.7071
## NASSIM                           0.3306
## NATIONAL UNIVERSITY OF S'PORE    0.3986
## NATURE RESERVE                   0.7691
## NEE SOON                         0.3017
## NEWTON CIRCUS                    0.3297
## NORTH COAST                      0.0000
## ONE TREE HILL                    0.1967
## ORANGE GROVE                     0.1082
## OXLEY                            0.0981
## PANDAN                           0.7041
## PANG SUA                         0.6589
## PASIR PANJANG 1                  0.4855
## PASIR PANJANG 2                  0.3629
## PASIR RIS DRIVE                  0.7827
## PASIR RIS PARK                   0.4029
## PASIR RIS WAFER FAB PARK         0.5193
## PASIR RIS WEST                   0.4092
## PATERSON                         0.1995
## PAYA LEBAR EAST                  0.3964
## PAYA LEBAR NORTH                 0.2634
## PAYA LEBAR WEST                  0.5670
## PEARL'S HILL                     0.3237
## PEI CHUN                         0.4757
## PENG SIANG                       0.3988
## PENJURU CRESCENT                 0.3956
## PEOPLE'S PARK                    0.4620
## PHILLIP                          0.0592
## PLAB                             0.2895
## PORT                             0.2864
## POTONG PASIR                     0.4439
## PUNGGOL FIELD                    0.0878
## QUEENSWAY                        0.3664
## RAFFLES PLACE                    0.0604
## REDHILL                          0.4935
## RESERVOIR VIEW                   0.5037
## RIDOUT                           0.1915
## RIVERVALE                        0.0013
## ROBERTSON QUAY                   0.2205
## ROCHOR CANAL                     0.2884
## SAFTI                            0.4224
## SAMULUN                          0.0603
## SAUJANA                          0.6726
## SELEGIE                          0.2478
## SELETAR                          0.8565
## SELETAR AEROSPACE PARK           0.5818
## SELETAR HILLS                    0.6082
## SEMBAWANG CENTRAL                0.4054
## SEMBAWANG EAST                   0.3624
## SEMBAWANG HILLS                  0.7699
## SEMBAWANG NORTH                  0.5673
## SEMBAWANG SPRINGS                0.3352
## SEMBAWANG STRAITS                0.2870
## SENGKANG TOWN CENTRE             0.0000
## SENGKANG WEST                    0.3999
## SENNETT                          0.3936
## SENOKO NORTH                     0.6463
## SENOKO SOUTH                     0.7235
## SENOKO WEST                      0.9635
## SENTOSA                          0.1300
## SERANGOON CENTRAL                0.2436
## SERANGOON GARDEN                 0.0682
## SERANGOON NORTH                  0.1975
## SERANGOON NORTH IND ESTATE       0.9245
## SHANGRI-LA                       0.4097
## SIGLAP                           0.9725
## SIMEI                            0.0037
## SINGAPORE POLYTECHNIC            0.5957
## SOMERSET                         0.6285
## SPRINGLEAF                       0.4456
## STRAITS VIEW                     0.0134
## SUNGEI ROAD                      0.3510
## SWISS CLUB                       0.4157
## TAGORE                           0.5310
## TAI SENG                         0.5214
## TAMAN JURONG                     0.0685
## TAMPINES NORTH                   0.6869
## TAMPINES WEST                    0.0559
## TANGLIN                          0.1260
## TANGLIN HALT                     0.4521
## TANJONG PAGAR                    0.0983
## TANJONG RHU                      0.5751
## TEBAN GARDENS                    0.4929
## TECK WHYE                        0.3251
## TELOK BLANGAH DRIVE              0.5780
## TELOK BLANGAH RISE               0.4763
## TELOK BLANGAH WAY                0.5426
## TENGAH                           0.8239
## TENGEH                           0.2435
## THE WHARVES                      0.2851
## TIONG BAHRU                      0.4570
## TIONG BAHRU STATION              0.6901
## TOA PAYOH WEST                   0.5214
## TOH GUAN                         0.4434
## TOH TUCK                         0.5793
## TOWNSVILLE                       0.5198
## TRAFALGAR                        0.0139
## TUAS NORTH                       0.2821
## TUAS PROMENADE                   0.2812
## TUAS VIEW                        0.1067
## TUAS VIEW EXTENSION              0.0470
## TUKANG                           0.3438
## TURF CLUB                        0.4822
## TYERSALL                         0.1959
## ULU PANDAN                       0.4517
## UPPER PAYA LEBAR                 0.4915
## UPPER THOMSON                    0.0152
## VICTORIA                         0.6242
## WATERWAY EAST                    0.6975
## WENYA                            0.8542
## WEST COAST                       0.6505
## WOODGROVE                        0.4478
## WOODLANDS EAST                   0.0000
## WOODLANDS REGIONAL CENTRE        0.0000
## WOODLANDS SOUTH                  0.1330
## WOODLANDS WEST                   0.0001
## WOODLEIGH                        0.2346
## XILIN                            0.7836
## YEW TEE                          0.4065
## YIO CHU KANG                     0.3695
## YIO CHU KANG EAST                0.6242
## YIO CHU KANG WEST                0.4926
## YISHUN SOUTH                     0.8428
## YUHUA EAST                       0.3026
## YUHUA WEST                       0.2336
## YUNNAN                           0.4537
tap_out_data.localMI_out <- cbind(tap_out_data,localMI_out)

9.1.2 Mapping of Local Moran’s I

Commuters’ tap-in data

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

pvalue.map <- tm_shape(tap_in_data.localMI) +
  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-values") +
  tm_borders(alpha = 0.5)

tmap_arrange(localMI.map, pvalue.map, asp=1, ncol=2)
## Warning: The shape tap_in_data.localMI 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 tap_in_data.localMI is invalid. See sf::st_is_valid

Commuters’ tap-out data

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

pvalue_out.map <- tm_shape(tap_out_data.localMI_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-values") +
  tm_borders(alpha = 0.5)

tmap_arrange(localMI_out.map, pvalue_out.map, asp=1, ncol=2)
## Warning: The shape tap_out_data.localMI_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 tap_out_data.localMI_out is invalid. See sf::st_is_valid

9.1.3 Lisa Cluster Map

Commuters’ tap-in data
Visualize it with a Moran’s Scatter Plot.

tap_in_data$Z.total_count_of_tap_in <- scale(tap_in_data$total_count_of_tap_in) %>% as.vector 

nci <- moran.plot(tap_in_data$Z.total_count_of_tap_in, rswm_k, labels=as.character(tap_in_data$SUBZONE_N), xlab="Total Tap in Volume", ylab="Spatially Lag Tap In Volume")

Build Lisa Cluster Map
The map helps to identify the locations that meet the significance value of 0.05 as set in the code below. Given this significance value, we can see only 2 quadrant levels being displayed, mainly the low-high (spatial outlier such as Tuas View Extension) and the high-high quadrants (spatial cluster such as Sengkang Town Centre).

quadrant <- vector(mode="numeric",length=nrow(localMI))
DV <- tap_in_data$total_count_of_tap_in - mean(tap_in_data$total_count_of_tap_in)     
C_mI <- localMI[,1] - mean(localMI[,1])    
signif <- 0.05
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
quadrant[localMI[,5]>signif] <- 0
tap_in_data.localMI$quadrant <- quadrant
colors <- c("#ffffff", "#2c7bb6", "#abd9e9", "#fdae61", "#d7191c")
clusters <- c("insignificant", "low-low", "low-high", "high-low", "high-high")

tm_shape(st_make_valid(tap_in_data.localMI)) +
  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)

Commuters’ tap-out data
Visualize it with a Moran’s Scatter Plot.

tap_out_data$Z.total_count_of_tap_out <- scale(tap_out_data$total_count_of_tap_out) %>% as.vector 

nci_out <- moran.plot(tap_out_data$Z.total_count_of_tap_out, rswm_k_out, labels=as.character(tap_out_data$SUBZONE_N), xlab="Total Tap out Volume", ylab="Spatially Lag Tap out Volume")

Build LISA Cluster Map
The map helps to identify the locations that meet the significance value of 0.05 as set in the code below. Given this significance value, we can see only 2 quadrant levels being displayed, mainly the low-high (spatial outlier such as Tuas View Extension) and the high-high quadrants (spatial cluster such as Sengkang Town Centre).

quadrant_out <- vector(mode="numeric",length=nrow(localMI_out))
DV_out <- tap_out_data$total_count_of_tap_out - mean(tap_out_data$total_count_of_tap_out)     
C_mI_out <- localMI_out[,1] - mean(localMI_out[,1])    
signif <- 0.05
quadrant_out[DV_out >0 & C_mI_out>0] <- 4      
quadrant_out[DV_out <0 & C_mI_out<0] <- 1      
quadrant_out[DV_out <0 & C_mI_out>0] <- 2
quadrant_out[DV_out >0 & C_mI_out<0] <- 3
quadrant_out[localMI_out[,5]>signif] <- 0
tap_out_data.localMI_out$quadrant <- quadrant_out
colors_out <- c("#ffffff", "#2c7bb6", "#abd9e9", "#fdae61", "#d7191c")
clusters_out <- c("insignificant", "low-low", "low-high", "high-low", "high-high")

tm_shape(st_make_valid(tap_out_data.localMI_out)) +
  tm_fill(col = "quadrant", style = "cat", palette = colors[c(sort(unique(quadrant_out)))+1], labels = clusters[c(sort(unique(quadrant_out)))+1], popup.vars = c("SUBZONE_N")) +
  tm_view(set.zoom.limits = c(11,17)) +
  tm_borders(alpha=0.5)

9.2 Analysis of Hot Spot and Cold Spot Area

9.2.1 Deriving the Spatial Weight Matrix

Commuters’ tap-in data

knb_in <- knn2nb(knearneigh(coords, k=8, longlat = FALSE), row.names=row.names(tap_in_data$total_count_of_tap_in))
knb_lw_in <- nb2listw(knb_in, style = 'B')
summary(knb_lw_in)
## Characteristics of weights list object:
## Neighbour list object:
## Number of regions: 270 
## Number of nonzero links: 2160 
## Percentage nonzero weights: 2.962963 
## Average number of links: 8 
## Non-symmetric neighbours list
## Link number distribution:
## 
##   8 
## 270 
## 270 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 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 with 8 links
## 270 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 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 with 8 links
## 
## Weights style: B 
## Weights constants summary:
##     n    nn   S0   S1    S2
## B 270 72900 2160 3896 70696

Visualisation

plot(singapore, border="grey")
plot(knb_in, coordinates(spatial_tap_in_data), pch=19, cex=0.6, add=TRUE, col="red")

Commuters’ tap-out data

knb_out <- knn2nb(knearneigh(coords_out, k=8, longlat = FALSE), row.names=row.names(tap_out_data$total_count_of_tap_out))
knb_lw_out <- nb2listw(knb_out, style = 'B')
summary(knb_lw_out)
## Characteristics of weights list object:
## Neighbour list object:
## Number of regions: 270 
## Number of nonzero links: 2160 
## Percentage nonzero weights: 2.962963 
## Average number of links: 8 
## Non-symmetric neighbours list
## Link number distribution:
## 
##   8 
## 270 
## 270 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 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 with 8 links
## 270 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 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 with 8 links
## 
## Weights style: B 
## Weights constants summary:
##     n    nn   S0   S1    S2
## B 270 72900 2160 3896 70696

Visualisation

plot(singapore, border="grey")
plot(knb_out, coordinates(spatial_tap_out_data), pch=19, cex=0.6, add=TRUE, col="blue")

9.2.2 Computing of Gi Statistics

Commuters’ tap-in data

fips <- order(spatial_tap_in_data$total_count_of_tap_in)
gi.adaptive <- localG(spatial_tap_in_data$total_count_of_tap_in, knb_lw_in)
spatial_tap_in_data.gi <- cbind(spatial_tap_in_data, as.matrix(gi.adaptive))
names(spatial_tap_in_data.gi)[5] <- "gstat_adaptive"

Commuters’ tap-out data

fips_out <- order(spatial_tap_out_data$total_count_of_tap_out)
gi_out.adaptive <- localG(spatial_tap_out_data$total_count_of_tap_out, knb_lw_out)
spatial_tap_out_data.gi <- cbind(spatial_tap_out_data, as.matrix(gi_out.adaptive))
names(spatial_tap_out_data.gi)[5] <- "gstat_adaptive_out"

9.2.3 Visualisation of Local Gi

Commuters’ tap-in data
The diagram below shows the tap-in volume for residential location, categorizing the higher volume in red and lower volume in blue. The density of the volume in each residential location is reflected. The cold spot is categorized as blue, and as the blue gets darker, it indicates even lesser tap-ins proportionally. This applies to the hot-spot in red as well.

tm_shape(spatial_tap_in_data.gi) +
  tm_fill(col = "gstat_adaptive", 
          style = "pretty",
          palette="-RdBu",
          title = "local Gi") +
  tm_borders(alpha = 0.5)
## Warning: The shape spatial_tap_in_data.gi is invalid. See sf::st_is_valid
## Variable(s) "gstat_adaptive" contains positive and negative values, so midpoint is set to 0. Set midpoint = NA to show the full spectrum of the color palette.

Commuters’ tap-out data
The diagram below shows the tap-out volume for residential location, categorizing the higher volume in red and lower volume in blue. The density of the volume in each residential location is reflected. The cold spot is categorized as blue, and as the blue gets darker, it indicates even lesser tap-outs proportionally. This applies to the hot-spot in red as well.

tm_shape(spatial_tap_out_data.gi) +
  tm_fill(col = "gstat_adaptive_out", 
          style = "pretty",
          palette="-RdBu",
          title = "local Gi") +
  tm_borders(alpha = 0.5)
## Warning: The shape spatial_tap_out_data.gi is invalid. See sf::st_is_valid
## Variable(s) "gstat_adaptive_out" contains positive and negative values, so midpoint is set to 0. Set midpoint = NA to show the full spectrum of the color palette.

Revert to tmap_mode from interactive to plot mode.

#tmap_mode("plot")  #There was an error for me to publish onto RPubs because of the the tmap_mode. Therefore, I commented it off. 

10.0 Discuss the Analysis Results


From the visualization diagrams and the analysis above, the tap-in and tap-out volume can be concluded as following:

1. Residuals’ distribution is not randomized, as the observed spatial pattern of values are unique to this set of data. Also, the values in one location is actually dependent on the neighbouring locations.

2. From the LISA cluster maps, more clusters are observed as compared to the outliers. Clusters observed are high and positive, therefore this can show that the locations are associated with relatively high values from neighbouring locations. Thus, displaying the dependency between neighbours.

3. Hot and Cold spot analysis can also show similar observations for both the tap in and tap out. As seen from the hot and cold spot diagrams above, locations like Midview has the highest tap in volume while locations like Marina South has the lowest. Similarly, observations for tap out volume can be observed to be the same as well. One thing to highlight is that for the cold spot analysis, Tuas View is observed as well which in contrast is different for the tap-in volume.

This shows that residential population does not impact on the tap in and tap out volume directly, but rather the surrounding neighbours may have.

For instance, the residential population in Kovan is about 24950 but its tap in volume is at 464650. However, Kovan is depicted as an insignificant area on the LISA map but the neighbours such as Hougang West, is depicted as a high-high cluster.

Thus, this can show that Kovan is actually grouped into the hot spots because of the location being surrounded by neighbours with high values.