In this exercise, we will analyse the distribution of Airbnb listings by using appropriate spatial point patterns analysis techniques. The specific tasks are as follow:
Section A: Nation-wide analysis
–> Using appropriate tmap function, display the locations of the Airbnb listing by room type with Openstreetmap of Singapore as the background. Describe the spatial patterns observed.
–> Formulate the null hypothesis and alternative hypothesis and select the confidence level.
–> Perform the test by using appropriate 1nd order spatial point patterns analysis technique.
–> With reference to the analysis results, draw statistical conclusions.
–> Derive kernel density maps of Airbnb listing by room type.
–> Using appropriate tmap functions, display the kernel density maps on openstreetmap of Singapore. Describe the spatial patterns revealed by the kernel density maps. Highlight the advantage of kernel density map over point map.
Section B: By planning subzones
–> Extract Airbnb listing by room type within Aljunied, Balestier, Lavender and Tanjong Pagar planning subzones.
–> Display their distribution as point maps. Describe the spatial patterns reveal by their respective distribution.
–> Formulate the null hypothesis and alternative hypothesis and select the confidence level.
–> Perform the test by using appropriate 2nd order spatial point patterns analysis technique.
–> With reference to the analysis results, draw statistical conclusions.
–> Derive kernel density maps of Airbnb listing by room type.
–> Using appropriate tmap functions, display the kernel density maps on openstreetmap of Singapore. Deduce what are the possible factors determine the spatial patterns observed.
The data used in this assignment are as follow:
AirBnb Listings (taken from Inside AirBnb and converted to ESRI shapefile format)
Planning Subzone Levels (taken from URA)
Singapore Coastal Boundary Outline (taken from SLA)
The data is in ESRI shapefile format.
packages = c('rgdal', 'maptools', 'raster','spatstat', 'tmap', 'sf', 'spdep', 'tidyverse', 'rgeos', 'sp', 'markdown')
for (p in packages){
if(!require(p, character.only = T)){
install.packages(p)
}
library(p,character.only = T)
}
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()
## )
subzones <- readOGR(dsn = "data/geospatial",
layer = "MP14_SUBZONE_WEB_PL")
## OGR data source with driver: ESRI Shapefile
## Source: "F:\IS415\Assignments\IS415_Take-Home_Ex02\data\geospatial", layer: "MP14_SUBZONE_WEB_PL"
## with 323 features
## It has 15 fields
sg <- readOGR(dsn = "data/geospatial",
layer="CostalOutline")
## OGR data source with driver: ESRI Shapefile
## Source: "F:\IS415\Assignments\IS415_Take-Home_Ex02\data\geospatial", layer: "CostalOutline"
## with 60 features
## It has 4 fields
–> Converting into SFDF
listings_sf <- st_as_sf(listings,
coords = c("longitude", "latitude"),
crs= 4326)
Before we analyse the data, we need to ensure that they are in the same projected system.
crs(listings_sf)
## [1] "+proj=longlat +datum=WGS84 +no_defs "
crs(subzones)
## 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(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
Since the crs are not the same, we need to standardise them.
listings_sf_crs <- st_transform(listings_sf, crs = "+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 ")
We will recheck the crs to confirm that they are the same.
crs(listings_sf_crs)
## [1] "+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 "
crs(subzones)
## 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(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
listings_private <- listings_sf_crs %>%
filter(room_type == 'Private room')
listings_home <- listings_sf_crs %>%
filter(room_type == 'Entire home/apt')
listings_hotel <- listings_sf_crs %>%
filter(room_type == 'Hotel room')
listings_shared <- listings_sf_crs %>%
filter(room_type == 'Shared room')
We will be taking a look at the distribution of all airbnbs by room type in Singapore.
tmap_mode('view')
tm_basemap(leaflet::providers$OpenStreetMap)+
tm_shape(sg) +
tm_borders(alpha = 0.5) +
tm_shape(listings_sf_crs) +
tm_dots(col = 'room_type', size = 0.02)
tm_basemap(leaflet::providers$OpenStreetMap)+
tm_shape(sg) +
tm_borders(alpha = 0.5) +
tm_shape(listings_sf_crs) +
tm_dots(col = 'room_type',
size = 0.5) +
tm_facets(by="room_type")
From the maps:
–> The number of AirBnb listings for each room type are in the following descending order (Private room, Entire home/apt, Shared room, Hotel room)
–> The number of AirBnb listings for private rooms are the highest while the number of listings for hotel room are the lowest.
–> There are very few AirBnb listings in the west region of Singapore.
–> Majority of the AirBnb listings for hotel rooms are towards the south of Singapore.
tmap_mode('plot')
## tmap mode set to plotting
listings_home_sp <- as_Spatial(listings_home)
listings_home_point <- as(listings_home_sp, "SpatialPoints")
listings_hotel_sp <- as_Spatial(listings_hotel)
listings_hotel_point <- as(listings_hotel_sp, "SpatialPoints")
listings_shared_sp <- as_Spatial(listings_shared)
listings_shared_point <- as(listings_shared_sp, "SpatialPoints")
listings_private_sp <- as_Spatial(listings_private)
listings_private_point <- as(listings_private_sp, "SpatialPoints")
sg_sp <- as(sg, "SpatialPolygons")
Checking Class of Generic Spatial Objects
class(listings_home_point)
## [1] "SpatialPoints"
## attr(,"package")
## [1] "sp"
class(listings_hotel_point)
## [1] "SpatialPoints"
## attr(,"package")
## [1] "sp"
class(listings_shared_point)
## [1] "SpatialPoints"
## attr(,"package")
## [1] "sp"
class(listings_private_point)
## [1] "SpatialPoints"
## attr(,"package")
## [1] "sp"
class(sg_sp)
## [1] "SpatialPolygons"
## attr(,"package")
## [1] "sp"
listings_home_ppp <- as(listings_home_point, "ppp")
listings_hotel_ppp <- as(listings_hotel_point, "ppp")
listings_shared_ppp <- as(listings_shared_point, "ppp")
listings_private_ppp <- as(listings_private_point, "ppp")
Checking Class of ppp Objects
class(listings_home_ppp)
## [1] "ppp"
class(listings_hotel_ppp)
## [1] "ppp"
class(listings_shared_ppp)
## [1] "ppp"
class(listings_private_ppp)
## [1] "ppp"
–> Checking for Duplication
any(duplicated(listings_home_ppp))
## [1] TRUE
any(duplicated(listings_hotel_ppp))
## [1] TRUE
any(duplicated(listings_shared_ppp))
## [1] TRUE
any(duplicated(listings_private_ppp))
## [1] TRUE
–> Overcoming Duplication with Jittering Approach (adding a small perturbation to the duplicate points so that they do not occupy the exact same space.)
listings_home_jit <- rjitter(listings_home_ppp, retry=TRUE, nsim=1, drop=TRUE)
listings_hotel_jit <- rjitter(listings_hotel_ppp, retry=TRUE, nsim=1, drop=TRUE)
listings_shared_jit <- rjitter(listings_shared_ppp, retry=TRUE, nsim=1, drop=TRUE)
listings_private_jit <- rjitter(listings_private_ppp, retry=TRUE, nsim=1, drop=TRUE)
–> Rechecking for Duplication
any(duplicated(listings_home_jit))
## [1] FALSE
any(duplicated(listings_hotel_jit))
## [1] FALSE
any(duplicated(listings_shared_jit))
## [1] FALSE
any(duplicated(listings_private_jit))
## [1] FALSE
sg_owin <- as(sg_sp, "owin")
SG_listings_home <- listings_home_jit[sg_owin]
SG_listings_hotel <- listings_hotel_jit[sg_owin]
SG_listings_shared <- listings_shared_jit[sg_owin]
SG_listings_private <- listings_private_jit[sg_owin]
–> Plotting Combined Points
plot(SG_listings_home)
plot(SG_listings_hotel)
plot(SG_listings_shared)
plot(SG_listings_private)
We will perform a test of Complete Spatial Randomness for a given point pattern, based on quadrat counts by using quadrat.test() of statspat.
The test hypotheses are:
Ho = AirBnb listings that are entire homes/ apartments are randomly distributed.
H1 = AirBnb listings that are entire homes/ apartments are not randomly distributed.
The 95% confidence interval will be used.
–> The nx and ny values are chosen as such since SG has more of a rectangle shape to reduce the no of rectangles with 0 value
qt_home <- quadrat.test(SG_listings_home,
nx = 20, ny = 15)
## Warning: Some expected counts are small; chi^2 approximation may be inaccurate
qt_home
##
## Chi-squared test of CSR using quadrat counts
##
## data: SG_listings_home
## X2 = 43765, df = 184, p-value < 2.2e-16
## alternative hypothesis: two.sided
##
## Quadrats: 185 tiles (irregular windows)
plot(SG_listings_home)
plot(qt_home, add = TRUE, cex =.1)
Conclusion:
–> The p value is smaller than 2.2e-16, which is also smaller than 0.05.
–> Therefore, we reject the null hypothesis.
–> AirBnb listings that are entire homes/ apartments are not randomly distributed
–> The x2 square value is greater than 1, therefore there is clustering.
quadrat.test(SG_listings_home,
nx = 20, ny = 15,
method="M",
nsim=999)
##
## Conditional Monte Carlo test of CSR using quadrat counts
## Test statistic: Pearson X2 statistic
##
## data: SG_listings_home
## X2 = 43765, p-value = 0.002
## alternative hypothesis: two.sided
##
## Quadrats: 185 tiles (irregular windows)
Conclusion:
–> The p value is 0.002 which is smaller than 0.05.
–> Therefore, we reject the null hypothesis.
–> AirBnb listings that are entire homes/ apartments are not randomly distributed.
–> The x2 square value is greater than 1, therefore there is clustering.
AirBnb listings that are entire homes/ apartments are not randomly distributed.
There is presence of clustering.
The test hypotheses are:
Ho = AirBnb listings that are hotel rooms are randomly distributed.
H1 = AirBnb listings that are hotel rooms are not randomly distributed.
The 95% confidence interval will be used.
–> The nx and ny values are chosen as such since SG has more of a rectangle shape to reduce the no of rectangles with 0 value
qt_hotel <- quadrat.test(SG_listings_hotel,
nx = 20, ny = 15)
## Warning: Some expected counts are small; chi^2 approximation may be inaccurate
qt_hotel
##
## Chi-squared test of CSR using quadrat counts
##
## data: SG_listings_hotel
## X2 = 9226.9, df = 184, p-value < 2.2e-16
## alternative hypothesis: two.sided
##
## Quadrats: 185 tiles (irregular windows)
plot(SG_listings_hotel)
plot(qt_hotel, add = TRUE, cex =.1)
Conclusion:
–> The p value is smaller than 2.2e-16, which is also smaller than 0.05.
–> Therefore, we reject the null hypothesis.
–> AirBnb listings that are hotel rooms are not randomly distributed.
–> The x2 square value is greater than 1, therefore there is clustering.
quadrat.test(SG_listings_hotel,
nx = 20, ny = 15,
method="M",
nsim=999)
##
## Conditional Monte Carlo test of CSR using quadrat counts
## Test statistic: Pearson X2 statistic
##
## data: SG_listings_hotel
## X2 = 9226.9, p-value = 0.002
## alternative hypothesis: two.sided
##
## Quadrats: 185 tiles (irregular windows)
Conclusion:
–> The p value is 0.002 which is smaller than 0.05.
–> Therefore, we reject the null hypothesis.
–> AirBnb listings that are hotel rooms are not randomly distributed.
–> The x2 square value is greater than 1, therefore there is clustering.
AirBnb listings that are hotel rooms are not randomly distributed.
There is presence of clustering.
The test hypotheses are:
Ho = AirBnb listings that are private rooms are randomly distributed.
H1 = AirBnb listings that are private rooms are not randomly distributed.
The 95% confidence interval will be used.
–> The nx and ny values are chosen as such since SG has more of a rectangle shape to reduce the no of rectangles with 0 value
qt_private <- quadrat.test(SG_listings_private,
nx = 20, ny = 15)
## Warning: Some expected counts are small; chi^2 approximation may be inaccurate
qt_private
##
## Chi-squared test of CSR using quadrat counts
##
## data: SG_listings_private
## X2 = 22002, df = 184, p-value < 2.2e-16
## alternative hypothesis: two.sided
##
## Quadrats: 185 tiles (irregular windows)
plot(SG_listings_private)
plot(qt_shared, add = TRUE, cex =.1)
Conclusion:
–> The p value is smaller than 2.2e-16, which is also smaller than 0.05.
–> Therefore, we reject the null hypothesis.
–> AirBnb listings that are private rooms are not randomly distributed.
–> The x2 square value is greater than 1, therefore there is clustering.
quadrat.test(SG_listings_private,
nx = 20, ny = 15,
method="M",
nsim=999)
##
## Conditional Monte Carlo test of CSR using quadrat counts
## Test statistic: Pearson X2 statistic
##
## data: SG_listings_private
## X2 = 22002, p-value = 0.002
## alternative hypothesis: two.sided
##
## Quadrats: 185 tiles (irregular windows)
Conclusion:
–> The p value is 0.002 which is smaller than 0.05.
–> Therefore, we reject the null hypothesis.
–> AirBnb listings that are private rooms are not randomly distributed.
–> The x2 square value is greater than 1, therefore there is clustering.
AirBnb listings that are private rooms are not randomly distributed.
There is presence of clustering.
The nearest neighbour analysis will be done as the quadrat analysis may be too sensitive to quadrat size and is a measure of dispersion rather than pattern.
We will perform the Clark-Evans test of aggregation for a spatial point pattern by using clarkevans.test() of statspat.
The test hypotheses are:
Ho = AirBnb listings that are entire homes/ apartments are randomly distributed.
H1 = AirBnb listings that are entire homes/ apartments are not randomly distributed.
The 95% confidence interval will be used.
clarkevans.test(SG_listings_home,
correction="none",
clipregion="sg_owin",
alternative=c("two.sided"),
nsim=999)
##
## Clark-Evans test
## No edge correction
## Monte Carlo test based on 999 simulations of CSR with fixed n
##
## data: SG_listings_home
## R = 0.26394, p-value = 0.002
## alternative hypothesis: two-sided
Conclusion:
–> The p value is 0.002 which is smaller than 0.05.
–> Therefore, we reject the null hypothesis.
–> AirBnb listings that are entire homes/ apartments are not randomly distributed.
–> The R value is smaller than 1, therefore there is clustering.
The test hypotheses are:
Ho = AirBnb listings that are hotel rooms are randomly distributed.
H1 = AirBnb listings that are hotel rooms are not randomly distributed.
The 95% confidence interval will be used.
clarkevans.test(SG_listings_hotel,
correction="none",
clipregion="sg_owin",
alternative=c("two.sided"),
nsim=999)
##
## Clark-Evans test
## No edge correction
## Monte Carlo test based on 999 simulations of CSR with fixed n
##
## data: SG_listings_hotel
## R = 0.10366, p-value = 0.002
## alternative hypothesis: two-sided
Conclusion:
–> The p value is 0.002 which is smaller than 0.05.
–> Therefore, we reject the null hypothesis.
–> AirBnb listings that are hotel rooms rooms are not randomly distributed.
–> The R value is smaller than 1, therefore there is clustering.
The test hypotheses are:
Ho = AirBnb listings that are private rooms are randomly distributed.
H1 = AirBnb listings that are private rooms are not randomly distributed.
The 95% confidence interval will be used.
clarkevans.test(SG_listings_private,
correction="none",
clipregion="sg_owin",
alternative=c("two.sided"),
nsim=999)
##
## Clark-Evans test
## No edge correction
## Monte Carlo test based on 999 simulations of CSR with fixed n
##
## data: SG_listings_private
## R = 0.37669, p-value = 0.002
## alternative hypothesis: two-sided
Conclusion:
–> The p value is 0.002 which is smaller than 0.05.
–> Therefore, we reject the null hypothesis.
–> AirBnb listings that are private rooms are not randomly distributed.
–> The R value is smaller than 1, therefore there is clustering.
The bandwidths are derived by bw.diggle method.
SG_listings_home.km <- rescale(SG_listings_home, 1000, "km")
kde_home <- density(SG_listings_home.km, sigma=0.6, edge=TRUE, kernel="gaussian")
## Warning: point-in-polygon test had difficulty with 215 points (total score not 0
## or 1)
gridded_kde_home <- as.SpatialGridDataFrame.im(kde_home)
spplot(gridded_kde_home)
kde_home_raster <- raster(gridded_kde_home)
projection(kde_home_raster) <- CRS("+init=EPSG:3414 +datum=WGS84 +units=km")
kde_home_raster
## class : RasterLayer
## dimensions : 128, 128, 16384 (nrow, ncol, ncell)
## resolution : 0.4170614, 0.2647348 (x, y)
## extent : 2.663926, 56.04779, 16.35798, 50.24403 (xmin, xmax, ymin, ymax)
## crs : +init=EPSG:3414 +datum=WGS84 +units=km +proj=tmerc +lat_0=1.366666666666667 +lon_0=103.8333333333333 +k=1 +x_0=28001.642 +y_0=38744.572 +no_defs +ellps=WGS84 +towgs84=0,0,0
## source : memory
## names : v
## values : -6.096084e-15, 172.7349 (min, max)
SG_listings_hotel.km <- rescale(SG_listings_hotel, 1000, "km")
kde_hotel <- density(SG_listings_hotel.km, sigma=0.6, edge=TRUE, kernel="gaussian")
## Warning: point-in-polygon test had difficulty with 215 points (total score not 0
## or 1)
gridded_kde_hotel <- as.SpatialGridDataFrame.im(kde_hotel)
spplot(gridded_kde_hotel)
kde_hotel_raster <- raster(gridded_kde_hotel)
projection(kde_hotel_raster) <- CRS("+init=EPSG:3414 +datum=WGS84 +units=km")
kde_hotel_raster
## class : RasterLayer
## dimensions : 128, 128, 16384 (nrow, ncol, ncell)
## resolution : 0.4170614, 0.2647348 (x, y)
## extent : 2.663926, 56.04779, 16.35798, 50.24403 (xmin, xmax, ymin, ymax)
## crs : +init=EPSG:3414 +datum=WGS84 +units=km +proj=tmerc +lat_0=1.366666666666667 +lon_0=103.8333333333333 +k=1 +x_0=28001.642 +y_0=38744.572 +no_defs +ellps=WGS84 +towgs84=0,0,0
## source : memory
## names : v
## values : -2.388157e-15, 67.80641 (min, max)
SG_listings_private.km <- rescale(SG_listings_private, 1000, "km")
kde_private <- density(SG_listings_private.km, sigma=0.6, edge=TRUE, kernel="gaussian")
## Warning: point-in-polygon test had difficulty with 215 points (total score not 0
## or 1)
gridded_kde_private <- as.SpatialGridDataFrame.im(kde_private)
spplot(gridded_kde_private)
kde_private_raster <- raster(gridded_kde_private)
projection(kde_private_raster) <- CRS("+init=EPSG:3414 +datum=WGS84 +units=km")
kde_private_raster
## class : RasterLayer
## dimensions : 128, 128, 16384 (nrow, ncol, ncell)
## resolution : 0.4170614, 0.2647348 (x, y)
## extent : 2.663926, 56.04779, 16.35798, 50.24403 (xmin, xmax, ymin, ymax)
## crs : +init=EPSG:3414 +datum=WGS84 +units=km +proj=tmerc +lat_0=1.366666666666667 +lon_0=103.8333333333333 +k=1 +x_0=28001.642 +y_0=38744.572 +no_defs +ellps=WGS84 +towgs84=0,0,0
## source : memory
## names : v
## values : -6.15893e-15, 155.1096 (min, max)
tmap_mode('view')
tm_basemap(leaflet::providers$OpenStreetMap)+
tm_shape(sg)+
tm_borders(alpha = 0.5) +
tm_shape(kde_home_raster) +
tm_raster("v", alpha=0.5,
palette = "YlOrRd")
tmap_mode('view')
tm_basemap(leaflet::providers$OpenStreetMap)+
tm_shape(sg)+
tm_borders(alpha = 0.5) +
tm_shape(kde_hotel_raster) +
tm_raster("v", alpha=0.5,
palette = "YlOrRd")
For all 4 room types, there are hot spots towards the South of Singapore. near Clarke Quay, Geylang and Marina.
Kernel density maps are better than point maps as they enable you to analyse and understand the concentration of AirBnb listings.
ALJ <- subzones[subzones@data$SUBZONE_N == "ALJUNIED",]
BAL <- subzones[subzones@data$SUBZONE_N == "BALESTIER",]
LAV <- subzones[subzones@data$SUBZONE_N == "LAVENDER",]
TP <- subzones[subzones@data$SUBZONE_N == "TANJONG PAGAR",]
The four subzones are plotted below.
par(mfrow=c(2,2))
plot(ALJ, main = "ALJUNIED")
plot(BAL, main = "BALESTIER")
plot(LAV, main = "LAVENDER")
plot(TP, main = "TANJONG PAGAR")
ALJ_sp = as(ALJ, "SpatialPolygons")
BAL_sp = as(BAL, "SpatialPolygons")
LAV_sp = as(LAV, "SpatialPolygons")
TP_sp = as(TP, "SpatialPolygons")
ALJ_owin = as(ALJ_sp, "owin")
BAL_owin = as(BAL_sp, "owin")
LAV_owin = as(LAV_sp, "owin")
TP_owin = as(TP_sp, "owin")
#ALJUNIED
ALJ_listings_home <- listings_home_jit[ALJ_owin]
ALJ_listings_hotel <- listings_hotel_jit[ALJ_owin]
ALJ_listings_shared <- listings_shared_jit[ALJ_owin]
ALJ_listings_private <- listings_private_jit[ALJ_owin]
# BALESTIER
BAL_listings_home <- listings_home_jit[BAL_owin]
BAL_listings_hotel <- listings_hotel_jit[BAL_owin]
BAL_listings_shared <- listings_shared_jit[BAL_owin]
BAL_listings_private <- listings_private_jit[BAL_owin]
# LAVENDER
LAV_listings_home <- listings_home_jit[LAV_owin]
LAV_listings_hotel <- listings_hotel_jit[LAV_owin]
LAV_listings_shared <- listings_shared_jit[LAV_owin]
LAV_listings_private <- listings_private_jit[LAV_owin]
#TANJONG PAGAR
TP_listings_home <- listings_home_jit[TP_owin]
TP_listings_hotel <- listings_hotel_jit[TP_owin]
TP_listings_shared <- listings_shared_jit[TP_owin]
TP_listings_private <- listings_private_jit[TP_owin]
par(mfrow=c(2,2))
plot(ALJ_listings_home, main="Entire Home/ Apartment")
plot(ALJ_listings_hotel, main="Hotel Room")
plot(ALJ_listings_shared, main="Shared Room")
plot(ALJ_listings_private, main="Private Room")
From the maps:
–> The number of AirBnb listings for each room type in Aljunied are in the following descending order (Entire Home/ Apartment, Private Room, Hotel ROom, Shared Room)
–> The number of AirBnb listings for entire homes/apartments are the highest while the number of listings for shared room are the lowest.
–> There seems to be clustering towards the centre of Aljunied.
par(mfrow=c(2,2))
plot(BAL_listings_home, main="Entire Home/ Apartment")
plot(BAL_listings_hotel, main="Hotel Room")
plot(BAL_listings_shared, main="Shared Room")
plot(BAL_listings_private, main="Private Room")
From the maps:
–> The number of AirBnb listings for each room type in Balestier are in the following descending order (Entire Home/ Apartment, Private Room, Hotel ROom, Shared Room)
–> The number of AirBnb listings for entire homes/apartments are the highest while the number of listings for shared room are the lowest in Balestier.
–> There seems to be clustering towards the east and centre of Balestier.
par(mfrow=c(2,2))
plot(LAV_listings_home, main="Entire Home/ Apartment")
plot(LAV_listings_hotel, main="Hotel Room")
plot(LAV_listings_shared, main="Shared Room")
plot(LAV_listings_private, main="Private Room")
From the maps:
–> The number of AirBnb listings for each room type in Lavender are in the following descending order (Private Room, Entire Home/ Apartment, Shared ROom, Hotel Room)
–> The number of AirBnb listings for private rooms are the highest while the number of listings for hotel rooms are the lowest in Lavender.
par(mfrow=c(2,2))
plot(TP_listings_home, main="Entire Home/ Apartment")
plot(TP_listings_hotel, main="Hotel Room")
plot(TP_listings_shared, main="Shared Room")
plot(TP_listings_private, main="Private Room")
From the maps:
–> The number of AirBnb listings for each room type in Tanjong Pagar are in the following descending order (Entire Home/ Apartment, Private Room, Hotel ROom, Shared Room)
–> The number of AirBnb listings for entire homes/apartments are the highest while the number of listings for shared room are the lowest in Tanjong Pagar.
–> There seem to be no shared rooms as AirBnb listings in Tanjong Pagar.
K-function measures the number of events found up to a given distance of any particular event. It will be the preferred method of analysis as it assumes isotropy over the regions analysed and provides an estimate of spatial dependence over a wider range of scales.
To confirm the observed spatial patterns, a hypothesis test will be conducted.
Ho = The distribution of AirBnb listings that are of entire homes/apartments at Aljunied are randomly distributed.
H1= The distribution of AirBnb listings that are of entire homes/apartments at Aljunied are not randomly distributed.
The 99% confidence interval will be used.
K_ALJ_home = Kest(ALJ_listings_home, correction = "Ripley")
plot(K_ALJ_home, . -r ~ r, ylab= "K(d)-r", xlab = "d(m)")
K_ALJ_home.csr <- envelope(ALJ_listings_home, Kest, nsim = 999, rank = 1, glocal=TRUE)
## Generating 999 simulations of CSR ...
## 1, 2, 3, ......10 [etd 10:41] .........20 [etd 10:09] .........
## 30 [etd 10:29] .........40 [etd 10:20] .........50 [etd 10:31] ........
## .60 [etd 10:18] .........70 [etd 10:12] .........80 [etd 10:05] .......
## ..90 [etd 9:58] .........100 [etd 9:51] .........110 [etd 9:43] ......
## ...120 [etd 9:39] .........130 [etd 9:31] .........140 [etd 9:24] .....
## ....150 [etd 9:17] .........160 [etd 9:09] .........170 [etd 9:05] ....
## .....180 [etd 8:57] .........190 [etd 8:48] .........200 [etd 8:43] ...
## ......210 [etd 8:36] .........220 [etd 8:29] .........230 [etd 8:23] ..
## .......240 [etd 8:16] .........250 [etd 8:09] .........260 [etd 8:03] .
## ........270 [etd 7:56] .........280 [etd 7:48] .........290
## [etd 7:40] .........300 [etd 7:34] .........310 [etd 7:28] .........
## 320 [etd 7:21] .........330 [etd 7:14] .........340 [etd 7:07] ........
## .350 [etd 7:00] .........360 [etd 6:54] .........370 [etd 6:47] .......
## ..380 [etd 6:40] .........390 [etd 6:34] .........400 [etd 6:28] ......
## ...410 [etd 6:21] .........420 [etd 6:14] .........430 [etd 6:08] .....
## ....440 [etd 6:01] .........450 [etd 5:54] .........460 [etd 5:48] ....
## .....470 [etd 5:41] .........480 [etd 5:35] .........490 [etd 5:28] ...
## ......500 [etd 5:22] .........510 [etd 5:15] .........520 [etd 5:09] ..
## .......530 [etd 5:02] .........540 [etd 4:56] .........550 [etd 4:50] .
## ........560 [etd 4:43] .........570 [etd 4:37] .........580
## [etd 4:31] .........590 [etd 4:24] .........600 [etd 4:17] .........
## 610 [etd 4:11] .........620 [etd 4:04] .........630 [etd 3:58] ........
## .640 [etd 3:52] .........650 [etd 3:45] .........660 [etd 3:39] .......
## ..670 [etd 3:32] .........680 [etd 3:26] .........690 [etd 3:19] ......
## ...700 [etd 3:13] .........710 [etd 3:06] .........720 [etd 3:00] .....
## ....730 [etd 2:53] .........740 [etd 2:47] .........750 [etd 2:40] ....
## .....760 [etd 2:34] .........770 [etd 2:27] .........780 [etd 2:21] ...
## ......790 [etd 2:14] .........800 [etd 2:08] .........810 [etd 2:01] ..
## .......820 [etd 1:55] .........830 [etd 1:48] .........840 [etd 1:42] .
## ........850 [etd 1:36] .........860 [etd 1:29] .........870
## [etd 1:23] .........880 [etd 1:16] .........890 [etd 1:10] .........
## 900 [etd 1:03] .........910 [etd 57 sec] .........920 [etd 51 sec] ........
## .930 [etd 44 sec] .........940 [etd 38 sec] .........950 [etd 31 sec] .......
## ..960 [etd 25 sec] .........970 [etd 19 sec] .........980 [etd 12 sec] ......
## ...990 [etd 6 sec] ........ 999.
##
## Done.
plot(K_ALJ_home.csr, . - r ~ r, xlab="d", ylab="K(d)-r")
Conclusion:
–> The observed line in black is above the envelope, hence we reject the null hypothesis.
–> The distribution of AirBnb listings that are of entire homes/apartments at Aljunied are not randomly distributed.
–> The observed pattern resembles significant clustered pattern.
Ho = The distribution of AirBnb listings that are of hotel rooms at Aljunied are randomly distributed.
H1= The distribution of AirBnb listings that are of hotel rooms at Aljunied are not randomly distributed.
The 99% confidence interval will be used.
K_ALJ_hotel = Kest(ALJ_listings_hotel, correction = "Ripley")
plot(K_ALJ_hotel, . -r ~ r, ylab= "K(d)-r", xlab = "d(m)")
K_ALJ_hotel.csr <- envelope(ALJ_listings_hotel, Kest, nsim = 999, rank = 1, glocal=TRUE)
## Generating 999 simulations of CSR ...
## 1, 2, 3, ......10.........20.........30.........40.........50.........60........
## .70.........80.........90.........100.........110.........120.........130......
## ...140.........150.........160.........170.........180.........190.........200....
## .....210.........220.........230.........240.........250.........260.........270..
## .......280.........290.........300.........310.........320.........330.........340
## .........350.........360.........370.........380.........390.........400........
## .410.........420.........430.........440.........450.........460.........470......
## ...480.........490.........500.........510.........520.........530.........540....
## .....550.........560.........570.........580.........590.........600.........610..
## .......620.........630.........640.........650.........660.........670.........680
## .........690.........700.........710.........720.........730.........740........
## .750.........760.........770.........780.........790.........800.........810......
## ...820.........830.........840.........850.........860.........870.........880....
## .....890.........900.........910.........920.........930.........940.........950..
## .......960.........970.........980.........990........ 999.
##
## Done.
plot(K_ALJ_hotel.csr, . - r ~ r, xlab="d", ylab="K(d)-r")
Conclusion:
–> The observed line in black is above the envelope from d=0 to d=275. From 275 onwards, the black line is within the envelope.
–> It can be observed that below the distance of ~275m, there is significant clustering pattern. Above 275, the observed pattern resembles CSR pattern.
To confirm the observed spatial patterns, a hypothesis test will be conducted.
Ho = The distribution of AirBnb listings that are of private rooms at Aljunied are randomly distributed.
H1= The distribution of AirBnb listings that are of private rooms at Aljunied are not randomly distributed.
The 99% confidence interval will be used.
K_ALJ_private = Kest(ALJ_listings_private, correction = "Ripley")
plot(K_ALJ_private, . -r ~ r, ylab= "K(d)-r", xlab = "d(m)")
K_ALJ_private.csr <- envelope(ALJ_listings_private, Kest, nsim = 999, rank = 1, glocal=TRUE)
## Generating 999 simulations of CSR ...
## 1, 2, 3, ......10.........20.........30.........40.........50.........60........
## .70.........80.........90.........100.........110.........120.........130......
## ...140.........150.........160.........170.........180.........190.........200....
## .....210.........220.........230.........240.........250.........260.........270..
## .......280.........290.........300.........310.........320.........330.........340
## .........350.........360.........370.........380.........390.........400........
## .410.........420.........430.........440.........450.........460.........470......
## ...480.........490.........500.........510.........520.........530.........540....
## .....550.........560.........570.........580.........590.........600.........610..
## .......620.........630.........640.........650.........660.........670.........680
## .........690.........700.........710.........720.........730.........740........
## .750.........760.........770.........780.........790.........800.........810......
## ...820.........830.........840.........850.........860.........870.........880....
## .....890.........900.........910.........920.........930.........940.........950..
## .......960.........970.........980.........990........ 999.
##
## Done.
plot(K_ALJ_private.csr, . - r ~ r, xlab="d", ylab="K(d)-r")
Conclusion:
–> The observed line in black is above the envelope, hence we reject the null hypothesis.
–> The distribution of AirBnb listings that are of private rooms at Aljunied are not randomly distributed.
–> The observed pattern resembles significant clustered pattern.
To confirm the observed spatial patterns, a hypothesis test will be conducted.
Ho = The distribution of AirBnb listings that are of entire homes/apartments at Balestier are randomly distributed.
H1= The distribution of AirBnb listings that are of entire homes/apartments at Balestier are not randomly distributed.
The 99% confidence interval will be used.
K_BAL_home = Kest(BAL_listings_home, correction = "Ripley")
plot(K_BAL_home, . -r ~ r, ylab= "K(d)-r", xlab = "d(m)")
K_BAL_home.csr <- envelope(BAL_listings_home, Kest, nsim = 999, rank = 1, glocal=TRUE)
## Generating 999 simulations of CSR ...
## 1, 2, 3, ......10 [etd 2:39] .........20 [etd 2:43] .........
## 30 [etd 2:41] .........40 [etd 2:40] .........50 [etd 2:42] ........
## .60 [etd 2:41] .........70 [etd 2:39] .........80 [etd 2:37] .......
## ..90 [etd 2:35] .........100 [etd 2:33] .........110 [etd 2:31] ......
## ...120 [etd 2:29] .........130 [etd 2:27] .........140 [etd 2:25] .....
## ....150 [etd 2:23] .........160 [etd 2:23] .........170 [etd 2:21] ....
## .....180 [etd 2:19] .........190 [etd 2:17] .........200 [etd 2:17] ...
## ......210 [etd 2:15] .........220 [etd 2:13] .........230 [etd 2:11] ..
## .......240 [etd 2:09] .........250 [etd 2:08] .........260 [etd 2:06] .
## ........270 [etd 2:04] .........280 [etd 2:02] .........290
## [etd 2:00] .........300 [etd 1:59] .........310 [etd 1:57] .........
## 320 [etd 1:56] .........330 [etd 1:54] .........340 [etd 1:52] ........
## .350 [etd 1:51] .........360 [etd 1:49] .........370 [etd 1:47] .......
## ..380 [etd 1:46] .........390 [etd 1:44] .........400 [etd 1:42] ......
## ...410 [etd 1:40] .........420 [etd 1:39] .........430 [etd 1:37] .....
## ....440 [etd 1:36] .........450 [etd 1:34] .........460 [etd 1:32] ....
## .....470 [etd 1:30] .........480 [etd 1:28] .........490 [etd 1:27] ...
## ......500 [etd 1:25] .........510 [etd 1:23] .........520 [etd 1:22] ..
## .......530 [etd 1:20] .........540 [etd 1:19] .........550 [etd 1:17] .
## ........560 [etd 1:15] .........570 [etd 1:14] .........580
## [etd 1:12] .........590 [etd 1:10] .........600 [etd 1:08] .........
## 610 [etd 1:06] .........620 [etd 1:05] .........630 [etd 1:03] ........
## .640 [etd 1:01] .........650 [etd 1:00] .........660 [etd 58 sec] .......
## ..670 [etd 56 sec] .........680 [etd 55 sec] .........690 [etd 53 sec] ......
## ...700 [etd 51 sec] .........710 [etd 49 sec] .........720 [etd 48 sec] .....
## ....730 [etd 46 sec] .........740 [etd 44 sec] .........750 [etd 42 sec] ....
## .....760 [etd 41 sec] .........770 [etd 39 sec] .........780 [etd 37 sec] ...
## ......790 [etd 36 sec] .........800 [etd 34 sec] .........810 [etd 32 sec] ..
## .......820 [etd 31 sec] .........830 [etd 29 sec] .........840 [etd 27 sec] .
## ........850 [etd 25 sec] .........860 [etd 24 sec] .........870
## [etd 22 sec] .........880 [etd 20 sec] .........890 [etd 19 sec] .........
## 900 [etd 17 sec] .........910 [etd 15 sec] .........920 [etd 13 sec] ........
## .930 [etd 12 sec] .........940 [etd 10 sec] .........950 [etd 8 sec] .......
## ..960 [etd 7 sec] .........970 [etd 5 sec] .........980 [etd 3 sec] ......
## ...990 [etd 2 sec] ........ 999.
##
## Done.
plot(K_BAL_home.csr, . - r ~ r, xlab="d", ylab="K(d)-r")
Conclusion:
–> The observed line in black is above the envelope, hence we reject the null hypothesis.
–> The distribution of AirBnb listings that are of entire homes/apartments at Balestier are not randomly distributed.
–> The observed pattern resembles significant clustered pattern.
Ho = The distribution of AirBnb listings that are of hotel rooms at Balestier are randomly distributed.
H1= The distribution of AirBnb listings that are of hotel rooms at Balestier are not randomly distributed.
The 99% confidence interval will be used.
K_BAL_hotel = Kest(BAL_listings_hotel, correction = "Ripley")
plot(K_BAL_hotel, . -r ~ r, ylab= "K(d)-r", xlab = "d(m)")
K_BAL_hotel.csr <- envelope(BAL_listings_hotel, Kest, nsim = 999, rank = 1, glocal=TRUE)
## Generating 999 simulations of CSR ...
## 1, 2, 3, ......10.........20.........30.........40.........50.........60........
## .70.........80.........90.........100.........110.........120.........130......
## ...140.........150.........160.........170.........180.........190.........200....
## .....210.........220.........230.........240.........250.........260.........270..
## .......280.........290.........300.........310.........320.........330.........340
## .........350.........360.........370.........380.........390.........400........
## .410.........420.........430.........440.........450.........460.........470......
## ...480.........490.........500.........510.........520.........530.........540....
## .....550.........560.........570.........580.........590.........600.........610..
## .......620.........630.........640.........650.........660.........670.........680
## .........690.........700.........710.........720.........730.........740........
## .750.........760.........770.........780.........790.........800.........810......
## ...820.........830.........840.........850.........860.........870.........880....
## .....890.........900.........910.........920.........930.........940.........950..
## .......960.........970.........980.........990........ 999.
##
## Done.
plot(K_BAL_hotel.csr, . - r ~ r, xlab="d", ylab="K(d)-r")
Conclusion:
–> The observed line in black is above the envelope, hence we reject the null hypothesis.
–> The distribution of AirBnb listings that are of hotel rooms at Balestier are not randomly distributed.
–> The observed pattern resembles significant clustered pattern.
To confirm the observed spatial patterns, a hypothesis test will be conducted.
Ho = The distribution of AirBnb listings that are of private rooms at Balestier are randomly distributed.
H1= The distribution of AirBnb listings that are of private rooms at Balestier are not randomly distributed.
The 99% confidence interval will be used.
K_BAL_private = Kest(BAL_listings_private, correction = "Ripley")
plot(K_BAL_private, . -r ~ r, ylab= "K(d)-r", xlab = "d(m)")
K_BAL_private.csr <- envelope(BAL_listings_private, Kest, nsim = 999, rank = 1, glocal=TRUE)
## Generating 999 simulations of CSR ...
## 1, 2, 3, ......10.........20.........30.........40.........50.........60........
## .70.........80.........90.........100.........110.........120.........130......
## ...140.........150.........160.........170.........180.........190.........200....
## .....210.........220.........230.........240.........250.........260.........270..
## .......280.........290.........300.........310.........320.........330.........340
## .........350.........360.........370.........380.........390.........400........
## .410.........420.........430.........440.........450.........460.........470......
## ...480.........490.........500.........510.........520.........530.........540....
## .....550.........560.........570.........580.........590.........600.........610..
## .......620.........630.........640.........650.........660.........670.........680
## .........690.........700.........710.........720.........730.........740........
## .750.........760.........770.........780.........790.........800.........810......
## ...820.........830.........840.........850.........860.........870.........880....
## .....890.........900.........910.........920.........930.........940.........950..
## .......960.........970.........980.........990........ 999.
##
## Done.
plot(K_BAL_private.csr, . - r ~ r, xlab="d", ylab="K(d)-r")
Conclusion:
–> The observed line in black is above the envelope, hence we reject the null hypothesis.
–> The distribution of AirBnb listings that are of private rooms at Balestier are not randomly distributed.
–> The observed pattern resembles significant clustered pattern.
To confirm the observed spatial patterns, a hypothesis test will be conducted.
Ho = The distribution of AirBnb listings that are of entire homes/apartments at Lavender are randomly distributed.
H1= The distribution of AirBnb listings that are of entire homes/apartments at Lavender are not randomly distributed.
The 99% confidence interval will be used.
K_LAV_home = Kest(LAV_listings_home, correction = "Ripley")
plot(K_LAV_home, . -r ~ r, ylab= "K(d)-r", xlab = "d(m)")
K_LAV_home.csr <- envelope(LAV_listings_home, Kest, nsim = 999, rank = 1, glocal=TRUE)
## Generating 999 simulations of CSR ...
## 1, 2, 3, ......10.........20.........30.........40.........50.........60........
## .70.........80.........90.........100.........110.........120.........130......
## ...140.........150.........160.........170.........180.........190.........200....
## .....210.........220.........230.........240.........250.........260.........270..
## .......280.........290.........300.........310.........320.........330.........340
## .........350.........360.........370.........380.........390.........400........
## .410.........420.........430.........440.........450.........460.........470......
## ...480.........490.........500.........510.........520.........530.........540....
## .....550.........560.........570.........580.........590.........600.........610..
## .......620.........630.........640.........650.........660.........670.........680
## .........690.........700.........710.........720.........730.........740........
## .750.........760.........770.........780.........790.........800.........810......
## ...820.........830.........840.........850.........860.........870.........880....
## .....890.........900.........910.........920.........930.........940.........950..
## .......960.........970.........980.........990........ 999.
##
## Done.
plot(K_LAV_home.csr, . - r ~ r, xlab="d", ylab="K(d)-r")
Conclusion:
–> The observed line in black is above the envelope, hence we reject the null hypothesis.
–> The distribution of AirBnb listings that are of entire homes/apartments at Lavender are not randomly distributed.
–> The observed pattern resembles significant clustered pattern.
Ho = The distribution of AirBnb listings that are of hotel rooms at Lavender are randomly distributed.
H1= The distribution of AirBnb listings that are of hotel rooms at Lavender are not randomly distributed.
The 99% confidence interval will be used.
K_LAV_hotel = Kest(LAV_listings_hotel, correction = "Ripley")
plot(K_LAV_hotel, . -r ~ r, ylab= "K(d)-r", xlab = "d(m)")
K_LAV_hotel.csr <- envelope(LAV_listings_hotel, Kest, nsim = 999, rank = 1, glocal=TRUE)
## Generating 999 simulations of CSR ...
## 1, 2, 3, ......10.........20.........30.........40.........50.........60........
## .70.........80.........90.........100.........110.........120.........130......
## ...140.........150.........160.........170.........180.........190.........200....
## .....210.........220.........230.........240.........250.........260.........270..
## .......280.........290.........300.........310.........320.........330.........340
## .........350.........360.........370.........380.........390.........400........
## .410.........420.........430.........440.........450.........460.........470......
## ...480.........490.........500.........510.........520.........530.........540....
## .....550.........560.........570.........580.........590.........600.........610..
## .......620.........630.........640.........650.........660.........670.........680
## .........690.........700.........710.........720.........730.........740........
## .750.........760.........770.........780.........790.........800.........810......
## ...820.........830.........840.........850.........860.........870.........880....
## .....890.........900.........910.........920.........930.........940.........950..
## .......960.........970.........980.........990........ 999.
##
## Done.
plot(K_LAV_hotel.csr, . - r ~ r, xlab="d", ylab="K(d)-r")
Conclusion:
–> The observed line in black is above the envelope, hence we reject the null hypothesis.
–> The distribution of AirBnb listings that are of hotel rooms at Lavender are not randomly distributed.
–> The observed pattern resembles significant clustered pattern.
To confirm the observed spatial patterns, a hypothesis test will be conducted.
Ho = The distribution of AirBnb listings that are of private rooms at Lavender are randomly distributed.
H1= The distribution of AirBnb listings that are of private rooms at Lavender are not randomly distributed.
The 99% confidence interval will be used.
K_LAV_private = Kest(LAV_listings_private, correction = "Ripley")
plot(K_LAV_private, . -r ~ r, ylab= "K(d)-r", xlab = "d(m)")
K_LAV_private.csr <- envelope(LAV_listings_private, Kest, nsim = 999, rank = 1, glocal=TRUE)
## Generating 999 simulations of CSR ...
## 1, 2, 3, ......10 [etd 3:32] .........20 [etd 3:13] .........
## 30 [etd 3:02] .........40 [etd 2:58] .........50 [etd 3:01] ........
## .60 [etd 2:58] .........70 [etd 2:56] .........80 [etd 2:53] .......
## ..90 [etd 2:50] .........100 [etd 2:47] .........110 [etd 2:46] ......
## ...120 [etd 2:43] .........130 [etd 2:42] .........140 [etd 2:39] .....
## ....150 [etd 2:39] .........160 [etd 2:37] .........170 [etd 2:35] ....
## .....180 [etd 2:33] .........190 [etd 2:30] .........200 [etd 2:28] ...
## ......210 [etd 2:27] .........220 [etd 2:25] .........230 [etd 2:23] ..
## .......240 [etd 2:21] .........250 [etd 2:19] .........260 [etd 2:17] .
## ........270 [etd 2:15] .........280 [etd 2:13] .........290
## [etd 2:11] .........300 [etd 2:09] .........310 [etd 2:07] .........
## 320 [etd 2:05] .........330 [etd 2:04] .........340 [etd 2:02] ........
## .350 [etd 2:00] .........360 [etd 1:58] .........370 [etd 1:56] .......
## ..380 [etd 1:54] .........390 [etd 1:53] .........400 [etd 1:51] ......
## ...410 [etd 1:49] .........420 [etd 1:47] .........430 [etd 1:45] .....
## ....440 [etd 1:43] .........450 [etd 1:42] .........460 [etd 1:40] ....
## .....470 [etd 1:38] .........480 [etd 1:36] .........490 [etd 1:34] ...
## ......500 [etd 1:32] .........510 [etd 1:30] .........520 [etd 1:28] ..
## .......530 [etd 1:27] .........540 [etd 1:25] .........550 [etd 1:23] .
## ........560 [etd 1:21] .........570 [etd 1:19] .........580
## [etd 1:18] .........590 [etd 1:16] .........600 [etd 1:14] .........
## 610 [etd 1:12] .........620 [etd 1:10] .........630 [etd 1:08] ........
## .640 [etd 1:06] .........650 [etd 1:05] .........660 [etd 1:03] .......
## ..670 [etd 1:01] .........680 [etd 59 sec] .........690 [etd 57 sec] ......
## ...700 [etd 55 sec] .........710 [etd 53 sec] .........720 [etd 51 sec] .....
## ....730 [etd 49 sec] .........740 [etd 48 sec] .........750 [etd 46 sec] ....
## .....760 [etd 44 sec] .........770 [etd 42 sec] .........780 [etd 40 sec] ...
## ......790 [etd 38 sec] .........800 [etd 37 sec] .........810 [etd 35 sec] ..
## .......820 [etd 33 sec] .........830 [etd 31 sec] .........840 [etd 29 sec] .
## ........850 [etd 27 sec] .........860 [etd 25 sec] .........870
## [etd 24 sec] .........880 [etd 22 sec] .........890 [etd 20 sec] .........
## 900 [etd 18 sec] .........910 [etd 16 sec] .........920 [etd 14 sec] ........
## .930 [etd 13 sec] .........940 [etd 11 sec] .........950 [etd 9 sec] .......
## ..960 [etd 7 sec] .........970 [etd 5 sec] .........980 [etd 3 sec] ......
## ...990 [etd 2 sec] ........ 999.
##
## Done.
plot(K_LAV_private.csr, . - r ~ r, xlab="d", ylab="K(d)-r")
Conclusion:
–> The observed line in black is above the envelope, hence we reject the null hypothesis.
–> The distribution of AirBnb listings that are of private rooms at Lavender are not randomly distributed.
–> The observed pattern resembles significant clustered pattern.
To confirm the observed spatial patterns, a hypothesis test will be conducted.
Ho = The distribution of AirBnb listings that are of entire homes/apartments at Tanjong Pagar are randomly distributed.
H1= The distribution of AirBnb listings that are of entire homes/apartments at Tanjong Pagar are not randomly distributed.
The 99% confidence interval will be used.
K_TP_home = Kest(TP_listings_home, correction = "Ripley")
plot(K_TP_home, . -r ~ r, ylab= "K(d)-r", xlab = "d(m)")
K_TP_home.csr <- envelope(TP_listings_home, Kest, nsim = 999, rank = 1, glocal=TRUE)
## Generating 999 simulations of CSR ...
## 1, 2, 3, ......10.........20.........30.........40.........50.........60........
## .70.........80.........90.........100.........110.........120.........130......
## ...140.........150.........160.........170.........180.........190.........200....
## .....210.........220.........230.........240.........250.........260.........270..
## .......280.........290.........300.........310.........320.........330.........340
## .........350.........360.........370.........380.........390.........400........
## .410.........420.........430.........440.........450.........460.........470......
## ...480.........490.........500.........510.........520.........530.........540....
## .....550.........560.........570.........580.........590.........600.........610..
## .......620.........630.........640.........650.........660.........670.........680
## .........690.........700.........710.........720.........730.........740........
## .750.........760.........770.........780.........790.........800.........810......
## ...820.........830.........840.........850.........860.........870.........880....
## .....890.........900.........910.........920.........930.........940.........950..
## .......960.........970.........980.........990........ 999.
##
## Done.
plot(K_TP_home.csr, . - r ~ r, xlab="d", ylab="K(d)-r")
Conclusion:
–> The observed line in black is above the envelope, hence we reject the null hypothesis.
–> The distribution of AirBnb listings that are of entire homes/ apartments at Tanjong Pagar are not randomly distributed.
–> The observed pattern resembles significant clustered pattern.
Ho = The distribution of AirBnb listings that are of hotel rooms at Tanjong Pagar are randomly distributed.
H1= The distribution of AirBnb listings that are of hotel rooms at Tanjong Pagar are not randomly distributed.
The 99% confidence interval will be used.
K_TP_hotel = Kest(TP_listings_hotel, correction = "Ripley")
plot(K_TP_hotel, . -r ~ r, ylab= "K(d)-r", xlab = "d(m)")
There are only 2 observations of hotel rooms as AirBnb listings at Tanjong Pagar.
To confirm the observed spatial patterns, a hypothesis test will be conducted.
Ho = The distribution of AirBnb listings that are of private rooms at Tanjong Pagar are randomly distributed.
H1= The distribution of AirBnb listings that are of private rooms at Tanjong Pagar are not randomly distributed.
The 99% confidence interval will be used.
K_TP_private = Kest(TP_listings_private, correction = "Ripley")
plot(K_TP_private, . -r ~ r, ylab= "K(d)-r", xlab = "d(m)")
K_TP_private.csr <- envelope(TP_listings_private, Kest, nsim = 999, rank = 1, glocal=TRUE)
## Generating 999 simulations of CSR ...
## 1, 2, 3, ......10.........20.........30.........40.........50.........60........
## .70.........80.........90.........100.........110.........120.........130......
## ...140.........150.........160.........170.........180.........190.........200....
## .....210.........220.........230.........240.........250.........260.........270..
## .......280.........290.........300.........310.........320.........330.........340
## .........350.........360.........370.........380.........390.........400........
## .410.........420.........430.........440.........450.........460.........470......
## ...480.........490.........500.........510.........520.........530.........540....
## .....550.........560.........570.........580.........590.........600.........610..
## .......620.........630.........640.........650.........660.........670.........680
## .........690.........700.........710.........720.........730.........740........
## .750.........760.........770.........780.........790.........800.........810......
## ...820.........830.........840.........850.........860.........870.........880....
## .....890.........900.........910.........920.........930.........940.........950..
## .......960.........970.........980.........990........ 999.
##
## Done.
plot(K_TP_private.csr, . - r ~ r, xlab="d", ylab="K(d)-r")
Conclusion:
–> The observed line in black is within the envelope, hence we do not reject the null hypothesis.
–> The distribution of AirBnb listings that are of private rooms at Tanjong Pagar are randomly distributed.
–> The observed pattern resembles CSR pattern.
ALJ_listings_home.km <- rescale(ALJ_listings_home, 1000, "km")
kde_ALJ_home <- density(ALJ_listings_home.km, sigma=0.1, edge=TRUE, kernel="gaussian")
gridded_kde_ALJ_home <- as.SpatialGridDataFrame.im(kde_ALJ_home)
spplot(gridded_kde_ALJ_home)
kde_ALJ_home_raster <- raster(gridded_kde_ALJ_home)
projection(kde_ALJ_home_raster) <- CRS("+init=EPSG:3414 +datum=WGS84 +units=km")
kde_ALJ_home_raster
## class : RasterLayer
## dimensions : 128, 128, 16384 (nrow, ncol, ncell)
## resolution : 0.01534011, 0.01585319 (x, y)
## extent : 32.60574, 34.56928, 31.88027, 33.90948 (xmin, xmax, ymin, ymax)
## crs : +init=EPSG:3414 +datum=WGS84 +units=km +proj=tmerc +lat_0=1.366666666666667 +lon_0=103.8333333333333 +k=1 +x_0=28001.642 +y_0=38744.572 +no_defs +ellps=WGS84 +towgs84=0,0,0
## source : memory
## names : v
## values : 2.004246e-07, 1444.006 (min, max)
ALJ_listings_hotel.km <- rescale(ALJ_listings_hotel, 1000, "km")
kde_ALJ_hotel <- density(ALJ_listings_hotel.km, sigma=0.1, edge=TRUE, kernel="gaussian")
gridded_kde_ALJ_hotel <- as.SpatialGridDataFrame.im(kde_ALJ_hotel)
spplot(gridded_kde_ALJ_hotel)
kde_ALJ_hotel_raster <- raster(gridded_kde_ALJ_hotel)
projection(kde_ALJ_hotel_raster) <- CRS("+init=EPSG:3414 +datum=WGS84 +units=km")
kde_ALJ_hotel_raster
## class : RasterLayer
## dimensions : 128, 128, 16384 (nrow, ncol, ncell)
## resolution : 0.01534011, 0.01585319 (x, y)
## extent : 32.60574, 34.56928, 31.88027, 33.90948 (xmin, xmax, ymin, ymax)
## crs : +init=EPSG:3414 +datum=WGS84 +units=km +proj=tmerc +lat_0=1.366666666666667 +lon_0=103.8333333333333 +k=1 +x_0=28001.642 +y_0=38744.572 +no_defs +ellps=WGS84 +towgs84=0,0,0
## source : memory
## names : v
## values : -5.075579e-15, 79.3737 (min, max)
ALJ_listings_private.km <- rescale(ALJ_listings_private, 1000, "km")
kde_ALJ_private <- density(ALJ_listings_private.km, sigma=0.1, edge=TRUE, kernel="gaussian")
gridded_kde_ALJ_private <- as.SpatialGridDataFrame.im(kde_ALJ_private)
spplot(gridded_kde_ALJ_private)
kde_ALJ_private_raster <- raster(gridded_kde_ALJ_private)
projection(kde_ALJ_private_raster) <- CRS("+init=EPSG:3414 +datum=WGS84 +units=km")
kde_ALJ_private_raster
## class : RasterLayer
## dimensions : 128, 128, 16384 (nrow, ncol, ncell)
## resolution : 0.01534011, 0.01585319 (x, y)
## extent : 32.60574, 34.56928, 31.88027, 33.90948 (xmin, xmax, ymin, ymax)
## crs : +init=EPSG:3414 +datum=WGS84 +units=km +proj=tmerc +lat_0=1.366666666666667 +lon_0=103.8333333333333 +k=1 +x_0=28001.642 +y_0=38744.572 +no_defs +ellps=WGS84 +towgs84=0,0,0
## source : memory
## names : v
## values : 2.354563e-06, 584.4013 (min, max)
BAL_listings_home.km <- rescale(BAL_listings_home, 1000, "km")
kde_BAL_home <- density(BAL_listings_home.km, sigma=0.1, edge=TRUE, kernel="gaussian")
gridded_kde_BAL_home <- as.SpatialGridDataFrame.im(kde_BAL_home)
spplot(gridded_kde_BAL_home)
kde_BAL_home_raster <- raster(gridded_kde_BAL_home)
projection(kde_BAL_home_raster) <- CRS("+init=EPSG:3414 +datum=WGS84 +units=km")
kde_BAL_home_raster
## class : RasterLayer
## dimensions : 128, 128, 16384 (nrow, ncol, ncell)
## resolution : 0.01893197, 0.01039581 (x, y)
## extent : 28.80786, 31.23115, 33.41793, 34.74859 (xmin, xmax, ymin, ymax)
## crs : +init=EPSG:3414 +datum=WGS84 +units=km +proj=tmerc +lat_0=1.366666666666667 +lon_0=103.8333333333333 +k=1 +x_0=28001.642 +y_0=38744.572 +no_defs +ellps=WGS84 +towgs84=0,0,0
## source : memory
## names : v
## values : -4.398289e-14, 1002.327 (min, max)
BAL_listings_hotel.km <- rescale(BAL_listings_hotel, 1000, "km")
kde_BAL_hotel <- density(BAL_listings_hotel.km, sigma=0.1, edge=TRUE, kernel="gaussian")
gridded_kde_BAL_hotel <- as.SpatialGridDataFrame.im(kde_BAL_hotel)
spplot(gridded_kde_BAL_hotel)
kde_BAL_hotel_raster <- raster(gridded_kde_BAL_hotel)
projection(kde_BAL_hotel_raster) <- CRS("+init=EPSG:3414 +datum=WGS84 +units=km")
kde_BAL_hotel_raster
## class : RasterLayer
## dimensions : 128, 128, 16384 (nrow, ncol, ncell)
## resolution : 0.01893197, 0.01039581 (x, y)
## extent : 28.80786, 31.23115, 33.41793, 34.74859 (xmin, xmax, ymin, ymax)
## crs : +init=EPSG:3414 +datum=WGS84 +units=km +proj=tmerc +lat_0=1.366666666666667 +lon_0=103.8333333333333 +k=1 +x_0=28001.642 +y_0=38744.572 +no_defs +ellps=WGS84 +towgs84=0,0,0
## source : memory
## names : v
## values : 5.518547e-07, 151.9367 (min, max)
BAL_listings_private.km <- rescale(BAL_listings_private, 1000, "km")
kde_BAL_private <- density(BAL_listings_private.km, sigma=0.1, edge=TRUE, kernel="gaussian")
gridded_kde_BAL_private <- as.SpatialGridDataFrame.im(kde_BAL_private)
spplot(gridded_kde_BAL_private)
kde_BAL_private_raster <- raster(gridded_kde_BAL_private)
projection(kde_BAL_private_raster) <- CRS("+init=EPSG:3414 +datum=WGS84 +units=km")
kde_BAL_private_raster
## class : RasterLayer
## dimensions : 128, 128, 16384 (nrow, ncol, ncell)
## resolution : 0.01893197, 0.01039581 (x, y)
## extent : 28.80786, 31.23115, 33.41793, 34.74859 (xmin, xmax, ymin, ymax)
## crs : +init=EPSG:3414 +datum=WGS84 +units=km +proj=tmerc +lat_0=1.366666666666667 +lon_0=103.8333333333333 +k=1 +x_0=28001.642 +y_0=38744.572 +no_defs +ellps=WGS84 +towgs84=0,0,0
## source : memory
## names : v
## values : 0.02583227, 163.5153 (min, max)
LAV_listings_home.km <- rescale(LAV_listings_home, 1000, "km")
kde_LAV_home <- density(LAV_listings_home.km, sigma=0.1, edge=TRUE, kernel="gaussian")
gridded_kde_LAV_home <- as.SpatialGridDataFrame.im(kde_LAV_home)
spplot(gridded_kde_LAV_home)
kde_LAV_home_raster <- raster(gridded_kde_LAV_home)
projection(kde_LAV_home_raster) <- CRS("+init=EPSG:3414 +datum=WGS84 +units=km")
kde_LAV_home_raster
## class : RasterLayer
## dimensions : 128, 128, 16384 (nrow, ncol, ncell)
## resolution : 0.008682154, 0.009355564 (x, y)
## extent : 30.34265, 31.45396, 32.0356, 33.23311 (xmin, xmax, ymin, ymax)
## crs : +init=EPSG:3414 +datum=WGS84 +units=km +proj=tmerc +lat_0=1.366666666666667 +lon_0=103.8333333333333 +k=1 +x_0=28001.642 +y_0=38744.572 +no_defs +ellps=WGS84 +towgs84=0,0,0
## source : memory
## names : v
## values : 0.2245951, 426.8348 (min, max)
LAV_listings_hotel.km <- rescale(LAV_listings_hotel, 1000, "km")
kde_LAV_hotel <- density(LAV_listings_hotel.km, sigma=0.1, edge=TRUE, kernel="gaussian")
gridded_kde_LAV_hotel <- as.SpatialGridDataFrame.im(kde_LAV_hotel)
spplot(gridded_kde_LAV_hotel)
kde_LAV_hotel_raster <- raster(gridded_kde_LAV_hotel)
projection(kde_LAV_hotel_raster) <- CRS("+init=EPSG:3414 +datum=WGS84 +units=km")
kde_LAV_hotel_raster
## class : RasterLayer
## dimensions : 128, 128, 16384 (nrow, ncol, ncell)
## resolution : 0.008682154, 0.009355564 (x, y)
## extent : 30.34265, 31.45396, 32.0356, 33.23311 (xmin, xmax, ymin, ymax)
## crs : +init=EPSG:3414 +datum=WGS84 +units=km +proj=tmerc +lat_0=1.366666666666667 +lon_0=103.8333333333333 +k=1 +x_0=28001.642 +y_0=38744.572 +no_defs +ellps=WGS84 +towgs84=0,0,0
## source : memory
## names : v
## values : 0.01563053, 191.7775 (min, max)
LAV_listings_private.km <- rescale(LAV_listings_private, 1000, "km")
kde_LAV_private <- density(LAV_listings_private.km, sigma=0.1, edge=TRUE, kernel="gaussian")
gridded_kde_LAV_private <- as.SpatialGridDataFrame.im(kde_LAV_private)
spplot(gridded_kde_LAV_private)
kde_LAV_private_raster <- raster(gridded_kde_LAV_private)
projection(kde_LAV_private_raster) <- CRS("+init=EPSG:3414 +datum=WGS84 +units=km")
kde_LAV_private_raster
## class : RasterLayer
## dimensions : 128, 128, 16384 (nrow, ncol, ncell)
## resolution : 0.008682154, 0.009355564 (x, y)
## extent : 30.34265, 31.45396, 32.0356, 33.23311 (xmin, xmax, ymin, ymax)
## crs : +init=EPSG:3414 +datum=WGS84 +units=km +proj=tmerc +lat_0=1.366666666666667 +lon_0=103.8333333333333 +k=1 +x_0=28001.642 +y_0=38744.572 +no_defs +ellps=WGS84 +towgs84=0,0,0
## source : memory
## names : v
## values : 5.711151, 1055.866 (min, max)
TP_listings_home.km <- rescale(TP_listings_home, 1000, "km")
kde_TP_home <- density(TP_listings_home.km, sigma=0.1, edge=TRUE, kernel="gaussian")
gridded_kde_TP_home <- as.SpatialGridDataFrame.im(kde_TP_home)
spplot(gridded_kde_TP_home)
kde_TP_home_raster <- raster(gridded_kde_TP_home)
projection(kde_TP_home_raster) <- CRS("+init=EPSG:3414 +datum=WGS84 +units=km")
kde_TP_home_raster
## class : RasterLayer
## dimensions : 128, 128, 16384 (nrow, ncol, ncell)
## resolution : 0.003758669, 0.004986962 (x, y)
## extent : 29.16913, 29.65024, 28.43025, 29.06858 (xmin, xmax, ymin, ymax)
## crs : +init=EPSG:3414 +datum=WGS84 +units=km +proj=tmerc +lat_0=1.366666666666667 +lon_0=103.8333333333333 +k=1 +x_0=28001.642 +y_0=38744.572 +no_defs +ellps=WGS84 +towgs84=0,0,0
## source : memory
## names : v
## values : 12.33845, 1615.645 (min, max)
TP_listings_hotel.km <- rescale(TP_listings_hotel, 1000, "km")
kde_TP_hotel <- density(TP_listings_hotel.km, sigma=0.1, edge=TRUE, kernel="gaussian")
gridded_kde_TP_hotel <- as.SpatialGridDataFrame.im(kde_TP_hotel)
spplot(gridded_kde_TP_hotel)
kde_TP_hotel_raster <- raster(gridded_kde_TP_hotel)
projection(kde_TP_hotel_raster) <- CRS("+init=EPSG:3414 +datum=WGS84 +units=km")
kde_TP_hotel_raster
## class : RasterLayer
## dimensions : 128, 128, 16384 (nrow, ncol, ncell)
## resolution : 0.003758669, 0.004986962 (x, y)
## extent : 29.16913, 29.65024, 28.43025, 29.06858 (xmin, xmax, ymin, ymax)
## crs : +init=EPSG:3414 +datum=WGS84 +units=km +proj=tmerc +lat_0=1.366666666666667 +lon_0=103.8333333333333 +k=1 +x_0=28001.642 +y_0=38744.572 +no_defs +ellps=WGS84 +towgs84=0,0,0
## source : memory
## names : v
## values : 0.0008411488, 27.33706 (min, max)
TP_listings_private.km <- rescale(TP_listings_private, 1000, "km")
kde_TP_private <- density(TP_listings_private.km, sigma=0.1, edge=TRUE, kernel="gaussian")
gridded_kde_TP_private <- as.SpatialGridDataFrame.im(kde_TP_private)
spplot(gridded_kde_TP_private)
kde_TP_private_raster <- raster(gridded_kde_TP_private)
projection(kde_TP_private_raster) <- CRS("+init=EPSG:3414 +datum=WGS84 +units=km")
kde_TP_private_raster
## class : RasterLayer
## dimensions : 128, 128, 16384 (nrow, ncol, ncell)
## resolution : 0.003758669, 0.004986962 (x, y)
## extent : 29.16913, 29.65024, 28.43025, 29.06858 (xmin, xmax, ymin, ymax)
## crs : +init=EPSG:3414 +datum=WGS84 +units=km +proj=tmerc +lat_0=1.366666666666667 +lon_0=103.8333333333333 +k=1 +x_0=28001.642 +y_0=38744.572 +no_defs +ellps=WGS84 +towgs84=0,0,0
## source : memory
## names : v
## values : 20.49776, 193.2663 (min, max)
tm_shape(sg)+
tm_borders(alpha = 0.5) +
tm_shape(kde_ALJ_home_raster) +
tm_raster("v", alpha=0.6,
palette = "YlOrRd") +
tm_shape(kde_BAL_home_raster) +
tm_raster("v", alpha=0.6,
palette = "YlOrRd") +
tm_shape(kde_LAV_home_raster) +
tm_raster("v", alpha=0.6,
palette = "YlOrRd") +
tm_shape(kde_TP_home_raster) +
tm_raster("v", alpha=0.6,
palette = "YlOrRd")
## Warning: The shape sg is invalid. See sf::st_is_valid
From the map:
–> Tanjong Pagar is very dense with AirBnb listings of entire homes/ apartments as compared to other subzones. One reason for such a pattern to be observed is that tourists on long business trips may want to look for Airbnb listings near the Central Business District for ease of accessibility and have the convenience of having an entire home to themselves for their stay.
tm_shape(sg)+
tm_borders(alpha = 0.5) +
tm_shape(kde_ALJ_hotel_raster) +
tm_raster("v", alpha=0.8,
palette = "YlOrRd") +
tm_shape(kde_BAL_hotel_raster) +
tm_raster("v", alpha=0.8,
palette = "YlOrRd") +
tm_shape(kde_LAV_hotel_raster) +
tm_raster("v", alpha=0.8,
palette = "YlOrRd") +
tm_shape(kde_TP_hotel_raster) +
tm_raster("v", alpha=0.8,
palette = "YlOrRd")
## Warning: The shape sg is invalid. See sf::st_is_valid
From the map:
–> AirBnb listings of hotel rooms are most dense in Lavender. This can be due to Lavender being a residential area in the city, hence offering more hotel rooms as compared to the other subzones.
tm_shape(sg)+
tm_borders(alpha = 0.5) +
tm_shape(kde_ALJ_home_raster) +
tm_raster("v", alpha=0.8,
palette = "YlOrRd") +
tm_shape(kde_BAL_home_raster) +
tm_raster("v", alpha=0.8,
palette = "YlOrRd") +
tm_shape(kde_LAV_home_raster) +
tm_raster("v", alpha=0.8,
palette = "YlOrRd") +
tm_shape(kde_TP_home_raster) +
tm_raster("v", alpha=0.8,
palette = "YlOrRd")
## Warning: The shape sg is invalid. See sf::st_is_valid
From the map:
–> AirBnb listings of private rooms are most dense in Lavender. This can be due to Lavender being a residential area in the city, hence offering more private rooms as compared to the other subzones.
tmap_mode('plot')
## tmap mode set to plotting
Aljunied, Lavender and Balestier have are more dense in terms of listings by room type as compared to Tanjong Pagar.
This may be because Tanjong Pagar is significantly smaller in size as compared to the other subzones.
This may also be because Aljunied, Balestier and Lavender are closer to popular tourists spots towards the South of Singapore as compared to Tanjong Pagar. Tanjong Pagar is located in the Central Business District where most of the offices are. Therefore, there are more AirBnb listings for each room type in Aljunied, Balestier and Lavender as compared to Tanjong Pagar due to the increased ease of accessibility.