Install relevant R packages
packages = c('rgdal', 'maptools', 'raster','spatstat', 'tmap','sf','SpatialEpi', 'tidyverse','spData')
for (p in packages){
if(!require(p, character.only = T)){
install.packages(p)
}
library(p,character.only = T)
}
Import MP14_SUBZONE layer and named it as mpsz
mpsz <- readOGR(dsn = "data/geospatial", layer="MP14_SUBZONE_WEB_PL")
## OGR data source with driver: ESRI Shapefile
## Source: "C:\IS415 Geospatial Analytics and Applications\take-home2\Take_home_Exe02\data\geospatial", layer: "MP14_SUBZONE_WEB_PL"
## with 323 features
## It has 15 fields
mpsz
## class : SpatialPolygonsDataFrame
## features : 323
## extent : 2667.538, 56396.44, 15748.72, 50256.33 (xmin, xmax, ymin, ymax)
## 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
## variables : 15
## names : OBJECTID, SUBZONE_NO, SUBZONE_N, SUBZONE_C, CA_IND, PLN_AREA_N, PLN_AREA_C, REGION_N, REGION_C, INC_CRC, FMEL_UPD_D, X_ADDR, Y_ADDR, SHAPE_Leng, SHAPE_Area
## min values : 1, 1, ADMIRALTY, AMSZ01, N, ANG MO KIO, AM, CENTRAL REGION, CR, 00F5E30B5C9B7AD8, 2014/12/05, 5092.8949, 19579.069, 871.554887798, 39437.9352703
## max values : 323, 17, YUNNAN, YSSZ09, Y, YISHUN, YS, WEST REGION, WR, FFCCF172717C2EAF, 2014/12/05, 50424.7923, 49552.7904, 68083.9364708, 69748298.792
Import listings data set and named it as airbnb.
airbnb <- read_csv("data/aspatial/listings.csv")
After looking through the details of the data set, the coords of the data set is in longitude and latitude format. One key point to take note is the CRS of the langitude and latitude. It should be in WGS84 (EPSG:4326).
Commonly used by organizations that provide GIS data for the entire globe or many countries. CRS used by Google Earth.
airbnb_sf <- st_as_sf(airbnb, coords = c("longitude","latitude"), crs = 4326)
By using function st_transform, we are able to convert the longitude and latitude to XY coords by defining the EPSG as 3414 (SV21).
airbnb_sf <-st_transform(airbnb_sf, CRS("+init=epsg:3414"))
airbnb_sf
## Simple feature collection with 7713 features and 14 fields
## geometry type: POINT
## dimension: XY
## bbox: xmin: 7215.566 ymin: 25166.35 xmax: 43401.32 ymax: 48466.72
## epsg (SRID): NA
## proj4string: +proj=tmerc +lat_0=1.366666666666667 +lon_0=103.8333333333333 +k=1 +x_0=28001.642 +y_0=38744.572 +ellps=WGS84 +units=m +no_defs
## # A tibble: 7,713 x 15
## id name host_id host_name neighbourhood_g~ neighbourhood room_type price
## <dbl> <chr> <dbl> <chr> <chr> <chr> <chr> <dbl>
## 1 49091 "COZ~ 266763 Francesca North Region Woodlands Private ~ 87
## 2 50646 "Ple~ 227796 Sujatha Central Region Bukit Timah Private ~ 80
## 3 56334 "COZ~ 266763 Francesca North Region Woodlands Private ~ 72
## 4 71609 "Ens~ 367042 Belinda East Region Tampines Private ~ 214
## 5 71896 "B&B~ 367042 Belinda East Region Tampines Private ~ 99
## 6 71903 "Roo~ 367042 Belinda East Region Tampines Private ~ 109
## 7 71907 "3rd~ 367042 Belinda East Region Tampines Private ~ 217
## 8 117957 "Pri~ 448620 Lynnity North-East Regi~ Sengkang Private ~ 67
## 9 241503 "Lon~ 1017645 Bianca East Region Bedok Private ~ 52
## 10 241508 "Lon~ 1017645 Bianca East Region Bedok Private ~ 54
## # ... with 7,703 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 [m]>
Removing those irrelevant column and only keep the room_type column.
airbnb_sf <- subset(airbnb_sf, select = -c(name, host_id,host_name,neighbourhood_group,price,minimum_nights,number_of_reviews,last_review,reviews_per_month, calculated_host_listings_count,availability_365,id,neighbourhood))
Filter room_type by Private room.
private <- airbnb_sf %>%
filter(room_type == "Private room")
Filter room_type by Hotel room.
Hotel <- airbnb_sf %>%
filter(room_type == "Hotel room")
Filter room_type by Shared room.
Shared <- airbnb_sf %>%
filter(room_type == "Shared room")
Filter room_type by Entire home/apt
Entire <- airbnb_sf %>%
filter(room_type == "Entire home/apt")
Convert private to Spatialpoints format which only left the coords without any other information.
private_sp <- as(private, "Spatial")
private_sp <- as(private_sp, "SpatialPoints")
Convert hotel to Spatialpoints format which only left the coords without any other information.
Hotel_sp <- as(Hotel, "Spatial")
Hotel_sp <- as(Hotel_sp, "SpatialPoints")
Convert share to Spatialpoints format which only left the coords without any other information.
Shared_sp <- as(Shared, "Spatial")
Shared_sp <- as(Shared_sp, "SpatialPoints")
Convert entire to Spatialpoints format which only left the coords without any other information.
Entire_sp <- as(Entire, "Spatial")
Entire_sp <- as(Entire_sp, "SpatialPoints")
Converting the data set in to spatstat’s ppp object format.
private_ppp <- as(private_sp,"ppp")
private_ppp_jit <- rjitter(private_ppp, retry=TRUE, nsim=1, drop=TRUE)
entire_ppp <- as(Entire_sp,"ppp")
entire_ppp_jit <- rjitter(entire_ppp, retry=TRUE, nsim=1, drop=TRUE)
hotel_ppp <- as(Hotel_sp,"ppp")
hotel_ppp_jit <- rjitter(hotel_ppp, retry=TRUE, nsim=1, drop=TRUE)
shared_ppp <- as(Shared_sp,"ppp")
shared_ppp_jit <- rjitter(shared_ppp, retry=TRUE, nsim=1, drop=TRUE)
Extract the target planning areas
Aljunied <- mpsz[mpsz@data$SUBZONE_N == "ALJUNIED",]
Balestier <- mpsz[mpsz@data$SUBZONE_N == "BALESTIER",]
Lavender <- mpsz[mpsz@data$SUBZONE_N == "LAVENDER",]
Tanjong_Pagar <- mpsz[mpsz@data$SUBZONE_N == "TANJONG PAGAR",]
Plotting target planning areas
par(mfrow = c(2,2))
plot(Aljunied, main = "Aljunied")
plot(Balestier, main = "Balestier")
plot(Lavender, main = "Lavender")
plot(Tanjong_Pagar, main = "Tanjong Pagar")
Converting the spatial point data frame into generic sp format
Aljunied_sp <- as(Aljunied, "SpatialPolygons")
Balestier_sp <- as(Balestier, "SpatialPolygons")
Lavender_sp <- as(Lavender, "SpatialPolygons")
Tanjong_Pagar_sp <- as(Tanjong_Pagar, "SpatialPolygons")
Creating owin object
Aljunied_owin <- as(Aljunied_sp, "owin")
Balestier_owin <- as(Balestier_sp, "owin")
Lavender_owin <- as(Lavender_sp, "owin")
Tanjong_Pagar_owin <- as(Tanjong_Pagar_sp, "owin")
private_Aljunied_ppp <- private_ppp_jit[Aljunied_owin]
shared_Aljunied_ppp <- shared_ppp_jit[Aljunied_owin]
hotel_Aljunied_ppp <- hotel_ppp_jit[Aljunied_owin]
entire_Aljunied_ppp <- entire_ppp_jit[Aljunied_owin]
To confirm the observed spatial patterns above, a hypothesis test will be conducted. The hypothesis and test are as follows:
Ho = The distribution of shared rooms at Aljunied are randomly distributed.
H1= The distribution of shared rooms at Aljunied are not randomly distributed.
The null hypothesis will be rejected is p-value is smaller than alpha value of 0.001.
G_shared_aljunied.csr <- envelope(shared_Aljunied_ppp, Gest, coorection = "all", 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(G_shared_aljunied.csr)
Conculsion: Since it is within the envelopes, therefore it is homogeneous distribution (CSR).
To confirm the observed spatial patterns above, a hypothesis test will be conducted. The hypothesis and test are as follows:
Ho = The distribution of shared rooms at Aljunied are randomly distributed.
H1= The distribution of shared rooms at Aljunied are not randomly distributed.
The null hypothesis will be rejected is p-value is smaller than alpha value of 0.001.
F_shared_aljunied.csr <- envelope(shared_Aljunied_ppp, Fest, correction = "all", 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(F_shared_aljunied.csr)
Conclusion: Since it is within the envelopes, therefore it is homogeneous distribution (CSR).
To confirm the observed spatial patterns above, a hypothesis test will be conducted. The hypothesis and test are as follows:
Ho = The distribution of shared rooms at Aljunied are randomly distributed.
H1= The distribution of shared rooms at Aljunied are not randomly distributed.
The null hypothesis will be rejected is p-value is smaller than alpha value of 0.001.
K_shared_aljunied.csr <- envelope(shared_Aljunied_ppp, Kest, nsim = 999, rank = 1, glocal=TRUE)
## Generating 999 simulations of CSR ...
## 1, 2, 3, ......10.........20.........30.........40.........50.........60........
## .70.........80.........90.........100.........110.........120.........130......
## ...140.........150.........160.........170.........180.........190.........200....
## .....210.........220.........230.........240.........250.........260.........270..
## .......280.........290.........300.........310.........320.........330.........340
## .........350.........360.........370.........380.........390.........400........
## .410.........420.........430.........440.........450.........460.........470......
## ...480.........490.........500.........510.........520.........530.........540....
## .....550.........560.........570.........580.........590.........600.........610..
## .......620.........630.........640.........650.........660.........670.........680
## .........690.........700.........710.........720.........730.........740........
## .750.........760.........770.........780.........790.........800.........810......
## ...820.........830.........840.........850.........860.........870.........880....
## .....890.........900.........910.........920.........930.........940.........950..
## .......960.........970.........980.........990........ 999.
##
## Done.
plot(K_shared_aljunied.csr, . - r ~ r, xlab="d", ylab="K(d)-r")
Conclusion: Since it is within the envelopes, therefore it is homogeneous distribution (CSR).
However, K function might not be the appropriate function to use, as in the Kest function it mentioned in the warning seciton that The estimator of K(r) is approximately unbiased for each fixed r. Bias increases with r and depends on the window geometry. For a rectangular window it is prudent to restrict the r values to a maximum of 1/4 of the smaller side length of the rectangle. Bias may become appreciable for point patterns consisting of fewer than 15 points. Since some of our data have less than 15 points, therefore it may cause biasness in calucation.
To confirm the observed spatial patterns above, a hypothesis test will be conducted. The hypothesis and test are as follows:
Ho = The distribution of shared rooms at Aljunied are randomly distributed.
H1= The distribution of shared rooms at Aljunied are not randomly distributed.
The null hypothesis will be rejected is p-value is smaller than alpha value of 0.001.
L_shared_aljunied.csr <- envelope(shared_Aljunied_ppp, Lest, nsim = 999, rank = 1, glocal=TRUE)
## Generating 999 simulations of CSR ...
## 1, 2, 3, ......10.........20.........30.........40.........50.........60........
## .70.........80.........90.........100.........110.........120.........130......
## ...140.........150.........160.........170.........180.........190.........200....
## .....210.........220.........230.........240.........250.........260.........270..
## .......280.........290.........300.........310.........320.........330.........340
## .........350.........360.........370.........380.........390.........400........
## .410.........420.........430.........440.........450.........460.........470......
## ...480.........490.........500.........510.........520.........530.........540....
## .....550.........560.........570.........580.........590.........600.........610..
## .......620.........630.........640.........650.........660.........670.........680
## .........690.........700.........710.........720.........730.........740........
## .750.........760.........770.........780.........790.........800.........810......
## ...820.........830.........840.........850.........860.........870.........880....
## .....890.........900.........910.........920.........930.........940.........950..
## .......960.........970.........980.........990........ 999.
##
## Done.
plot(L_shared_aljunied.csr, . - r ~ r, xlab="d", ylab="L(d)-r")
plot(hotel_Aljunied_ppp, main = "Hotel Aljunied")
F_hotel_aljunied = Fest(hotel_Aljunied_ppp, correction = "all")
plot(F_hotel_aljunied)
To confirm the observed spatial patterns above, a hypothesis test will be conducted. The hypothesis and test are as follows:
Ho = The distribution of hotel rooms at Aljunied are randomly distributed.
H1= The distribution of hotel rooms at Aljunied are not randomly distributed.
The null hypothesis will be rejected is p-value is smaller than alpha value of 0.001.
F_hotel_aljunied.csr <- envelope(hotel_Aljunied_ppp, Fest, correction = "all", 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(F_hotel_aljunied.csr)
Conclusion: Since it is within the envelopes, therefore it is homogeneous distribution (CSR).
plot(private_Aljunied_ppp, main = "Private Aljunied")
F_private_aljunied = Fest(private_Aljunied_ppp, correction = "all")
plot(F_private_aljunied)
To confirm the observed spatial patterns above, a hypothesis test will be conducted. The hypothesis and test are as follows:
Ho = The distribution of private rooms at Aljunied are randomly distributed.
H1= The distribution of private rooms at Aljunied are not randomly distributed.
The null hypothesis will be rejected is p-value is smaller than alpha value of 0.001.
F_private_aljunied.csr <- envelope(private_Aljunied_ppp, Fest, correction = "all", 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(F_private_aljunied.csr)
Conclusion: Since the it is below the envelopes, therefore it is clustered pattern
plot(entire_Aljunied_ppp, main = "Entire Aljunied")
F_entire_aljunied = Fest(entire_Aljunied_ppp, correction = "all")
plot(F_entire_aljunied)
To confirm the observed spatial patterns above, a hypothesis test will be conducted. The hypothesis and test are as follows:
Ho = The distribution of entire rooms at Aljunied are randomly distributed.
H1= The distribution of entire rooms at Aljunied are not randomly distributed.
The null hypothesis will be rejected is p-value is smaller than alpha value of 0.001.
F_entire_aljunied.csr <- envelope(entire_Aljunied_ppp, Fest, correction = "all", 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(F_entire_aljunied.csr)
Conclusion: Since the it is below the envelopes, therefore it is clustered pattern
private_Balestier_ppp <- private_ppp_jit[Balestier_owin]
shared_Balestier_ppp <- shared_ppp_jit[Balestier_owin]
hotel_Balestier_ppp <- hotel_ppp_jit[Balestier_owin]
entire_Balestier_ppp <- entire_ppp_jit[Balestier_owin]
To confirm the observed spatial patterns above, a hypothesis test will be conducted. The hypothesis and test are as follows:
Ho = The distribution of Shared rooms at Balestier are randomly distributed.
H1= The distribution of Shared rooms at Balestier are not randomly distributed.
The null hypothesis will be rejected is p-value is smaller than alpha value of 0.001.
G_shared_balestier.csr <- envelope(shared_Balestier_ppp, Gest, coorection = "all", 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(G_shared_balestier.csr)
Conclusion: By using G function we are unable to get any results, even though there is a point in the study area. Therefore, G Function is not a appropraite 2 order spatial point patterns analysis technique.
To confirm the observed spatial patterns above, a hypothesis test will be conducted. The hypothesis and test are as follows:
Ho = The distribution of Shared rooms at Balestier are randomly distributed.
H1= The distribution of Shared rooms at Balestier are not randomly distributed.
The null hypothesis will be rejected is p-value is smaller than alpha value of 0.001.
F_shared_balestier.csr <- envelope(shared_Balestier_ppp, Fest, correction = "all", 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(F_shared_balestier.csr)
Conclusion: Since it is within the envelopes, therefore is it CSR.
plot(hotel_Balestier_ppp, main = "Hotel Balestier")
F_hotel_Balestier = Fest(hotel_Balestier_ppp)
plot(F_hotel_Balestier)
To confirm the observed spatial patterns above, a hypothesis test will be conducted. The hypothesis and test are as follows:
Ho = The distribution of hotel rooms at Balestier are randomly distributed.
H1= The distribution of hotel rooms at Balestier are not randomly distributed.
The null hypothesis will be rejected is p-value is smaller than alpha value of 0.001.
F_hotel_balestier.csr <- envelope(hotel_Balestier_ppp, Fest, correction = "all", 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(F_hotel_balestier.csr)
Conculsion: From 0m to 125m it is within the envelopes, therefore it is CSR. However from 125m onwards it is below the envelopes, therefore 125 onwards it is clustered pattern.
plot(private_Balestier_ppp, main = "Private Balestier")
F_private_Balestier = Fest(private_Balestier_ppp)
plot(F_private_Balestier)
To confirm the observed spatial patterns above, a hypothesis test will be conducted. The hypothesis and test are as follows:
Ho = The distribution of private rooms at Balestier are randomly distributed.
H1= The distribution of private rooms at Balestier are not randomly distributed.
The null hypothesis will be rejected is p-value is smaller than alpha value of 0.001.
F_private_balestier.csr <- envelope(private_Balestier_ppp, Fest, correction = "all", 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(F_private_balestier.csr)
Conclusion: Since the it is below the envelopes, therefore it is clustered pattern
plot(entire_Balestier_ppp, main = "Entire Balestier")
F_entire_Balestier = Fest(entire_Balestier_ppp)
plot(F_entire_Balestier)
To confirm the observed spatial patterns above, a hypothesis test will be conducted. The hypothesis and test are as follows:
Ho = The distribution of entire rooms at Balestier are randomly distributed.
H1= The distribution of entire rooms at Balestier are not randomly distributed.
The null hypothesis will be rejected is p-value is smaller than alpha value of 0.001.
F_entire_balestier.csr <- envelope(entire_Balestier_ppp, Fest, correction = "all", 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(F_entire_balestier.csr)
Conclusion: Since the it is below the envelopes, therefore it is clustered pattern
private_Lavender_ppp <- private_ppp_jit[Lavender_owin]
shared_Lavender_ppp <- shared_ppp_jit[Lavender_owin]
hotel_Lavender_ppp <- hotel_ppp_jit[Lavender_owin]
entire_Lavender_ppp <- entire_ppp_jit[Lavender_owin]
To confirm the observed spatial patterns above, a hypothesis test will be conducted. The hypothesis and test are as follows:
Ho = The distribution of Shared rooms at Lavender are randomly distributed.
H1= The distribution of Shared rooms at Lavender are not randomly distributed.
The null hypothesis will be rejected is p-value is smaller than alpha value of 0.001.
F_shared_lavender.csr <- envelope(shared_Lavender_ppp, Fest, correction = "all", 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(F_shared_lavender.csr)
Conculsion: From 0m to 75m it is within the envelopes, therefore it is CSR. However from 125m onwards it is below the envelopes, therefore 75 onwards it is clustered pattern.
plot(hotel_Lavender_ppp, main = "Hotel Lavender")
F_hotel_lavender = Fest(hotel_Lavender_ppp)
plot(F_hotel_lavender)
To confirm the observed spatial patterns above, a hypothesis test will be conducted. The hypothesis and test are as follows:
Ho = The distribution of Hotel rooms at Lavender are randomly distributed.
H1= The distribution of Hotel rooms at Lavender are not randomly distributed.
The null hypothesis will be rejected is p-value is smaller than alpha value of 0.001.
F_hotel_lavender.csr <- envelope(hotel_Lavender_ppp, Fest, correction = "all", 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(F_hotel_lavender.csr)
Conclusion: Since the it is below the envelopes, therefore it is clustered pattern
plot(private_Lavender_ppp, main = "Private Lavender")
F_private_lavender = Fest(private_Lavender_ppp)
plot(F_private_lavender)
## 6.4.3 Performing Complete Spatial Randomness Test
To confirm the observed spatial patterns above, a hypothesis test will be conducted. The hypothesis and test are as follows:
Ho = The distribution of Private rooms at Lavender are randomly distributed.
H1= The distribution of Private rooms at Lavender are not randomly distributed.
The null hypothesis will be rejected is p-value is smaller than alpha value of 0.001.
F_private_lavender.csr <- envelope(private_Lavender_ppp, Fest, correction = "all", nsim = 99)
## Generating 99 simulations of CSR ...
## 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40,
## 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80,
## 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99.
##
## Done.
plot(F_private_lavender.csr)
Conclusion: Since the it is below the envelopes, therefore it is clustered pattern
plot(entire_Lavender_ppp, main = "Entire Lavender")
F_entire_lavender = Fest(entire_Lavender_ppp)
plot(F_entire_lavender)
To confirm the observed spatial patterns above, a hypothesis test will be conducted. The hypothesis and test are as follows:
Ho = The distribution of Entire rooms at Lavender are randomly distributed.
H1= The distribution of Entire rooms at Lavender are not randomly distributed.
The null hypothesis will be rejected is p-value is smaller than alpha value of 0.001.
F_entire_lavender.csr <- envelope(entire_Lavender_ppp, Fest, correction = "all", 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(F_entire_lavender.csr)
Conclusion: Since the it is below the envelopes, therefore it is clustered pattern
private_Tanjong_Pagar_ppp <- private_ppp_jit[Tanjong_Pagar_owin]
shared_Tanjong_Pagar_ppp <- shared_ppp_jit[Tanjong_Pagar_owin]
hotel_Tanjong_Pagar_ppp <- hotel_ppp_jit[Tanjong_Pagar_owin]
entire_Tanjong_Pagar_ppp <- entire_ppp_jit[Tanjong_Pagar_owin]
plot(hotel_Tanjong_Pagar_ppp, main = "Hotel Tanjong Pagar")
F_hotel_tanjong_pagar = Fest(hotel_Tanjong_Pagar_ppp)
plot(F_hotel_tanjong_pagar)
To confirm the observed spatial patterns above, a hypothesis test will be conducted. The hypothesis and test are as follows:
Ho = The distribution of hotel rooms at tanjong pagar are randomly distributed.
H1= The distribution of hotel rooms at tanjong pagar are not randomly distributed.
The null hypothesis will be rejected is p-value is smaller than alpha value of 0.001.
F_hotel_tanjong_pagar.csr <- envelope(hotel_Tanjong_Pagar_ppp, Fest, correction = "all", 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(F_hotel_tanjong_pagar.csr)
Conclusion: Since it is within the envelopes, therefore is it CSR.
plot(private_Tanjong_Pagar_ppp, main = "Private Tanjong Pagar")
F_private_tanjong_pagar = Fest(private_Tanjong_Pagar_ppp)
plot(F_private_tanjong_pagar)
To confirm the observed spatial patterns above, a hypothesis test will be conducted. The hypothesis and test are as follows:
Ho = The distribution of private rooms at tanjong pagar are randomly distributed.
H1= The distribution of private rooms at tanjong pagar are not randomly distributed.
The null hypothesis will be rejected is p-value is smaller than alpha value of 0.001.
F_private_tanjong_pagar.csr <- envelope(private_Tanjong_Pagar_ppp, Fest, correction = "all", 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(F_private_tanjong_pagar.csr)
Conclusion: Since it is within the envelopes, therefore is it CSR.
plot(entire_Tanjong_Pagar_ppp, main = "Entire Tanjong Pagar")
F_entire_tanjong_pagar = Fest(entire_Tanjong_Pagar_ppp)
plot(F_entire_tanjong_pagar)
To confirm the observed spatial patterns above, a hypothesis test will be conducted. The hypothesis and test are as follows:
Ho = The distribution of enitre rooms at tanjong pagar are randomly distributed.
H1= The distribution of entire rooms at tanjong pagar are not randomly distributed.
The null hypothesis will be rejected is p-value is smaller than alpha value of 0.001.
F_entire_tanjong_pagar.csr <- envelope(entire_Tanjong_Pagar_ppp, Fest, correction = "all", 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(F_entire_tanjong_pagar.csr)
Conclusion: Since the it is below the envelopes, therefore it is clustered pattern