1. Installing and Loading the R package
packages = c('sf', 'tmap', 'tidyverse', 'rgdal', 'maptools', 'raster','spatstat')
for (p in packages){
if(!require(p, character.only = T)){
install.packages(p)
}
library(p,character.only = T)
}
2. Importing the spatial data
listings <- read_csv("data/aspatial/listings.csv")
## Parsed with column specification:
## cols(
## id = col_double(),
## name = col_character(),
## host_id = col_double(),
## host_name = col_character(),
## neighbourhood_group = col_character(),
## neighbourhood = col_character(),
## latitude = col_double(),
## longitude = col_double(),
## room_type = col_character(),
## price = col_double(),
## minimum_nights = col_double(),
## number_of_reviews = col_double(),
## last_review = col_date(format = ""),
## reviews_per_month = col_double(),
## calculated_host_listings_count = col_double(),
## availability_365 = col_double()
## )
sg <- st_read(dsn = "data/geospatial", layer="CostalOutline")
## Reading layer `CostalOutline' from data source `C:\Users\Jenny\Documents\SMU Documents\YEAR 3\Year 3 Semester 2\IS415 - Geospatial Analytics and Applications\Take-home exercises\IS415_Take-home_Ex02\data\geospatial' using driver `ESRI Shapefile'
## Simple feature collection with 60 features and 4 fields
## geometry type: POLYGON
## dimension: XY
## bbox: xmin: 2663.926 ymin: 16357.98 xmax: 56047.79 ymax: 50244.03
## epsg (SRID): NA
## 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
mpsz <- st_read(dsn = "data/geospatial", layer="MP14_SUBZONE_WEB_PL")
## Reading layer `MP14_SUBZONE_WEB_PL' from data source `C:\Users\Jenny\Documents\SMU Documents\YEAR 3\Year 3 Semester 2\IS415 - Geospatial Analytics and Applications\Take-home exercises\IS415_Take-home_Ex02\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
## epsg (SRID): NA
## 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
3. Creating a sf data frame from an aspatial data frame
listings_sf <- st_as_sf(listings,
coords = c("longitude", "latitude"),
crs= 4326)
4. Filtering data
listings_filtered <- dplyr::select(listings_sf, c(neighbourhood_group, neighbourhood, room_type, price, number_of_reviews, geometry))
5. Working with Projection
5.1 Checking projection
st_crs(listings_filtered)
## Coordinate Reference System:
## EPSG: 4326
## proj4string: "+proj=longlat +datum=WGS84 +no_defs"
st_crs(sg)
## Coordinate Reference System:
## No EPSG code
## 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"
st_crs(mpsz)
## Coordinate Reference System:
## No EPSG code
## 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"
5.2 Assigning EPSG 3414
listings_filtered <- st_transform(listings_filtered, 3414)
mpsz <- st_set_crs(mpsz, 3414)
## Warning: st_crs<- : replacing crs does not reproject data; use st_transform
## for that
sg <- st_set_crs(sg, 3414)
## Warning: st_crs<- : replacing crs does not reproject data; use st_transform
## for that
Section A
6. Visualising Airbnb listing by room type
tmap_mode("view")
## tmap mode set to interactive viewing
tm_shape(sg) +
tm_borders(col = 'black',
lwd = 1,
alpha = 0.5) +
tm_shape(listings_filtered) +
tm_layout(title = "Airbnb Listings") +
tm_bubbles(col = "room_type",
size = 0.02,
border.col = "black",
border.lwd = 1,
alpha = 0.7) +
tm_basemap('OpenStreetMap')
tm_shape(sg) +
tm_borders(alpha = 0.5) +
tm_shape(listings_filtered) +
tm_bubbles(col = "room_type",
size = 0.09,
alpha = 0.5) +
tm_facets(by= "room_type",
nrow = 2,
sync = TRUE) +
tm_basemap('OpenStreetMap')
tmap_mode('plot')
## tmap mode set to plotting
7. Analysis of spatial patterns observed
1. Airbnb has listings all over Singapore - North, East, West and Central region.
2. Majority of the listings on Airbnb is located in the central region.
3. There are more ‘Entire home/apt’ and ‘Private room’ room type being listed on Airbnb as compared to ‘Hotel room’ and ‘Shared room’.
4. Private rooms on Airbnb is well dispersed across all regions in Singapore. The listings are randomly distributed across all regions in Singapore with signs of clustering in the central region.
5. Entire home/apt, hotel rooms and shared rooms on Airbnb show signs of clustering - more obvious in the central region.
8. Spatial Data Wrangling
8.3 Handling duplicates
any(duplicated(listings_ppp))
## [1] TRUE
listings_ppp_jit <- rjitter(listings_ppp, retry=TRUE, nsim=1, drop=TRUE)
8.4 Creating owin
sg_owin <- as(sg_sp, "owin")
8.5 Combining listing points and the study area
listingSG_ppp = listings_ppp_jit[sg_owin]
plot(listingSG_ppp)

9. Quadrat Analysis
9.1 Chi-squared test of CSR using quadrat counts
Hypothesis:
Ho = The distribution of Airbnb listings are randomly distributed.
H1= The distribution of Airbnb listings are not randomly distributed.
The 95% confident interval will be used.
The null hypothesis will be rejected if p-value is smaller than alpha value of 0.05.
qt <- quadrat.test(listingSG_ppp,
nx = 20, ny = 15)
qt
##
## Chi-squared test of CSR using quadrat counts
##
## data: listingSG_ppp
## X2 = 72545, df = 184, p-value < 2.2e-16
## alternative hypothesis: two.sided
##
## Quadrats: 185 tiles (irregular windows)
plot(listingSG_ppp)
plot(qt, add = TRUE, cex =.1)

9.3 Conditional Monte Carlo test of CSR using quadrat counts
quadrat.test(listingSG_ppp,
nx = 20, ny = 15,
method="M",
nsim=999)
##
## Conditional Monte Carlo test of CSR using quadrat counts
## Test statistic: Pearson X2 statistic
##
## data: listingSG_ppp
## X2 = 72545, p-value = 0.002
## alternative hypothesis: two.sided
##
## Quadrats: 185 tiles (irregular windows)
10. Nearest Neighbour Analysis
From the results above, we observed that there are many quadrats with no observation. This will affect the validity of the result. Therefore, we will be performing the Nearest Neighbour analysis.
Hypothesis:
Ho = The distribution of Airbnb listings are randomly distributed.
H1= The distribution of Airbnb listings are not randomly distributed.
The 95% confident interval will be used.
The null hypothesis will be rejected if p-value is smaller than alpha value of 0.05.
10.1 Testing spatial point patterns using Clark and Evans Test
# Number of simulation = 1000 to ensure that the results is stable
clarkevans.test(listingSG_ppp,
correction="none",
clipregion="sg_owin",
alternative=c("two.sided"),
nsim=999)
##
## Clark-Evans test
## No edge correction
## Monte Carlo test based on 999 simulations of CSR with fixed n
##
## data: listingSG_ppp
## R = 0.34314, p-value = 0.002
## alternative hypothesis: two-sided
11. Kernel Density Estimation
11.1 Computing kernel density estimation using automatic bandwidth selection method
kde_listingSG_ppp_bw <- density(listingSG_ppp, sigma=bw.diggle, edge=TRUE, kernel="gaussian")
# Convert measurement to km
listingSG_ppp.km <- rescale(listingSG_ppp, 1000, "km")
# Compute KDE again and plot
kde_listingSG.bw <- density(listingSG_ppp.km, sigma=bw.diggle, edge=TRUE, kernel="gaussian")
plot(kde_listingSG.bw, main="Airbnb Listings")

11.3 Converting KDE output into grid object.
gridded_kde_listingSG_bw <- as.SpatialGridDataFrame.im(kde_listingSG.bw)
spplot(gridded_kde_listingSG_bw, main="Airbnb Listings")

11.4 Converting gridded output into raster
kde_listingSG_bw_raster <- raster(gridded_kde_listingSG_bw)
kde_listingSG_bw_raster
## class : RasterLayer
## dimensions : 128, 128, 16384 (nrow, ncol, ncell)
## resolution : 0.4170614, 0.2647348 (x, y)
## extent : 2.663926, 56.04779, 16.35798, 50.24403 (xmin, xmax, ymin, ymax)
## crs : NA
## source : memory
## names : v
## values : -2.508821e-13, 1394.793 (min, max)
11.5 Assigning projection systems
projection(kde_listingSG_bw_raster) <- CRS("+init=EPSG:3414 +datum=WGS84 +units=km")
kde_listingSG_bw_raster
## class : RasterLayer
## dimensions : 128, 128, 16384 (nrow, ncol, ncell)
## resolution : 0.4170614, 0.2647348 (x, y)
## extent : 2.663926, 56.04779, 16.35798, 50.24403 (xmin, xmax, ymin, ymax)
## crs : +init=EPSG:3414 +datum=WGS84 +units=km +proj=tmerc +lat_0=1.366666666666667 +lon_0=103.8333333333333 +k=1 +x_0=28001.642 +y_0=38744.572 +no_defs +ellps=WGS84 +towgs84=0,0,0
## source : memory
## names : v
## values : -2.508821e-13, 1394.793 (min, max)
11.6 Visualising the output in tmap
tmap_mode("view")
tm_shape(sg) +
tm_borders(col = 'black',
lwd = 1,
alpha = 0.5) +
tm_shape(kde_listingSG_bw_raster) +
tm_raster("v", alpha = 0.7) +
tm_layout(legend.position = c("right", "bottom"), frame = FALSE, title = "Airbnb Listings") +
tm_basemap('OpenStreetMap')
tmap_mode("plot")
## tmap mode set to plotting
12. Comparing Spatial Point Patterns by room type using KDE
12.4 Combining room type and the study area
eh_sp_ppp_jit = rjitter(eh_sp_ppp, retry=TRUE, nsim=1, drop=TRUE)
hr_sp_ppp_jit = rjitter(hr_sp_ppp, retry=TRUE, nsim=1, drop=TRUE)
pr_sp_ppp_jit = rjitter(pr_sp_ppp, retry=TRUE, nsim=1, drop=TRUE)
sr_sp_ppp_jit = rjitter(sr_sp_ppp, retry=TRUE, nsim=1, drop=TRUE)
12.6 Plotting each room type
par(mfrow=c(2,2))
plot(st_geometry(sg), main = 'Entire Home/apt')
plot(st_geometry(eh), add=TRUE)
plot(st_geometry(sg), main = 'Hotel room')
plot(st_geometry(hr), add=TRUE)
plot(st_geometry(sg), main = 'Private room')
plot(st_geometry(pr), add=TRUE)
plot(st_geometry(sg), main = 'Shared room')
plot(st_geometry(sr), add=TRUE)

13. Derive kernel density maps of Airbnb listing by room type
13.1 Using bw.diggle method to derive the bandwidth
# kde_eh_bw <- density(eh_sp_ppp_jit.km, sigma=bw.diggle, edge=TRUE, kernel="gaussian")
# kde_hr_bw <- density(hr_sp_ppp_jit.km, sigma=bw.diggle, edge=TRUE, kernel="gaussian")
# kde_pr_bw <- density(pr_sp_ppp_jit.km, sigma=bw.diggle, edge=TRUE, kernel="gaussian")
# kde_sr_bw <- density(sr_sp_ppp_jit.km, sigma=bw.diggle, edge=TRUE, kernel="gaussian")
13.2 Computing fixed bandwidth KDE - using 1300m/1.3km as the bandwidth
kde_eh_bw_fixed <- density(eh_sp_ppp_jit.km, sigma=1.3, edge=TRUE, kernel="gaussian")
kde_hr_bw_fixed <- density(hr_sp_ppp_jit.km, sigma=1.3, edge=TRUE, kernel="gaussian")
kde_pr_bw_fixed <- density(pr_sp_ppp_jit.km, sigma=1.3, edge=TRUE, kernel="gaussian")
kde_sr_bw_fixed <- density(sr_sp_ppp_jit.km, sigma=1.3, edge=TRUE, kernel="gaussian")
par(mfrow=c(2,2))
plot(kde_eh_bw_fixed, main = "Entire home/apt")
plot(kde_hr_bw_fixed, main = "Hotel room")
plot(kde_pr_bw_fixed, main = "Private room")
plot(kde_sr_bw_fixed, main = "Shared room")

13.3 Display the kernel density maps on openstreetmap of Singapore
# Converting KDE output into grid object.
gridded_eh_bw <- as.SpatialGridDataFrame.im(kde_eh_bw_fixed)
gridded_hr_bw <- as.SpatialGridDataFrame.im(kde_hr_bw_fixed)
gridded_pr_bw <- as.SpatialGridDataFrame.im(kde_pr_bw_fixed)
gridded_sr_bw <- as.SpatialGridDataFrame.im(kde_sr_bw_fixed)
# Converting gridded output into raster
gridded_eh_bw_raster <- raster(gridded_eh_bw)
gridded_hr_bw_raster <- raster(gridded_hr_bw)
gridded_pr_bw_raster <- raster(gridded_pr_bw)
gridded_sr_bw_raster <- raster(gridded_sr_bw)
# Assigning projection systems
projection(gridded_eh_bw_raster) <- CRS("+init=EPSG:3414 +datum=WGS84 +units=km")
projection(gridded_hr_bw_raster) <- CRS("+init=EPSG:3414 +datum=WGS84 +units=km")
projection(gridded_pr_bw_raster) <- CRS("+init=EPSG:3414 +datum=WGS84 +units=km")
projection(gridded_sr_bw_raster) <- CRS("+init=EPSG:3414 +datum=WGS84 +units=km")
tmap_mode("view")
## tmap mode set to interactive viewing
13.4 Plotting kernel density map using tmap
eh_map <- tm_shape(sg) +
tm_borders(col = 'black',
lwd = 1,
alpha = 0.5) +
tm_shape(gridded_eh_bw_raster) +
tm_raster("v", breaks=c(0, 20, 40, 60, 80, 100), alpha = 0.7) +
tm_layout(legend.position = c("right", "bottom"), frame = FALSE, title = "Entire home/apt") +
tm_basemap('OpenStreetMap')
hr_map <- tm_shape(sg) +
tm_borders(col = 'black',
lwd = 1,
alpha = 0.5) +
tm_shape(gridded_hr_bw_raster) +
tm_raster("v", breaks=c(0, 20, 40, 60, 80, 100), alpha = 0.7) +
tm_layout(legend.position = c("right", "bottom"), frame = FALSE, title = "Hotel room") +
tm_basemap('OpenStreetMap')
pr_map <- tm_shape(sg) +
tm_borders(col = 'black',
lwd = 1,
alpha = 0.5) +
tm_shape(gridded_pr_bw_raster) +
tm_raster("v", breaks=c(0, 20, 40, 60, 80, 100), alpha = 0.7) +
tm_layout(legend.position = c("right", "bottom"), frame = FALSE, title = "Private room") +
tm_basemap('OpenStreetMap')
sr_map <- tm_shape(sg) +
tm_borders(col = 'black',
lwd = 1,
alpha = 0.5) +
tm_shape(gridded_sr_bw_raster) +
tm_raster("v", breaks=c(0, 20, 40, 60, 80, 100), alpha = 0.7) +
tm_layout(legend.position = c("right", "bottom"), frame = FALSE, title = "Shared room") +
tm_basemap('OpenStreetMap')
tmap_arrange(eh_map, hr_map, pr_map, sr_map, asp=2, ncol=2)
tmap_mode('plot')
## tmap mode set to plotting
13.5 Spatial patterns observed:
1. Most of the listings on Airbnb that are located in the central region are of room type - ‘Entire home/apt’.
2. There are 80 to 100 Airbnb listings with room type - ‘Entire home/apt’ within the 1km radius.
3. There are 20 to 40 Airbnb listings with room type - ‘Hotel room’ within the 1km radius.
4. There are 60 to 800 Airbnb listings with room type - ‘Private room’ within the 1km radius.
5. There are 0 to 20 Airbnb listings with room type - ‘Shared room’ within the 1km radius.
13.6 Advantage of kernel density map over point map
1. Helps to precisely identify the location, spatial extent and intensity of the Airbnb listings.
2. Visually attractive which helps to invoke further enquiry and the reasoning behind why the Airbnb listings is concentrated.
3. The density surface that is created can reflect the distribution of Airbnb listings.
4. It is less subjective if clear guidelines are followed for the setting of parameters.
5. The calculation of a density surfaces gives the users a better overview of the point data compared to a point map, where we have to deal with overprinting.
6. Density maps are often subject to further spatial analysis, for which a suitable density map and understanding its meaning is crucial.
7. Using the kernel functions for density estimation allows con-trolling information presented in the resulting map by changing the kernel search.
Section B: By planning subzones
14.3.1 Analysis of spatial patterns observed within Aljunied
1. Entire home/apt, Hotel room and Private room show signs of clustering at the heart of Aljunied.
2. Shared room follows a random distribution.
3. Majority of the listings at Aljunied are ‘Entire home/apt’ and ‘Private home’.
14.4 Distribution of room type in Balestier
listings_ba_eh_ppp = eh_sp_ppp_jit[ba_owin]
listings_ba_hr_ppp = hr_sp_ppp_jit[ba_owin]
listings_ba_pr_ppp = pr_sp_ppp_jit[ba_owin]
listings_ba_sr_ppp = sr_sp_ppp_jit[ba_owin]
par(mfrow=c(2,2))
plot(listings_ba_eh_ppp, main="Balestier - Entire home/apt")
plot(listings_ba_hr_ppp, main="Balestier - Hotel room")
plot(listings_ba_pr_ppp, main="Balestier - Private room")
plot(listings_ba_sr_ppp, main="Balestier - Shared room")

14.4.1 Analysis of spatial patterns observed
1. All room types show signs of clustering.
2. There are little of no listings at the upper right of Balestier.
3. Majority of the listings at Balestier are ‘Entire home/apt’.
14.5 Distribution of room type in Lavender
listings_la_eh_ppp = eh_sp_ppp_jit[la_owin]
listings_la_hr_ppp = hr_sp_ppp_jit[la_owin]
listings_la_pr_ppp = pr_sp_ppp_jit[la_owin]
listings_la_sr_ppp = sr_sp_ppp_jit[la_owin]
par(mfrow=c(2,2))
plot(listings_la_eh_ppp, main="Lavender - Entire home/apt")
plot(listings_la_hr_ppp, main="Lavender - Hotel room")
plot(listings_la_pr_ppp, main="Lavender - Private room")
plot(listings_la_sr_ppp, main="Lavender - Shared room")

14.5.1 Analysis of spatial patterns observed
1. All room types show signs of clustering.
2. Majority of the listings at Lavender are ‘Entire home/apt’ and ‘Private room’.
14.6 Distribution of room type in Tanjong Pagar
listings_tp_eh_ppp = eh_sp_ppp_jit[tp_owin]
listings_tp_hr_ppp = hr_sp_ppp_jit[tp_owin]
listings_tp_pr_ppp = pr_sp_ppp_jit[tp_owin]
listings_tp_sr_ppp = sr_sp_ppp_jit[tp_owin]
par(mfrow=c(2,2))
plot(listings_tp_eh_ppp, main="Tanjong Pagar - Entire home")
plot(listings_tp_hr_ppp, main="Tanjong Pagar - Hotel room")
plot(listings_tp_pr_ppp, main="Tanjong Pagar - Private room")
plot(listings_tp_sr_ppp, main="Tanjong Pagar - Shared room")

14.6.1 Analysis of spatial patterns observed
1. Entire home/apts and Private rooms at Tanjong Pagar show signs of clustering.
2. Hotel rooms at Tanjong Pagar are randomly distributed
3. There are no shared rooms at Tanjong Pagar.
4. There are little of no listings at the top of Tanjong Pagar
5. Majority of the listings at Tanjong Pagar are ‘Entire home/apt’.
15. Analysing Spatial Point Process Using G-Function
15.1 Computing G-function estimate
G_Al = Gest(listings_al_ppp, correction = "border")
G_Ba = Gest(listings_ba_ppp, correction = "border")
G_La = Gest(listings_la_ppp, correction = "border")
G_Tp = Gest(listings_tp_ppp, correction = "border")
par(mfrow=c(2,2))
plot(G_Al, main="Aljunied")
plot(G_Ba, main="Balestier")
plot(G_La, main="Lavender")
plot(G_Tp, main="Tanjong Pagar")

15.2 Performing Complete Spatial Randomness Test
To confirm the observed spatial patterns above, a hypothesis test will be conducted. The hypothesis and test are as follows:
Ho = The distribution of Airbnb listings at Aljunied/Balestier/Lavender/Tanjong Pagar are randomly distributed.
H1= The distribution of Airbnb listings at Aljunied/Balestier/Lavender/Tanjong Pagar are not randomly distributed.
The null hypothesis will be rejected if p-value is smaller than alpha value of 0.001 (the value 0.001 is dependent on the number of simulations performed).
Monte Carlo test with G-function
G_Al.csr <- envelope(listings_al_ppp, Gest, nsim = 999)
## Generating 999 simulations of CSR ...
## 1, 2, 3, ......10.........20.........30.........40.........50.........60...
## ......70.........80.........90.........100.........110.........120......
## ...130.........140.........150.........160.........170.........180.........
## 190.........200.........210.........220.........230.........240.........250..
## .......260.........270.........280.........290.........300.........310.....
## ....320.........330.........340.........350.........360.........370........
## .380.........390.........400.........410.........420.........430.........440.
## ........450.........460.........470.........480.........490.........500....
## .....510.........520.........530.........540.........550.........560.......
## ..570.........580.........590.........600.........610.........620.........630
## .........640.........650.........660.........670.........680.........690...
## ......700.........710.........720.........730.........740.........750......
## ...760.........770.........780.........790.........800.........810.........
## 820.........830.........840.........850.........860.........870.........880..
## .......890.........900.........910.........920.........930.........940.....
## ....950.........960.........970.........980.........990........ 999.
##
## Done.
G_Ba.csr <- envelope(listings_ba_ppp, Gest, nsim = 999)
## Generating 999 simulations of CSR ...
## 1, 2, 3, ......10.........20.........30.........40.........50.........60...
## ......70.........80.........90.........100.........110.........120......
## ...130.........140.........150.........160.........170.........180.........
## 190.........200.........210.........220.........230.........240.........250..
## .......260.........270.........280.........290.........300.........310.....
## ....320.........330.........340.........350.........360.........370........
## .380.........390.........400.........410.........420.........430.........440.
## ........450.........460.........470.........480.........490.........500....
## .....510.........520.........530.........540.........550.........560.......
## ..570.........580.........590.........600.........610.........620.........630
## .........640.........650.........660.........670.........680.........690...
## ......700.........710.........720.........730.........740.........750......
## ...760.........770.........780.........790.........800.........810.........
## 820.........830.........840.........850.........860.........870.........880..
## .......890.........900.........910.........920.........930.........940.....
## ....950.........960.........970.........980.........990........ 999.
##
## Done.
G_La.csr <- envelope(listings_la_ppp, Gest, nsim = 999)
## Generating 999 simulations of CSR ...
## 1, 2, 3, ......10.........20.........30.........40.........50.........60...
## ......70.........80.........90.........100.........110.........120......
## ...130.........140.........150.........160.........170.........180.........
## 190.........200.........210.........220.........230.........240.........250..
## .......260.........270.........280.........290.........300.........310.....
## ....320.........330.........340.........350.........360.........370........
## .380.........390.........400.........410.........420.........430.........440.
## ........450.........460.........470.........480.........490.........500....
## .....510.........520.........530.........540.........550.........560.......
## ..570.........580.........590.........600.........610.........620.........630
## .........640.........650.........660.........670.........680.........690...
## ......700.........710.........720.........730.........740.........750......
## ...760.........770.........780.........790.........800.........810.........
## 820.........830.........840.........850.........860.........870.........880..
## .......890.........900.........910.........920.........930.........940.....
## ....950.........960.........970.........980.........990........ 999.
##
## Done.
G_Tp.csr <- envelope(listings_tp_ppp, Gest, nsim = 999)
## Generating 999 simulations of CSR ...
## 1, 2, 3, ......10.........20.........30.........40.........50.........60...
## ......70.........80.........90.........100.........110.........120......
## ...130.........140.........150.........160.........170.........180.........
## 190.........200.........210.........220.........230.........240.........250..
## .......260.........270.........280.........290.........300.........310.....
## ....320.........330.........340.........350.........360.........370........
## .380.........390.........400.........410.........420.........430.........440.
## ........450.........460.........470.........480.........490.........500....
## .....510.........520.........530.........540.........550.........560.......
## ..570.........580.........590.........600.........610.........620.........630
## .........640.........650.........660.........670.........680.........690...
## ......700.........710.........720.........730.........740.........750......
## ...760.........770.........780.........790.........800.........810.........
## 820.........830.........840.........850.........860.........870.........880..
## .......890.........900.........910.........920.........930.........940.....
## ....950.........960.........970.........980.........990........ 999.
##
## Done.
par(mfrow=c(2,2))
plot(G_Al.csr, main="Aljunied")
plot(G_Ba.csr, main="Balestier")
plot(G_La.csr, main="Lavender")
plot(G_Tp.csr, main="Tanjong Pagar")

15.3 Results from analysing Spatial Point Process Using G-Function
[Aljunied]
From 0m to 2m, the observed(black) line is within the envelop. Therefore, there is not enough statistical evidence to reject the null hypothesis and say that it resembles cluster or regular pattern. This also allows us to infer that it resembles complete spatial randomness. However, from 2m onwards, we noticed that the observed(black) line is outside the envelope. This means that we have statistical evidence to reject the null hypothesis. Furthermore, since the observed(black) line is above the theoretical(red) line, the estimated G is statistically significant and it show signs of clustered pattern.
[Balestier]
From 0m to 4m, the observed(black) line is within the envelop. Therefore, there is not enough statistical evidence to reject the null hypothesis and say that it resembles cluster or regular pattern. This also allows us to infer that it resembles complete spatial randomness. However, from 4m onwards, we noticed that the observed(black) line is outside the envelope. This means that we have statistical evidence to reject the null hypothesis. Furthermore, since the observed(black) line is above the theoretical(red) line, the estimated G is statistically significant and it show signs of clustered pattern.
[Lavender]
From 0m to 6m and beyond 27m, the observed(black) line is within the envelop. Therefore, there is not enough statistical evidence to reject the null hypothesis and say that it resembles cluster or regular pattern. This also allows us to infer that it resembles complete spatial randomness. However, from 6m to 27m onwards, we noticed that the observed(black) line is outside the envelope. This means that we have statistical evidence to reject the null hypothesis. Furthermore, since the observed(black) line is above the theoretical(red) line, the estimated G is statistically significant and it show signs of clustered pattern.
[Tanjong Pagar]
From 0m to 6m and beyond 16m, the observed(black) line is within the envelop. Therefore, there is not enough statistical evidence to reject the null hypothesis and say that it resembles cluster or regular pattern. This also allows us to infer that it resembles complete spatial randomness. However, from 6m to 16m onwards, we noticed that the observed(black) line is outside the envelope. This means that we have statistical evidence to reject the null hypothesis. Furthermore, since the observed(black) line is above the theoretical(red) line, the estimated G is statistically significant and it show signs of clustered pattern.
16. Analysing Spatial Point Process Using F-Function
16.1 Computing F-function estimate
F_Al = Fest(listings_al_ppp)
F_Ba = Fest(listings_ba_ppp)
F_La = Fest(listings_la_ppp)
F_Tp = Fest(listings_tp_ppp)
par(mfrow=c(2,2))
plot(F_Al, main="Aljunied")
plot(F_Ba, main="Balestier")
plot(F_La, main="Lavender")
plot(F_Tp, main="Tanjong Pagar")

16.2 Performing Complete Spatial Randomness Test
To confirm the observed spatial patterns above, a hypothesis test will be conducted. The hypothesis and test are as follows:
Ho = The distribution of Airbnb listings at Aljunied/Balestier/Lavender/Tanjong Pagar are randomly distributed.
H1= The distribution of Airbnb listings at Aljunied/Balestier/Lavender/Tanjong Pagar are not randomly distributed.
The null hypothesis will be rejected if p-value is smaller than alpha value of 0.001.
Monte Carlo test with F-fucntion
F_Al.csr <- envelope(listings_al_ppp, Fest, nsim = 999)
## Generating 999 simulations of CSR ...
## 1, 2, 3, ......10.........20.........30.........40.........50.........60...
## ......70.........80.........90.........100.........110.........120......
## ...130.........140.........150.........160.........170.........180.........
## 190.........200.........210.........220.........230.........240.........250..
## .......260.........270.........280.........290.........300.........310.....
## ....320.........330.........340.........350.........360.........370........
## .380.........390.........400.........410.........420.........430.........440.
## ........450.........460.........470.........480.........490.........500....
## .....510.........520.........530.........540.........550.........560.......
## ..570.........580.........590.........600.........610.........620.........630
## .........640.........650.........660.........670.........680.........690...
## ......700.........710.........720.........730.........740.........750......
## ...760.........770.........780.........790.........800.........810.........
## 820.........830.........840.........850.........860.........870.........880..
## .......890.........900.........910.........920.........930.........940.....
## ....950.........960.........970.........980.........990........ 999.
##
## Done.
F_Ba.csr <- envelope(listings_ba_ppp, Fest, nsim = 999)
## Generating 999 simulations of CSR ...
## 1, 2, 3, ......10.........20.........30.........40.........50.........60...
## ......70.........80.........90.........100.........110.........120......
## ...130.........140.........150.........160.........170.........180.........
## 190.........200.........210.........220.........230.........240.........250..
## .......260.........270.........280.........290.........300.........310.....
## ....320.........330.........340.........350.........360.........370........
## .380.........390.........400.........410.........420.........430.........440.
## ........450.........460.........470.........480.........490.........500....
## .....510.........520.........530.........540.........550.........560.......
## ..570.........580.........590.........600.........610.........620.........630
## .........640.........650.........660.........670.........680.........690...
## ......700.........710.........720.........730.........740.........750......
## ...760.........770.........780.........790.........800.........810.........
## 820.........830.........840.........850.........860.........870.........880..
## .......890.........900.........910.........920.........930.........940.....
## ....950.........960.........970.........980.........990........ 999.
##
## Done.
F_La.csr <- envelope(listings_la_ppp, Fest, nsim = 999)
## Generating 999 simulations of CSR ...
## 1, 2, 3, ......10.........20.........30.........40.........50.........60...
## ......70.........80.........90.........100.........110.........120......
## ...130.........140.........150.........160.........170.........180.........
## 190.........200.........210.........220.........230.........240.........250..
## .......260.........270.........280.........290.........300.........310.....
## ....320.........330.........340.........350.........360.........370........
## .380.........390.........400.........410.........420.........430.........440.
## ........450.........460.........470.........480.........490.........500....
## .....510.........520.........530.........540.........550.........560.......
## ..570.........580.........590.........600.........610.........620.........630
## .........640.........650.........660.........670.........680.........690...
## ......700.........710.........720.........730.........740.........750......
## ...760.........770.........780.........790.........800.........810.........
## 820.........830.........840.........850.........860.........870.........880..
## .......890.........900.........910.........920.........930.........940.....
## ....950.........960.........970.........980.........990........ 999.
##
## Done.
F_Tp.csr <- envelope(listings_tp_ppp, Fest, nsim = 999)
## Generating 999 simulations of CSR ...
## 1, 2, 3, ......10.........20.........30.........40.........50.........60...
## ......70.........80.........90.........100.........110.........120......
## ...130.........140.........150.........160.........170.........180.........
## 190.........200.........210.........220.........230.........240.........250..
## .......260.........270.........280.........290.........300.........310.....
## ....320.........330.........340.........350.........360.........370........
## .380.........390.........400.........410.........420.........430.........440.
## ........450.........460.........470.........480.........490.........500....
## .....510.........520.........530.........540.........550.........560.......
## ..570.........580.........590.........600.........610.........620.........630
## .........640.........650.........660.........670.........680.........690...
## ......700.........710.........720.........730.........740.........750......
## ...760.........770.........780.........790.........800.........810.........
## 820.........830.........840.........850.........860.........870.........880..
## .......890.........900.........910.........920.........930.........940.....
## ....950.........960.........970.........980.........990........ 999.
##
## Done.
par(mfrow=c(2,2))
plot(F_Al.csr, main="Aljunied")
plot(F_Ba.csr, main="Balestier")
plot(F_La.csr, main="Lavender")
plot(F_Tp.csr, main="Tanjong Pagar")

16.3 Results from analysing Spatial Point Process Using F-Function
[Aljunied]
From 0m to 10m, the observed(black) line is within the envelop. Therefore, there is not enough statistical evidence to reject the null hypothesis and say that it resembles cluster or regular pattern. This also allows us to infer that it resembles complete spatial randomness. However, from 10m onwards, we noticed that the observed(black) line is outside the envelope. This means that we have statistical evidence to reject the null hypothesis. Furthermore, since the observed(black) line is below the theoretical(red) line, it is statistically significant and it show signs of clustered pattern.
[Balestier]
From 0m to 18m, the observed(black) line is within the envelop. Therefore, there is not enough statistical evidence to reject the null hypothesis and say that it resembles cluster or regular pattern. This also allows us to infer that it resembles complete spatial randomness. However, from 18m onwards, we noticed that the observed(black) line is outside the envelope. This means that we have statistical evidence to reject the null hypothesis. Furthermore, since the observed(black) line is below the theoretical(red) line, it is statistically significant and it show signs of clustered pattern.
[Lavender]
From 0m to 17m, the observed(black) line is within the envelop. Therefore, there is not enough statistical evidence to reject the null hypothesis and say that it resembles cluster or regular pattern. This also allows us to infer that it resembles complete spatial randomness. However, from 17m onwards, we noticed that the observed(black) line is outside the envelope. This means that we have statistical evidence to reject the null hypothesis. Furthermore, since the observed(black) line is below the theoretical(red) line, it is statistically significant and it show signs of clustered pattern.
[Tanjong Pagar]
From 0m to 12m, the observed(black) line is within the envelop. Therefore, there is not enough statistical evidence to reject the null hypothesis and say that it resembles cluster or regular pattern. This also allows us to infer that it resembles complete spatial randomness. However, from 12m onwards, we noticed that the observed(black) line is outside the envelope. This means that we have statistical evidence to reject the null hypothesis. Furthermore, since the observed(black) line is below the theoretical(red) line, it is statistically significant and it show signs of clustered pattern.
17. Analysing Spatial Point Process Using K-Function
17.1 Computing K-function estimate
K_Al = Kest(listings_al_ppp, correction = "Ripley")
K_Ba = Kest(listings_ba_ppp, correction = "Ripley")
K_La = Kest(listings_la_ppp, correction = "Ripley")
K_Tp = Kest(listings_tp_ppp, correction = "Ripley")
par(mfrow=c(2,2))
plot(K_Al, . -r ~ r, ylab= "K(d)-r", xlab = "d(m)", main="Aljunied")
plot(K_Al, . -r ~ r, ylab= "K(d)-r", xlab = "d(m)", main="Balestier")
plot(K_Al, . -r ~ r, ylab= "K(d)-r", xlab = "d(m)", main="Lavender")
plot(K_Al, . -r ~ r, ylab= "K(d)-r", xlab = "d(m)", main="Tanjong Pagar")

17.2 Performing Complete Spatial Randomness Test
To confirm the observed spatial patterns above, a hypothesis test will be conducted. The hypothesis and test are as follows:
Ho = The distribution of Airbnb listings at Aljunied/Balestier/Lavender/Tanjong Pagar are randomly distributed.
H1= The distribution of Airbnb listings at Aljunied/Balestier/Lavender/Tanjong Pagar are not randomly distributed.
The null hypothesis will be rejected if p-value is smaller than alpha value of 0.001.
K_Al.csr <- envelope(listings_al_ppp, Kest, nsim = 999, rank = 1, glocal=TRUE)
## Generating 999 simulations of CSR ...
## 1, 2, 3, ......10 [etd 19:01] .........20 [etd 19:02] .........
## 30 [etd 18:59] .........40 [etd 18:54] .........50 [etd 19:11] ........
## .60 [etd 18:55] .........70 [etd 18:36] .........80 [etd 18:24] .......
## ..90 [etd 18:06] .........100 [etd 17:51] .........110 [etd 17:33] ......
## ...120 [etd 17:18] .........130 [etd 17:04] .........140 [etd 16:50] .....
## ....150 [etd 16:36] .........160 [etd 16:25] .........170 [etd 16:16] ....
## .....180 [etd 16:03] .........190 [etd 15:50] .........200 [etd 15:38] ...
## ......210 [etd 15:27] .........220 [etd 15:15] .........230 [etd 15:04] ..
## .......240 [etd 14:49] .........250 [etd 14:37] .........260 [etd 14:25] .
## ........270 [etd 14:14] .........280 [etd 14:02] .........290
## [etd 13:50] .........300 [etd 13:39] .........310 [etd 13:26] .........
## 320 [etd 13:14] .........330 [etd 13:02] .........340 [etd 12:51] ........
## .350 [etd 12:38] .........360 [etd 12:26] .........370 [etd 12:14] .......
## ..380 [etd 12:02] .........390 [etd 11:51] .........400 [etd 11:39] ......
## ...410 [etd 11:27] .........420 [etd 11:15] .........430 [etd 11:03] .....
## ....440 [etd 10:52] .........450 [etd 10:40] .........460 [etd 10:28] ....
## .....470 [etd 10:17] .........480 [etd 10:05] .........490 [etd 9:54] ...
## ......500 [etd 9:43] .........510 [etd 9:31] .........520 [etd 9:19] ..
## .......530 [etd 9:07] .........540 [etd 8:56] .........550 [etd 8:44] .
## ........560 [etd 8:33] .........570 [etd 8:21] .........580
## [etd 8:09] .........590 [etd 7:57] .........600 [etd 7:46] .........
## 610 [etd 7:34] .........620 [etd 7:22] .........630 [etd 7:10] ........
## .640 [etd 6:59] .........650 [etd 6:47] .........660 [etd 6:35] .......
## ..670 [etd 6:23] .........680 [etd 6:12] .........690 [etd 6:00] ......
## ...700 [etd 5:48] .........710 [etd 5:36] .........720 [etd 5:24] .....
## ....730 [etd 5:13] .........740 [etd 5:01] .........750 [etd 4:49] ....
## .....760 [etd 4:37] .........770 [etd 4:26] .........780 [etd 4:14] ...
## ......790 [etd 4:03] .........800 [etd 3:51] .........810 [etd 3:39] ..
## .......820 [etd 3:28] .........830 [etd 3:16] .........840 [etd 3:04] .
## ........850 [etd 2:53] .........860 [etd 2:41] .........870
## [etd 2:30] .........880 [etd 2:18] .........890 [etd 2:06] .........
## 900 [etd 1:55] .........910 [etd 1:43] .........920 [etd 1:32] ........
## .930 [etd 1:20] .........940 [etd 1:08] .........950 [etd 57 sec] .......
## ..960 [etd 45 sec] .........970 [etd 34 sec] .........980 [etd 22 sec] ......
## ...990 [etd 10 sec] ........ 999.
##
## Done.
K_Ba.csr <- envelope(listings_ba_ppp, Kest, nsim = 999, rank = 1, glocal=TRUE)
## Generating 999 simulations of CSR ...
## 1, 2, 3, ......10 [etd 3:30] .........20 [etd 3:30] .........
## 30 [etd 3:26] .........40 [etd 3:24] .........50 [etd 3:23] ........
## .60 [etd 3:20] .........70 [etd 3:19] .........80 [etd 3:17] .......
## ..90 [etd 3:17] .........100 [etd 3:17] .........110 [etd 3:14] ......
## ...120 [etd 3:12] .........130 [etd 3:09] .........140 [etd 3:07] .....
## ....150 [etd 3:06] .........160 [etd 3:03] .........170 [etd 3:01] ....
## .....180 [etd 2:59] .........190 [etd 2:56] .........200 [etd 2:54] ...
## ......210 [etd 2:52] .........220 [etd 2:49] .........230 [etd 2:47] ..
## .......240 [etd 2:45] .........250 [etd 2:43] .........260 [etd 2:40] .
## ........270 [etd 2:38] .........280 [etd 2:36] .........290
## [etd 2:33] .........300 [etd 2:31] .........310 [etd 2:29] .........
## 320 [etd 2:27] .........330 [etd 2:25] .........340 [etd 2:23] ........
## .350 [etd 2:21] .........360 [etd 2:19] .........370 [etd 2:17] .......
## ..380 [etd 2:15] .........390 [etd 2:13] .........400 [etd 2:11] ......
## ...410 [etd 2:08] .........420 [etd 2:06] .........430 [etd 2:04] .....
## ....440 [etd 2:02] .........450 [etd 1:59] .........460 [etd 1:57] ....
## .....470 [etd 1:55] .........480 [etd 1:53] .........490 [etd 1:51] ...
## ......500 [etd 1:48] .........510 [etd 1:46] .........520 [etd 1:44] ..
## .......530 [etd 1:42] .........540 [etd 1:40] .........550 [etd 1:38] .
## ........560 [etd 1:36] .........570 [etd 1:33] .........580
## [etd 1:31] .........590 [etd 1:29] .........600 [etd 1:27] .........
## 610 [etd 1:25] .........620 [etd 1:23] .........630 [etd 1:20] ........
## .640 [etd 1:18] .........650 [etd 1:16] .........660 [etd 1:14] .......
## ..670 [etd 1:12] .........680 [etd 1:10] .........690 [etd 1:07] ......
## ...700 [etd 1:05] .........710 [etd 1:03] .........720 [etd 1:01] .....
## ....730 [etd 59 sec] .........740 [etd 57 sec] .........750 [etd 54 sec] ....
## .....760 [etd 52 sec] .........770 [etd 50 sec] .........780 [etd 48 sec] ...
## ......790 [etd 46 sec] .........800 [etd 43 sec] .........810 [etd 41 sec] ..
## .......820 [etd 39 sec] .........830 [etd 37 sec] .........840 [etd 35 sec] .
## ........850 [etd 32 sec] .........860 [etd 30 sec] .........870
## [etd 28 sec] .........880 [etd 26 sec] .........890 [etd 24 sec] .........
## 900 [etd 22 sec] .........910 [etd 19 sec] .........920 [etd 17 sec] ........
## .930 [etd 15 sec] .........940 [etd 13 sec] .........950 [etd 11 sec] .......
## ..960 [etd 9 sec] .........970 [etd 6 sec] .........980 [etd 4 sec] ......
## ...990 [etd 2 sec] ........ 999.
##
## Done.
K_La.csr <- envelope(listings_la_ppp, Kest, nsim = 999, rank = 1, glocal=TRUE)
## Generating 999 simulations of CSR ...
## 1, 2, 3, ......10 [etd 7:09] .........20 [etd 7:03] .........
## 30 [etd 6:56] .........40 [etd 6:55] .........50 [etd 6:58] ........
## .60 [etd 6:55] .........70 [etd 6:49] .........80 [etd 6:45] .......
## ..90 [etd 6:39] .........100 [etd 6:36] .........110 [etd 6:31] ......
## ...120 [etd 6:28] .........130 [etd 6:23] .........140 [etd 6:18] .....
## ....150 [etd 6:13] .........160 [etd 6:08] .........170 [etd 6:05] ....
## .....180 [etd 5:59] .........190 [etd 5:54] .........200 [etd 5:50] ...
## ......210 [etd 5:47] .........220 [etd 5:42] .........230 [etd 5:38] ..
## .......240 [etd 5:34] .........250 [etd 5:29] .........260 [etd 5:25] .
## ........270 [etd 5:20] .........280 [etd 5:16] .........290
## [etd 5:12] .........300 [etd 5:07] .........310 [etd 5:03] .........
## 320 [etd 4:59] .........330 [etd 4:54] .........340 [etd 4:50] ........
## .350 [etd 4:45] .........360 [etd 4:41] .........370 [etd 4:37] .......
## ..380 [etd 4:33] .........390 [etd 4:29] .........400 [etd 4:24] ......
## ...410 [etd 4:20] .........420 [etd 4:15] .........430 [etd 4:11] .....
## ....440 [etd 4:06] .........450 [etd 4:02] .........460 [etd 3:58] ....
## .....470 [etd 3:53] .........480 [etd 3:49] .........490 [etd 3:44] ...
## ......500 [etd 3:40] .........510 [etd 3:35] .........520 [etd 3:31] ..
## .......530 [etd 3:27] .........540 [etd 3:22] .........550 [etd 3:18] .
## ........560 [etd 3:13] .........570 [etd 3:09] .........580
## [etd 3:04] .........590 [etd 3:00] .........600 [etd 2:56] .........
## 610 [etd 2:51] .........620 [etd 2:47] .........630 [etd 2:42] ........
## .640 [etd 2:38] .........650 [etd 2:33] .........660 [etd 2:29] .......
## ..670 [etd 2:25] .........680 [etd 2:20] .........690 [etd 2:16] ......
## ...700 [etd 2:12] .........710 [etd 2:07] .........720 [etd 2:03] .....
## ....730 [etd 1:58] .........740 [etd 1:54] .........750 [etd 1:50] ....
## .....760 [etd 1:45] .........770 [etd 1:41] .........780 [etd 1:36] ...
## ......790 [etd 1:32] .........800 [etd 1:28] .........810 [etd 1:23] ..
## .......820 [etd 1:19] .........830 [etd 1:14] .........840 [etd 1:10] .
## ........850 [etd 1:06] .........860 [etd 1:01] .........870
## [etd 57 sec] .........880 [etd 52 sec] .........890 [etd 48 sec] .........
## 900 [etd 44 sec] .........910 [etd 39 sec] .........920 [etd 35 sec] ........
## .930 [etd 30 sec] .........940 [etd 26 sec] .........950 [etd 22 sec] .......
## ..960 [etd 17 sec] .........970 [etd 13 sec] .........980 [etd 8 sec] ......
## ...990 [etd 4 sec] ........ 999.
##
## Done.
K_Tp.csr <- envelope(listings_tp_ppp, Kest, nsim = 999, rank = 1, glocal=TRUE)
## Generating 999 simulations of CSR ...
## 1, 2, 3, ......10.........20.........30.........40.........50.........60...
## ......70.........80.........90.........100.........110.........120......
## ...130.........140.........150.........160.........170.........180.........
## 190.........200.........210.........220.........230.........240.........250..
## .......260.........270.........280.........290.........300.........310.....
## ....320.........330.........340.........350.........360.........370........
## .380.........390.........400.........410.........420.........430.........440.
## ........450.........460.........470.........480.........490.........500....
## .....510.........520.........530.........540.........550.........560.......
## ..570.........580.........590.........600.........610.........620.........630
## .........640.........650.........660.........670.........680.........690...
## ......700.........710.........720.........730.........740.........750......
## ...760.........770.........780.........790.........800.........810.........
## 820.........830.........840.........850.........860.........870.........880..
## .......890.........900.........910.........920.........930.........940.....
## ....950.........960.........970.........980.........990........ 999.
##
## Done.
par(mfrow=c(2,2))
plot(K_Al.csr, . - r ~ r, xlab="d", ylab="K(d)-r", main="Aljunied")
plot(K_Ba.csr, . - r ~ r, xlab="d", ylab="K(d)-r", main="Balestier")
plot(K_La.csr, . - r ~ r, xlab="d", ylab="K(d)-r", main="Lavender")
plot(K_Tp.csr, . - r ~ r, xlab="d", ylab="K(d)-r", main="Tanjong Pagar")

17.3 Results from analysing Spatial Point Process Using K-Function
[Aljunied]
From 0m to 20m, the observed(black) line is within the envelop. Therefore, there is not enough statistical evidence to reject the null hypothesis and say that it resembles cluster or regular pattern. This also allows us to infer that it resembles complete spatial randomness. However, from 20m onwards, we noticed that the observed(black) line is outside the envelope. This means that we have statistical evidence to reject the null hypothesis. Furthermore, since the observed(black) line is above the theoretical(red) line, it is statistically significant and it show signs of clustered pattern.
[Balestier]
From 0m to 25m, the observed(black) line is within the envelop. Therefore, there is not enough statistical evidence to reject the null hypothesis and say that it resembles cluster or regular pattern. This also allows us to infer that it resembles complete spatial randomness. However, from 25m onwards, we noticed that the observed(black) line is outside the envelope. This means that we have statistical evidence to reject the null hypothesis. Furthermore, since the observed(black) line is above the theoretical(red) line, it is statistically significant and it show signs of clustered pattern.
[Lavender]
From 0m to 25m, the observed(black) line is within the envelop. Therefore, there is not enough statistical evidence to reject the null hypothesis and say that it resembles cluster or regular pattern. This also allows us to infer that it resembles complete spatial randomness. However, from 25m onwards, we noticed that the observed(black) line is outside the envelope. This means that we have statistical evidence to reject the null hypothesis. Furthermore, since the observed(black) line is above the theoretical(red) line, it is statistically significant and it show signs of clustered pattern.
[Tanjong Pagar]
From 0m to 18m, the observed(black) line is within the envelop. Therefore, there is not enough statistical evidence to reject the null hypothesis and say that it resembles cluster or regular pattern. This also allows us to infer that it resembles complete spatial randomness. However, from 18m onwards, we noticed that the observed(black) line is outside the envelope. This means that we have statistical evidence to reject the null hypothesis. Furthermore, since the observed(black) line is above the theoretical(red) line, it is statistically significant and it show signs of clustered pattern.
18. Analysing Spatial Point Process Using L-Function
18.1 Computing L-function estimate
L_Al = Lest(listings_al_ppp, correction = "Ripley")
L_Ba = Lest(listings_ba_ppp, correction = "Ripley")
L_La = Lest(listings_la_ppp, correction = "Ripley")
L_Tp = Lest(listings_tp_ppp, correction = "Ripley")
par(mfrow=c(2,2))
plot(L_Al, . -r ~ r, ylab= "L(d)-r", xlab = "d(m)", main="Aljunied")
plot(L_Ba, . -r ~ r, ylab= "L(d)-r", xlab = "d(m)", main="Balestier")
plot(L_La, . -r ~ r, ylab= "L(d)-r", xlab = "d(m)", main="Lavender")
plot(L_Tp, . -r ~ r, ylab= "L(d)-r", xlab = "d(m)", main="Tanjong Pagar")

18.2 Performing Complete Spatial Randomness Test
To confirm the observed spatial patterns above, a hypothesis test will be conducted. The hypothesis and test are as follows:
Ho = The distribution of Airbnb listings at Aljunied/Balestier/Lavender/Tanjong Pagar are randomly distributed.
H1= The distribution of Airbnb listings at Aljunied/Balestier/Lavender/Tanjong Pagar are not randomly distributed.
The null hypothesis will be rejected if p-value if smaller than alpha value of 0.001.
L_Al.csr <- envelope(listings_al_ppp, Lest, nsim = 999, rank = 1, glocal=TRUE)
## Generating 999 simulations of CSR ...
## 1, 2, 3, ......10 [etd 21:47] .........20 [etd 20:24] .........
## 30 [etd 20:03] .........40 [etd 19:34] .........50 [etd 19:11] ........
## .60 [etd 18:56] .........70 [etd 18:28] .........80 [etd 18:03] .......
## ..90 [etd 17:51] .........100 [etd 17:37] .........110 [etd 17:21] ......
## ...120 [etd 17:07] .........130 [etd 16:52] .........140 [etd 16:39] .....
## ....150 [etd 16:26] .........160 [etd 16:14] .........170 [etd 16:01] ....
## .....180 [etd 15:47] .........190 [etd 15:36] .........200 [etd 15:24] ...
## ......210 [etd 15:12] .........220 [etd 15:00] .........230 [etd 14:48] ..
## .......240 [etd 14:36] .........250 [etd 14:24] .........260 [etd 14:13] .
## ........270 [etd 14:02] .........280 [etd 13:49] .........290
## [etd 13:36] .........300 [etd 13:23] .........310 [etd 13:12] .........
## 320 [etd 13:00] .........330 [etd 12:49] .........340 [etd 12:38] ........
## .350 [etd 12:26] .........360 [etd 12:15] .........370 [etd 12:03] .......
## ..380 [etd 11:52] .........390 [etd 11:40] .........400 [etd 11:28] ......
## ...410 [etd 11:17] .........420 [etd 11:04] .........430 [etd 10:53] .....
## ....440 [etd 10:41] .........450 [etd 10:30] .........460 [etd 10:18] ....
## .....470 [etd 10:07] .........480 [etd 9:54] .........490 [etd 9:43] ...
## ......500 [etd 9:32] .........510 [etd 9:21] .........520 [etd 9:09] ..
## .......530 [etd 8:57] .........540 [etd 8:46] .........550 [etd 8:34] .
## ........560 [etd 8:22] .........570 [etd 8:11] .........580
## [etd 8:00] .........590 [etd 7:48] .........600 [etd 7:37] .........
## 610 [etd 7:25] .........620 [etd 7:14] .........630 [etd 7:02] ........
## .640 [etd 6:51] .........650 [etd 6:39] .........660 [etd 6:28] .......
## ..670 [etd 6:17] .........680 [etd 6:05] .........690 [etd 5:53] ......
## ...700 [etd 5:42] .........710 [etd 5:30] .........720 [etd 5:19] .....
## ....730 [etd 5:07] .........740 [etd 4:56] .........750 [etd 4:45] ....
## .....760 [etd 4:33] .........770 [etd 4:22] .........780 [etd 4:10] ...
## ......790 [etd 3:59] .........800 [etd 3:47] .........810 [etd 3:36] ..
## .......820 [etd 3:24] .........830 [etd 3:13] .........840 [etd 3:02] .
## ........850 [etd 2:50] .........860 [etd 2:39] .........870
## [etd 2:27] .........880 [etd 2:16] .........890 [etd 2:05] .........
## 900 [etd 1:53] .........910 [etd 1:42] .........920 [etd 1:30] ........
## .930 [etd 1:19] .........940 [etd 1:07] .........950 [etd 56 sec] .......
## ..960 [etd 45 sec] .........970 [etd 33 sec] .........980 [etd 22 sec] ......
## ...990 [etd 10 sec] ........ 999.
##
## Done.
L_Ba.csr <- envelope(listings_ba_ppp, Lest, nsim = 999, rank = 1, glocal=TRUE)
## Generating 999 simulations of CSR ...
## 1, 2, 3, ......10 [etd 3:33] .........20 [etd 3:25] .........
## 30 [etd 3:26] .........40 [etd 3:23] .........50 [etd 3:22] ........
## .60 [etd 3:22] .........70 [etd 3:21] .........80 [etd 3:19] .......
## ..90 [etd 3:18] .........100 [etd 3:16] .........110 [etd 3:15] ......
## ...120 [etd 3:12] .........130 [etd 3:11] .........140 [etd 3:09] .....
## ....150 [etd 3:06] .........160 [etd 3:04] .........170 [etd 3:02] ....
## .....180 [etd 2:59] .........190 [etd 2:57] .........200 [etd 2:55] ...
## ......210 [etd 2:53] .........220 [etd 2:51] .........230 [etd 2:49] ..
## .......240 [etd 2:46] .........250 [etd 2:44] .........260 [etd 2:42] .
## ........270 [etd 2:39] .........280 [etd 2:37] .........290
## [etd 2:35] .........300 [etd 2:33] .........310 [etd 2:30] .........
## 320 [etd 2:28] .........330 [etd 2:26] .........340 [etd 2:24] ........
## .350 [etd 2:21] .........360 [etd 2:19] .........370 [etd 2:17] .......
## ..380 [etd 2:15] .........390 [etd 2:12] .........400 [etd 2:10] ......
## ...410 [etd 2:08] .........420 [etd 2:06] .........430 [etd 2:04] .....
## ....440 [etd 2:02] .........450 [etd 2:00] .........460 [etd 1:57] ....
## .....470 [etd 1:55] .........480 [etd 1:53] .........490 [etd 1:51] ...
## ......500 [etd 1:49] .........510 [etd 1:47] .........520 [etd 1:44] ..
## .......530 [etd 1:42] .........540 [etd 1:40] .........550 [etd 1:38] .
## ........560 [etd 1:36] .........570 [etd 1:33] .........580
## [etd 1:31] .........590 [etd 1:29] .........600 [etd 1:27] .........
## 610 [etd 1:25] .........620 [etd 1:23] .........630 [etd 1:20] ........
## .640 [etd 1:18] .........650 [etd 1:16] .........660 [etd 1:14] .......
## ..670 [etd 1:12] .........680 [etd 1:09] .........690 [etd 1:07] ......
## ...700 [etd 1:05] .........710 [etd 1:03] .........720 [etd 1:01] .....
## ....730 [etd 58 sec] .........740 [etd 56 sec] .........750 [etd 54 sec] ....
## .....760 [etd 52 sec] .........770 [etd 50 sec] .........780 [etd 48 sec] ...
## ......790 [etd 45 sec] .........800 [etd 43 sec] .........810 [etd 41 sec] ..
## .......820 [etd 39 sec] .........830 [etd 37 sec] .........840 [etd 35 sec] .
## ........850 [etd 32 sec] .........860 [etd 30 sec] .........870
## [etd 28 sec] .........880 [etd 26 sec] .........890 [etd 24 sec] .........
## 900 [etd 22 sec] .........910 [etd 19 sec] .........920 [etd 17 sec] ........
## .930 [etd 15 sec] .........940 [etd 13 sec] .........950 [etd 11 sec] .......
## ..960 [etd 8 sec] .........970 [etd 6 sec] .........980 [etd 4 sec] ......
## ...990 [etd 2 sec] ........ 999.
##
## Done.
L_La.csr <- envelope(listings_la_ppp, Lest, nsim = 999, rank = 1, glocal=TRUE)
## Generating 999 simulations of CSR ...
## 1, 2, 3, ......10 [etd 7:13] .........20 [etd 7:15] .........
## 30 [etd 7:17] .........40 [etd 7:13] .........50 [etd 7:06] ........
## .60 [etd 6:59] .........70 [etd 6:54] .........80 [etd 6:46] .......
## ..90 [etd 6:40] .........100 [etd 6:35] .........110 [etd 6:31] ......
## ...120 [etd 6:28] .........130 [etd 6:25] .........140 [etd 6:20] .....
## ....150 [etd 6:15] .........160 [etd 6:10] .........170 [etd 6:05] ....
## .....180 [etd 6:02] .........190 [etd 5:57] .........200 [etd 5:53] ...
## ......210 [etd 5:47] .........220 [etd 5:43] .........230 [etd 5:39] ..
## .......240 [etd 5:34] .........250 [etd 5:29] .........260 [etd 5:24] .
## ........270 [etd 5:20] .........280 [etd 5:15] .........290
## [etd 5:11] .........300 [etd 5:06] .........310 [etd 5:02] .........
## 320 [etd 4:58] .........330 [etd 4:54] .........340 [etd 4:49] ........
## .350 [etd 4:45] .........360 [etd 4:40] .........370 [etd 4:36] .......
## ..380 [etd 4:32] .........390 [etd 4:28] .........400 [etd 4:23] ......
## ...410 [etd 4:19] .........420 [etd 4:14] .........430 [etd 4:10] .....
## ....440 [etd 4:05] .........450 [etd 4:01] .........460 [etd 3:56] ....
## .....470 [etd 3:52] .........480 [etd 3:48] .........490 [etd 3:43] ...
## ......500 [etd 3:39] .........510 [etd 3:34] .........520 [etd 3:29] ..
## .......530 [etd 3:25] .........540 [etd 3:21] .........550 [etd 3:16] .
## ........560 [etd 3:12] .........570 [etd 3:08] .........580
## [etd 3:03] .........590 [etd 2:59] .........600 [etd 2:55] .........
## 610 [etd 2:50] .........620 [etd 2:46] .........630 [etd 2:41] ........
## .640 [etd 2:37] .........650 [etd 2:33] .........660 [etd 2:28] .......
## ..670 [etd 2:24] .........680 [etd 2:19] .........690 [etd 2:15] ......
## ...700 [etd 2:11] .........710 [etd 2:06] .........720 [etd 2:02] .....
## ....730 [etd 1:58] .........740 [etd 1:53] .........750 [etd 1:49] ....
## .....760 [etd 1:44] .........770 [etd 1:40] .........780 [etd 1:36] ...
## ......790 [etd 1:31] .........800 [etd 1:27] .........810 [etd 1:23] ..
## .......820 [etd 1:18] .........830 [etd 1:14] .........840 [etd 1:10] .
## ........850 [etd 1:05] .........860 [etd 1:01] .........870
## [etd 56 sec] .........880 [etd 52 sec] .........890 [etd 48 sec] .........
## 900 [etd 43 sec] .........910 [etd 39 sec] .........920 [etd 35 sec] ........
## .930 [etd 30 sec] .........940 [etd 26 sec] .........950 [etd 21 sec] .......
## ..960 [etd 17 sec] .........970 [etd 13 sec] .........980 [etd 8 sec] ......
## ...990 [etd 4 sec] ........ 999.
##
## Done.
L_Tp.csr <- envelope(listings_tp_ppp, Lest, nsim = 999, rank = 1, glocal=TRUE)
## Generating 999 simulations of CSR ...
## 1, 2, 3, ......10.........20.........30.........40.........50.........60...
## ......70.........80.........90.........100.........110.........120......
## ...130.........140.........150.........160.........170.........180.........
## 190.........200.........210.........220.........230.........240.........250..
## .......260.........270.........280.........290.........300.........310.....
## ....320.........330.........340.........350.........360.........370........
## .380.........390.........400.........410.........420.........430.........440.
## ........450.........460.........470.........480.........490.........500....
## .....510.........520.........530.........540.........550.........560.......
## ..570.........580.........590.........600.........610.........620.........630
## .........640.........650.........660.........670.........680.........690...
## ......700.........710.........720.........730.........740.........750......
## ...760.........770.........780.........790.........800.........810.........
## 820.........830.........840.........850.........860.........870.........880..
## .......890.........900.........910.........920.........930.........940.....
## ....950.........960.........970.........980.........990........ 999.
##
## Done.
par(mfrow=c(2,2))
plot(L_Al.csr, . - r ~ r, xlab="d", ylab="L(d)-r", main="Aljunied")
plot(L_Ba.csr, . - r ~ r, xlab="d", ylab="L(d)-r", main="Balestier")
plot(L_La.csr, . - r ~ r, xlab="d", ylab="L(d)-r", main="Lavender")
plot(L_Tp.csr, . - r ~ r, xlab="d", ylab="L(d)-r", main="Tanjong Pagar")

18.3 Results from analysing Spatial Point Process Using L-Function
[Aljunied]
From the plot above, we noticed that the observed(black) line is outside the envelope. This means that we have statistical evidence to reject the null hypothesis. Furthermore, since the observed(black) line is above the theoretical(red) line, it is statistically significant and it show signs of clustered pattern.
[Balestier]
From the plot above, we noticed that the observed(black) line is outside the envelope. This means that we have statistical evidence to reject the null hypothesis. Furthermore, since the observed(black) line is above the theoretical(red) line, it is statistically significant and it show signs of clustered pattern.
[Lavender]
From 0m to 6m, the observed(black) line is within the envelop. Therefore, there is not enough statistical evidence to reject the null hypothesis and say that it resembles cluster or regular pattern. This also allows us to infer that it resembles complete spatial randomness. However, from 6m onwards, we noticed that the observed(black) line is outside the envelope. This means that we have statistical evidence to reject the null hypothesis. Furthermore, since the observed(black) line is above the theoretical(red) line, it is statistically significant and it show signs of clustered pattern.
[Tanjong Pagar]
From 0m to 8m, the observed(black) line is within the envelop. Therefore, there is not enough statistical evidence to reject the null hypothesis and say that it resembles cluster or regular pattern. This also allows us to infer that it resembles complete spatial randomness. However, from 8m onwards, we noticed that the observed(black) line is outside the envelope. This means that we have statistical evidence to reject the null hypothesis. Furthermore, since the observed(black) line is above the theoretical(red) line, it is statistically significant and it show signs of clustered pattern.
19. Kernel Density Maps of Airbnb listings by room type
listings_al_ppp.km = rescale(listings_al_ppp, 1000, "km")
listings_ba_ppp.km = rescale(listings_ba_ppp, 1000, "km")
listings_la_ppp.km = rescale(listings_la_ppp, 1000, "km")
listings_tp_ppp.km = rescale(listings_tp_ppp, 1000, "km")
kde_al <- density(listings_al_ppp.km, sigma=bw.diggle, edge=TRUE, kernel="gaussian")
kde_ba <- density(listings_ba_ppp.km, sigma=bw.diggle, edge=TRUE, kernel="gaussian")
kde_la <- density(listings_la_ppp.km, sigma=bw.diggle, edge=TRUE, kernel="gaussian")
kde_tp <- density(listings_tp_ppp.km, sigma=bw.diggle, edge=TRUE, kernel="gaussian")
par(mfrow=c(2,2))
plot(kde_al, main="Aljunied - Entire home/apt")
plot(kde_ba, main="Balestier - Hotel room")
plot(kde_la, main="Lavender - Private room")
plot(kde_tp, main="Tanjong Pagar - Shared room")

19.1 Aljunied
listings_al_eh_ppp.km = rescale(listings_al_eh_ppp, 1000, "km")
listings_al_hr_ppp.km = rescale(listings_al_hr_ppp, 1000, "km")
listings_al_pr_ppp.km = rescale(listings_al_pr_ppp, 1000, "km")
listings_al_sr_ppp.km = rescale(listings_al_sr_ppp, 1000, "km")
kde_al_eh_bw <- density(listings_al_eh_ppp.km, sigma=bw.diggle, edge=TRUE, kernel="gaussian")
kde_al_hr_bw <- density(listings_al_hr_ppp.km, sigma=bw.diggle, edge=TRUE, kernel="gaussian")
kde_al_pr_bw <- density(listings_al_pr_ppp.km, sigma=bw.diggle, edge=TRUE, kernel="gaussian")
kde_al_sr_bw <- density(listings_al_sr_ppp.km, sigma=bw.diggle, edge=TRUE, kernel="gaussian")
par(mfrow=c(2,2))
plot(kde_al_eh_bw, main="Aljunied - Entire home/apt")
plot(kde_al_hr_bw, main="Aljunied - Hotel room")
plot(kde_al_pr_bw, main="Aljunied - Private room")
plot(kde_al_sr_bw, main="Aljunied - Shared room")

19.2 Balestier
listings_ba_eh_ppp.km = rescale(listings_ba_eh_ppp, 1000, "km")
listings_ba_hr_ppp.km = rescale(listings_ba_hr_ppp, 1000, "km")
listings_ba_pr_ppp.km = rescale(listings_ba_pr_ppp, 1000, "km")
listings_ba_sr_ppp.km = rescale(listings_ba_sr_ppp, 1000, "km")
kde_ba_eh_bw <- density(listings_ba_eh_ppp.km, sigma=bw.diggle, edge=TRUE, kernel="gaussian")
kde_ba_hr_bw <- density(listings_ba_hr_ppp.km, sigma=bw.diggle, edge=TRUE, kernel="gaussian")
kde_ba_pr_bw <- density(listings_ba_pr_ppp.km, sigma=bw.diggle, edge=TRUE, kernel="gaussian")
kde_ba_sr_bw <- density(listings_ba_sr_ppp.km, sigma=0.01, edge=TRUE, kernel="gaussian")
par(mfrow=c(2,2))
plot(kde_ba_eh_bw, main="Balestier - Entire home/apt")
plot(kde_ba_hr_bw, main="Balestier - Hotel room")
plot(kde_ba_pr_bw, main="Balestier - Private room")
plot(kde_ba_sr_bw, main="Balestier - Shared room")

19.3 Lavender
listings_la_eh_ppp.km = rescale(listings_la_eh_ppp, 1000, "km")
listings_la_hr_ppp.km = rescale(listings_la_hr_ppp, 1000, "km")
listings_la_pr_ppp.km = rescale(listings_la_pr_ppp, 1000, "km")
listings_la_sr_ppp.km = rescale(listings_la_sr_ppp, 1000, "km")
kde_la_eh_bw <- density(listings_la_eh_ppp.km, sigma=bw.diggle, edge=TRUE, kernel="gaussian")
kde_la_hr_bw <- density(listings_la_hr_ppp.km, sigma=bw.diggle, edge=TRUE, kernel="gaussian")
kde_la_pr_bw <- density(listings_la_pr_ppp.km, sigma=bw.diggle, edge=TRUE, kernel="gaussian")
kde_la_sr_bw <- density(listings_la_sr_ppp.km, sigma=bw.diggle, edge=TRUE, kernel="gaussian")
par(mfrow=c(2,2))
plot(kde_la_eh_bw, main="Lavender - Entire home/apt")
plot(kde_la_hr_bw, main="Lavender - Hotel room")
plot(kde_la_pr_bw, main="Lavender - Private room")
plot(kde_la_sr_bw, main="Lavender - Shared room")

19.4 Tanjong Pagar
listings_tp_eh_ppp.km = rescale(listings_tp_eh_ppp, 1000, "km")
listings_tp_hr_ppp.km = rescale(listings_tp_hr_ppp, 1000, "km")
listings_tp_pr_ppp.km = rescale(listings_tp_pr_ppp, 1000, "km")
listings_tp_sr_ppp.km = rescale(listings_tp_sr_ppp, 1000, "km")
kde_tp_eh_bw <- density(listings_tp_eh_ppp.km, sigma=bw.diggle, edge=TRUE, kernel="gaussian")
kde_tp_hr_bw <- density(listings_tp_hr_ppp.km, sigma=bw.diggle, edge=TRUE, kernel="gaussian")
kde_tp_pr_bw <- density(listings_tp_pr_ppp.km, sigma=bw.diggle, edge=TRUE, kernel="gaussian")
kde_tp_sr_bw <- density(listings_tp_sr_ppp.km, sigma=0.1, edge=TRUE, kernel="gaussian")
par(mfrow=c(2,2))
plot(kde_tp_eh_bw, main="Tanjong Pagar - Entire home/apt")
plot(kde_tp_hr_bw, main="Tanjong Pagar - Hotel room")
plot(kde_tp_pr_bw, main="Tanjong Pagar - Private room")
plot(kde_tp_sr_bw, main="Tanjong Pagar - Shared room")

19.5 Displaying kernel density maps on openstreetmap of Singapore - Aljunied
# Converting KDE output into grid object.
gridded_al_eh_bw <- as.SpatialGridDataFrame.im(kde_al_eh_bw)
gridded_al_hr_bw <- as.SpatialGridDataFrame.im(kde_al_hr_bw)
gridded_al_pr_bw <- as.SpatialGridDataFrame.im(kde_al_pr_bw)
gridded_al_sr_bw <- as.SpatialGridDataFrame.im(kde_al_sr_bw)
# Converting gridded output into raster
gridded_al_eh_bw_raster <- raster(gridded_al_eh_bw)
gridded_al_hr_bw_raster <- raster(gridded_al_hr_bw)
gridded_al_pr_bw_raster <- raster(gridded_al_pr_bw)
gridded_al_sr_bw_raster <- raster(gridded_al_sr_bw)
# Assigning projection systems
projection(gridded_al_eh_bw_raster) <- CRS("+init=EPSG:3414 +datum=WGS84 +units=km")
projection(gridded_al_hr_bw_raster) <- CRS("+init=EPSG:3414 +datum=WGS84 +units=km")
projection(gridded_al_pr_bw_raster) <- CRS("+init=EPSG:3414 +datum=WGS84 +units=km")
projection(gridded_al_sr_bw_raster) <- CRS("+init=EPSG:3414 +datum=WGS84 +units=km")
tmap_mode("view")
## tmap mode set to interactive viewing
al_eh_map <- tm_shape(al) +
tm_borders(col = 'black',
lwd = 1,
alpha = 0.5) +
tm_shape(gridded_al_eh_bw_raster) +
tm_raster("v", alpha = 0.8, breaks=c(0, 1000, 2000, 3000, 4000, 5000), palette = "Reds") +
tm_layout(legend.position = c("right", "bottom"), frame = FALSE, title = "Aljunied - Entire home/apt") +
tm_basemap('OpenStreetMap')
al_hr_map <- tm_shape(al) +
tm_borders(col = 'black',
lwd = 1,
alpha = 0.5) +
tm_shape(gridded_al_hr_bw_raster) +
tm_raster("v", alpha = 0.8, breaks=c(0, 1000, 2000, 3000, 4000, 5000), palette = "Reds") +
tm_layout(legend.position = c("right", "bottom"), frame = FALSE, title = "Aljunied - Hotel room") +
tm_basemap('OpenStreetMap')
al_pr_map <- tm_shape(al) +
tm_borders(col = 'black',
lwd = 1,
alpha = 0.5) +
tm_shape(gridded_al_pr_bw_raster) +
tm_raster("v", alpha = 0.8, breaks=c(0, 1000, 2000, 3000, 4000, 5000), palette = "Reds") +
tm_layout(legend.position = c("right", "bottom"), frame = FALSE, title = "Aljunied - Private room") +
tm_basemap('OpenStreetMap')
al_sr_map <- tm_shape(al) +
tm_borders(col = 'black',
lwd = 1,
alpha = 0.5) +
tm_shape(gridded_al_sr_bw_raster) +
tm_raster("v", alpha = 0.8, breaks=c(0, 1000, 2000, 3000, 4000, 5000), palette = "Reds") +
tm_layout(legend.position = c("right", "bottom"), frame = FALSE, title = "Aljunied - Shared room") +
tm_basemap('OpenStreetMap')
tmap_arrange(al_eh_map, al_hr_map, al_pr_map, al_sr_map, asp=2, ncol=2)
19.5.1 Analysis of the spatial patterns for Aljunied by room type
There is significantly more private rooms available in Aljunied as compared to the other subzones and this is due to the location and its accessibility to other parts of Singapore. Furthermore, as Aljunied is only one stop away from Paya Lebar, tourist would be keen to rent a private room at Aljunied as it is a convenient place to live at.
19.6 Displaying kernel density maps on openstreetmap of Singapore - Balestier
# Converting KDE output into grid object.
gridded_ba_eh_bw <- as.SpatialGridDataFrame.im(kde_ba_eh_bw)
gridded_ba_hr_bw <- as.SpatialGridDataFrame.im(kde_ba_hr_bw)
gridded_ba_pr_bw <- as.SpatialGridDataFrame.im(kde_ba_pr_bw)
gridded_ba_sr_bw <- as.SpatialGridDataFrame.im(kde_ba_sr_bw)
# Converting gridded output into raster
gridded_ba_eh_bw_raster <- raster(gridded_ba_eh_bw)
gridded_ba_hr_bw_raster <- raster(gridded_ba_hr_bw)
gridded_ba_pr_bw_raster <- raster(gridded_ba_pr_bw)
gridded_ba_sr_bw_raster <- raster(gridded_ba_sr_bw)
# Assigning projection systems
projection(gridded_ba_eh_bw_raster) <- CRS("+init=EPSG:3414 +datum=WGS84 +units=km")
projection(gridded_ba_hr_bw_raster) <- CRS("+init=EPSG:3414 +datum=WGS84 +units=km")
projection(gridded_ba_pr_bw_raster) <- CRS("+init=EPSG:3414 +datum=WGS84 +units=km")
projection(gridded_ba_sr_bw_raster) <- CRS("+init=EPSG:3414 +datum=WGS84 +units=km")
ba_eh_map <- tm_shape(ba) +
tm_borders(col = 'black',
lwd = 1,
alpha = 0.5) +
tm_shape(gridded_ba_eh_bw_raster) +
tm_raster("v", alpha = 0.8, breaks=c(0, 500, 1000, 1500, 2000), palette = "Blues") +
tm_layout(legend.position = c("right", "bottom"), frame = FALSE, title = "Balestier - Entire home/apt") +
tm_basemap('OpenStreetMap')
ba_hr_map <- tm_shape(ba) +
tm_borders(col = 'black',
lwd = 1,
alpha = 0.5) +
tm_shape(gridded_ba_hr_bw_raster) +
tm_raster("v", alpha = 0.8, breaks=c(0, 500, 1000, 1500, 2000), palette = "Blues") +
tm_layout(legend.position = c("right", "bottom"), frame = FALSE, title = "Balestier - Hotel room") +
tm_basemap('OpenStreetMap')
ba_pr_map <- tm_shape(ba) +
tm_borders(col = 'black',
lwd = 1,
alpha = 0.5) +
tm_shape(gridded_ba_pr_bw_raster) +
tm_raster("v", alpha = 0.8, breaks=c(0, 500, 1000, 1500, 2000), palette = "Blues") +
tm_layout(legend.position = c("right", "bottom"), frame = FALSE, title = "Balestier - Private room") +
tm_basemap('OpenStreetMap')
ba_sr_map <- tm_shape(ba) +
tm_borders(col = 'black',
lwd = 1,
alpha = 0.5) +
tm_shape(gridded_ba_sr_bw_raster) +
tm_raster("v", alpha = 0.8, breaks=c(0, 500, 1000, 1500, 2000), palette = "Blues") +
tm_layout(legend.position = c("right", "bottom"), frame = FALSE, title = "Balestier - Shared room") +
tm_basemap('OpenStreetMap')
tmap_arrange(ba_eh_map, ba_hr_map, ba_pr_map, ba_sr_map, asp=2, ncol=2)
19.6.1 Analysis of the spatial patterns for Balestier by room type
There is significantly more entire homes/apts available in Balestier as compared to the other subzones and this may be due to Balestier being a residential area. There may be a demand among tourist to live in Balestier as it is located in the central region of Singapore. This makes travelling very accessible and conveient for tourist during their trip to Singapore.
19.7 Displaying kernel density maps on openstreetmap of Singapore - Lavender
# Converting KDE output into grid object.
gridded_la_eh_bw <- as.SpatialGridDataFrame.im(kde_la_eh_bw)
gridded_la_hr_bw <- as.SpatialGridDataFrame.im(kde_la_hr_bw)
gridded_la_pr_bw <- as.SpatialGridDataFrame.im(kde_la_pr_bw)
gridded_la_sr_bw <- as.SpatialGridDataFrame.im(kde_la_sr_bw)
# Converting gridded output into raster
gridded_la_eh_bw_raster <- raster(gridded_la_eh_bw)
gridded_la_hr_bw_raster <- raster(gridded_la_hr_bw)
gridded_la_pr_bw_raster <- raster(gridded_la_pr_bw)
gridded_la_sr_bw_raster <- raster(gridded_la_sr_bw)
# Assigning projection systems
projection(gridded_la_eh_bw_raster) <- CRS("+init=EPSG:3414 +datum=WGS84 +units=km")
projection(gridded_la_hr_bw_raster) <- CRS("+init=EPSG:3414 +datum=WGS84 +units=km")
projection(gridded_la_pr_bw_raster) <- CRS("+init=EPSG:3414 +datum=WGS84 +units=km")
projection(gridded_la_sr_bw_raster) <- CRS("+init=EPSG:3414 +datum=WGS84 +units=km")
la_eh_map <- tm_shape(la) +
tm_borders(col = 'black',
lwd = 1,
alpha = 0.5) +
tm_shape(gridded_la_eh_bw_raster) +
tm_raster("v", alpha = 0.8, breaks=c(0, 1000, 2000, 3000, 4000, 5000), palette = "Purples") +
tm_layout(legend.position = c("right", "bottom"), frame = FALSE, title = "Lavender - Entire home/apt") +
tm_basemap('OpenStreetMap')
la_hr_map <- tm_shape(la) +
tm_borders(col = 'black',
lwd = 1,
alpha = 0.5) +
tm_shape(gridded_la_hr_bw_raster) +
tm_raster("v", alpha = 0.8, breaks=c(0, 1000, 2000, 3000, 4000, 5000), palette = "Purples") +
tm_layout(legend.position = c("right", "bottom"), frame = FALSE, title = "Lavender - Hotel room") +
tm_basemap('OpenStreetMap')
la_pr_map <- tm_shape(la) +
tm_borders(col = 'black',
lwd = 1,
alpha = 0.5) +
tm_shape(gridded_la_pr_bw_raster) +
tm_raster("v", alpha = 0.8, breaks=c(0, 1000, 2000, 3000, 4000, 5000), palette = "Purples") +
tm_layout(legend.position = c("right", "bottom"), frame = FALSE, title = "Lavender - Private room") +
tm_basemap('OpenStreetMap')
la_sr_map <- tm_shape(la) +
tm_borders(col = 'black',
lwd = 1,
alpha = 0.5) +
tm_shape(gridded_la_sr_bw_raster) +
tm_raster("v", alpha = 0.8, breaks=c(0, 1000, 2000, 3000, 4000, 5000), palette = "Purples") +
tm_layout(legend.position = c("right", "bottom"), frame = FALSE, title = "Lavender - Shared room") +
tm_basemap('OpenStreetMap')
tmap_arrange(la_eh_map, la_hr_map, la_pr_map, la_sr_map, asp=2, ncol=2)
19.7.1 Analysis of the spatial patterns for Lavender by room type
There is significantly more private rooms available in Lavender as compared to the other subzones and this may be due to the location. As Lavender is relatively nearer to tourist attractions like gardens by the bay, there may be more private rooms available to cater to tourist.
19.8 Displaying kernel density maps on openstreetmap of Singapore - Tanjong Pagar
# Converting KDE output into grid object.
gridded_tp_eh_bw <- as.SpatialGridDataFrame.im(kde_tp_eh_bw)
gridded_tp_hr_bw <- as.SpatialGridDataFrame.im(kde_tp_hr_bw)
gridded_tp_pr_bw <- as.SpatialGridDataFrame.im(kde_tp_pr_bw)
gridded_tp_sr_bw <- as.SpatialGridDataFrame.im(kde_tp_sr_bw)
# Converting gridded output into raster
gridded_tp_eh_bw_raster <- raster(gridded_tp_eh_bw)
gridded_tp_hr_bw_raster <- raster(gridded_tp_hr_bw)
gridded_tp_pr_bw_raster <- raster(gridded_tp_pr_bw)
gridded_tp_sr_bw_raster <- raster(gridded_tp_sr_bw)
# Assigning projection systems
projection(gridded_tp_eh_bw_raster) <- CRS("+init=EPSG:3414 +datum=WGS84 +units=km")
projection(gridded_tp_hr_bw_raster) <- CRS("+init=EPSG:3414 +datum=WGS84 +units=km")
projection(gridded_tp_pr_bw_raster) <- CRS("+init=EPSG:3414 +datum=WGS84 +units=km")
projection(gridded_tp_sr_bw_raster) <- CRS("+init=EPSG:3414 +datum=WGS84 +units=km")
tp_eh_map <- tm_shape(tp) +
tm_borders(col = 'black',
lwd = 1,
alpha = 0.5) +
tm_shape(gridded_tp_eh_bw_raster) +
tm_raster("v", alpha = 0.8, breaks=c(0, 1000, 2000, 3000, 4000), palette = "Greens") +
tm_layout(legend.position = c("right", "bottom"), frame = FALSE, title = "Tanjong Pagar - Entire home/apt") +
tm_basemap('OpenStreetMap')
tp_hr_map <- tm_shape(tp) +
tm_borders(col = 'black',
lwd = 1,
alpha = 0.5) +
tm_shape(gridded_tp_hr_bw_raster) +
tm_raster("v", alpha = 0.8, breaks=c(0, 1000, 2000, 3000, 4000), palette = "Greens") +
tm_layout(legend.position = c("right", "bottom"), frame = FALSE, title = "Tanjong Pagar - Hotel room") +
tm_basemap('OpenStreetMap')
tp_pr_map <- tm_shape(tp) +
tm_borders(col = 'black',
lwd = 1,
alpha = 0.5) +
tm_shape(gridded_tp_pr_bw_raster) +
tm_raster("v", alpha = 0.8, breaks=c(0, 1000, 2000, 3000, 4000), palette = "Greens") +
tm_layout(legend.position = c("right", "bottom"), frame = FALSE, title = "Tanjong Pagar - Private room") +
tm_basemap('OpenStreetMap')
tp_sr_map <- tm_shape(tp) +
tm_borders(col = 'black',
lwd = 1,
alpha = 0.5) +
tm_shape(gridded_tp_sr_bw_raster) +
tm_raster("v", alpha = 0.8, breaks=c(0, 1000, 2000, 3000, 4000), palette = "Greens") +
tm_layout(legend.position = c("right", "bottom"), frame = FALSE, title = "Tanjong Pagar - Shared room") +
tm_basemap('OpenStreetMap')
tmap_arrange(tp_eh_map, tp_hr_map, tp_pr_map, tp_sr_map, asp=2, ncol=2)
tmap_mode('plot')
## tmap mode set to plotting
19.8.1 Analysis of the spatial patterns for Tanjong Pagar by room type
There is significantly more entire homes/apts in Tanjong Pagar as compared to the other planning subzones. This might be due to the high number of housing/apartments around the area. Owners may rent their apartment out to others as an additional source of income.
20. Overall analysis of kernel density maps of Airbnb listing by room type within Aljunied, Balestier, Lavender and Tanjong Pagar planning subzones
From the plots above, we noticed that there are very few hotel rooms and shared rooms available within Aljunied, Balestier, Lavender and Tanjong Pagar planning subzones. This is because those subzones are not famous tourist spot, hence, there will be lesser hotels availble. Furthermore, people might not be keen on the idea of sharing spaces. Therefore, the demand of shared rooms will be low, leading to a low supply of shared rooms.