In this task, we use first order and second order spatial point analysis to understand the distribution of Airbnb listing in Singapore.

Data import and preparation

Install R packages

packages = c('readr','rgdal', 'maptools', 'raster','spatstat', 'tmap', 'dplyr','sf')
for (p in packages){
if(!require(p, character.only = T)){
install.packages(p)
}
library(p,character.only = T)
}

Import data

Data required for this task:

Aspatial 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()
## )
head(listings)
## Registered S3 method overwritten by 'cli':
##   method     from    
##   print.boxx spatstat
## # A tibble: 6 x 16
##      id name  host_id host_name neighbourhood_g~ neighbourhood latitude
##   <dbl> <chr>   <dbl> <chr>     <chr>            <chr>            <dbl>
## 1 49091 COZI~  266763 Francesca North Region     Woodlands         1.44
## 2 50646 Plea~  227796 Sujatha   Central Region   Bukit Timah       1.33
## 3 56334 COZI~  266763 Francesca North Region     Woodlands         1.44
## 4 71609 Ensu~  367042 Belinda   East Region      Tampines          1.35
## 5 71896 B&B ~  367042 Belinda   East Region      Tampines          1.35
## 6 71903 Room~  367042 Belinda   East Region      Tampines          1.35
## # ... with 9 more variables: longitude <dbl>, room_type <chr>, price <dbl>,
## #   minimum_nights <dbl>, number_of_reviews <dbl>, last_review <date>,
## #   reviews_per_month <dbl>, calculated_host_listings_count <dbl>,
## #   availability_365 <dbl>

Geospatial data

sg <- readOGR(dsn = "data/geospatial", layer="CostalOutline")
## OGR data source with driver: ESRI Shapefile 
## Source: "C:\Users\weich\Downloads\SMU2020\IS415\IS415_Take-home_Ex02\data\geospatial", layer: "CostalOutline"
## with 60 features
## It has 4 fields
mpsz <- readOGR(dsn = "data/geospatial", layer="MP14_SUBZONE_WEB_PL")
## OGR data source with driver: ESRI Shapefile 
## Source: "C:\Users\weich\Downloads\SMU2020\IS415\IS415_Take-home_Ex02\data\geospatial", layer: "MP14_SUBZONE_WEB_PL"
## with 323 features
## It has 15 fields

Check projection system

crs(sg)
## CRS arguments:
##  +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
## +ellps=WGS84 +towgs84=0,0,0
crs(mpsz)
## CRS arguments:
##  +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
## +ellps=WGS84 +towgs84=0,0,0

Convert listings CSV to sf’s simple features dataframe and assign coordinate reference system

listings_sf4326 <- st_as_sf(listings,
                        coords = c("longitude", "latitude"),
                        crs= 4326)
listings_sf <- st_transform(listings_sf4326, 3414)
class(listings_sf)
## [1] "sf"         "tbl_df"     "tbl"        "data.frame"
crs(listings_sf)
## [1] "+proj=tmerc +lat_0=1.366666666666667 +lon_0=103.8333333333333 +k=1 +x_0=28001.642 +y_0=38744.572 +ellps=WGS84 +units=m +no_defs "

Nation-wide analysis

Exploratory spatial data analysis

Check the room_type

Check for NA values

any(is.na(listings_sf$room_type))
## [1] FALSE

There are no NAs in room_type variable.

Count the no. of elements with a particular room_type

table(listings_sf$room_type)
## 
## Entire home/apt      Hotel room    Private room     Shared room 
##            3728             507            3206             272

There are four room types - Entire home/apt, Hotel room, Private room and Shared room.

From Airbnb’s website, we learn that the room types mean:

  • Entire place: Guests have the whole place to themselves. This usually includes a bedroom, a bathroom, and a kitchen. Hosts should note in the description if they’ll be on the property (e.g. “Host occupies ground floor of the home”)
  • Private room: Guests have their own private room for sleeping. Other areas could be shared.
  • Shared room: Guests sleep in a bedroom or a common area that could be shared with others.

Locations of the Airbnb listing by room type with Openstreemap of Singapore as the background

tmap_mode("view")
## tmap mode set to interactive viewing
tm_shape(sg) +
  tm_borders(alpha = 0.5) +
tm_shape(listings_sf) +
  tm_dots(col = 'room_type', 
          palette=c('blue', 'orange', 'red', 'green'),
          size = 0.02)
## Warning: The shape sg is invalid. See sf::st_is_valid
tmap_mode("plot")
## tmap mode set to plotting
tm_shape(sg) +
  tm_borders(alpha = 0.5) +
tm_shape(listings_sf) +
  tm_dots(col = 'room_type', 
          palette=c('blue', 'orange', 'red', 'green'),
          size = 0.05) +
  tm_facets(by="room_type")
## Warning: The shape sg is invalid. See sf::st_is_valid

EDA findings:

  • A sizeable portion of the Airbnb listings are located in the downtown region of Singapore. This could be due to the more stringent measures regarding the rental of HDB flats (which are generally located in the heartlands).

Generally, for Housing Development Board (HDB) flats, the minimum rental period is 6 months and it cannot be rented to tourists. For private properties, the minimum rental period is 3 months. (Source: irblaw)

  • It is important to note that the private rooms do not represent private properties but the presence of a private room for guests.
  • Entire home/apt, private rooms and shared rooms are located all over Singapore while hotel rooms are mostly located in the downtown region.
  • There is a significantly higher number of private rooms as compared to entire home/apt, shared rooms and hotel rooms.

Spatial Data Wrangling

spatstat requires data in ppp object form.

1. Split listings_sf to four dataframes according to room_type

listings_entire <- listings_sf %>% 
                filter(room_type == 'Entire home/apt')
listings_hotel <- listings_sf %>% 
                filter(room_type == 'Hotel room')
listings_private <- listings_sf %>% 
                filter(room_type == 'Private room')
listings_shared <- listings_sf %>% 
                filter(room_type == 'Shared room')

2. Convert listings simple features dataframe to sp’s SpatialPointsDataframe, SpatialPoints and finally spatstat’s ppp object

listings_spdf <- as(listings_sf, "Spatial")
listings_sp <- as(listings_spdf, "SpatialPoints")
listings_ppp <- as(listings_sp, "ppp")
class(listings_ppp)
## [1] "ppp"
Entire home/apt
listings_entire_spdf <- as(listings_entire, "Spatial")
listings_entire_sp <- as(listings_entire_spdf, "SpatialPoints")
listings_entire_ppp <- as(listings_entire_sp, "ppp")
Hotel room
listings_hotel_spdf <- as(listings_hotel, "Spatial")
listings_hotel_sp <- as(listings_hotel_spdf, "SpatialPoints")
listings_hotel_ppp <- as(listings_hotel_sp, "ppp")
Private room
listings_private_spdf <- as(listings_private, "Spatial")
listings_private_sp <- as(listings_private_spdf, "SpatialPoints")
listings_private_ppp <- as(listings_private_sp, "ppp")
Shared room
listings_shared_spdf <- as(listings_shared, "Spatial")
listings_shared_sp <- as(listings_shared_spdf, "SpatialPoints")
listings_shared_ppp <- as(listings_shared_sp, "ppp")

3. Convert coastal boundary and subzone planning area SpatialDataframe to sp’s Spatial object

sg_sp <- as(sg, "SpatialPolygons")
mpsz_sp <- as(mpsz, "SpatialPolygons")
class(sg_sp)
## [1] "SpatialPolygons"
## attr(,"package")
## [1] "sp"

4. Check for duplicated spatial point event and remove them

If there are duplicated spatial points, we will use the jittering method to avoid these duplicates.

any(duplicated(listings_ppp))
## [1] TRUE
any(duplicated(listings_entire_ppp))
## [1] TRUE
any(duplicated(listings_hotel_ppp))
## [1] TRUE
any(duplicated(listings_private_ppp))
## [1] TRUE
any(duplicated(listings_shared_ppp))
## [1] TRUE
listings_ppp_jit <- rjitter(listings_ppp, retry=TRUE, nsim=1, drop=TRUE)
listings_entire_ppp_jit <- rjitter(listings_entire_ppp, retry=TRUE, nsim=1, drop=TRUE)
listings_hotel_ppp_jit <- rjitter(listings_hotel_ppp, retry=TRUE, nsim=1, drop=TRUE)
listings_private_ppp_jit <- rjitter(listings_private_ppp, retry=TRUE, nsim=1, drop=TRUE)
listings_shared_ppp_jit <- rjitter(listings_shared_ppp, retry=TRUE, nsim=1, drop=TRUE)
any(duplicated(listings_ppp_jit))
## [1] FALSE
any(duplicated(listings_entire_ppp_jit))
## [1] FALSE
any(duplicated(listings_hotel_ppp_jit))
## [1] FALSE
any(duplicated(listings_private_ppp_jit))
## [1] FALSE
any(duplicated(listings_shared_ppp_jit))
## [1] FALSE

5. Create owin object to confine analysis to Singapore boundary

sg_owin <- as(sg_sp, "owin")
plot(sg_owin)

6. Combine listing points and study area

listingsSG_ppp <- listings_ppp_jit[sg_owin]
listingsSG_entire_ppp <- listings_entire_ppp_jit[sg_owin]
listingsSG_hotel_ppp <- listings_hotel_ppp_jit[sg_owin]
listingsSG_private_ppp <- listings_private_ppp_jit[sg_owin]
listingsSG_shared_ppp <- listings_shared_ppp_jit[sg_owin]

1st order spatial point patterns analysis (density based analysis)

Quadrat analysis using Chi-squared test of complete spatial randomness

All listings

From the EDA, we generate several hypothesis about the spatial point patterns:

  • H0: The distribution of Airbnb listings are randomly distributed.
  • H1: The distribution of Airbnb listings are not randomly distributed.

The confidence interval of 95% is used.

qt <- quadrat.test(listingsSG_ppp, 
                   nx = 20, ny = 15)
## Warning: Some expected counts are small; chi^2 approximation may be inaccurate
qt
## 
##  Chi-squared test of CSR using quadrat counts
## 
## data:  listingsSG_ppp
## X2 = 72446, df = 184, p-value < 2.2e-16
## alternative hypothesis: two.sided
## 
## Quadrats: 185 tiles (irregular windows)

Preliminary findings:

  • Since p-value <2.2e-16 < alpha value 0.05, we reject the null hypothesis and conclude that the distribution of Airbnb listings are not randomly distributed.
  • Since chi-squared value > 1, we can also conclude that the Airbnb listings are clustered.
plot(listingsSG_ppp)
plot(qt, add = TRUE, cex =.1)

Conditional Monte Carlo test of CSR using quadrat counts

quadrat.test(listingsSG_ppp,
             nx = 20, ny = 15,
             method="M",
             nsim=999)
## 
##  Conditional Monte Carlo test of CSR using quadrat counts
##  Test statistic: Pearson X2 statistic
## 
## data:  listingsSG_ppp
## X2 = 72446, p-value = 0.002
## alternative hypothesis: two.sided
## 
## Quadrats: 185 tiles (irregular windows)

The Monte Carlo test brings more certainty that we should reject H0 and the distribution of Airbnb listings are not randomly distributed.

Entire home/apt

From the EDA, we generate several hypothesis about the spatial point patterns:

  • H0: The distribution of entire home/apt Airbnb listings are randomly distributed.
  • H1: The distribution of entire home/apt Airbnb listings are not randomly distributed.

The confidence interval of 95% is used.

qt_entire <- quadrat.test(listingsSG_entire_ppp, 
                   nx = 20, ny = 15)
qt_entire
## 
##  Chi-squared test of CSR using quadrat counts
## 
## data:  listingsSG_entire_ppp
## X2 = 43841, df = 184, p-value < 2.2e-16
## alternative hypothesis: two.sided
## 
## Quadrats: 185 tiles (irregular windows)

Preliminary findings:

  • Since p-value <2.2e-16 < alpha value 0.05, we reject the null hypothesis and conclude that the distribution of entire home/apt Airbnb listings are not randomly distributed.
  • Since chi-squared value > 1, we can also conclude that the entire home/apt Airbnb listings are clustered.
plot(listingsSG_entire_ppp)
plot(qt_entire, add = TRUE, cex =.1)

Conditional Monte Carlo test of CSR using quadrat counts

quadrat.test(listingsSG_entire_ppp,
             nx = 20, ny = 15,
             method="M",
             nsim=999)
## 
##  Conditional Monte Carlo test of CSR using quadrat counts
##  Test statistic: Pearson X2 statistic
## 
## data:  listingsSG_entire_ppp
## X2 = 43841, p-value = 0.002
## alternative hypothesis: two.sided
## 
## Quadrats: 185 tiles (irregular windows)

The Monte Carlo test brings more certainty that we should reject H0 and the distribution of entire home/apt Airbnb listings are not randomly distributed.

Hotel room

From the EDA, we generate several hypothesis about the spatial point patterns:

  • H0: The distribution of hotel room Airbnb listings are randomly distributed.
  • H1: The distribution of hotel room Airbnb listings are not randomly distributed.

The confidence interval of 95% is used.

qt_hotel <- quadrat.test(listingsSG_hotel_ppp, 
                   nx = 20, ny = 15)
qt_hotel
## 
##  Chi-squared test of CSR using quadrat counts
## 
## data:  listingsSG_hotel_ppp
## X2 = 9183.7, df = 184, p-value < 2.2e-16
## alternative hypothesis: two.sided
## 
## Quadrats: 185 tiles (irregular windows)

Preliminary findings:

  • Since p-value <2.2e-16 < alpha value 0.05, we reject the null hypothesis and conclude that the distribution of hotel room Airbnb listings are not randomly distributed.
  • Since chi-squared value > 1, we can also conclude that the hotel room Airbnb listings are clustered.
plot(listingsSG_hotel_ppp)
plot(qt_hotel, add = TRUE, cex =.1)

Conditional Monte Carlo test of CSR using quadrat counts

quadrat.test(listingsSG_hotel_ppp,
             nx = 20, ny = 15,
             method="M",
             nsim=999)
## 
##  Conditional Monte Carlo test of CSR using quadrat counts
##  Test statistic: Pearson X2 statistic
## 
## data:  listingsSG_hotel_ppp
## X2 = 9183.7, p-value = 0.002
## alternative hypothesis: two.sided
## 
## Quadrats: 185 tiles (irregular windows)

The Monte Carlo test brings more certainty that we should reject H0 and the distribution of hotel room Airbnb listings are not randomly distributed.

Private room

From the EDA, we generate several hypothesis about the spatial point patterns:

  • H0: The distribution of private room Airbnb listings are randomly distributed.
  • H1: The distribution of private room Airbnb listings are not randomly distributed.

The confidence interval of 95% is used.

qt_private <- quadrat.test(listingsSG_private_ppp, 
                   nx = 20, ny = 15)
qt_private
## 
##  Chi-squared test of CSR using quadrat counts
## 
## data:  listingsSG_private_ppp
## X2 = 21945, df = 184, p-value < 2.2e-16
## alternative hypothesis: two.sided
## 
## Quadrats: 185 tiles (irregular windows)

Preliminary findings:

  • Since p-value <2.2e-16 < alpha value 0.05, we reject the null hypothesis and conclude that the distribution of private room Airbnb listings are not randomly distributed.
  • Since chi-squared value > 1, we can also conclude that the private room Airbnb listings are clustered.
plot(listingsSG_private_ppp)
plot(qt_private, add = TRUE, cex =.1)

Conditional Monte Carlo test of CSR using quadrat counts

quadrat.test(listingsSG_private_ppp,
             nx = 20, ny = 15,
             method="M",
             nsim=999)
## 
##  Conditional Monte Carlo test of CSR using quadrat counts
##  Test statistic: Pearson X2 statistic
## 
## data:  listingsSG_private_ppp
## X2 = 21945, p-value = 0.002
## alternative hypothesis: two.sided
## 
## Quadrats: 185 tiles (irregular windows)

The Monte Carlo test brings more certainty that we should reject H0 and the distribution of private room Airbnb listings are not randomly distributed.

Shared room

From the EDA, we generate several hypothesis about the spatial point patterns:

  • H0: The distribution of shared room Airbnb listings are randomly distributed.
  • H1: The distribution of shared room Airbnb listings are not randomly distributed.

The confidence interval of 95% is used.

qt_shared <- quadrat.test(listingsSG_shared_ppp, 
                   nx = 20, ny = 15)
qt_shared
## 
##  Chi-squared test of CSR using quadrat counts
## 
## data:  listingsSG_shared_ppp
## X2 = 4487.4, df = 184, p-value < 2.2e-16
## alternative hypothesis: two.sided
## 
## Quadrats: 185 tiles (irregular windows)

Preliminary findings:

  • Since p-value <2.2e-16 < alpha value 0.05, we reject the null hypothesis and conclude that the distribution of shared room Airbnb listings are not randomly distributed.
  • Since chi-squared value > 1, we can also conclude that the shared room Airbnb listings are clustered.
plot(listingsSG_shared_ppp)
plot(qt_shared, add = TRUE, cex =.1)

Conditional Monte Carlo test of CSR using quadrat counts

quadrat.test(listingsSG_shared_ppp,
             nx = 20, ny = 15,
             method="M",
             nsim=999)
## 
##  Conditional Monte Carlo test of CSR using quadrat counts
##  Test statistic: Pearson X2 statistic
## 
## data:  listingsSG_shared_ppp
## X2 = 4487.4, p-value = 0.002
## alternative hypothesis: two.sided
## 
## Quadrats: 185 tiles (irregular windows)

The Monte Carlo test brings more certainty that we should reject H0 and the distribution of shared room Airbnb listings are not randomly distributed.

Nearest Neighbour Analysis using Clark and Evans Test

All listings

Again, we generate several hypothesis about the spatial point patterns:

  • H0: The distribution of Airbnb listings are randomly distributed.
  • H1: The distribution of Airbnb listings are not randomly distributed.

The confidence interval of 95% is used.

clarkevans.test(listingsSG_ppp,
                correction="none",
                clipregion="sg_owin",
                alternative=c("two.sided"),
                nsim=99)
## 
##  Clark-Evans test
##  No edge correction
##  Monte Carlo test based on 99 simulations of CSR with fixed n
## 
## data:  listingsSG_ppp
## R = 0.33994, p-value = 0.02
## alternative hypothesis: two-sided

Preliminary findings:

  • Since p-value = 0.02 < alpha value 0.05, we reject the null hypothesis and conclude that the distribution of Airbnb listings are not randomly distributed.
  • Since Nearest Neighbour Index < 1, we can also conclude that the Airbnb listings are clustered.
  • The Nearest Neighbour Analysis confirms our Quadrat Analysis. This could be due to the clustering in the downtown region of Singapore.
Entire home/apt

We generate several hypothesis about the spatial point patterns:

  • H0: The distribution of entire home/apt Airbnb listings are randomly distributed.
  • H1: The distribution of entire home/apt Airbnb listings are not randomly distributed.

The confidence interval of 95% is used.

clarkevans.test(listingsSG_entire_ppp,
                correction="none",
                clipregion="sg_owin",
                alternative=c("two.sided"),
                nsim=99)
## 
##  Clark-Evans test
##  No edge correction
##  Monte Carlo test based on 99 simulations of CSR with fixed n
## 
## data:  listingsSG_entire_ppp
## R = 0.26372, p-value = 0.02
## alternative hypothesis: two-sided

Preliminary findings:

  • Since p-value = 0.02 < alpha value 0.05, we reject the null hypothesis and conclude that the distribution of entire home/apt Airbnb listings are not randomly distributed.
  • Since Nearest Neighbour Index < 1, we can also conclude that the entire home/apt Airbnb listings are clustered.
  • The Nearest Neighbour Analysis confirms our Quadrat Analysis. This could be due to the clustering in the downtown region of Singapore.
Hotel room

We generate several hypothesis about the spatial point patterns:

  • H0: The distribution of hotel room Airbnb listings are randomly distributed.
  • H1: The distribution of hotel room Airbnb listings are not randomly distributed.

The confidence interval of 95% is used.

clarkevans.test(listingsSG_hotel_ppp,
                correction="none",
                clipregion="sg_owin",
                alternative=c("two.sided"),
                nsim=99)
## 
##  Clark-Evans test
##  No edge correction
##  Monte Carlo test based on 99 simulations of CSR with fixed n
## 
## data:  listingsSG_hotel_ppp
## R = 0.10058, p-value = 0.02
## alternative hypothesis: two-sided

Preliminary findings:

  • Since p-value = 0.02 < alpha value 0.05, we reject the null hypothesis and conclude that the distribution of hotel room Airbnb listings are not randomly distributed.
  • Since Nearest Neighbour Index < 1, we can also conclude that the hotel room Airbnb listings are clustered.
  • The Nearest Neighbour Analysis confirms our Quadrat Analysis. This could be due to the clustering in the downtown region of Singapore.
Private room

We generate several hypothesis about the spatial point patterns:

  • H0: The distribution of private room Airbnb listings are randomly distributed.
  • H1: The distribution of private room Airbnb listings are not randomly distributed.

The confidence interval of 95% is used.

clarkevans.test(listingsSG_private_ppp,
                correction="none",
                clipregion="sg_owin",
                alternative=c("two.sided"),
                nsim=99)
## 
##  Clark-Evans test
##  No edge correction
##  Monte Carlo test based on 99 simulations of CSR with fixed n
## 
## data:  listingsSG_private_ppp
## R = 0.37528, p-value = 0.02
## alternative hypothesis: two-sided

Preliminary findings:

  • Since p-value = 0.02 < alpha value 0.05, we reject the null hypothesis and conclude that the distribution of private room Airbnb listings are not randomly distributed.
  • Since Nearest Neighbour Index < 1, we can also conclude that the private room Airbnb listings are clustered.
  • The Nearest Neighbour Analysis confirms our Quadrat Analysis. This could be due to the clustering in the downtown region of Singapore.
Shared room

We generate several hypothesis about the spatial point patterns:

  • H0: The distribution of shared room Airbnb listings are randomly distributed.
  • H1: The distribution of shared room Airbnb listings are not randomly distributed.

The confidence interval of 95% is used.

clarkevans.test(listingsSG_shared_ppp,
                correction="none",
                clipregion="sg_owin",
                alternative=c("two.sided"),
                nsim=99)
## 
##  Clark-Evans test
##  No edge correction
##  Monte Carlo test based on 99 simulations of CSR with fixed n
## 
## data:  listingsSG_shared_ppp
## R = 0.34871, p-value = 0.02
## alternative hypothesis: two-sided

Preliminary findings:

  • Since p-value = 0.02 < alpha value 0.05, we reject the null hypothesis and conclude that the distribution of shared room Airbnb listings are not randomly distributed.
  • Since Nearest Neighbour Index < 1, we can also conclude that the shared room Airbnb listings are clustered.
  • The Nearest Neighbour Analysis confirms our Quadrat Analysis. This could be due to the clustering in the downtown region of Singapore.

Kernel density estimation

1. Compute kernel density estimation using automatic bandwidth selection method

kde_listingsSG_bw <- density(listingsSG_ppp, sigma=bw.diggle, edge=TRUE, kernel="gaussian")
## Warning: point-in-polygon test had difficulty with 215 points (total score not 0
## or 1)
plot(kde_listingsSG_bw)

Since the density output range is too small to comprehend, we convert the unit of measurement from m to km.

2. Rescale by converting unit of measurement from m to km and compute kernel density estimation by defining bandwidth manually

We also define the bandwidth of 1km (sigma=1) for the density map.

listingsSG_ppp.km <- rescale(listingsSG_ppp, 1000, "km")
kde_listingsSG_bw.km <- density(listingsSG_ppp.km, sigma=1, edge=TRUE, kernel="gaussian")
plot(kde_listingsSG_bw.km)

We will do likewise for the four room types.

listingsSG_entire_ppp.km <- rescale(listingsSG_entire_ppp, 1000, "km")
kde_listingsSG_entire_bw.km <- density(listingsSG_entire_ppp.km, sigma=1, edge=TRUE, kernel="gaussian")
listingsSG_hotel_ppp.km <- rescale(listingsSG_hotel_ppp, 1000, "km")
kde_listingsSG_hotel_bw.km <- density(listingsSG_hotel_ppp.km, sigma=1, edge=TRUE, kernel="gaussian")
listingsSG_private_ppp.km <- rescale(listingsSG_private_ppp, 1000, "km")
kde_listingsSG_private_bw.km <- density(listingsSG_private_ppp.km, sigma=1, edge=TRUE, kernel="gaussian")
listingsSG_shared_ppp.km <- rescale(listingsSG_shared_ppp, 1000, "km")
kde_listingsSG_shared_bw.km <- density(listingsSG_shared_ppp.km, sigma=1, edge=TRUE, kernel="gaussian")
par(mfrow=c(2,2))
plot(kde_listingsSG_entire_bw.km, main = "Entire home/apt")
plot(kde_listingsSG_hotel_bw.km, main = "Hotel room")
plot(kde_listingsSG_private_bw.km, main = "Private room")
plot(kde_listingsSG_shared_bw.km, main = "Shared room")

3. Convert KDE output to grid object

gridded_kde_listingsSG_entire_bw <- as.SpatialGridDataFrame.im(kde_listingsSG_entire_bw.km)
gridded_kde_listingsSG_hotel_bw <- as.SpatialGridDataFrame.im(kde_listingsSG_hotel_bw.km)
gridded_kde_listingsSG_private_bw <- as.SpatialGridDataFrame.im(kde_listingsSG_private_bw.km)
gridded_kde_listingsSG_shared_bw <- as.SpatialGridDataFrame.im(kde_listingsSG_shared_bw.km)

4. Convert gridded output into raster

kde_listingsSG_entire_bw_raster <- raster(gridded_kde_listingsSG_entire_bw)
kde_listingsSG_hotel_bw_raster <- raster(gridded_kde_listingsSG_hotel_bw)
kde_listingsSG_private_bw_raster <- raster(gridded_kde_listingsSG_private_bw)
kde_listingsSG_shared_bw_raster <- raster(gridded_kde_listingsSG_shared_bw)

5. Assign projection system

projection(kde_listingsSG_entire_bw_raster) <- CRS("+init=EPSG:3414")
projection(kde_listingsSG_hotel_bw_raster) <- CRS("+init=EPSG:3414")
projection(kde_listingsSG_private_bw_raster) <- CRS("+init=EPSG:3414")
projection(kde_listingsSG_shared_bw_raster) <- CRS("+init=EPSG:3414")

6. Visualize output in tmap

kde_entire.map <- tm_shape(kde_listingsSG_entire_bw_raster) + 
  tm_raster("v", title="Entire home/apt", breaks=c(0, 20, 40, 60, 80, Inf)) +
  tm_layout(legend.position = c("right", "bottom"), frame = FALSE)

kde_hotel.map <- tm_shape(kde_listingsSG_hotel_bw_raster) + 
  tm_raster("v", title="Hotel room", breaks=c(0, 20, 40, 60, 80, Inf)) +
  tm_layout(legend.position = c("right", "bottom"), frame = FALSE)

kde_private.map <- tm_shape(kde_listingsSG_private_bw_raster) + 
  tm_raster("v",title="Private room", breaks=c(0, 20, 40, 60, 80, Inf)) +
  tm_layout(legend.position = c("right", "bottom"), frame = FALSE)

kde_shared.map <- tm_shape(kde_listingsSG_shared_bw_raster) + 
  tm_raster("v", title="Shared room", breaks=c(0, 20, 40, 60, 80, Inf)) +
  tm_layout(legend.position = c("right", "bottom"), frame = FALSE) 

tmap_arrange(kde_entire.map, kde_hotel.map, kde_private.map, kde_shared.map,
             asp=1, ncol=2, nrow=2)
## Warning: Values have found that are less than the lowest break
## Variable(s) "v" contains positive and negative values, so midpoint is set to 0. Set midpoint = NA to show the full spectrum of the color palette.
## Warning: Values have found that are less than the lowest break
## Variable(s) "v" contains positive and negative values, so midpoint is set to 0. Set midpoint = NA to show the full spectrum of the color palette.
## Warning: Values have found that are less than the lowest break
## Variable(s) "v" contains positive and negative values, so midpoint is set to 0. Set midpoint = NA to show the full spectrum of the color palette.
## Warning: Values have found that are less than the lowest break
## Variable(s) "v" contains positive and negative values, so midpoint is set to 0. Set midpoint = NA to show the full spectrum of the color palette.

KDE analysis:

  • Given the same scale of 1km, we find out if there is clustering in the density.
  • Entire home/apt: There is clustering in the downtown region of Singapore. Using the density based method with a common bandwidth of 1km reveal that the clustering occurs in the downtown region although there are entire home/apt listings scattered in other parts of Singapore. This is in line with the EDA done earlier.
  • Hotel room: Since there are few shared room, using the distance based method with a common bandwidth as the other room types does not allow us to comprehend whether there is patterns of complete spatial randomness. The second order analysis could give us better insight into the distribution of hotel room listings.
  • Private room: There is clustering in the downtown region of Singapore, albeit lower in density as compared to entire home/apt listing.
  • Shared room: Since there are few shared room, using the density based method with a common bandwidth as the other room types does not allow us to comprehend whether there is patterns of complete spatial randomness. The second order analysis could give us better insight into the distribution of shared room listings.

It is important to note that unlike the point map, the KDE map allows us to view the density of a location. This makes us focus on the southern region of Singapore, which we will be doing a planning subzone analysis below.

Planning subzones analysis of Aljunied, Balestier, Lavender and Tanjong Pagar

Extract study area

aj = mpsz[mpsz@data$SUBZONE_N == "ALJUNIED",]
bl = mpsz[mpsz@data$SUBZONE_N == "BALESTIER",]
lv = mpsz[mpsz@data$SUBZONE_N == "LAVENDER",]
tp = mpsz[mpsz@data$SUBZONE_N == "TANJONG PAGAR",]
par(mfrow=c(2,2))
plot(aj, main = "Aljunied")
plot(bl, main = "Balestier")
plot(lv, main = "Lavender")
plot(tp, main = "Tanjong Pagar")

Exploratory spatial data analysis

1. Convert the spatial point data frame into generic sp format

aj_sp = as(aj, "SpatialPolygons")
bl_sp = as(bl, "SpatialPolygons")
lv_sp = as(lv, "SpatialPolygons")
tp_sp = as(tp, "SpatialPolygons")

2. Create owin object

aj_owin = as(aj_sp, "owin")
bl_owin = as(bl_sp, "owin")
lv_owin = as(lv_sp, "owin")
tp_owin = as(tp_sp, "owin")

3. Combine Airbnb listings and study area

Aljunied
listings_aj_ppp_entire = listings_entire_ppp_jit[aj_owin]
listings_aj_ppp_hotel = listings_hotel_ppp_jit[aj_owin]
listings_aj_ppp_private = listings_private_ppp_jit[aj_owin]
listings_aj_ppp_shared = listings_shared_ppp_jit[aj_owin]
Balestier
listings_bl_ppp_entire = listings_entire_ppp_jit[bl_owin]
listings_bl_ppp_hotel = listings_hotel_ppp_jit[bl_owin]
listings_bl_ppp_private = listings_private_ppp_jit[bl_owin]
listings_bl_ppp_shared = listings_shared_ppp_jit[bl_owin]
Lavender
listings_lv_ppp_entire = listings_entire_ppp_jit[lv_owin]
listings_lv_ppp_hotel = listings_hotel_ppp_jit[lv_owin]
listings_lv_ppp_private = listings_private_ppp_jit[lv_owin]
listings_lv_ppp_shared = listings_shared_ppp_jit[lv_owin]
Tanjong Pagar
listings_tp_ppp_entire = listings_entire_ppp_jit[tp_owin]
listings_tp_ppp_hotel = listings_hotel_ppp_jit[tp_owin]
listings_tp_ppp_private = listings_private_ppp_jit[tp_owin]
listings_tp_ppp_shared = listings_shared_ppp_jit[tp_owin]

4. Locations of the Airbnb listing by room type

Aljunied
par(mfrow=c(2,2))
plot(listings_aj_ppp_entire, main = "Entire home/apt")
plot(listings_aj_ppp_hotel, main = "Hotel room")
plot(listings_aj_ppp_private, main = "Private room")
plot(listings_aj_ppp_shared, main = "Shared room")

EDA findings:

  • Entire home/apt listings: There seems to be clustering along the longitude axis. This could be due to the presence of many shophouses available for rent along Geylang Road.
  • Private room listings: A similar finding and explanation could be said for this room type.
  • Hotel room listings: Though the rooms are scattered in the Aljunied area, they are generally found around the Geylang Road area as well.
  • Shared room listings: These rooms seem to be scattered in the Aljunied area with no prominent pattern.
Balestier
par(mfrow=c(2,2))
plot(listings_bl_ppp_entire, main = "Entire home/apt")
plot(listings_bl_ppp_hotel, main = "Hotel room")
plot(listings_bl_ppp_private, main = "Private room")
plot(listings_bl_ppp_shared, main = "Shared room")

EDA findings:

  • Entire home/apt listings: There seems to be clustering in the southern and western region of Balestier. Interestingly, the number of entire home/apt listings is significantly higher than that of all other types of listing. This could be due to the prime location of Balestier to town, and Singaporeans making use of this to rent to rent seekers.
  • Private room listings: The private room listings are rather scattered and no visible pattern could be seen.
  • Hotel room listings: A similar finding to the private room listings could be said for the hotel room listings. Interestingly, the number of hotel rooms in the Balestier region is close to the number of private rooms.
  • Shared room listings: There is only one shared room listing in the Balestier region so no possible clustering distribution. We will not analyse the shared room listing in Balestier.
Lavender
par(mfrow=c(2,2))
plot(listings_lv_ppp_entire, main = "Entire home/apt")
plot(listings_lv_ppp_hotel, main = "Hotel room")
plot(listings_lv_ppp_private, main = "Private room")
plot(listings_lv_ppp_shared, main = "Shared room")

EDA findings:

  • Entire home/apt listings: There seems to be clustering in the northern region of Lavender. This could be due to the presence of HDB flats in the area.
  • Private room listings: There seems to be clustering in the southern east region of Lavender in contrary to the entire home/apt listings. This could also be due to the presence of HDB flats in the area.
  • Hotel room listings: Although the rooms are generally scattered, there seems to be two distinct clusters in the northern and central region of Lavender. However, a statistically analysis will need to be done to understand the clustering patterns.
  • Shared room listings: A similar explanation to the hotel room listings can be said for the shared room listings.
Tanjong Pagar
par(mfrow=c(2,2))
plot(listings_tp_ppp_entire, main = "Entire home/apt")
plot(listings_tp_ppp_hotel, main = "Hotel room")
plot(listings_tp_ppp_private, main = "Private room")
plot(listings_tp_ppp_shared, main = "Shared room")

EDA findings:

  • Entire home/apt listings: There seems to be clustering in the southern west region of Tanjong Pagar. This could be due to Tanjong Pagar being a prime zone located near the CBD area, and Singaporeans making use of this to rent to rent seekers.
  • Private room listings: The private room listings are rather scattered in the region and no visible pattern could be found.
  • Hotel room listings: There are only two hotel room listings in Tanjong Pagar area. This could be due to Tanjong Pagar being a prime zone, and promiment hotels tend to have their own listing websites and rarely list on Airbnb.
  • Shared room listings: There are no shared rooms listings in Tanjong Pagar area. This could be due to Tanjong Pagar being a prime zone, and shared rooms which are associated with cheaper and lower quality, are not located at.

2nd order spatial point patterns analysis (distance based analysis)

G-Function analysis

The shape of the G-function reveals how the points are spaced in a region.

  • Clustered: G increases rapidly in short distance
  • Evenness: G increases slowly and then rapidly in long distance

In addition, the significance of G-function is found by using the Monte Carlo test to generate simulations.

  • Significant: Estimated G(r) lies above or below the envelope
  • Not significant: Estimated G(r) lies within the envelope

Aljunied

G-function estimation
G_CK_aj_entire = Gest(listings_aj_ppp_entire, correction = "border")
G_CK_aj_hotel = Gest(listings_aj_ppp_hotel, correction = "border")
G_CK_aj_private = Gest(listings_aj_ppp_private, correction = "border")
G_CK_aj_shared = Gest(listings_aj_ppp_shared, correction = "border")
par(mfrow=c(2,2))
plot(G_CK_aj_entire, main = "Entire home/apt")
plot(G_CK_aj_hotel, main = "Hotel room")
plot(G_CK_aj_private, main = "Private room")
plot(G_CK_aj_shared, main = "Shared room")

Complete Spatial Randomness Test

Hypothesis to test:

(a) Entire home/apt

  • H0: The distribution of entire home/apt Airbnb listings in Aljunied are randomly distributed.
  • H1: The distribution of entire home/apt Airbnb listings in Aljunied are not randomly distributed.

(b) Hotel room

  • H0: The distribution of hotel room Airbnb listings in Aljunied are randomly distributed.
  • H1: The distribution of hotel room Airbnb listings in Aljunied are not randomly distributed.

(c) Private room

  • H0: The distribution of private room Airbnb listings in Aljunied are randomly distributed.
  • H1: The distribution of private room Airbnb listings in Aljunied are not randomly distributed.

(d) Shared room

  • H0: The distribution of shared room Airbnb listings in Aljunied are randomly distributed.
  • H1: The distribution of shared room Airbnb listings in Aljunied are not randomly distributed.

For all hypothesis generated, the confidence interval of 95% is used.

G_CK_aj_entire.csr <- envelope(listings_aj_ppp_entire, 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_CK_aj_hotel.csr <- envelope(listings_aj_ppp_hotel, 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_CK_aj_private.csr <- envelope(listings_aj_ppp_private, 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_CK_aj_shared.csr <- envelope(listings_aj_ppp_shared, 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_CK_aj_entire.csr, main = "Entire home/apt")
plot(G_CK_aj_hotel.csr, main = "Hotel room")
plot(G_CK_aj_private.csr, main = "Private room")
plot(G_CK_aj_shared.csr, main = "Shared room")

Monte Carlo G-function findings:

  • Entire home/apt listings: Since estimated G(r) is above upper envelope, it is significant. We can reject H0 and conclude that there is clustering of entire home/apt listings in Aljunied subzone.
  • Hotel room listings: Where estimated G(r) is above the envelope (e.g. some parts between 40 to 110), it is significant and we conclude that there is clustering of hotel room listings in Aljunied. Where estimated G(r) is within the envelope (e.g. other parts of G(r)), it is not significant. We fail to reject H0 and conclude that the distribution of hotel room listings in Aljunied exhibits complete spatial randomness.
  • Private room listings: Where estimated G(r) is above the envelope (e.g. approx below 70), it is significant and we conclude that there is clustering of private room listings in Aljunied. Where estimated G(r) is within the envelope (e.g. other parts of G(r)), it is not significant. We fail to reject H0 and conclude that the distribution of hotel room listings in Aljunied exhibits complete spatial randomness.
  • Shared room listings: Since estimated G(r) is within the envelope, it is not significant. We fail to reject H0 and conclude that the distribution of shared room listings in Aljunied exhibits complete spatial randomness.

Balestier

G-function estimation
G_CK_bl_entire = Gest(listings_bl_ppp_entire, correction = "border")
G_CK_bl_hotel = Gest(listings_bl_ppp_hotel, correction = "border")
G_CK_bl_private = Gest(listings_bl_ppp_private, correction = "border")
# G_CK_bl_shared = Gest(listings_bl_ppp_shared, correction = "border")
par(mfrow=c(2,2))
plot(G_CK_bl_entire, main = "Entire home/apt")
plot(G_CK_bl_hotel, main = "Hotel room")
plot(G_CK_bl_private, main = "Private room")
# plot(G_CK_bl_shared, main = "Shared room")

Complete Spatial Randomness Test

Hypothesis to test:

(a) Entire home/apt

  • H0: The distribution of entire home/apt Airbnb listings in Balestier are randomly distributed.
  • H1: The distribution of entire home/apt Airbnb listings in Balestier are not randomly distributed.

(b) Hotel room

  • H0: The distribution of hotel room Airbnb listings in Balestier are randomly distributed.
  • H1: The distribution of hotel room Airbnb listings in Balestier are not randomly distributed.

(c) Private room

  • H0: The distribution of private room Airbnb listings in Balestier are randomly distributed.
  • H1: The distribution of private room Airbnb listings in Balestier are not randomly distributed.

(d) Shared room

  • H0: The distribution of shared room Airbnb listings in Balestier are randomly distributed.
  • H1: The distribution of shared room Airbnb listings in Balestier are not randomly distributed.

For all hypothesis generated, the confidence interval of 95% is used.

G_CK_bl_entire.csr <- envelope(listings_bl_ppp_entire, 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_CK_bl_hotel.csr <- envelope(listings_bl_ppp_hotel, 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_CK_bl_private.csr <- envelope(listings_bl_ppp_private, 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_CK_bl_shared.csr <- envelope(listings_bl_ppp_shared, Gest, nsim = 999)
par(mfrow=c(2,2))
plot(G_CK_bl_entire.csr, main = "Entire home/apt")
plot(G_CK_bl_hotel.csr, main = "Hotel room")
plot(G_CK_bl_private.csr, main = "Private room")
# plot(G_CK_bl_shared.csr, main = "Shared room")

Monte Carlo G-function findings:

  • Entire home/apt listings: Where estimated G(r) is above the envelope (e.g. approx above 5), it is significant and we conclude that there is clustering of entire home/apt listings in Balestier. Where estimated G(r) is within the envelope (e.g. other parts of G(r)), it is not significant. We fail to reject H0 and conclude that the distribution of hotel room listings in Balestier exhibits complete spatial randomness.
  • Hotel room listings: Where estimated G(r) is above the envelope (e.g. some parts between 75 and 80), it is significant and we conclude that there is clustering of hotel room listings in Balestier. Where estimated G(r) is within the envelope (e.g. other parts of G(r)), it is not significant. We fail to reject H0 and conclude that the distribution of hotel room listings in Balestier exhibits complete spatial randomness.
  • Private room listings: Where estimated G(r) is above the envelope (e.g. some parts above 25), it is significant and we conclude that there is clustering of private room listings in Balestier. Where estimated G(r) is within the envelope (e.g. other parts of G(r)), it is not significant. We fail to reject H0 and conclude that the distribution of private room listings in Balestier exhibits complete spatial randomness.
  • Shared room listings: Since estimated G(r) is within the envelope, it is not significant. We fail to reject H0 and conclude that the distribution of shared room listings in Balestier exhibits complete spatial randomness.

Lavender

G-function estimation
G_CK_lv_entire = Gest(listings_lv_ppp_entire, correction = "border")
G_CK_lv_hotel = Gest(listings_lv_ppp_hotel, correction = "border")
G_CK_lv_private = Gest(listings_lv_ppp_private, correction = "border")
G_CK_lv_shared = Gest(listings_lv_ppp_shared, correction = "border")
par(mfrow=c(2,2))
plot(G_CK_lv_entire, main = "Entire home/apt")
plot(G_CK_lv_hotel, main = "Hotel room")
plot(G_CK_lv_private, main = "Private room")
plot(G_CK_lv_shared, main = "Shared room")

Complete Spatial Randomness Test

Hypothesis to test:

(a) Entire home/apt

  • H0: The distribution of entire home/apt Airbnb listings in Lavender are randomly distributed.
  • H1: The distribution of entire home/apt Airbnb listings in Lavender are not randomly distributed.

(b) Hotel room

  • H0: The distribution of hotel room Airbnb listings in Lavender are randomly distributed.
  • H1: The distribution of hotel room Airbnb listings in Lavender are not randomly distributed.

(c) Private room

  • H0: The distribution of private room Airbnb listings in Lavender are randomly distributed.
  • H1: The distribution of private room Airbnb listings in Lavender are not randomly distributed.

(d) Shared room

  • H0: The distribution of shared room Airbnb listings in Lavender are randomly distributed.
  • H1: The distribution of shared room Airbnb listings in Lavender are not randomly distributed.

For all hypothesis generated, the confidence interval of 95% is used.

G_CK_lv_entire.csr <- envelope(listings_lv_ppp_entire, 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_CK_lv_hotel.csr <- envelope(listings_lv_ppp_hotel, 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_CK_lv_private.csr <- envelope(listings_lv_ppp_private, 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_CK_lv_shared.csr <- envelope(listings_lv_ppp_shared, 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_CK_lv_entire.csr, main = "Entire home/apt")
plot(G_CK_lv_hotel.csr, main = "Hotel room")
plot(G_CK_lv_private.csr, main = "Private room")
plot(G_CK_lv_shared.csr, main = "Shared room")

Monte Carlo G-function findings:

  • Entire home/apt listings: Where estimated G(r) is above the envelope (e.g. some parts between 20 to 35), it is significant and we conclude that there is clustering of entire home/apt listings in Lavender. Where estimated G(r) is within the envelope (e.g. other parts of G(r)), it is not significant. We fail to reject H0 and conclude that the distribution of entire home/apt listings in Lavender exhibits complete spatial randomness.
  • Hotel room listings: Where estimated G(r) is above the envelope (e.g. some parts between 10 to 15 and 55 to 60), it is significant and we conclude that there is clustering of hotel room listings in Lavender. Where estimated G(r) is within the envelope (e.g. other parts of G(r)), it is not significant. We fail to reject H0 and conclude that the distribution of hotel room listings in Lavender exhibits complete spatial randomness.
  • Private room listings: Where estimated G(r) is above the envelope (e.g. approx above 3), it is significant and we conclude that there is clustering of private room listings in Lavender. Where estimated G(r) is within the envelope (e.g. other parts of G(r)), it is not significant. We fail to reject H0 and conclude that the distribution of private room listings in Lavender exhibits complete spatial randomness.
  • Shared room listings: Where estimated G(r) is above the envelope (e.g. some parts between 25 to 50), it is significant and we conclude that there is clustering of shared room listings in Lavender. Where estimated G(r) is within the envelope (e.g. other parts of G(r)), it is not significant. We fail to reject H0 and conclude that the distribution of shared room listings in Lavender exhibits complete spatial randomness.

Tanjong Pagar

G-function estimation
G_CK_tp_entire = Gest(listings_tp_ppp_entire, correction = "border")
G_CK_tp_hotel = Gest(listings_tp_ppp_hotel, correction = "border")
G_CK_tp_private = Gest(listings_tp_ppp_private, correction = "border")
G_CK_tp_shared = Gest(listings_tp_ppp_shared, correction = "border")
par(mfrow=c(2,2))
plot(G_CK_tp_entire, main = "Entire home/apt")
plot(G_CK_tp_hotel, main = "Hotel room")
plot(G_CK_tp_private, main = "Private room")
plot(G_CK_tp_shared, main = "Shared room")

Complete Spatial Randomness Test

Hypothesis to test:

(a) Entire home/apt

  • H0: The distribution of entire home/apt Airbnb listings in Tanjong Pagar are randomly distributed.
  • H1: The distribution of entire home/apt Airbnb listings in Tanjong Pagar are not randomly distributed.

(b) Hotel room

  • H0: The distribution of hotel room Airbnb listings in Tanjong Pagar are randomly distributed.
  • H1: The distribution of hotel room Airbnb listings in Tanjong Pagar are not randomly distributed.

(c) Private room

  • H0: The distribution of private room Airbnb listings in Tanjong Pagar are randomly distributed.
  • H1: The distribution of private room Airbnb listings in Tanjong Pagar are not randomly distributed.

(d) Shared room

There are no shared room listings in Tanjong Pagar subzone.

For all hypothesis generated, the confidence interval of 95% is used.

G_CK_tp_entire.csr <- envelope(listings_tp_ppp_entire, 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_CK_tp_hotel.csr <- envelope(listings_tp_ppp_hotel, 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_CK_tp_private.csr <- envelope(listings_tp_ppp_private, 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_CK_tp_entire.csr, main = "Entire home/apt")
plot(G_CK_tp_hotel.csr, main = "Hotel room")
plot(G_CK_tp_private.csr, main = "Private room")

Monte Carlo G-function findings:

  • Entire home/apt listings: Where estimated G(r) is above the envelope (e.g. some parts between 10 to 15), it is significant and we conclude that there is clustering of entire home/apt listings in Tanjong Pagar. Where estimated G(r) is within the envelope (e.g. other parts of G(r)), it is not significant. We fail to reject H0 and conclude that the distribution of entire home/apt listings in Tanjong Pagar exhibits complete spatial randomness.
  • Hotel room listings: Since estimated G(r) is within the envelope, it is not significant. We fail to reject H0 and conclude that the distribution of hotel room listings in Tanjong Pagar exhibits complete spatial randomness.
  • Private room listings: Since estimated G(r) is within the envelope, it is not significant. We fail to reject H0 and conclude that the distribution of private room listings in Tanjong Pagar exhibits complete spatial randomness.

L-Function analysis

The L-function is the normalized version of the K-function. Similarly, the significance of the L-function can be found with respect to the envelope:

  • Significant: Estimated L(r) lies above or below the envelope
  • Not significant: Estimated L(r) lies within the envelope
Complete Spatial Randomness Test

Hypothesis to test:

(a) Entire home/apt

  • H0: The distribution of entire home/apt Airbnb listings in Aljunied are randomly distributed.
  • H1: The distribution of entire home/apt Airbnb listings in Aljunied are not randomly distributed.

(b) Hotel room

  • H0: The distribution of hotel room Airbnb listings in Aljunied are randomly distributed.
  • H1: The distribution of hotel room Airbnb listings in Aljunied are not randomly distributed.

(c) Private room

  • H0: The distribution of private room Airbnb listings in Aljunied are randomly distributed.
  • H1: The distribution of entire home/apt Airbnb listings in Aljunied are not randomly distributed.

(d) Shared room

  • H0: The distribution of entire home/apt Airbnb listings in Aljunied are randomly distributed.
  • H1: The distribution of entire home/apt Airbnb listings in Aljunied are not randomly distributed.

For all hypothesis generated, the confidence interval of 95% is used.

L_ck_aj_entire.csr <- envelope(listings_aj_ppp_entire, Lest, nsim = 99, rank = 1, glocal=TRUE)
## Generating 99 simulations of CSR  ...
## 1, 2,  [etd 3:57] 3,  [etd 3:40] 4,
##  [etd 3:40] 5,  [etd 3:45] 6,  [etd 3:49] 7,  [etd 3:41] 8,
##  [etd 3:40] 9,  [etd 3:53] 10,  [etd 3:49] 11,  [etd 3:46] 12,
##  [etd 3:44] 13,  [etd 3:40] 14,  [etd 3:38] 15,  [etd 3:33] 16,
##  [etd 3:30] 17,  [etd 3:29] 18,  [etd 3:25] 19,  [etd 3:25] 20,
##  [etd 3:23] 21,  [etd 3:21] 22,  [etd 3:18] 23,  [etd 3:14] 24,
##  [etd 3:11] 25,  [etd 3:07] 26,  [etd 3:04] 27,  [etd 2:57] 28,
##  [etd 2:50] 29,  [etd 2:44] 30,  [etd 2:37] 31,  [etd 2:31] 32,
##  [etd 2:25] 33,  [etd 2:20] 34,  [etd 2:15] 35,  [etd 2:11] 36,
##  [etd 2:07] 37,  [etd 2:03] 38,  [etd 1:59] 39,  [etd 1:56] 40,
##  [etd 1:53] 41,  [etd 1:49] 42,  [etd 1:46] 43,  [etd 1:43] 44,
##  [etd 1:40] 45,  [etd 1:37] 46,  [etd 1:34] 47,  [etd 1:32] 48,
##  [etd 1:29] 49,  [etd 1:26] 50,  [etd 1:24] 51,  [etd 1:22] 52,
##  [etd 1:20] 53,  [etd 1:17] 54,  [etd 1:15] 55,  [etd 1:13] 56,
##  [etd 1:10] 57,  [etd 1:08] 58,  [etd 1:06] 59,  [etd 1:04] 60,
##  [etd 1:02] 61,  [etd 1:00] 62,  [etd 58 sec] 63,  [etd 56 sec] 64,
##  [etd 54 sec] 65,  [etd 52 sec] 66,  [etd 50 sec] 67,  [etd 49 sec] 68,
##  [etd 47 sec] 69,  [etd 45 sec] 70,  [etd 44 sec] 71,  [etd 42 sec] 72,
##  [etd 40 sec] 73,  [etd 39 sec] 74,  [etd 37 sec] 75,  [etd 35 sec] 76,
##  [etd 34 sec] 77,  [etd 32 sec] 78,  [etd 30 sec] 79,  [etd 29 sec] 80,
##  [etd 27 sec] 81,  [etd 26 sec] 82,  [etd 24 sec] 83,  [etd 23 sec] 84,
##  [etd 21 sec] 85,  [etd 20 sec] 86,  [etd 18 sec] 87,  [etd 17 sec] 88,
##  [etd 15 sec] 89,  [etd 14 sec] 90,  [etd 12 sec] 91,  [etd 11 sec] 92,
##  [etd 10 sec] 93,  [etd 8 sec] 94,  [etd 7 sec] 95,  [etd 5 sec] 96,
##  [etd 4 sec] 97,  [etd 3 sec] 98,  [etd 1 sec]  99.
## 
## Done.
L_ck_aj_hotel.csr <- envelope(listings_aj_ppp_hotel, Lest, nsim = 99, rank = 1, glocal=TRUE)
## Generating 99 simulations of CSR  ...
## 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.
## 
## Done.
L_ck_aj_private.csr <- envelope(listings_aj_ppp_private, Lest, nsim = 99, rank = 1, glocal=TRUE)
## Generating 99 simulations of CSR  ...
## 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.
## 
## Done.
L_ck_aj_shared.csr <- envelope(listings_aj_ppp_shared, Lest, nsim = 99, rank = 1, glocal=TRUE)
## Generating 99 simulations of CSR  ...
## 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.
## 
## Done.
par(mfrow=c(2,2))
plot(L_ck_aj_entire.csr, . - r ~ r,
     xlab="d", ylab="L(d)-r", main = "Entire home/apt")
plot(L_ck_aj_hotel.csr, . - r ~ r,
     xlab="d", ylab="L(d)-r", main = "Hotel room")
plot(L_ck_aj_private.csr, . - r ~ r,
     xlab="d", ylab="L(d)-r", main = "Private room")
plot(L_ck_aj_shared.csr, . - r ~ r,
     xlab="d", ylab="L(d)-r", main = "Shared room")

Monte Carlo L-function findings:

  • Entire home/apt listings: Since estimated L(r) is above the envelope, it is significant and we conclude that there is clustering of entire home/apt listings in Aljunied. This Monte Carlo test using the L-function confirms the analysis in the G-function test and we reject H0 to conclude that there is signs of clustering.
  • Hotel room listings: Where estimated L(r) is above the envelope (e.g. most parts above 50), it is significant and we conclude that there is clustering of hotel room listings in Aljunied. Where estimated L(r) is within the envelope (e.g. other parts of L(r)), it is not significant. We fail to reject H0 and conclude that the distribution of hotel room listings in Aljunied exhibits complete spatial randomness. This Monte Carlo test using the L-function confirms the analysis in the G-function test and we reject H0 only for certain distances to conclude that there is some signs of clustering.
  • Private room listings: Since estimated L(r) is above the envelope, it is significant and we conclude that there is clustering of private home listings in Aljunied. This Monte Carlo test using the L-function confirms the analysis in the G-function test and we reject H0 to conclude that there is signs of clustering.
  • Shared room listings: Since estimated L(r) is within the envelope, it is not significant. We fail to reject H0 and conclude that the distribution of shared room listings in Aljunied exhbits complete spatial randomness. This Monte Carlo test using the L-function confirms the analysis in the G-function test and we fail to reject H0 to conclude that there is complete spatial randomness.

Balestier

L-function estimation
L_ck_bl_entire = Lest(listings_bl_ppp_entire, correction = "Ripley")
L_ck_bl_hotel = Lest(listings_bl_ppp_hotel, correction = "Ripley")
L_ck_bl_private = Lest(listings_bl_ppp_private, correction = "Ripley")
L_ck_bl_shared = Lest(listings_bl_ppp_shared, correction = "Ripley")
par(mfrow=c(2,2))
plot(L_ck_bl_entire, . -r ~ r, 
     ylab= "L(d)-r", xlab = "d(m)", main = "Entire home/apt")
plot(L_ck_bl_hotel, . -r ~ r, 
     ylab= "L(d)-r", xlab = "d(m)", main = "Hotel room")
plot(L_ck_bl_private, . -r ~ r, 
     ylab= "L(d)-r", xlab = "d(m)", main = "Private room")
plot(L_ck_bl_shared, . -r ~ r, 
     ylab= "L(d)-r", xlab = "d(m)", main = "Shared room")

Complete Spatial Randomness Test

Hypothesis to test:

(a) Entire home/apt

  • H0: The distribution of entire home/apt Airbnb listings in Balestier are randomly distributed.
  • H1: The distribution of entire home/apt Airbnb listings in Balestier are not randomly distributed.

(b) Hotel room

  • H0: The distribution of hotel room Airbnb listings in Balestier are randomly distributed.
  • H1: The distribution of hotel room Airbnb listings in Balestier are not randomly distributed.

(c) Private room

  • H0: The distribution of private room Airbnb listings in Balestier are randomly distributed.
  • H1: The distribution of private room Airbnb listings in Balestier are not randomly distributed.

(d) Shared room

  • H0: The distribution of shared room Airbnb listings in Balestier are randomly distributed.
  • H1: The distribution of shared room Airbnb listings in Balestier are not randomly distributed.

For all hypothesis generated, the confidence interval of 95% is used.

L_ck_bl_entire.csr <- envelope(listings_bl_ppp_entire, Lest, nsim = 99, rank = 1, glocal=TRUE)
## Generating 99 simulations of CSR  ...
## 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.
## 
## Done.
L_ck_bl_hotel.csr <- envelope(listings_bl_ppp_hotel, Lest, nsim = 99, rank = 1, glocal=TRUE)
## Generating 99 simulations of CSR  ...
## 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.
## 
## Done.
L_ck_bl_private.csr <- envelope(listings_bl_ppp_private, Lest, nsim = 99, rank = 1, glocal=TRUE)
## Generating 99 simulations of CSR  ...
## 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.
## 
## Done.
L_ck_bl_shared.csr <- envelope(listings_bl_ppp_shared, Lest, nsim = 99, rank = 1, glocal=TRUE)
## Generating 99 simulations of CSR  ...
## 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.
## 
## Done.
par(mfrow=c(2,2))
plot(L_ck_bl_entire.csr, . - r ~ r,
     xlab="d", ylab="L(d)-r", main = "Entire home/apt")
plot(L_ck_bl_hotel.csr, . - r ~ r,
     xlab="d", ylab="L(d)-r", main = "Hotel room")
plot(L_ck_bl_private.csr, . - r ~ r,
     xlab="d", ylab="L(d)-r", main = "Private room")
plot(L_ck_bl_shared.csr, . - r ~ r,
     xlab="d", ylab="L(d)-r", main = "Shared room")

Monte Carlo L-function findings:

  • Entire home/apt listings: Since estimated L(r) is above the envelope, it is significant and we conclude that there is clustering of entire home/apt listings in Balestier. This Monte Carlo test using the L-function is contrary to the analysis in the G-function test and we fail to reject H0 to conclude that there is complete spatial randomness.
  • Hotel room listings: Where estimated L(r) is above the envelope (e.g. approx above 55), it is significant and we conclude that there is clustering of hotel room listings in Balestier. Where estimated L(r) is within the envelope (e.g. other parts of L(r)), it is not significant. We fail to reject H0 and conclude that the distribution of hotel room listings in Balestier exhibits complete spatial randomness. This Monte Carlo test using the L-function confirms the analysis in the G-function test and we reject H0 only for short distances to conclude that there is some signs of clustering.
  • Private room listings: Where estimated L(r) is above the envelope (e.g. approx above 45), it is significant and we conclude that there is clustering of private room listings in Balestier. Where estimated L(r) is within the envelope (e.g. other parts of L(r)), it is not significant. We fail to reject H0 and conclude that the distribution of private room listings in Balestier exhibits complete spatial randomness. This Monte Carlo test using the L-function confirms the analysis in the G-function test and we reject H0 only for short distances to conclude that there is some signs of clustering.

Lavender

L-function estimation
L_ck_lv_entire = Lest(listings_lv_ppp_entire, correction = "Ripley")
L_ck_lv_hotel = Lest(listings_lv_ppp_hotel, correction = "Ripley")
L_ck_lv_private = Lest(listings_lv_ppp_private, correction = "Ripley")
L_ck_lv_shared = Lest(listings_lv_ppp_shared, correction = "Ripley")
par(mfrow=c(2,2))
plot(L_ck_lv_entire, . -r ~ r, 
     ylab= "L(d)-r", xlab = "d(m)", main = "Entire home/apt")
plot(L_ck_lv_hotel, . -r ~ r, 
     ylab= "L(d)-r", xlab = "d(m)", main = "Hotel room")
plot(L_ck_lv_private, . -r ~ r, 
     ylab= "L(d)-r", xlab = "d(m)", main = "Private room")
plot(L_ck_lv_shared, . -r ~ r, 
     ylab= "L(d)-r", xlab = "d(m)", main = "Shared room")

Complete Spatial Randomness Test

Hypothesis to test:

(a) Entire home/apt

  • H0: The distribution of entire home/apt Airbnb listings in Lavender are randomly distributed.
  • H1: The distribution of entire home/apt Airbnb listings in Lavender are not randomly distributed.

(b) Hotel room

  • H0: The distribution of hotel room Airbnb listings in Lavender are randomly distributed.
  • H1: The distribution of hotel room Airbnb listings in Lavender are not randomly distributed.

(c) Private room

  • H0: The distribution of private room Airbnb listings in Lavender are randomly distributed.
  • H1: The distribution of private room Airbnb listings in Lavender are not randomly distributed.

(d) Shared room

  • H0: The distribution of shared room Airbnb listings in Lavender are randomly distributed.
  • H1: The distribution of shared room Airbnb listings in Lavender are not randomly distributed.

For all hypothesis generated, the confidence interval of 95% is used.

L_ck_lv_entire.csr <- envelope(listings_lv_ppp_entire, Lest, nsim = 99, rank = 1, glocal=TRUE)
## Generating 99 simulations of CSR  ...
## 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.
## 
## Done.
L_ck_lv_hotel.csr <- envelope(listings_lv_ppp_hotel, Lest, nsim = 99, rank = 1, glocal=TRUE)
## Generating 99 simulations of CSR  ...
## 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.
## 
## Done.
L_ck_lv_private.csr <- envelope(listings_lv_ppp_private, Lest, nsim = 99, rank = 1, glocal=TRUE)
## Generating 99 simulations of CSR  ...
## 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.
## 
## Done.
L_ck_lv_shared.csr <- envelope(listings_lv_ppp_shared, Lest, nsim = 99, rank = 1, glocal=TRUE)
## Generating 99 simulations of CSR  ...
## 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.
## 
## Done.
par(mfrow=c(2,2))
plot(L_ck_lv_entire.csr, . - r ~ r,
     xlab="d", ylab="L(d)-r", main = "Entire home/apt")
plot(L_ck_lv_hotel.csr, . - r ~ r,
     xlab="d", ylab="L(d)-r", main = "Hotel room")
plot(L_ck_lv_private.csr, . - r ~ r,
     xlab="d", ylab="L(d)-r", main = "Private room")
plot(L_ck_lv_shared.csr, . - r ~ r,
     xlab="d", ylab="L(d)-r", main = "Shared room")

Monte Carlo L-function findings:

  • Entire home/apt listings: Where estimated L(r) is above the envelope (e.g. approx above 20), it is significant and we conclude that there is clustering of entire home/apt listings in Lavender. Where estimated L(r) is within the envelope (e.g. other parts of L(r)), it is not significant. We fail to reject H0 and conclude that the distribution of entire home/apt listings in Lavender exhibits complete spatial randomness. This Monte Carlo test using the L-function confirms the analysis in the G-function test and we reject H0 only for certain distances to conclude that there is some signs of clustering.
  • Hotel room listings: Where estimated L(r) is above the envelope (e.g. approx above 20), it is significant and we conclude that there is clustering of hotel room listings in Lavender. Where estimated L(r) is within the envelope (e.g. other parts of L(r)), it is not significant. We fail to reject H0 and conclude that the distribution of hotel room listings in Lavender exhibits complete spatial randomness. This Monte Carlo test using the L-function is contrary to the analysis in the G-function test and we fail to reject H0 to conclude that there is complete spatial randomness.
  • Private room listings: Since estimated L(r) is above the envelope, it is significant and we conclude that there is clustering of private room listings in Lavender. This Monte Carlo test using the L-function is contrary to the analysis in the G-function test and we fail reject H0 to conclude that there is complete spatial randomness.
  • Shared room listings: Where estimated L(r) is above the envelope (e.g. approx above 25), it is significant and we conclude that there is clustering of shared room listings in Lavender. Where estimated L(r) is within the envelope (e.g. other parts of L(r)), it is not significant. We fail to reject H0 and conclude that the distribution of shared room listings in Lavender exhibits complete spatial randomness. This Monte Carlo test using the L-function is contrary to the analysis in the G-function test and we fail to reject H0 to conclude that there is complete spatial randomness.

Tanjong Pagar

L-function estimation
L_ck_tp_entire = Lest(listings_tp_ppp_entire, correction = "Ripley")
L_ck_tp_hotel = Lest(listings_tp_ppp_hotel, correction = "Ripley")
L_ck_tp_private = Lest(listings_tp_ppp_private, correction = "Ripley")
par(mfrow=c(2,2))
plot(L_ck_tp_entire, . -r ~ r, 
     ylab= "L(d)-r", xlab = "d(m)", main = "Entire home/apt")
plot(L_ck_tp_hotel, . -r ~ r, 
     ylab= "L(d)-r", xlab = "d(m)", main = "Hotel room")
plot(L_ck_tp_private, . -r ~ r, 
     ylab= "L(d)-r", xlab = "d(m)", main = "Private room")

Complete Spatial Randomness Test

Hypothesis to test:

(a) Entire home/apt

  • H0: The distribution of entire home/apt Airbnb listings in Tanjong Pagar are randomly distributed.
  • H1: The distribution of entire home/apt Airbnb listings in Tanjong Pagar are not randomly distributed.

(b) Hotel room

  • H0: The distribution of hotel room Airbnb listings in Tanjong Pagar are randomly distributed.
  • H1: The distribution of hotel room Airbnb listings in Tanjong Pagar are not randomly distributed.

(c) Private room

  • H0: The distribution of private room Airbnb listings in Tanjong Pagar are randomly distributed.
  • H1: The distribution of private room Airbnb listings in Tanjong Pagar are not randomly distributed.

(d) Shared room

There is no shared room listings in Tanjong Pagar.

For all hypothesis generated, the confidence interval of 95% is used.

L_ck_tp_entire.csr <- envelope(listings_tp_ppp_entire, Lest, nsim = 99, rank = 1, glocal=TRUE)
## Generating 99 simulations of CSR  ...
## 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.
## 
## Done.
L_ck_tp_hotel.csr <- envelope(listings_tp_ppp_hotel, Lest, nsim = 99, rank = 1, glocal=TRUE)
## Generating 99 simulations of CSR  ...
## 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.
## 
## Done.
L_ck_tp_private.csr <- envelope(listings_tp_ppp_private, Lest, nsim = 99, rank = 1, glocal=TRUE)
## Generating 99 simulations of CSR  ...
## 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.
## 
## Done.
par(mfrow=c(2,2))
plot(L_ck_tp_entire.csr, . - r ~ r,
     xlab="d", ylab="L(d)-r", main = "Entire home/apt")
plot(L_ck_tp_hotel.csr, . - r ~ r,
     xlab="d", ylab="L(d)-r", main = "Hotel room")
plot(L_ck_tp_private.csr, . - r ~ r,
     xlab="d", ylab="L(d)-r", main = "Private room")

Monte Carlo L-function findings:

  • Entire home/apt listings: Where estimated L(r) is above the envelope (e.g. approx above 5), it is significant and we conclude that there is clustering of entire home/apt listings in Lavender. Where estimated L(r) is within the envelope (e.g. other parts of L(r)), it is not significant. We fail to reject H0 and conclude that the distribution of entire home/apt listings in Lavender exhibits complete spatial randomness. This Monte Carlo test using the L-function confirms the analysis in the G-function test and we reject H0 only for certain distances to conclude that there is some signs of clustering.
  • Hotel room listings: As there are only two listings, clustering pattern depends on the distance used in the density estimation. Since estimated L(r) is below theoretical L(r), it is significant and we conclude that there is clustering of hotel room listings in Tanjong Pagar. However, more listing points are needed to confirm the analysis with the L-function test.
  • Private room listings: Where estimated L(r) is above the envelope (e.g. approx above 105), it is significant and we conclude that there is clustering of private room listings in Tanjong Pagar. Where estimated L(r) is within the envelope (e.g. other parts of L(r)), it is not significant. We fail to reject H0 and conclude that the distribution of private room listings in Tanjong Pagar exhibits complete spatial randomness. This Monte Carlo test using the L-function is contrary to the analysis in the G-function test and we fail to reject H0 to conclude that there is complete spatial randomness.

Kernel density estimation

Aljunied

Rescale to convert unit of measurement from m to km
listings_aj_ppp_entire.km <- rescale(listings_aj_ppp_entire, 1000, "km")
listings_aj_ppp_hotel.km <- rescale(listings_aj_ppp_hotel, 1000, "km")
listings_aj_ppp_private.km <- rescale(listings_aj_ppp_private, 1000, "km")
listings_aj_ppp_shared.km <- rescale(listings_aj_ppp_shared, 1000, "km")
Compute kernel density estimation by defining bandwidth manually
kde_listings_sg_bw_aj_entire.km <- density(listings_aj_ppp_entire.km, sigma=0.5, edge=TRUE, kernel="gaussian")
kde_listings_sg_bw_aj_hotel.km <- density(listings_aj_ppp_hotel.km, sigma=0.5, edge=TRUE, kernel="gaussian")
kde_listings_sg_bw_aj_private.km <- density(listings_aj_ppp_private.km, sigma=0.5, edge=TRUE, kernel="gaussian")
kde_listings_sg_bw_aj_shared.km <- density(listings_aj_ppp_shared.km, sigma=0.5, edge=TRUE, kernel="gaussian")
par(mfrow=c(2,2))
plot(kde_listings_sg_bw_aj_entire.km, main = "Entire home/apt")
contour(kde_listings_sg_bw_aj_entire.km, add=TRUE)
plot(kde_listings_sg_bw_aj_hotel.km, main = "Hotel room")
contour(kde_listings_sg_bw_aj_hotel.km, add=TRUE)
plot(kde_listings_sg_bw_aj_private.km, main = "Private room")
contour(kde_listings_sg_bw_aj_private.km, add=TRUE)
plot(kde_listings_sg_bw_aj_shared.km, main = "Shared room")
contour(kde_listings_sg_bw_aj_shared.km, add=TRUE)

Balestier

Rescale to convert unit of measurement from m to km
listings_bl_ppp_entire.km <- rescale(listings_bl_ppp_entire, 1000, "km")
listings_bl_ppp_hotel.km <- rescale(listings_bl_ppp_hotel, 1000, "km")
listings_bl_ppp_private.km <- rescale(listings_bl_ppp_private, 1000, "km")
# listings_bl_ppp_shared.km <- rescale(listings_bl_ppp_shared, 1000, "km")
Compute kernel density estimation by defining bandwidth manually
kde_listings_sg_bw_bl_entire.km <- density(listings_bl_ppp_entire.km, sigma=0.25, edge=TRUE, kernel="gaussian")
kde_listings_sg_bw_bl_hotel.km <- density(listings_bl_ppp_hotel.km, sigma=0.25, edge=TRUE, kernel="gaussian")
kde_listings_sg_bw_bl_private.km <- density(listings_bl_ppp_private.km, sigma=0.25, edge=TRUE, kernel="gaussian")
# kde_listings_sg_bw_bl_shared.km <- density(listings_bl_ppp_shared.km, sigma=0.25, edge=TRUE, kernel="gaussian")
par(mfrow=c(2,2))
plot(kde_listings_sg_bw_bl_entire.km, main = "Entire home/apt")
contour(kde_listings_sg_bw_bl_entire.km, add=TRUE)
plot(kde_listings_sg_bw_bl_hotel.km, main = "Hotel room")
contour(kde_listings_sg_bw_bl_hotel.km, add=TRUE)
plot(kde_listings_sg_bw_bl_private.km, main = "Private room")
contour(kde_listings_sg_bw_bl_private.km, add=TRUE)

Lavender

Rescale to convert unit of measurement from m to km
listings_lv_ppp_entire.km <- rescale(listings_lv_ppp_entire, 1000, "km")
listings_lv_ppp_hotel.km <- rescale(listings_lv_ppp_hotel, 1000, "km")
listings_lv_ppp_private.km <- rescale(listings_lv_ppp_private, 1000, "km")
listings_lv_ppp_shared.km <- rescale(listings_lv_ppp_shared, 1000, "km")
Compute kernel density estimation by defining bandwidth manually
kde_listings_sg_bw_lv_entire.km <- density(listings_lv_ppp_entire.km, sigma=0.25, edge=TRUE, kernel="gaussian")
kde_listings_sg_bw_lv_hotel.km <- density(listings_lv_ppp_hotel.km, sigma=0.25, edge=TRUE, kernel="gaussian")
kde_listings_sg_bw_lv_private.km <- density(listings_lv_ppp_private.km, sigma=0.25, edge=TRUE, kernel="gaussian")
kde_listings_sg_bw_lv_shared.km <- density(listings_lv_ppp_shared.km, sigma=0.25, edge=TRUE, kernel="gaussian")
par(mfrow=c(2,2))
plot(kde_listings_sg_bw_lv_entire.km, main = "Entire home/apt")
contour(kde_listings_sg_bw_lv_entire.km, add=TRUE)
plot(kde_listings_sg_bw_lv_hotel.km, main = "Hotel room")
contour(kde_listings_sg_bw_lv_hotel.km, add=TRUE)
plot(kde_listings_sg_bw_lv_private.km, main = "Private room")
contour(kde_listings_sg_bw_lv_private.km, add=TRUE)
plot(kde_listings_sg_bw_lv_shared.km, main = "Shared room")
contour(kde_listings_sg_bw_lv_shared.km, add=TRUE)

Tanjong Pagar

Rescale to convert unit of measurement from m to km
listings_tp_ppp_entire.km <- rescale(listings_tp_ppp_entire, 1000, "km")
listings_tp_ppp_hotel.km <- rescale(listings_tp_ppp_hotel, 1000, "km")
listings_tp_ppp_private.km <- rescale(listings_tp_ppp_private, 1000, "km")
# listings_tp_ppp_shared.km <- rescale(listings_tp_ppp_shared, 1000, "km")
Compute kernel density estimation by defining bandwidth manually
kde_listings_sg_bw_tp_entire.km <- density(listings_tp_ppp_entire.km, sigma=0.25, edge=TRUE, kernel="gaussian")
kde_listings_sg_bw_tp_hotel.km <- density(listings_tp_ppp_hotel.km, sigma=0.25, edge=TRUE, kernel="gaussian")
kde_listings_sg_bw_tp_private.km <- density(listings_tp_ppp_private.km, sigma=0.25, edge=TRUE, kernel="gaussian")
# kde_listings_sg_bw_tp_shared.km <- density(listings_tp_ppp_shared.km, sigma=0.25, edge=TRUE, kernel="gaussian")
par(mfrow=c(2,2))
plot(kde_listings_sg_bw_tp_entire.km, main = "Entire home/apt")
contour(kde_listings_sg_bw_tp_entire.km, add=TRUE)
plot(kde_listings_sg_bw_tp_hotel.km, main = "Hotel room")
contour(kde_listings_sg_bw_tp_hotel.km, add=TRUE)
plot(kde_listings_sg_bw_tp_private.km, main = "Private room")
contour(kde_listings_sg_bw_tp_private.km, add=TRUE)

Convert KDE output to grid object

gridded_kde_listingsSG_aj_entire_bw <- as.SpatialGridDataFrame.im(kde_listings_sg_bw_aj_entire.km)
gridded_kde_listingsSG_aj_hotel_bw <- as.SpatialGridDataFrame.im(kde_listings_sg_bw_aj_hotel.km)
gridded_kde_listingsSG_aj_private_bw <- as.SpatialGridDataFrame.im(kde_listings_sg_bw_aj_private.km)
gridded_kde_listingsSG_aj_shared_bw <- as.SpatialGridDataFrame.im(kde_listings_sg_bw_aj_shared.km)

gridded_kde_listingsSG_bl_entire_bw <- as.SpatialGridDataFrame.im(kde_listings_sg_bw_bl_entire.km)
gridded_kde_listingsSG_bl_hotel_bw <- as.SpatialGridDataFrame.im(kde_listings_sg_bw_bl_hotel.km)
gridded_kde_listingsSG_bl_private_bw <- as.SpatialGridDataFrame.im(kde_listings_sg_bw_bl_private.km)
# gridded_kde_listingsSG_bl_shared_bw <- as.SpatialGridDataFrame.im(kde_listings_sg_bw_bl_shared.km)

gridded_kde_listingsSG_lv_entire_bw <- as.SpatialGridDataFrame.im(kde_listings_sg_bw_lv_entire.km)
gridded_kde_listingsSG_lv_hotel_bw <- as.SpatialGridDataFrame.im(kde_listings_sg_bw_lv_hotel.km)
gridded_kde_listingsSG_lv_private_bw <- as.SpatialGridDataFrame.im(kde_listings_sg_bw_lv_private.km)
gridded_kde_listingsSG_lv_shared_bw <- as.SpatialGridDataFrame.im(kde_listings_sg_bw_lv_shared.km)

gridded_kde_listingsSG_tp_entire_bw <- as.SpatialGridDataFrame.im(kde_listings_sg_bw_tp_entire.km)
gridded_kde_listingsSG_tp_hotel_bw <- as.SpatialGridDataFrame.im(kde_listings_sg_bw_tp_hotel.km)
gridded_kde_listingsSG_tp_private_bw <- as.SpatialGridDataFrame.im(kde_listings_sg_bw_tp_private.km)
# gridded_kde_listingsSG_tp_shared_bw <- as.SpatialGridDataFrame.im(kde_listings_sg_bw_tp_shared.km)

Convert gridded output into raster

kde_listingsSG_aj_entire_bw_raster <- raster(gridded_kde_listingsSG_aj_entire_bw)
kde_listingsSG_aj_hotel_bw_raster <- raster(gridded_kde_listingsSG_aj_hotel_bw)
kde_listingsSG_aj_private_bw_raster <- raster(gridded_kde_listingsSG_aj_private_bw)
kde_listingsSG_aj_shared_bw_raster <- raster(gridded_kde_listingsSG_aj_shared_bw)

kde_listingsSG_bl_entire_bw_raster <- raster(gridded_kde_listingsSG_bl_entire_bw)
kde_listingsSG_bl_hotel_bw_raster <- raster(gridded_kde_listingsSG_bl_hotel_bw)
kde_listingsSG_bl_private_bw_raster <- raster(gridded_kde_listingsSG_bl_private_bw)
# kde_listingsSG_bl_shared_bw_raster <- raster(gridded_kde_listingsSG_bl_shared_bw)

kde_listingsSG_lv_entire_bw_raster <- raster(gridded_kde_listingsSG_lv_entire_bw)
kde_listingsSG_lv_hotel_bw_raster <- raster(gridded_kde_listingsSG_lv_hotel_bw)
kde_listingsSG_lv_private_bw_raster <- raster(gridded_kde_listingsSG_lv_private_bw)
kde_listingsSG_lv_shared_bw_raster <- raster(gridded_kde_listingsSG_lv_shared_bw)

kde_listingsSG_tp_entire_bw_raster <- raster(gridded_kde_listingsSG_tp_entire_bw)
kde_listingsSG_tp_hotel_bw_raster <- raster(gridded_kde_listingsSG_tp_hotel_bw)
kde_listingsSG_tp_private_bw_raster <- raster(gridded_kde_listingsSG_tp_private_bw)
# kde_listingsSG_tp_shared_bw_raster <- raster(gridded_kde_listingsSG_tp_shared_bw)

Assign projection system

projection(kde_listingsSG_aj_entire_bw_raster) <- CRS("+init=EPSG:3414")
projection(kde_listingsSG_aj_hotel_bw_raster) <- CRS("+init=EPSG:3414")
projection(kde_listingsSG_aj_private_bw_raster) <- CRS("+init=EPSG:3414")
projection(kde_listingsSG_aj_shared_bw_raster) <- CRS("+init=EPSG:3414")

projection(kde_listingsSG_bl_entire_bw_raster) <- CRS("+init=EPSG:3414")
projection(kde_listingsSG_bl_hotel_bw_raster) <- CRS("+init=EPSG:3414")
projection(kde_listingsSG_bl_private_bw_raster) <- CRS("+init=EPSG:3414")
# projection(kde_listingsSG_bl_shared_bw_raster) <- CRS("+init=EPSG:3414")

projection(kde_listingsSG_lv_entire_bw_raster) <- CRS("+init=EPSG:3414")
projection(kde_listingsSG_lv_hotel_bw_raster) <- CRS("+init=EPSG:3414")
projection(kde_listingsSG_lv_private_bw_raster) <- CRS("+init=EPSG:3414")
projection(kde_listingsSG_lv_shared_bw_raster) <- CRS("+init=EPSG:3414")

projection(kde_listingsSG_tp_entire_bw_raster) <- CRS("+init=EPSG:3414")
projection(kde_listingsSG_tp_hotel_bw_raster) <- CRS("+init=EPSG:3414")
projection(kde_listingsSG_tp_private_bw_raster) <- CRS("+init=EPSG:3414")
# projection(kde_listingsSG_tp_shared_bw_raster) <- CRS("+init=EPSG:3414")

Visualize output in tmap

Aljunied
kde_entire.map <- tm_shape(kde_listingsSG_aj_entire_bw_raster) + 
  tm_raster("v", title="Entire home/apt") +
  tm_layout(legend.outside=TRUE, frame = FALSE)

kde_hotel.map <- tm_shape(kde_listingsSG_aj_hotel_bw_raster) + 
  tm_raster("v", title="Hotel room") +
  tm_layout(legend.outside=TRUE, frame = FALSE)

kde_private.map <- tm_shape(kde_listingsSG_aj_private_bw_raster) + 
  tm_raster("v", title="Private room") +
  tm_layout(legend.outside=TRUE, frame = FALSE)

kde_shared.map <- tm_shape(kde_listingsSG_aj_shared_bw_raster) + 
  tm_raster("v", title="Shared room") +
  tm_layout(legend.outside=TRUE, frame = FALSE) 

tmap_arrange(kde_entire.map, kde_hotel.map, kde_private.map, kde_shared.map,
             asp=1, ncol=2, nrow=2)

KDE analysis:

  • It is important to take note of the differences in scale despite using the same bandwidth of 500m.
  • Entire home/apt: There is clustering in two main locations around the longitudinal axis of Aljunied subzone. Similar to the EDA, it could be due to the rental of shophouses along Geylang Road.
  • Hotel room: There is clustering towards the western region of Aljunied subzone, along the longitudinal axis as well.
  • Private room: There is clustering in the central area of Aljunied subzone. Similar to the EDA, it could be due to the rental of shophouses along Geylang Road.
  • Shared room: Though there are few shared room listings in Aljunied, it clusters in the Eastern region of Aljunied.
Balestier
kde_entire.map <- tm_shape(kde_listingsSG_bl_entire_bw_raster) + 
  tm_raster("v", title="Entire home/apt") +
  tm_layout(legend.outside=TRUE, frame = FALSE)

kde_hotel.map <- tm_shape(kde_listingsSG_bl_hotel_bw_raster) + 
  tm_raster("v", title="Hotel room") +
  tm_layout(legend.outside=TRUE, frame = FALSE)

kde_private.map <- tm_shape(kde_listingsSG_bl_private_bw_raster) + 
  tm_raster("v", title="Private room") +
  tm_layout(legend.outside=TRUE, frame = FALSE)

tmap_arrange(kde_entire.map, kde_hotel.map, kde_private.map,
             asp=1, ncol=2, nrow=2)

KDE analysis:

  • It is important to take note of the differences in scale despite using the same bandwidth of 500m.
  • Entire home/apt: There is clustering in the southern central area of Balestier subzone, stretching towards the north. Similar to the EDA, it could be due to the presence of HDB flats in the area.
  • Hotel room: There is clustering towards the southern region of Balestier subzone. The hotels tend to be located in this part of Balestier
  • Private room: There is clustering in the southern central area of Balestier subzone. Similar to the EDA, it could be due to the presence of HDB flats in the area.
Lavender
kde_entire.map <- tm_shape(kde_listingsSG_lv_entire_bw_raster) + 
  tm_raster("v", title="Entire home/apt") +
  tm_layout(legend.outside=TRUE, frame = FALSE)

kde_hotel.map <- tm_shape(kde_listingsSG_lv_hotel_bw_raster) + 
  tm_raster("v", title="Hotel room") +
  tm_layout(legend.outside=TRUE, frame = FALSE)

kde_private.map <- tm_shape(kde_listingsSG_lv_private_bw_raster) + 
  tm_raster("v", title="Private room") +
  tm_layout(legend.outside=TRUE, frame = FALSE)

kde_shared.map <- tm_shape(kde_listingsSG_lv_shared_bw_raster) + 
  tm_raster("v", title="Shared room") +
  tm_layout(legend.outside=TRUE, frame = FALSE) 

tmap_arrange(kde_entire.map, kde_hotel.map, kde_private.map, kde_shared.map,
             asp=1, ncol=2, nrow=2)

KDE analysis:

  • It is important to take note of the differences in scale despite using the same bandwidth of 500m.
  • Entire home/apt: There is clustering in the northern region of Lavender subzone. This could be due to the proximity of facilities such as the MRT station.
  • Hotel room: There is clustering towards the northern region of Lavender subzone. This could be due to the proximity of facilities such as the MRT station.
  • Private room: There is clustering in the southern east area of Lavender subzone. Similar to the EDA, it could be due to the presence of HDB flats in the region.
  • Shared room: There is clustering towards the northern region of Lavender subzone.
Tanjong Pagar
kde_entire.map <- tm_shape(kde_listingsSG_tp_entire_bw_raster) + 
  tm_raster("v", title="Entire home/apt") +
  tm_layout(legend.outside=TRUE, frame = FALSE)

kde_hotel.map <- tm_shape(kde_listingsSG_tp_hotel_bw_raster) + 
  tm_raster("v", title="Hotel room") +
  tm_layout(legend.outside=TRUE, frame = FALSE)

kde_private.map <- tm_shape(kde_listingsSG_tp_private_bw_raster) + 
  tm_raster("v", title="Private room") +
  tm_layout(legend.outside=TRUE, frame = FALSE)

tmap_arrange(kde_entire.map, kde_hotel.map, kde_private.map,
             asp=1, ncol=2, nrow=2)

KDE analysis:

  • It is important to take note of the differences in scale despite using the same bandwidth of 500m.
  • Entire home/apt: There is clustering in southern region of Tanjong Pagar subzone. This could be due to proximity of facilities such as food outlets and MRT station.
  • Hotel room: here is clustering in southern region of Tanjong Pagar subzone. This could be due to proximity of facilities such as food outlets and MRT station. Interestingly, the clusters are towards the east than the west unlike the entire home/apt and private room listings.
  • Private room: here is clustering in southern region of Tanjong Pagar subzone. This could be due to proximity of facilities such as food outlets and MRT station.