Overview

In this take-home exercise, I will be analysing the distribution of Airbnb Airbnb listing by using appropriate spatial point patterns analysis techniques. The analysis will be conducted on a nation-wide level and subzone level.

Data

  1. The listing data set of Inside Airbnb will be used. This data set is downloaded from Inside Airbnb (http://insideairbnb.com/get-the-data.html)

  2. Singapore coastal outline boundary from Singapore Land Authorithy (SLA) (i.e. CostalOutline). It is in ESRI shapefile format.

  3. URA Planning Subzone boundary data (i.e. MP14_SUBZONE_WEB_PL). It is in ESRI shapefile format.

Loading in required packages

packages <- c('rgdal', 'maptools', 'raster','spatstat', 'tmap', 'sf','tidyverse','tmaptools','cartography')
for (p in packages){
if(!require(p, character.only = T)){
install.packages(p)
}
library(p,character.only = T)
}
## Loading required package: rgdal
## Loading required package: sp
## rgdal: version: 1.4-8, (SVN revision 845)
##  Geospatial Data Abstraction Library extensions to R successfully loaded
##  Loaded GDAL runtime: GDAL 2.2.3, released 2017/11/20
##  Path to GDAL shared files: C:/Users/vanes/Documents/R/win-library/3.6/rgdal/gdal
##  GDAL binary built with GEOS: TRUE 
##  Loaded PROJ.4 runtime: Rel. 4.9.3, 15 August 2016, [PJ_VERSION: 493]
##  Path to PROJ.4 shared files: C:/Users/vanes/Documents/R/win-library/3.6/rgdal/proj
##  Linking to sp version: 1.4-1
## Loading required package: maptools
## Checking rgeos availability: TRUE
## Loading required package: raster
## Loading required package: spatstat
## Loading required package: spatstat.data
## Loading required package: nlme
## 
## Attaching package: 'nlme'
## The following object is masked from 'package:raster':
## 
##     getData
## Loading required package: rpart
## 
## spatstat 1.64-1       (nickname: 'Help you I can, yes!') 
## For an introduction to spatstat, type 'beginner'
## 
## Attaching package: 'spatstat'
## The following objects are masked from 'package:raster':
## 
##     area, rotate, shift
## Loading required package: tmap
## Loading required package: sf
## Linking to GEOS 3.8.0, GDAL 3.0.4, PROJ 6.3.1
## Loading required package: tidyverse
## Registered S3 method overwritten by 'cli':
##   method     from    
##   print.boxx spatstat
## -- Attaching packages ------- tidyverse 1.3.0 --
## v ggplot2 3.3.0     v purrr   0.3.4
## v tibble  3.0.1     v dplyr   0.8.5
## v tidyr   1.0.3     v stringr 1.4.0
## v readr   1.3.1     v forcats 0.5.0
## -- Conflicts ---------- tidyverse_conflicts() --
## x dplyr::collapse() masks nlme::collapse()
## x tidyr::extract()  masks raster::extract()
## x dplyr::filter()   masks stats::filter()
## x dplyr::lag()      masks stats::lag()
## x dplyr::select()   masks raster::select()
## Loading required package: tmaptools
## Loading required package: cartography

Importing Coastal data and performing projection and validity checks

sg <- readOGR(dsn = "data/geospatial", layer="CostalOutline")
## OGR data source with driver: ESRI Shapefile 
## Source: "C:\IS415\take home exercise\take home exercise 2\data\geospatial", layer: "CostalOutline"
## with 60 features
## It has 4 fields
sg_sp <- as(sg, "SpatialPolygons")
class(sg_sp)
## [1] "SpatialPolygons"
## attr(,"package")
## [1] "sp"
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

Importing subzone data, performing projection and validity checks

subzone <- readOGR(dsn = "data/geospatial", layer="MP14_SUBZONE_WEB_PL")
## OGR data source with driver: ESRI Shapefile 
## Source: "C:\IS415\take home exercise\take home exercise 2\data\geospatial", layer: "MP14_SUBZONE_WEB_PL"
## with 323 features
## It has 15 fields
subzone <- st_as_sf(subzone)
any(is.na(subzone))
## [1] FALSE
test <- st_is_valid(subzone)
length(which(test==FALSE))
## [1] 9
subzone <- st_transform(subzone, crs= 3414) 
subzone <- st_make_valid(subzone)
crs(subzone)
## [1] "+proj=tmerc +lat_0=1.36666666666667 +lon_0=103.833333333333 +k=1 +x_0=28001.642 +y_0=38744.572 +ellps=WGS84 +towgs84=0,0,0,0,0,0,0 +units=m +no_defs"

Selecting polygons to be removed

subzone <-subzone[!subzone$SUBZONE_N=="CENTRAL WATER CATCHMENT",] 

subzone <-subzone[!subzone$SUBZONE_N=="WESTERN WATER CATCHMENT",]
subzone <-subzone[!subzone$SUBZONE_N=="TUAS VIEW EXTENSION",] # Not built yet
subzone <- as(subzone, "Spatial") 
class(subzone)
## [1] "SpatialPolygonsDataFrame"
## attr(,"package")
## [1] "sp"

Importing listings data and performing validity checks

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()
## )
listings[rowSums(is.na(listings))!=0,]
## # A tibble: 2,826 x 16
##        id name  host_id host_name neighbourhood_g~ neighbourhood latitude
##     <dbl> <chr>   <dbl> <chr>     <chr>            <chr>            <dbl>
##  1 1.18e5 Priv~  448620 Lynnity   North-East Regi~ Sengkang          1.39
##  2 3.56e5 Doub~ 1759905 Aresha    Central Region   Geylang           1.31
##  3 4.82e5 Mast~ 2386154 Susan     East Region      Tampines          1.35
##  4 6.43e5 BEST~ 3212572 Roger     Central Region   Rochor            1.30
##  5 7.20e5 HDB ~ 3648224 Audrey    Central Region   Queenstown        1.31
##  6 7.34e5 Home~ 3824517 Shirlnet  North-East Regi~ Serangoon         1.37
##  7 7.56e5 Bedr~ 3981177 Sharon    East Region      Pasir Ris         1.38
##  8 7.68e5 Comm~ 4053150 Immellym~ North-East Regi~ Punggol           1.40
##  9 8.24e5 Apar~ 4177147 Tania     East Region      Bedok             1.31
## 10 1.56e6 Delu~ 8270362 Domus     Central Region   Novena            1.32
## # ... with 2,816 more rows, and 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>
listings$reviews_per_month[is.na(listings$reviews_per_month)] <- 0
listings$host_name[is.na(listings$host_name)] <- "Unknown"
listings$name[is.na(listings$name)] <- "Unknown"
listings_sf <- st_as_sf(listings, 
                       coords = c("longitude", "latitude"), crs=4326) 
test <- st_is_valid(listings_sf)
length(which(test==FALSE))
## [1] 0
listings_sf[rowSums(is.na(listings_sf))!=0,]
## Simple feature collection with 2812 features and 14 fields
## geometry type:  POINT
## dimension:      XY
## bbox:           xmin: 103.6782 ymin: 1.24387 xmax: 103.9717 ymax: 1.45459
## geographic CRS: WGS 84
## # A tibble: 2,812 x 15
##        id name  host_id host_name neighbourhood_g~ neighbourhood room_type price
##     <dbl> <chr>   <dbl> <chr>     <chr>            <chr>         <chr>     <dbl>
##  1 1.18e5 Priv~  448620 Lynnity   North-East Regi~ Sengkang      Private ~    67
##  2 3.56e5 Doub~ 1759905 Aresha    Central Region   Geylang       Private ~    80
##  3 4.82e5 Mast~ 2386154 Susan     East Region      Tampines      Private ~    38
##  4 6.43e5 BEST~ 3212572 Roger     Central Region   Rochor        Private ~   174
##  5 7.20e5 HDB ~ 3648224 Audrey    Central Region   Queenstown    Shared r~   217
##  6 7.34e5 Home~ 3824517 Shirlnet  North-East Regi~ Serangoon     Private ~    26
##  7 7.56e5 Bedr~ 3981177 Sharon    East Region      Pasir Ris     Private ~   206
##  8 7.68e5 Comm~ 4053150 Immellym~ North-East Regi~ Punggol       Private ~   174
##  9 8.24e5 Apar~ 4177147 Tania     East Region      Bedok         Private ~   290
## 10 1.56e6 Delu~ 8270362 Domus     Central Region   Novena        Private ~    30
## # ... with 2,802 more rows, and 7 more variables: minimum_nights <dbl>,
## #   number_of_reviews <dbl>, last_review <date>, reviews_per_month <dbl>,
## #   calculated_host_listings_count <dbl>, availability_365 <dbl>,
## #   geometry <POINT [°]>
listings_sf <- listings_sf %>% select(room_type)
listings_sp <- as_Spatial(listings_sf)
listings_sp$room_type <- as.factor(listings_sp$room_type)
listings_sp <-spTransform(listings_sp, CRS("+init=epsg:3414"))
class(listings_sp)
## [1] "SpatialPointsDataFrame"
## attr(,"package")
## [1] "sp"

Load Openstreetmap

sg_map<-getTiles(x = listings_sf, type = "osm")

Overview of listings data

room_type <- table(listings_sf$room_type)
barplot(room_type, main="Listings by Room Type",
xlab="Room Type",
ylab="Count")

Mapping the geospatial layers

tmap_mode("plot")
## tmap mode set to plotting
tm_basemap("OpenStreetMap")+
  tm_shape(listings_sf)+
  tm_dots(col = "room_type", alpha = 0.7, id = "neighbourhood")

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

We can see that entire homes an private rooms take up the majority of listing types. This may be due to the affordability compared to hotel rooms and a more private experience compared to shared rooms. We will look at this further in the later parts of this study.

Section A:Nation-wide analysis

Mapping the geospatial layers

tmap_mode("plot")
## tmap mode set to plotting
tm_shape(sg_map)+ 
  tm_layout(legend.outside = TRUE)+
  tm_rgb()+
tm_shape(subzone)+
  tm_borders(alpha=0.5, col = "black", lwd = 1)+
tm_shape(listings_sp)+
  tm_dots(col = "room_type",
          alpha=0.7,
          size = 0.1,
          border.col = "black",
          border.lwd = 5,
          palette=c("red","blue","yellow","green"))+
  tm_facets(by="room_type")
## Warning: Raster values found that are outside the range [0, 255]
## Warning in CPL_crs_from_input(x): GDAL Message 1: +init=epsg:XXXX syntax is
## deprecated. It might return a CRS with a non-EPSG compliant axis order.

Hotel Rooms

For hotel rooms , we can see that they are located mainly in the central areas such as Balestier and Raffles Place with a few in the Northeast, SouthEast and SouthWest.

Entire Homes/Apartment

For entire homes, we can see that they are all around Singapore and are significant in numbers.They are mainly located in the central areas such as Tanjong Pagar and Geylang.

Shared room

For shared rooms, they are scattered sparsely around Singapore and are located mainly in central areas such as Chinatown and Bugis.

Private rooms

There is a significant number of private rooms located all around Singapore. They are more commonly located in central areas such as Little India and Kallang,

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

Converting the generic sp format into spatstat’s ppp format

listings_ppp <- as(listings_sp, "ppp")
listings_ppp
## Marked planar point pattern: 7713 points
## Multitype, with levels = 
##    Entire home/apt Hotel room Private room Shared room
## window: rectangle = [7215.57, 43401.32] x [25166.35, 48466.72] units

Handling duplicate points

any(duplicated(listings_ppp))
## [1] TRUE
sum(multiplicity(listings_ppp) > 1)
## [1] 230
listings_ppp_jit <- rjitter(listings_ppp, retry=TRUE, nsim=1, drop=TRUE)
plot(listings_ppp_jit)

any(duplicated(listings_ppp_jit))
## [1] FALSE

Creating owin

We should confine the analysis with a geographical area like Singapore boundary. In spatstat, an object called owin is specially designed to represent this polygonal region.

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

summary(sg_owin)
## Window: polygonal boundary
## 390 separate polygons (31 holes)
##                    vertices         area relative.area
## polygon 1               156  1.63038e+06      2.52e-03
## polygon 2               305  5.59816e+05      8.65e-04
## polygon 3                47  1.60807e+05      2.48e-04
## polygon 4                47  5.95429e+05      9.20e-04
## polygon 5                48  3.87429e+05      5.98e-04
## polygon 6                59  1.03038e+06      1.59e-03
## polygon 7                83  5.51732e+05      8.52e-04
## polygon 8                70  2.90185e+05      4.48e-04
## polygon 9               217  1.08479e+06      1.68e-03
## polygon 10               42  6.31644e+05      9.76e-04
## polygon 11              226  1.82685e+06      2.82e-03
## polygon 12               53  2.93706e+05      4.54e-04
## polygon 13              256  1.84406e+06      2.85e-03
## polygon 14              165  3.92563e+05      6.06e-04
## polygon 15              240  5.06589e+05      7.83e-04
## polygon 16             1151  3.30122e+07      5.10e-02
## polygon 17 (hole)        26 -1.25665e+03     -1.94e-06
## polygon 18              478  2.06120e+06      3.18e-03
## polygon 19              266  1.50631e+06      2.33e-03
## polygon 20               65  8.42861e+04      1.30e-04
## polygon 21               47  3.82087e+04      5.90e-05
## polygon 22               22  6.74651e+03      1.04e-05
## polygon 23              234  2.08755e+06      3.22e-03
## polygon 24              227  1.10308e+06      1.70e-03
## polygon 25              145  9.61782e+05      1.49e-03
## polygon 26               19  3.09221e+04      4.78e-05
## polygon 27               37  1.29481e+04      2.00e-05
## polygon 28               10  6.60195e+03      1.02e-05
## polygon 29               30  4.28933e+03      6.63e-06
## polygon 30                4  9.47108e+01      1.46e-07
## polygon 31             1045  4.44510e+06      6.87e-03
## polygon 32 (hole)        13 -3.91907e+02     -6.05e-07
## polygon 33              234  4.72886e+05      7.31e-04
## polygon 34               15  4.03300e+04      6.23e-05
## polygon 35               14  5.86546e+03      9.06e-06
## polygon 36               64  3.43149e+04      5.30e-05
## polygon 37 (hole)         3 -5.12482e-03     -7.92e-12
## polygon 38 (hole)         3 -1.96410e-03     -3.03e-12
## polygon 39 (hole)         3 -1.98390e-03     -3.06e-12
## polygon 40 (hole)         3 -5.55856e-03     -8.59e-12
## polygon 41 (hole)         4 -1.13774e-02     -1.76e-11
## polygon 42                6  4.50259e+02      6.96e-07
## polygon 43              155  2.67502e+05      4.13e-04
## polygon 44              211  4.70521e+05      7.27e-04
## polygon 45               10  4.90942e+02      7.58e-07
## polygon 46                4  2.69313e+02      4.16e-07
## polygon 47               95  5.96187e+04      9.21e-05
## polygon 48 (hole)         4 -1.86410e-02     -2.88e-11
## polygon 49             1027  1.27782e+06      1.97e-03
## polygon 50 (hole)         3 -3.23310e-04     -4.99e-13
## polygon 51 (hole)         3 -1.16959e-03     -1.81e-12
## polygon 52 (hole)         3 -1.46474e-03     -2.26e-12
## polygon 53              132  9.53357e+04      1.47e-04
## polygon 54               75  1.73526e+04      2.68e-05
## polygon 55              106  3.04104e+03      4.70e-06
## polygon 56               83  5.28920e+03      8.17e-06
## polygon 57             1468  4.87083e+06      7.52e-03
## polygon 58 (hole)         7 -1.40545e-01     -2.17e-10
## polygon 59 (hole)        12 -8.36709e+01     -1.29e-07
## polygon 60              148  3.10395e+03      4.79e-06
## polygon 61              142  3.22293e+03      4.98e-06
## polygon 62               45  2.51218e+03      3.88e-06
## polygon 63               40  1.38607e+04      2.14e-05
## polygon 64              430  3.44964e+06      5.33e-03
## polygon 65               85  1.03238e+05      1.59e-04
## polygon 66              104  1.12730e+06      1.74e-03
## polygon 67                3  6.12658e-02      9.46e-11
## polygon 68              775  2.70301e+06      4.18e-03
## polygon 69 (hole)        20 -4.39069e+00     -6.78e-09
## polygon 70 (hole)        28 -1.99862e+01     -3.09e-08
## polygon 71 (hole)        48 -1.38338e+02     -2.14e-07
## polygon 72 (hole)       351 -1.21433e+03     -1.88e-06
## polygon 73               53  2.76827e+05      4.28e-04
## polygon 74              115  6.36650e+04      9.83e-05
## polygon 75               84  1.96620e+05      3.04e-04
## polygon 76               33  3.65333e+05      5.64e-04
## polygon 77              106  1.45483e+06      2.25e-03
## polygon 78              133  8.53207e+05      1.32e-03
## polygon 79              196  1.07072e+06      1.65e-03
## polygon 80               47  5.33017e+05      8.23e-04
## polygon 81               82  4.42503e+05      6.84e-04
## polygon 82              222  9.31404e+04      1.44e-04
## polygon 83               37  4.11723e+05      6.36e-04
## polygon 84              230  5.87223e+05      9.07e-04
## polygon 85               35  3.94379e+04      6.09e-05
## polygon 86               96  1.88767e+05      2.92e-04
## polygon 87               59  1.33007e+05      2.05e-04
## polygon 88               47  4.48128e+05      6.92e-04
## polygon 89               31  5.21201e+05      8.05e-04
## polygon 90               17  3.50788e+05      5.42e-04
## polygon 91               54  2.61844e+05      4.04e-04
## polygon 92              240  1.59034e+06      2.46e-03
## polygon 93              298  8.86955e+05      1.37e-03
## polygon 94              190  2.23207e+05      3.45e-04
## polygon 95              143  2.00053e+05      3.09e-04
## polygon 96              169  7.10569e+05      1.10e-03
## polygon 97               34  7.48684e+05      1.16e-03
## polygon 98              192  5.91779e+05      9.14e-04
## polygon 99              178  1.75595e+06      2.71e-03
## polygon 100             193  3.40743e+05      5.26e-04
## polygon 101             219  3.29438e+05      5.09e-04
## polygon 102              88  1.70664e+05      2.64e-04
## polygon 103             173  3.68483e+05      5.69e-04
## polygon 104             294  7.60189e+06      1.17e-02
## polygon 105             243  2.21973e+05      3.43e-04
## polygon 106             130  2.80175e+05      4.33e-04
## polygon 107             141  2.14250e+05      3.31e-04
## polygon 108              83  1.73122e+05      2.67e-04
## polygon 109              92  5.33671e+05      8.24e-04
## polygon 110              95  1.45519e+05      2.25e-04
## polygon 111              55  6.35704e+05      9.82e-04
## polygon 112              54  5.03221e+05      7.77e-04
## polygon 113              48  5.56813e+04      8.60e-05
## polygon 114              60  1.16330e+05      1.80e-04
## polygon 115             137  2.05165e+06      3.17e-03
## polygon 116             122  2.43459e+06      3.76e-03
## polygon 117             114  1.71362e+06      2.65e-03
## polygon 118              55  3.10514e+05      4.80e-04
## polygon 119              95  1.38664e+06      2.14e-03
## polygon 120             127  1.95187e+06      3.02e-03
## polygon 121             266  4.52472e+05      6.99e-04
## polygon 122              79  6.97502e+05      1.08e-03
## polygon 123             119  1.71721e+05      2.65e-04
## polygon 124             277  1.09783e+06      1.70e-03
## polygon 125             136  1.05349e+06      1.63e-03
## polygon 126             304  2.79601e+06      4.32e-03
## polygon 127 (hole)        3 -2.18000e-06     -3.37e-15
## polygon 128             556  3.04972e+06      4.71e-03
## polygon 129 (hole)        3 -6.62377e-01     -1.02e-09
## polygon 130 (hole)        3 -2.09065e-03     -3.23e-12
## polygon 131             139  3.36221e+05      5.19e-04
## polygon 132              62  7.41438e+05      1.15e-03
## polygon 133             322  4.60550e+05      7.11e-04
## polygon 134             199  5.43484e+05      8.40e-04
## polygon 135              52  2.78304e+05      4.30e-04
## polygon 136             544  1.76950e+06      2.73e-03
## polygon 137             150  3.85093e+05      5.95e-04
## polygon 138             120  5.58761e+05      8.63e-04
## polygon 139              88  5.67581e+06      8.77e-03
## polygon 140             212  2.09609e+06      3.24e-03
## polygon 141              89  7.22589e+05      1.12e-03
## polygon 142             279  2.55046e+06      3.94e-03
## polygon 143              34  2.04263e+06      3.16e-03
## polygon 144              70  3.26040e+06      5.04e-03
## polygon 145             216  1.34615e+06      2.08e-03
## polygon 146              25  1.71334e+05      2.65e-04
## polygon 147              84  4.96260e+04      7.67e-05
## polygon 148             199  1.93992e+05      3.00e-04
## polygon 149              77  1.20171e+05      1.86e-04
## polygon 150             272  8.50854e+05      1.31e-03
## polygon 151              99  1.02647e+06      1.59e-03
## polygon 152             154  1.67537e+05      2.59e-04
## polygon 153              81  1.16002e+06      1.79e-03
## polygon 154              32  2.56100e+06      3.96e-03
## polygon 155             112  7.35502e+05      1.14e-03
## polygon 156             124  9.48159e+05      1.46e-03
## polygon 157             134  1.32109e+06      2.04e-03
## polygon 158              59  2.99731e+06      4.63e-03
## polygon 159             123  1.37683e+06      2.13e-03
## polygon 160             129  1.92662e+06      2.98e-03
## polygon 161             522  3.20331e+06      4.95e-03
## polygon 162              93  2.34938e+06      3.63e-03
## polygon 163              85  9.63199e+05      1.49e-03
## polygon 164              36  4.85022e+05      7.49e-04
## polygon 165              82  1.88131e+06      2.91e-03
## polygon 166             103  1.42508e+06      2.20e-03
## polygon 167              60  2.38728e+06      3.69e-03
## polygon 168             114  1.07899e+06      1.67e-03
## polygon 169              71  4.59546e+05      7.10e-04
## polygon 170              91  2.47888e+05      3.83e-04
## polygon 171             107  2.13582e+05      3.30e-04
## polygon 172             207  2.47266e+06      3.82e-03
## polygon 173 (hole)        3 -4.95057e-02     -7.65e-11
## polygon 174 (hole)        3 -3.65501e-03     -5.65e-12
## polygon 175 (hole)       36 -7.79904e+03     -1.20e-05
## polygon 176               4  1.41753e-02      2.19e-11
## polygon 177             579  1.94069e+06      3.00e-03
## polygon 178 (hole)        4 -2.05611e-02     -3.18e-11
## polygon 179             349  2.11850e+06      3.27e-03
## polygon 180             109  4.85047e+05      7.49e-04
## polygon 181             102  7.57908e+05      1.17e-03
## polygon 182             120  3.51242e+05      5.43e-04
## polygon 183              69  1.31292e+06      2.03e-03
## polygon 184 (hole)        3 -3.99521e-02     -6.17e-11
## polygon 185              63  9.46651e+05      1.46e-03
## polygon 186             100  7.48043e+05      1.16e-03
## polygon 187             111  1.02229e+06      1.58e-03
## polygon 188              95  4.10995e+05      6.35e-04
## polygon 189              73  8.39489e+05      1.30e-03
## polygon 190             173  1.22849e+06      1.90e-03
## polygon 191              43  5.54624e+05      8.57e-04
## polygon 192             130  3.39290e+06      5.24e-03
## polygon 193              97  1.87809e+06      2.90e-03
## polygon 194              40  8.67750e+05      1.34e-03
## polygon 195              55  6.39144e+05      9.87e-04
## polygon 196              39  3.26015e+06      5.04e-03
## polygon 197              54  4.11404e+05      6.36e-04
## polygon 198              75  4.18657e+05      6.47e-04
## polygon 199             104  2.09818e+06      3.24e-03
## polygon 200              92  1.52455e+06      2.36e-03
## polygon 201              79  8.13383e+05      1.26e-03
## polygon 202              94  1.48430e+06      2.29e-03
## polygon 203             118  3.10802e+06      4.80e-03
## polygon 204              97  1.03728e+06      1.60e-03
## polygon 205             157  2.82017e+06      4.36e-03
## polygon 206              53  9.24762e+05      1.43e-03
## polygon 207             118  1.80655e+06      2.79e-03
## polygon 208              64  1.40454e+06      2.17e-03
## polygon 209              91  2.37933e+06      3.68e-03
## polygon 210             111  2.07780e+06      3.21e-03
## polygon 211             134  3.14295e+06      4.86e-03
## polygon 212             195  2.63648e+06      4.07e-03
## polygon 213              80  1.05717e+06      1.63e-03
## polygon 214              56  1.28795e+06      1.99e-03
## polygon 215              69  4.39647e+05      6.79e-04
## polygon 216              51  7.46882e+05      1.15e-03
## polygon 217              61  4.46242e+05      6.89e-04
## polygon 218              72  5.72502e+05      8.84e-04
## polygon 219             152  2.95937e+06      4.57e-03
## polygon 220             119  2.15829e+06      3.33e-03
## polygon 221             140  1.34746e+06      2.08e-03
## polygon 222              60  2.33891e+06      3.61e-03
## polygon 223             111  4.29714e+06      6.64e-03
## polygon 224             105  9.91040e+05      1.53e-03
## polygon 225             202  2.04955e+06      3.17e-03
## polygon 226             127  2.57909e+06      3.98e-03
## polygon 227              91  3.18758e+06      4.92e-03
## polygon 228              40  9.06317e+05      1.40e-03
## polygon 229              41  3.80202e+05      5.87e-04
## polygon 230              93  5.26383e+05      8.13e-04
## polygon 231              77  8.00299e+05      1.24e-03
## polygon 232             124  8.98561e+05      1.39e-03
## polygon 233             172  1.79346e+06      2.77e-03
## polygon 234             378  3.18810e+06      4.92e-03
## polygon 235              85  4.94504e+05      7.64e-04
## polygon 236              79  1.06189e+06      1.64e-03
## polygon 237              75  1.79446e+06      2.77e-03
## polygon 238              96  3.47521e+06      5.37e-03
## polygon 239              74  1.22567e+06      1.89e-03
## polygon 240             139  1.97437e+06      3.05e-03
## polygon 241             159  1.08508e+06      1.68e-03
## polygon 242              90  1.96413e+06      3.03e-03
## polygon 243              43  1.97494e+06      3.05e-03
## polygon 244             141  4.14132e+06      6.40e-03
## polygon 245             164  4.33982e+06      6.70e-03
## polygon 246             131  1.79606e+06      2.77e-03
## polygon 247             130  2.25116e+06      3.48e-03
## polygon 248             124  7.76142e+05      1.20e-03
## polygon 249             105  2.20631e+06      3.41e-03
## polygon 250             107  1.18013e+06      1.82e-03
## polygon 251              73  1.22989e+06      1.90e-03
## polygon 252             101  9.64683e+05      1.49e-03
## polygon 253              75  1.26341e+06      1.95e-03
## polygon 254              51  3.69771e+05      5.71e-04
## polygon 255              83  3.20366e+06      4.95e-03
## polygon 256              96  1.10727e+06      1.71e-03
## polygon 257              81  1.28739e+06      1.99e-03
## polygon 258              32  8.42668e+05      1.30e-03
## polygon 259              61  1.33353e+06      2.06e-03
## polygon 260              50  1.00741e+06      1.56e-03
## polygon 261             147  8.94516e+05      1.38e-03
## polygon 262              76  9.11208e+05      1.41e-03
## polygon 263              43  1.14381e+06      1.77e-03
## polygon 264              95  1.32888e+06      2.05e-03
## polygon 265             111  6.09895e+05      9.42e-04
## polygon 266              66  7.63183e+05      1.18e-03
## polygon 267             164  2.76835e+06      4.28e-03
## polygon 268             134  3.46704e+06      5.36e-03
## polygon 269             401  7.83399e+06      1.21e-02
## polygon 270              80  2.77864e+06      4.29e-03
## polygon 271              54  8.62737e+05      1.33e-03
## polygon 272             105  1.58344e+06      2.45e-03
## polygon 273              43  8.46137e+05      1.31e-03
## polygon 274             122  1.74439e+06      2.69e-03
## polygon 275              89  1.00159e+06      1.55e-03
## polygon 276              82  1.09730e+06      1.70e-03
## polygon 277             251  4.84852e+06      7.49e-03
## polygon 278              53  6.68454e+05      1.03e-03
## polygon 279              69  6.24878e+05      9.65e-04
## polygon 280              85  6.74992e+05      1.04e-03
## polygon 281             123  2.33068e+06      3.60e-03
## polygon 282              68  1.09321e+06      1.69e-03
## polygon 283              83  1.86187e+06      2.88e-03
## polygon 284              45  9.09419e+05      1.40e-03
## polygon 285             108  2.11479e+06      3.27e-03
## polygon 286             204  3.33419e+06      5.15e-03
## polygon 287              59  1.51553e+06      2.34e-03
## polygon 288              60  9.44998e+05      1.46e-03
## polygon 289             189  1.99079e+06      3.08e-03
## polygon 290              83  1.64141e+06      2.54e-03
## polygon 291             173  1.65255e+05      2.55e-04
## polygon 292              91  1.49663e+04      2.31e-05
## polygon 293              71  8.18750e+03      1.26e-05
## polygon 294              83  2.25924e+06      3.49e-03
## polygon 295             221  3.86032e+06      5.96e-03
## polygon 296              58  8.59179e+05      1.33e-03
## polygon 297              63  5.46404e+05      8.44e-04
## polygon 298              71  1.94861e+06      3.01e-03
## polygon 299              87  1.07862e+06      1.67e-03
## polygon 300              99  6.87930e+05      1.06e-03
## polygon 301             151  3.02315e+06      4.67e-03
## polygon 302              35  4.41733e+05      6.82e-04
## polygon 303              62  9.70068e+05      1.50e-03
## polygon 304              93  1.23590e+06      1.91e-03
## polygon 305             100  1.63967e+06      2.53e-03
## polygon 306             107  2.54311e+06      3.93e-03
## polygon 307              83  9.55710e+05      1.48e-03
## polygon 308              58  3.16882e+05      4.90e-04
## polygon 309              94  1.04642e+06      1.62e-03
## polygon 310              63  9.21431e+05      1.42e-03
## polygon 311             149  7.37056e+06      1.14e-02
## polygon 312              52  6.84704e+05      1.06e-03
## polygon 313             127  1.51149e+06      2.33e-03
## polygon 314             151  2.45910e+06      3.80e-03
## polygon 315             191  7.03481e+06      1.09e-02
## polygon 316             158  3.65203e+06      5.64e-03
## polygon 317             285  1.71970e+06      2.66e-03
## polygon 318 (hole)        3 -2.83151e-01     -4.37e-10
## polygon 319              87  1.08864e+06      1.68e-03
## polygon 320              81  1.56903e+06      2.42e-03
## polygon 321             176  1.67003e+06      2.58e-03
## polygon 322              79  2.39108e+06      3.69e-03
## polygon 323              52  1.37871e+06      2.13e-03
## polygon 324             101  9.23215e+05      1.43e-03
## polygon 325             246  5.32542e+06      8.23e-03
## polygon 326              92  1.41828e+06      2.19e-03
## polygon 327              50  1.48925e+06      2.30e-03
## polygon 328             117  5.18613e+06      8.01e-03
## polygon 329             537  3.50960e+07      5.42e-02
## polygon 330              80  1.46328e+06      2.26e-03
## polygon 331             258  9.95945e+05      1.54e-03
## polygon 332              55  1.45551e+06      2.25e-03
## polygon 333              44  1.49911e+06      2.32e-03
## polygon 334              68  9.24866e+05      1.43e-03
## polygon 335             127  1.34017e+06      2.07e-03
## polygon 336             353  8.50444e+06      1.31e-02
## polygon 337 (hole)      317 -5.11280e+04     -7.90e-05
## polygon 338             210  1.36000e+06      2.10e-03
## polygon 339              67  1.43138e+05      2.21e-04
## polygon 340              64  4.36369e+05      6.74e-04
## polygon 341             134  1.25974e+06      1.95e-03
## polygon 342               4  6.49287e-01      1.00e-09
## polygon 343             112  3.29141e+06      5.08e-03
## polygon 344             102  1.57600e+06      2.43e-03
## polygon 345             122  1.66547e+06      2.57e-03
## polygon 346              94  1.76709e+06      2.73e-03
## polygon 347              95  2.05005e+06      3.17e-03
## polygon 348             129  1.51777e+06      2.34e-03
## polygon 349             117  5.95652e+05      9.20e-04
## polygon 350             263  3.28413e+06      5.07e-03
## polygon 351             118  2.55346e+06      3.94e-03
## polygon 352              50  9.62437e+05      1.49e-03
## polygon 353             112  1.28130e+06      1.98e-03
## polygon 354              26  7.58123e+05      1.17e-03
## polygon 355              76  9.05921e+05      1.40e-03
## polygon 356             285  1.61128e+06      2.49e-03
## polygon 357              66  1.26165e+06      1.95e-03
## polygon 358            1605  1.74949e+07      2.70e-02
## polygon 359 (hole)        3 -8.83647e-03     -1.37e-11
## polygon 360             164  3.45046e+06      5.33e-03
## polygon 361              65  1.74196e+06      2.69e-03
## polygon 362              74  1.39487e+06      2.15e-03
## polygon 363             141  1.07438e+06      1.66e-03
## polygon 364             711  1.28815e+07      1.99e-02
## polygon 365 (hole)        3 -3.41405e-01     -5.27e-10
## polygon 366             668  5.40368e+07      8.35e-02
## polygon 367              77  3.29939e+05      5.10e-04
## polygon 368              44  2.26577e+03      3.50e-06
## polygon 369             181  7.23581e+06      1.12e-02
## polygon 370             193  2.14708e+06      3.32e-03
## polygon 371              90  1.51100e+06      2.33e-03
## polygon 372             125  9.36416e+05      1.45e-03
## polygon 373             148  1.64863e+06      2.55e-03
## polygon 374             102  1.09939e+06      1.70e-03
## polygon 375              77  2.20921e+06      3.41e-03
## polygon 376              79  1.26438e+06      1.95e-03
## polygon 377              75  2.20670e+06      3.41e-03
## polygon 378              40  1.26592e+06      1.96e-03
## polygon 379             111  3.91607e+06      6.05e-03
## polygon 380             148  2.17538e+06      3.36e-03
## polygon 381             132  3.62184e+06      5.59e-03
## polygon 382              80  1.43291e+06      2.21e-03
## polygon 383             112  4.38713e+06      6.78e-03
## polygon 384             145  1.20080e+06      1.85e-03
## polygon 385             532  2.45079e+06      3.79e-03
## polygon 386 (hole)        3 -2.05920e-03     -3.18e-12
## polygon 387 (hole)        3 -2.21090e+00     -3.42e-09
## polygon 388             125  1.54073e+06      2.38e-03
## polygon 389             379  1.63581e+06      2.53e-03
## polygon 390             357  2.24139e+06      3.46e-03
## enclosing rectangle: [4453.85, 56396.44] x [15748.72, 50256.33] units
##                      (51940 x 34510 units)
## Window area = 647338000 square units
## Fraction of frame area: 0.361

Combining airbnb points and the study area

listings_ppp_SG <- listings_ppp_jit[sg_owin]
plot(listings_ppp_SG)

Next, we will observe the room types with the study area separately

listings_ppp_pr <- listings_ppp_SG[listings_ppp_SG$marks == "Private room"]
listings_ppp_eh <- listings_ppp_SG[listings_ppp_SG$marks == "Entire home/apt"]
listings_ppp_sr <- listings_ppp_SG[listings_ppp_SG$marks == "Shared room"]
listings_ppp_hr <- listings_ppp_SG[listings_ppp_SG$marks == "Hotel room"]
par(mfrow=c(2,2))
plot(listings_ppp_pr, main = "Private room")
plot(listings_ppp_eh, main = "Entire home/apt")
plot(listings_ppp_sr, main = "Shared room")
plot(listings_ppp_hr, main = "Hotel room")

Similar to the previous analysis , we can see that the hotel rooms are located mainly in the central areas with a few in the Northeast, SouthEast and SouthWest. For entire homes, we can see that they are all around Singapore and are significant in numbers and are mainly located in the central areas. For shared rooms, they are scattered sparsely around Singapore and are located mainly in central areas.Lastly,the private rooms located all around Singapore and are significant in numbers.

Quadrat analysis

The test hypotheses are : Ho = The distribution of airbnb listings in Singapore are randomly distributed.

H1= The distribution of airbnb listings in Singapore are not randomly distributed.

Confidence interval: 95%

Chi-squared test

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

Since the p-value is 2.2e-16, we reject the null hypothesis at 95% confidence level. The high X2 value may indicate clustering of airbnb data points. The chi-square approximation may be inaccurate. Hence we will now conduct a monte-carlo test.

Conditional Monte Carlo test of CSR using quadrat counts

qt  <-quadrat.test(listings_ppp_SG, 
             nx = 20, ny = 15,
            method="M",
             nsim=999) 
qt
## 
##  Conditional Monte Carlo test of CSR using quadrat counts
##  Test statistic: Pearson X2 statistic
## 
## data:  listings_ppp_SG
## X2 = 62038, p-value = 0.002
## alternative hypothesis: two.sided
## 
## Quadrats: 180 tiles (irregular windows)
plot(listings_ppp_SG)
plot(qt, add = TRUE, cex =.1)

Since p-value = 0.002<0.05, we reject the null hypothesis at 0.05 significance level. This is consistent with our chi-squared test.

Nearest Neighbour Analysis

clarkevans.test(listings_ppp_SG,
                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:  listings_ppp_SG
## R = 0.36251, p-value = 0.02
## alternative hypothesis: two-sided

The nearest neighbour index value is 0.30875 which is less than 1, indicating clustering is exibited.

Hence, the quadrat and nearest neighbour analysis allows us to conclude that the distribution of airbnbs in Singapore exhibit clustering.

Kernel density maps for each room types

Check of there are enough observations for each room type(2 or more observations are required)

listings_ppp_pr$n
## [1] 3200
listings_ppp_eh$n
## [1] 3704
listings_ppp_sr$n
## [1] 272
listings_ppp_hr$n
## [1] 507

Hence, there is sufficient observations and we can do the kde analysis,

We will be analysis the room types separately first , followed by visualising them together.

tmap_mode("plot")
## tmap mode set to plotting
getKernelDensityMap <- function(ppp, ppp_str) {
  
  ppp.km <- rescale(ppp, 1000, "km")

 
  kde_1000 <- density(ppp.km, sigma=1, edge=TRUE, kernel="gaussian")

 
  gridded_kde_1000_bw <- as.SpatialGridDataFrame.im(kde_1000)
 
  kde_1000_bw_raster <- raster(gridded_kde_1000_bw)
 
  projection(kde_1000_bw_raster) <- crs("+init=EPSG:3414 +datum=WGS84 +units=km")
 
   tm_shape(sg_map)+
    tm_layout(legend.outside = TRUE, title=ppp_str)+
    tm_rgb()+
  tm_shape(subzone)+
    tm_polygons(alpha = 0, border.col = "black", border.alpha = 0.5)+
  tm_shape(kde_1000_bw_raster) + 
    tm_raster("v", alpha=0.5,  
          palette = "YlOrRd")
  
}
eh_kdm <- getKernelDensityMap(listings_ppp_eh, "Entire home/apt")
hr_kdm <- getKernelDensityMap(listings_ppp_hr, "Hotel room")
pr_kdm <- getKernelDensityMap(listings_ppp_pr, "Private room")
sr_kdm <- getKernelDensityMap(listings_ppp_sr, "Shared room")

Private room

pr_kdm
## Warning: Raster values found that are outside the range [0, 255]

For private room , we can see that there are more rooms in the central area, in particular , the lavender subzone

Entire homes

eh_kdm
## Warning: Raster values found that are outside the range [0, 255]

For entire homes , we can see that there are more rooms in the central area. There is a cluster in Balestier/LAvender, Tanjong Pagar subzone and Aljunied subzone . The popularity of entire homes may be due to the homely experience that tourists might want to experience in Singapore

Hotel room

hr_kdm
## Warning: Raster values found that are outside the range [0, 255]

For hotel rooms , we can see that there are more rooms in the central area, in particular Tanjong Pagar area. This may be because Tanjong Pagar is more centralised and in the office area and more affluent people can afford.

Shared Room

sr_kdm
## Warning: Raster values found that are outside the range [0, 255]

For entire homes , we can see that there are more rooms in the central area, in particular the lavender subzone.

tmap_arrange(eh_kdm, hr_kdm, pr_kdm, sr_kdm)
## Warning: Raster values found that are outside the range [0, 255]

## Warning: Raster values found that are outside the range [0, 255]

## Warning: Raster values found that are outside the range [0, 255]

## Warning: Raster values found that are outside the range [0, 255]

## Warning: Raster values found that are outside the range [0, 255]

## Warning: Raster values found that are outside the range [0, 255]

## Warning: Raster values found that are outside the range [0, 255]

## Warning: Raster values found that are outside the range [0, 255]

For all the plots, the room types are clustered around the central region. This is most likely due to the convenience and accessibility for tourists.

Advantage of kernel density map over point map

In Kernel density maps, we are able to identify precisely the location and intensity of the Airbnb listings. Kernity density maps provide a quantitative and visual aspect that shows the concentration of points.Points maps however,does not enable the viewing of exact locations and are less accurate than kernel density maps.

Section B:Planning subzones

Extract study areas

al <- subzone[subzone@data$SUBZONE_N == "ALJUNIED",]
ba <- subzone[subzone@data$SUBZONE_N == "BALESTIER",]
la <- subzone[subzone@data$SUBZONE_N == "LAVENDER",]
tp <- subzone[subzone@data$SUBZONE_N == "TANJONG PAGAR",]

Load osm

al_map<-getTiles(x = al, type = "osm")
ba_map<-getTiles(x = ba, type = "osm")
la_map<-getTiles(x = la, type = "osm")
tp_map<-getTiles(x = tp, type = "osm")

Plotting study areas

par(mfrow=c(2,2))
plot(al, main = "ALJUNIED")
plot(ba, main = "BALESTIER")
plot(la, main = "LAVENDER")
plot(tp, main = "TANJONG PAGAR")

Converting the spatial point data frame into generic sp forma

al_sp <- as(al, "SpatialPolygons")
ba_sp <- as(ba, "SpatialPolygons")
la_sp <- as(la, "SpatialPolygons")
tp_sp <- as(tp, "SpatialPolygons")

Convert SpatialPolygons objects into owin objects

al_owin = as(al_sp, "owin")
ba_owin = as(ba_sp, "owin")
la_owin = as(la_sp, "owin")
tp_owin = as(tp_sp, "owin")

Combining private points and study area

listings_al_ppp <- listings_ppp_jit[al_owin]
listings_ba_ppp <- listings_ppp_jit[ba_owin]
listings_la_ppp <- listings_ppp_jit[la_owin]
listings_tp_ppp <- listings_ppp_jit[tp_owin]

Plotting listings by subzone

par(mfrow=c(2,2))
plot(listings_al_ppp, main="Aljunied")
plot(listings_ba_ppp, main="Balestier")
plot(listings_la_ppp, main="Lavender")
plot(listings_tp_ppp, main="Tanjong Pagar")

From the plot,we see clusterings in certain regions of each study area. For aljunied, the listings are concentrated in the central area . For balestier, the listings are more sparse in the eastern and north-eastern part of balestier. For lavender, the listings are relatively evenly spread out with the exception of the south and south western parts of lavender where listings are sparse. For tanjong pagar, the listings are cencentrated in the south western part of tanjong pagar.

Distribution of room types within Aljunied

listings_al_eh_ppp <- listings_ppp_eh[al_owin]
listings_al_hr_ppp <- listings_ppp_hr[al_owin]
listings_al_pr_ppp <- listings_ppp_pr[al_owin]
listings_al_sr_ppp <- listings_ppp_sr[al_owin]
listings_al_pr_ppp$n
## [1] 226
listings_al_sr_ppp$n
## [1] 10
listings_al_hr_ppp$n
## [1] 17
listings_al_eh_ppp$n
## [1] 579
par(mfrow=c(2,2))
plot(listings_al_eh_ppp, main="Aljunied - Entire home")
plot(listings_al_hr_ppp, main="Aljunied - Hotel room")
plot(listings_al_pr_ppp, main="Aljunied - Private room")
plot(listings_al_sr_ppp, main="Aljunied - Shared room")

There is significantly more private rooms and entire homes in aljunied and they are located in central aljunied.Hotel rooms are also mostly located in the central aljunied but are less in numbers than the previous 2 room types. Shared rooms are spread sparsely in the central and eastern part of aljunied.

Distribution of room types within Balestier

listings_ba_eh_ppp <- listings_ppp_eh[ba_owin]
listings_ba_hr_ppp <- listings_ppp_hr[ba_owin]
listings_ba_pr_ppp <- listings_ppp_pr[ba_owin]
listings_ba_sr_ppp <- listings_ppp_sr[ba_owin]
listings_ba_pr_ppp$n
## [1] 60
listings_ba_sr_ppp$n
## [1] 1
listings_ba_hr_ppp$n
## [1] 40
listings_ba_eh_ppp$n
## [1] 373
par(mfrow=c(2,2))
plot(listings_ba_eh_ppp, main="Balestier - Entire home/apt")
plot(listings_ba_hr_ppp, main="Balestier - Hotel room")
plot(listings_ba_pr_ppp, main="Balestier - Private room")
plot(listings_ba_sr_ppp, main="Balestier - Shared room")

From the plots, balestier has a the most number of entire homes among the room types and they are located in the south and western parts of balestier. For hotel and private rooms, they are most common in the central parts of balestier. There is a relatively insignificant number of shared rooms in balestier

Distribution of room types within Lavender

listings_la_eh_ppp = listings_ppp_eh[la_owin]
listings_la_hr_ppp = listings_ppp_hr[la_owin]
listings_la_pr_ppp = listings_ppp_pr[la_owin]
listings_la_sr_ppp = listings_ppp_sr[la_owin]
listings_la_pr_ppp$n
## [1] 281
listings_la_sr_ppp$n
## [1] 51
listings_la_hr_ppp$n
## [1] 42
listings_la_eh_ppp$n
## [1] 123
par(mfrow=c(2,2))
plot(listings_la_eh_ppp, main="Lavender - Entire home/apt")
plot(listings_la_hr_ppp, main="Lavender - Hotel room")
plot(listings_la_pr_ppp, main="Lavender - Private room")
plot(listings_la_sr_ppp, main="Lavender - Shared room")

From the plots, lavender has a significant number of private rooms and they mainly located in the eastern parts of lavender. Lavender also has a significant number of entire homes and they are mainly located in the northern part of lavender. Hotel and shared rooms are less in numbers than the other 2 room types and are mainly located in the northern and central parts of lavender.

Distribution of room types within Tanjong Pagar

listings_tp_eh_ppp = listings_ppp_eh[tp_owin]
listings_tp_hr_ppp = listings_ppp_hr[tp_owin]
listings_tp_pr_ppp = listings_ppp_pr[tp_owin]
listings_tp_sr_ppp = listings_ppp_sr[tp_owin]
listings_tp_pr_ppp$n
## [1] 20
listings_tp_sr_ppp$n
## [1] 0
listings_tp_hr_ppp$n
## [1] 2
listings_tp_eh_ppp$n
## [1] 148
par(mfrow=c(2,2))
plot(listings_tp_eh_ppp, main="Tanjong Pagar - Entire home")
plot(listings_tp_hr_ppp, main="Tanjong Pagar - Hotel room")
plot(listings_tp_pr_ppp, main="Tanjong Pagar - Private room")
plot(listings_tp_sr_ppp, main="Tanjong Pagar - Shared room")

There is a large number of entire homes in Tanjong Pagar which are mainly located in the south-western part of tanjong pagar. The private rooms are spread out in Tanjong Pagar rather evenly and there are only a few hotel rooms which are located in the eastern part of tanjong pagar. Shared rooms are rather insignificant in Tanjong Pagar.

Perform second order anaysis With reference to the spatial point patterns observed

Determine function

Aljunied_nnd <- nndist.ppp(listings_al_ppp)
Balestier_nnd <- nndist.ppp(listings_ba_ppp)
Lavender_nnd <- nndist.ppp(listings_la_ppp)
TanjongPagar_nnd <- nndist.ppp(listings_tp_ppp)

range(Aljunied_nnd)
## [1]   0.4823623 305.6527962
range(Aljunied_nnd)
## [1]   0.4823623 305.6527962
range(Balestier_nnd)
## [1]   0.7013138 558.1480528
range(Lavender_nnd)
## [1]   0.7127891 148.0174823
range(TanjongPagar_nnd)
## [1]  0.9127245 64.7492573

Using the K-function will not be ideal due to the shape of our study areas (we can assume they have identical values of a property in all directions.) . There is a big difference betwwen the ranges of values for Aljunied and Balestier which may be a problem when using the G-function as the G-functionis cummulative in nature. Hence , for our analysis , we will be using the F-function.

Aljunied

The hypothesis and test are as follows: Ho = The distribution of rooms at Aljunied are randomly distributed. H1= The distribution of rooms at Aljunied are not randomly distributed.

fal.csr <- envelope(listings_al_ppp, Fest, nsim = 999)
## Generating 999 simulations of CSR  ...
## 1, 2, 3, ......10.........20.........30.........40.........50.........60........
## .70.........80.........90.........100.........110.........120.........130......
## ...140.........150.........160.........170.........180.........190.........200....
## .....210.........220.........230.........240.........250.........260.........270..
## .......280.........290.........300.........310.........320.........330.........340
## .........350.........360.........370.........380.........390.........400........
## .410.........420.........430.........440.........450.........460.........470......
## ...480.........490.........500.........510.........520.........530.........540....
## .....550.........560.........570.........580.........590.........600.........610..
## .......620.........630.........640.........650.........660.........670.........680
## .........690.........700.........710.........720.........730.........740........
## .750.........760.........770.........780.........790.........800.........810......
## ...820.........830.........840.........850.........860.........870.........880....
## .....890.........900.........910.........920.........930.........940.........950..
## .......960.........970.........980.........990........ 999.
## 
## Done.
fal_EH.csr <- envelope(listings_al_eh_ppp, Fest, nsim = 999)
## Generating 999 simulations of CSR  ...
## 1, 2, 3, ......10.........20.........30.........40.........50.........60........
## .70.........80.........90.........100.........110.........120.........130......
## ...140.........150.........160.........170.........180.........190.........200....
## .....210.........220.........230.........240.........250.........260.........270..
## .......280.........290.........300.........310.........320.........330.........340
## .........350.........360.........370.........380.........390.........400........
## .410.........420.........430.........440.........450.........460.........470......
## ...480.........490.........500.........510.........520.........530.........540....
## .....550.........560.........570.........580.........590.........600.........610..
## .......620.........630.........640.........650.........660.........670.........680
## .........690.........700.........710.........720.........730.........740........
## .750.........760.........770.........780.........790.........800.........810......
## ...820.........830.........840.........850.........860.........870.........880....
## .....890.........900.........910.........920.........930.........940.........950..
## .......960.........970.........980.........990........ 999.
## 
## Done.
fal_HR.csr <- envelope(listings_al_hr_ppp, Fest, nsim = 999)
## Generating 999 simulations of CSR  ...
## 1, 2, 3, ......10.........20.........30.........40.........50.........60........
## .70.........80.........90.........100.........110.........120.........130......
## ...140.........150.........160.........170.........180.........190.........200....
## .....210.........220.........230.........240.........250.........260.........270..
## .......280.........290.........300.........310.........320.........330.........340
## .........350.........360.........370.........380.........390.........400........
## .410.........420.........430.........440.........450.........460.........470......
## ...480.........490.........500.........510.........520.........530.........540....
## .....550.........560.........570.........580.........590.........600.........610..
## .......620.........630.........640.........650.........660.........670.........680
## .........690.........700.........710.........720.........730.........740........
## .750.........760.........770.........780.........790.........800.........810......
## ...820.........830.........840.........850.........860.........870.........880....
## .....890.........900.........910.........920.........930.........940.........950..
## .......960.........970.........980.........990........ 999.
## 
## Done.
fal_PR.csr <- envelope(listings_al_pr_ppp, Fest, nsim = 999)
## Generating 999 simulations of CSR  ...
## 1, 2, 3, ......10.........20.........30.........40.........50.........60........
## .70.........80.........90.........100.........110.........120.........130......
## ...140.........150.........160.........170.........180.........190.........200....
## .....210.........220.........230.........240.........250.........260.........270..
## .......280.........290.........300.........310.........320.........330.........340
## .........350.........360.........370.........380.........390.........400........
## .410.........420.........430.........440.........450.........460.........470......
## ...480.........490.........500.........510.........520.........530.........540....
## .....550.........560.........570.........580.........590.........600.........610..
## .......620.........630.........640.........650.........660.........670.........680
## .........690.........700.........710.........720.........730.........740........
## .750.........760.........770.........780.........790.........800.........810......
## ...820.........830.........840.........850.........860.........870.........880....
## .....890.........900.........910.........920.........930.........940.........950..
## .......960.........970.........980.........990........ 999.
## 
## Done.
fal_SR.csr <- envelope(listings_al_sr_ppp, Fest, nsim = 999)
## Generating 999 simulations of CSR  ...
## 1, 2, 3, ......10.........20.........30.........40.........50.........60........
## .70.........80.........90.........100.........110.........120.........130......
## ...140.........150.........160.........170.........180.........190.........200....
## .....210.........220.........230.........240.........250.........260.........270..
## .......280.........290.........300.........310.........320.........330.........340
## .........350.........360.........370.........380.........390.........400........
## .410.........420.........430.........440.........450.........460.........470......
## ...480.........490.........500.........510.........520.........530.........540....
## .....550.........560.........570.........580.........590.........600.........610..
## .......620.........630.........640.........650.........660.........670.........680
## .........690.........700.........710.........720.........730.........740........
## .750.........760.........770.........780.........790.........800.........810......
## ...820.........830.........840.........850.........860.........870.........880....
## .....890.........900.........910.........920.........930.........940.........950..
## .......960.........970.........980.........990........ 999.
## 
## Done.
plot(fal.csr)

We reject the null hypothesis at 95% confidence interval.

par(mfrow=c(2,2))
plot(fal_EH.csr)
plot(fal_HR.csr)
plot(fal_PR.csr)
plot(fal_SR.csr)

We can see that for entire homes and private room listings , they are overall clustered .This may be due to double listings or tourist hotspots for the two room types. We reject the null hypothesis for entire homes and private rooms and do not reject the null hypothesis for hotel and shared rooms.

Balestier

The hypothesis and test are as follows: Ho = The distribution of rooms at Balestier are randomly distributed. H1= The distribution of rooms at Balestier are not randomly distributed.

fba.csr <- envelope(listings_ba_ppp, Fest, nsim = 999)
## Generating 999 simulations of CSR  ...
## 1, 2, 3, ......10.........20.........30.........40.........50.........60........
## .70.........80.........90.........100.........110.........120.........130......
## ...140.........150.........160.........170.........180.........190.........200....
## .....210.........220.........230.........240.........250.........260.........270..
## .......280.........290.........300.........310.........320.........330.........340
## .........350.........360.........370.........380.........390.........400........
## .410.........420.........430.........440.........450.........460.........470......
## ...480.........490.........500.........510.........520.........530.........540....
## .....550.........560.........570.........580.........590.........600.........610..
## .......620.........630.........640.........650.........660.........670.........680
## .........690.........700.........710.........720.........730.........740........
## .750.........760.........770.........780.........790.........800.........810......
## ...820.........830.........840.........850.........860.........870.........880....
## .....890.........900.........910.........920.........930.........940.........950..
## .......960.........970.........980.........990........ 999.
## 
## Done.
fba_EH.csr <- envelope(listings_ba_eh_ppp, Fest, nsim = 999)
## Generating 999 simulations of CSR  ...
## 1, 2, 3, ......10.........20.........30.........40.........50.........60........
## .70.........80.........90.........100.........110.........120.........130......
## ...140.........150.........160.........170.........180.........190.........200....
## .....210.........220.........230.........240.........250.........260.........270..
## .......280.........290.........300.........310.........320.........330.........340
## .........350.........360.........370.........380.........390.........400........
## .410.........420.........430.........440.........450.........460.........470......
## ...480.........490.........500.........510.........520.........530.........540....
## .....550.........560.........570.........580.........590.........600.........610..
## .......620.........630.........640.........650.........660.........670.........680
## .........690.........700.........710.........720.........730.........740........
## .750.........760.........770.........780.........790.........800.........810......
## ...820.........830.........840.........850.........860.........870.........880....
## .....890.........900.........910.........920.........930.........940.........950..
## .......960.........970.........980.........990........ 999.
## 
## Done.
fba_HR.csr <- envelope(listings_ba_hr_ppp, Fest, nsim = 999)
## Generating 999 simulations of CSR  ...
## 1, 2, 3, ......10.........20.........30.........40.........50.........60........
## .70.........80.........90.........100.........110.........120.........130......
## ...140.........150.........160.........170.........180.........190.........200....
## .....210.........220.........230.........240.........250.........260.........270..
## .......280.........290.........300.........310.........320.........330.........340
## .........350.........360.........370.........380.........390.........400........
## .410.........420.........430.........440.........450.........460.........470......
## ...480.........490.........500.........510.........520.........530.........540....
## .....550.........560.........570.........580.........590.........600.........610..
## .......620.........630.........640.........650.........660.........670.........680
## .........690.........700.........710.........720.........730.........740........
## .750.........760.........770.........780.........790.........800.........810......
## ...820.........830.........840.........850.........860.........870.........880....
## .....890.........900.........910.........920.........930.........940.........950..
## .......960.........970.........980.........990........ 999.
## 
## Done.
fba_PR.csr <- envelope(listings_ba_pr_ppp, Fest, nsim = 999)
## Generating 999 simulations of CSR  ...
## 1, 2, 3, ......10.........20.........30.........40.........50.........60........
## .70.........80.........90.........100.........110.........120.........130......
## ...140.........150.........160.........170.........180.........190.........200....
## .....210.........220.........230.........240.........250.........260.........270..
## .......280.........290.........300.........310.........320.........330.........340
## .........350.........360.........370.........380.........390.........400........
## .410.........420.........430.........440.........450.........460.........470......
## ...480.........490.........500.........510.........520.........530.........540....
## .....550.........560.........570.........580.........590.........600.........610..
## .......620.........630.........640.........650.........660.........670.........680
## .........690.........700.........710.........720.........730.........740........
## .750.........760.........770.........780.........790.........800.........810......
## ...820.........830.........840.........850.........860.........870.........880....
## .....890.........900.........910.........920.........930.........940.........950..
## .......960.........970.........980.........990........ 999.
## 
## Done.
fba_SR.csr <- envelope(listings_ba_sr_ppp, Fest, nsim = 999)
## Generating 999 simulations of CSR  ...
## 1, 2, 3, ......10.........20.........30.........40.........50.........60........
## .70.........80.........90.........100.........110.........120.........130......
## ...140.........150.........160.........170.........180.........190.........200....
## .....210.........220.........230.........240.........250.........260.........270..
## .......280.........290.........300.........310.........320.........330.........340
## .........350.........360.........370.........380.........390.........400........
## .410.........420.........430.........440.........450.........460.........470......
## ...480.........490.........500.........510.........520.........530.........540....
## .....550.........560.........570.........580.........590.........600.........610..
## .......620.........630.........640.........650.........660.........670.........680
## .........690.........700.........710.........720.........730.........740........
## .750.........760.........770.........780.........790.........800.........810......
## ...820.........830.........840.........850.........860.........870.........880....
## .....890.........900.........910.........920.........930.........940.........950..
## .......960.........970.........980.........990........ 999.
## 
## Done.
plot(fba.csr)

We reject the null hypothesis at 95% confidence interval.

par(mfrow=c(2,2))
plot(fba_EH.csr)
plot(fba_HR.csr)
plot(fba_PR.csr)
plot(fba_SR.csr)

We reject the null hypothesis for entire homes and private rooms and do not reject the null hypothesis for hotel and shared rooms.We can see that for entire homes and private room listings , they are overall clustered, more evidently in entire homes. For shared rooms , the plot may be due to the lack of data points .

Lavender

The hypothesis and test are as follows: Ho = The distribution of rooms at Lavender are randomly distributed. H1= The distribution of rooms at Lavender are not randomly distributed.

fla.csr <- envelope(listings_la_ppp, Fest, nsim = 999)
## Generating 999 simulations of CSR  ...
## 1, 2, 3, ......10.........20.........30.........40.........50.........60........
## .70.........80.........90.........100.........110.........120.........130......
## ...140.........150.........160.........170.........180.........190.........200....
## .....210.........220.........230.........240.........250.........260.........270..
## .......280.........290.........300.........310.........320.........330.........340
## .........350.........360.........370.........380.........390.........400........
## .410.........420.........430.........440.........450.........460.........470......
## ...480.........490.........500.........510.........520.........530.........540....
## .....550.........560.........570.........580.........590.........600.........610..
## .......620.........630.........640.........650.........660.........670.........680
## .........690.........700.........710.........720.........730.........740........
## .750.........760.........770.........780.........790.........800.........810......
## ...820.........830.........840.........850.........860.........870.........880....
## .....890.........900.........910.........920.........930.........940.........950..
## .......960.........970.........980.........990........ 999.
## 
## Done.
fla_EH.csr <- envelope(listings_la_eh_ppp, Fest, nsim = 999)
## Generating 999 simulations of CSR  ...
## 1, 2, 3, ......10.........20.........30.........40.........50.........60........
## .70.........80.........90.........100.........110.........120.........130......
## ...140.........150.........160.........170.........180.........190.........200....
## .....210.........220.........230.........240.........250.........260.........270..
## .......280.........290.........300.........310.........320.........330.........340
## .........350.........360.........370.........380.........390.........400........
## .410.........420.........430.........440.........450.........460.........470......
## ...480.........490.........500.........510.........520.........530.........540....
## .....550.........560.........570.........580.........590.........600.........610..
## .......620.........630.........640.........650.........660.........670.........680
## .........690.........700.........710.........720.........730.........740........
## .750.........760.........770.........780.........790.........800.........810......
## ...820.........830.........840.........850.........860.........870.........880....
## .....890.........900.........910.........920.........930.........940.........950..
## .......960.........970.........980.........990........ 999.
## 
## Done.
fla_HR.csr <- envelope(listings_la_hr_ppp, Fest, nsim = 999)
## Generating 999 simulations of CSR  ...
## 1, 2, 3, ......10.........20.........30.........40.........50.........60........
## .70.........80.........90.........100.........110.........120.........130......
## ...140.........150.........160.........170.........180.........190.........200....
## .....210.........220.........230.........240.........250.........260.........270..
## .......280.........290.........300.........310.........320.........330.........340
## .........350.........360.........370.........380.........390.........400........
## .410.........420.........430.........440.........450.........460.........470......
## ...480.........490.........500.........510.........520.........530.........540....
## .....550.........560.........570.........580.........590.........600.........610..
## .......620.........630.........640.........650.........660.........670.........680
## .........690.........700.........710.........720.........730.........740........
## .750.........760.........770.........780.........790.........800.........810......
## ...820.........830.........840.........850.........860.........870.........880....
## .....890.........900.........910.........920.........930.........940.........950..
## .......960.........970.........980.........990........ 999.
## 
## Done.
fla_PR.csr <- envelope(listings_la_pr_ppp, Fest, nsim = 999)
## Generating 999 simulations of CSR  ...
## 1, 2, 3, ......10.........20.........30.........40.........50.........60........
## .70.........80.........90.........100.........110.........120.........130......
## ...140.........150.........160.........170.........180.........190.........200....
## .....210.........220.........230.........240.........250.........260.........270..
## .......280.........290.........300.........310.........320.........330.........340
## .........350.........360.........370.........380.........390.........400........
## .410.........420.........430.........440.........450.........460.........470......
## ...480.........490.........500.........510.........520.........530.........540....
## .....550.........560.........570.........580.........590.........600.........610..
## .......620.........630.........640.........650.........660.........670.........680
## .........690.........700.........710.........720.........730.........740........
## .750.........760.........770.........780.........790.........800.........810......
## ...820.........830.........840.........850.........860.........870.........880....
## .....890.........900.........910.........920.........930.........940.........950..
## .......960.........970.........980.........990........ 999.
## 
## Done.
fla_SR.csr <- envelope(listings_la_sr_ppp, Fest, nsim = 999)
## Generating 999 simulations of CSR  ...
## 1, 2, 3, ......10.........20.........30.........40.........50.........60........
## .70.........80.........90.........100.........110.........120.........130......
## ...140.........150.........160.........170.........180.........190.........200....
## .....210.........220.........230.........240.........250.........260.........270..
## .......280.........290.........300.........310.........320.........330.........340
## .........350.........360.........370.........380.........390.........400........
## .410.........420.........430.........440.........450.........460.........470......
## ...480.........490.........500.........510.........520.........530.........540....
## .....550.........560.........570.........580.........590.........600.........610..
## .......620.........630.........640.........650.........660.........670.........680
## .........690.........700.........710.........720.........730.........740........
## .750.........760.........770.........780.........790.........800.........810......
## ...820.........830.........840.........850.........860.........870.........880....
## .....890.........900.........910.........920.........930.........940.........950..
## .......960.........970.........980.........990........ 999.
## 
## Done.
plot(fla.csr)

We reject the null hypothesis at 95% confidence interval.

par(mfrow=c(2,2))
plot(fla_EH.csr)
plot(fla_HR.csr)
plot(fla_PR.csr)
plot(fla_SR.csr)

We reject the null hypothesis for entire homes and private rooms and hotel rooms and do not reject the null hypothesis for shared rooms.

Tanjong Pagar

The hypothesis and test are as follows: Ho = The distribution of rooms at Tanjong Pagar are randomly distributed. H1= The distribution of rooms at Tanjong Pagar are not randomly distributed.

ftp.csr <- envelope(listings_tp_ppp, Fest, nsim = 999)
## Generating 999 simulations of CSR  ...
## 1, 2, 3, ......10.........20.........30.........40.........50.........60........
## .70.........80.........90.........100.........110.........120.........130......
## ...140.........150.........160.........170.........180.........190.........200....
## .....210.........220.........230.........240.........250.........260.........270..
## .......280.........290.........300.........310.........320.........330.........340
## .........350.........360.........370.........380.........390.........400........
## .410.........420.........430.........440.........450.........460.........470......
## ...480.........490.........500.........510.........520.........530.........540....
## .....550.........560.........570.........580.........590.........600.........610..
## .......620.........630.........640.........650.........660.........670.........680
## .........690.........700.........710.........720.........730.........740........
## .750.........760.........770.........780.........790.........800.........810......
## ...820.........830.........840.........850.........860.........870.........880....
## .....890.........900.........910.........920.........930.........940.........950..
## .......960.........970.........980.........990........ 999.
## 
## Done.
ftp_EH.csr <- envelope(listings_tp_eh_ppp, Fest, nsim = 999)
## Generating 999 simulations of CSR  ...
## 1, 2, 3, ......10.........20.........30.........40.........50.........60........
## .70.........80.........90.........100.........110.........120.........130......
## ...140.........150.........160.........170.........180.........190.........200....
## .....210.........220.........230.........240.........250.........260.........270..
## .......280.........290.........300.........310.........320.........330.........340
## .........350.........360.........370.........380.........390.........400........
## .410.........420.........430.........440.........450.........460.........470......
## ...480.........490.........500.........510.........520.........530.........540....
## .....550.........560.........570.........580.........590.........600.........610..
## .......620.........630.........640.........650.........660.........670.........680
## .........690.........700.........710.........720.........730.........740........
## .750.........760.........770.........780.........790.........800.........810......
## ...820.........830.........840.........850.........860.........870.........880....
## .....890.........900.........910.........920.........930.........940.........950..
## .......960.........970.........980.........990........ 999.
## 
## Done.
ftp_HR.csr <- envelope(listings_tp_hr_ppp, Fest, nsim = 999)
## Generating 999 simulations of CSR  ...
## 1, 2, 3, ......10.........20.........30.........40.........50.........60........
## .70.........80.........90.........100.........110.........120.........130......
## ...140.........150.........160.........170.........180.........190.........200....
## .....210.........220.........230.........240.........250.........260.........270..
## .......280.........290.........300.........310.........320.........330.........340
## .........350.........360.........370.........380.........390.........400........
## .410.........420.........430.........440.........450.........460.........470......
## ...480.........490.........500.........510.........520.........530.........540....
## .....550.........560.........570.........580.........590.........600.........610..
## .......620.........630.........640.........650.........660.........670.........680
## .........690.........700.........710.........720.........730.........740........
## .750.........760.........770.........780.........790.........800.........810......
## ...820.........830.........840.........850.........860.........870.........880....
## .....890.........900.........910.........920.........930.........940.........950..
## .......960.........970.........980.........990........ 999.
## 
## Done.
ftp_PR.csr <- envelope(listings_tp_pr_ppp, Fest, nsim = 999)
## Generating 999 simulations of CSR  ...
## 1, 2, 3, ......10.........20.........30.........40.........50.........60........
## .70.........80.........90.........100.........110.........120.........130......
## ...140.........150.........160.........170.........180.........190.........200....
## .....210.........220.........230.........240.........250.........260.........270..
## .......280.........290.........300.........310.........320.........330.........340
## .........350.........360.........370.........380.........390.........400........
## .410.........420.........430.........440.........450.........460.........470......
## ...480.........490.........500.........510.........520.........530.........540....
## .....550.........560.........570.........580.........590.........600.........610..
## .......620.........630.........640.........650.........660.........670.........680
## .........690.........700.........710.........720.........730.........740........
## .750.........760.........770.........780.........790.........800.........810......
## ...820.........830.........840.........850.........860.........870.........880....
## .....890.........900.........910.........920.........930.........940.........950..
## .......960.........970.........980.........990........ 999.
## 
## Done.
ftp_SR.csr <- envelope(listings_tp_sr_ppp, Fest, nsim = 999)
## Generating 999 simulations of CSR  ...
## 1, 2, 3, ......10.........20.........30.........40.........50.........60........
## .70.........80.........90.........100.........110.........120.........130......
## ...140.........150.........160.........170.........180.........190.........200....
## .....210.........220.........230.........240.........250.........260.........270..
## .......280.........290.........300.........310.........320.........330.........340
## .........350.........360.........370.........380.........390.........400........
## .410.........420.........430.........440.........450.........460.........470......
## ...480.........490.........500.........510.........520.........530.........540....
## .....550.........560.........570.........580.........590.........600.........610..
## .......620.........630.........640.........650.........660.........670.........680
## .........690.........700.........710.........720.........730.........740........
## .750.........760.........770.........780.........790.........800.........810......
## ...820.........830.........840.........850.........860.........870.........880....
## .....890.........900.........910.........920.........930.........940.........950..
## .......960.........970.........980.........990........ 999.
## 
## Done.
plot(ftp.csr)

We reject the null hypothesis at 95% confidence interval.

par(mfrow=c(2,2))
plot(ftp_EH.csr)
plot(ftp_HR.csr)
plot(ftp_PR.csr)
plot(ftp_SR.csr)

## Error in yp[whole] <- yp[whole] + epsilon : 
##   NAs are not allowed in subscripted assignments

We reject the null hypothesis for entire homes and private rooms s and do not reject the null hypothesis for and hotel rooms. Analysis for shared rooms cannot be done as there are no points for Tanjong Pagar,

Kernel Density Maps of listings by room type

getmap <- function(osm, sz, ppp, ppp_str) {
  
  ppp.km <- rescale(ppp, 1000, "km")
  
  
  kde <- density(ppp.km, sigma=0.20, edge=TRUE, kernel="gaussian")

  
  gridded_kde_bw <- as.SpatialGridDataFrame.im(kde)
  
 
  kde_bw_raster <- raster(gridded_kde_bw)
  
  
  projection(kde_bw_raster) <- crs("+init=EPSG:3414 +datum=WGS84 +units=km")
 
  tm_shape(osm)+ 
    tm_layout(legend.outside = TRUE, title=ppp_str)+
    tm_rgb()+
  tm_shape(sz)+
    tm_borders(col = "darkblue", lwd = 2, lty="longdash")+
  tm_shape(kde_bw_raster) + 
    tm_raster("v", alpha=0.5,  
          palette = "YlOrRd")
  
}
tmap_mode("plot")
## tmap mode set to plotting

Aljunied

checking if can proceed with analysis

listings_al_pr_ppp$n
## [1] 226
listings_al_sr_ppp$n
## [1] 10
listings_al_hr_ppp$n
## [1] 17
listings_al_eh_ppp$n
## [1] 579

Entire Home

getmap(al_map, al, listings_al_eh_ppp, "Aljunied Entire home/apt")
## Warning: Raster values found that are outside the range [0, 255]

For entire homes , there is a main cluster in the east and central of aljunied.

Shared room

getmap(al_map, al, listings_al_sr_ppp, "Aljunied Shared room")
## Warning: Raster values found that are outside the range [0, 255]

For Shared rooms , there is a cluster in the central/north of aljunied

Private room

getmap(al_map, al, listings_al_pr_ppp, "Aljunied Private room")
## Warning: Raster values found that are outside the range [0, 255]

For private room , there is a cluster in the central of aljunied

Hotel room

getmap(al_map, al, listings_al_hr_ppp, "Aljunied Hotel room")
## Warning: Raster values found that are outside the range [0, 255]

For hotel room , there is a main cluster in the west of aljunied as well as a smaller cluster in the central

From the plots and scales, there are the most entire in Aljunied.This may be due to the fact that tourists may want a local experience by staying in homes . The cluster on the west which is closer to the central of Singapore may be due to the accessibility to town.

Balestier

listings_ba_pr_ppp$n
## [1] 60
listings_ba_sr_ppp$n
## [1] 1
listings_ba_hr_ppp$n
## [1] 40
listings_ba_eh_ppp$n
## [1] 373

Entire Home

getmap(ba_map, ba, listings_ba_eh_ppp, "Balestier Entire home/apt")
## Warning: Raster values found that are outside the range [0, 255]

For entire homes , there is a main cluster in the south of Balestier

Private room

getmap(ba_map, ba, listings_ba_pr_ppp, "Balestier Private room")
## Warning: Raster values found that are outside the range [0, 255]

For private room , there is a cluster in the central and south of Balestier

Hotel room

getmap(ba_map, ba, listings_ba_hr_ppp, "Balestier Hotel room")
## Warning: Raster values found that are outside the range [0, 255]

For hotel room , there is a cluster in the central.south of Balestier

Based on the plots and scale,balestier has the highest number of entire homes.All the room types have higher numbers in the central and south areas of balestier.Tourists may want to feel what it is like to live in Singapore as a local as Balestier is a residential area. As seen from our listings check, there is not enough observations for balestier shared room listings.

Lavender

listings_la_pr_ppp$n
## [1] 281
listings_la_sr_ppp$n
## [1] 51
listings_la_hr_ppp$n
## [1] 42
listings_la_eh_ppp$n
## [1] 123

Entire Home

getmap(la_map, la, listings_la_eh_ppp, "Lavender Entire home/apt")
## Warning: Raster values found that are outside the range [0, 255]

For entire homes , there is a main cluster in the north west of Lavender

Shared room

getmap(la_map, la, listings_la_sr_ppp, "Lavender Shared room")
## Warning: Raster values found that are outside the range [0, 255]

For Shared rooms , there is a cluster in the north west of Lavender

Private room

getmap(la_map, la, listings_la_pr_ppp, "Lavender Private room")
## Warning: Raster values found that are outside the range [0, 255]

For private room , there is a cluster in the east of Lavender

Hotel room

getmap(la_map, la, listings_la_hr_ppp, "Aljunied Hotel room")
## Warning: Raster values found that are outside the range [0, 255]

For hotel room , there is a cluster in the north west of Lavender

Lavender has a highest number of private rooms among the room types. The rest of the room types are located in the north west of Lavender. An interesting point to point out is that there is a hospital located at the north west of Lavender which may be related to the high numbers of room types.

Tanjong Pagar

listings_tp_pr_ppp$n
## [1] 20
listings_tp_sr_ppp$n
## [1] 0
listings_tp_hr_ppp$n
## [1] 2
listings_tp_eh_ppp$n
## [1] 148

Entire Home

getmap(tp_map, tp, listings_tp_eh_ppp, "Tanjong Pagar Entire home/apt")
## Warning: Raster values found that are outside the range [0, 255]

For entire homes , there is a main cluster in the south of Tanjong Pagar

Private room

getmap(tp_map, tp, listings_tp_pr_ppp, "Tanjong Pagar Private room")
## Warning: Raster values found that are outside the range [0, 255]

For private room , there is a cluster in the south of Tanjong Pagar

There is the most entire homes in tanjong pagar. Tourists may want to feel what it is like to live in Singapore as a local . We will not perform analysis for shared and hotel rooms as there are not enough observations available.

Overall analysis

We can see that tourists prefer staying in listings that are entire homes or private rooms. This may be due to the ‘local experience’ that tourists are attracted to.Furthermore,we can deduce that tourists are more likely to stay in the central regions of Singapore which is most likely due to the convenience of the location. The number of shared rooms overall is very low which may be due to tourists not being comfortable with the idea of shared space. The number of hotel rooms are also relatively low which may be due to the price and the idea that tourists may want a more homely experience and experience local life.