1 Overview

In this exercise, I will be analyzing the geographic distribution childcare and kindergarten services by using appropriate map analysis and spatial point patterns analysis techniques.

Section A: The supply and demand of childcare and kindergarten services by planning subzone

  1. Exploratory Spatial Data Analysis:
  • Using appropriate EDA and choropleth mapping techniques to reveal the supply and demand of childcare and kindergarten services at the planning subzone level. Describe the spatial patterns observed.
  1. Analytics mapping:
  • Using appropriate analytics mapping techniques to reveal relationship between childcare and kindergarten services at the planning subzone level.
  1. Geocommunication
  • Describe the results of (1) and (2) and draw statistical conclusions.

Section B: Spatial Point Pattern Analysis

  1. Exploratory Spatial Data Analysis:
  • Display the location of childcare and kindergarten services in separate point maps. Describe the spatial patterns reveal by their respective distribution.
  1. With reference to the spatial point patterns observed in (4):
  • Formulate the null hypothesis and alternative hypothesis and select the confidence level.

  • Perform the test by using appropriate 2nd order spatial point patterns analysis technique.

  • With reference to the analysis results, draw statistical conclusions.

  1. With reference to the results derived in (4) and (5):
  • Derive kernel density maps of childcare and kindergarten services.

  • Using appropriate tmap functions, display the kernel density maps on openstreetmap of Singapore.

  • With reference to the analysis results, draw statistical conclusions.

  • Compare the advantages of kernel density maps (6) over point maps (4).

2 Background

Singapore are divided into planning areas and subzones for urban planning and census studies under the Urban Redevelopment Authority (URA) masterplan. There are a total of 55 planning areas and they are are futher subdivided into 323 subzones. The division can be seen in the picture below.

Singapore map with planning area and subzones.

3 Setting Up Working Environment

This code chunk will check if the R packages in the packaging list have been installed. If no, go ahead to install the missing one. After installation, it will also load the R packages in R.

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

4 Analysis on supply and demand of childcare and kindergarten services by planning subzone (Section A)

4.1 The Data

  • The latest childcare and kindergarten (Pre school) data sets from data.gov.sg.

  • URA Master Plan 2014 Planning Subzone GIS data from data.gov.sg.

  • Singapore Residents by Planning Area Subzone, Age Group, Sex and Type of Dwelling,June 2011-2019 from Singapore Department of Statistics.

4.2 Importing Geospatial Data into R

sf_mpsz <- st_read(dsn = "data", 
                layer = "MP14_SUBZONE_WEB_PL")
## Reading layer `MP14_SUBZONE_WEB_PL' from data source `C:\Users\Yong Wei\Documents\Y2\IS415-Geospatial\TakeHome_Ex01\data' using driver `ESRI Shapefile'
## Simple feature collection with 323 features and 15 fields
## geometry type:  MULTIPOLYGON
## dimension:      XY
## bbox:           xmin: 2667.538 ymin: 15748.72 xmax: 56396.44 ymax: 50256.33
## projected CRS:  SVY21
sgpopdata <- read_csv("data/respopagesextod2011to2019.csv")
popVol <-read_csv("data/respopagesextod2011to2019.csv")
sf_preschool <- st_read("data/pre-schools-location-kml.kml")
## Reading layer `PRESCHOOLS_LOCATION' from data source `C:\Users\Yong Wei\Documents\Y2\IS415-Geospatial\TakeHome_Ex01\data\pre-schools-location-kml.kml' using driver `KML'
## Simple feature collection with 1925 features and 2 fields
## geometry type:  POINT
## dimension:      XYZ
## bbox:           xmin: 103.6824 ymin: 1.247759 xmax: 103.9897 ymax: 1.462134
## z_range:        zmin: 0 zmax: 0
## geographic CRS: WGS 84

4.3 Examine content

Checking contents of data objects

summary(sf_mpsz)
##     OBJECTID       SUBZONE_NO      SUBZONE_N          SUBZONE_C        
##  Min.   :  1.0   Min.   : 1.000   Length:323         Length:323        
##  1st Qu.: 81.5   1st Qu.: 2.000   Class :character   Class :character  
##  Median :162.0   Median : 4.000   Mode  :character   Mode  :character  
##  Mean   :162.0   Mean   : 4.625                                        
##  3rd Qu.:242.5   3rd Qu.: 6.500                                        
##  Max.   :323.0   Max.   :17.000                                        
##     CA_IND           PLN_AREA_N         PLN_AREA_C          REGION_N        
##  Length:323         Length:323         Length:323         Length:323        
##  Class :character   Class :character   Class :character   Class :character  
##  Mode  :character   Mode  :character   Mode  :character   Mode  :character  
##                                                                             
##                                                                             
##                                                                             
##    REGION_C           INC_CRC            FMEL_UPD_D             X_ADDR     
##  Length:323         Length:323         Min.   :2014-12-05   Min.   : 5093  
##  Class :character   Class :character   1st Qu.:2014-12-05   1st Qu.:21864  
##  Mode  :character   Mode  :character   Median :2014-12-05   Median :28465  
##                                        Mean   :2014-12-05   Mean   :27257  
##                                        3rd Qu.:2014-12-05   3rd Qu.:31674  
##                                        Max.   :2014-12-05   Max.   :50425  
##      Y_ADDR        SHAPE_Leng        SHAPE_Area                geometry  
##  Min.   :19579   Min.   :  871.5   Min.   :   39438   MULTIPOLYGON :323  
##  1st Qu.:31776   1st Qu.: 3709.6   1st Qu.:  628261   epsg:NA      :  0  
##  Median :35113   Median : 5211.9   Median : 1229894   +proj=tmer...:  0  
##  Mean   :36106   Mean   : 6524.4   Mean   : 2420882                      
##  3rd Qu.:39869   3rd Qu.: 6942.6   3rd Qu.: 2106483                      
##  Max.   :49553   Max.   :68083.9   Max.   :69748299
sgpopdata 
## # A tibble: 883,728 x 7
##    PA        SZ               AG    Sex    TOD                         Pop  Time
##    <chr>     <chr>            <chr> <chr>  <chr>                     <dbl> <dbl>
##  1 Ang Mo K~ Ang Mo Kio Town~ 0_to~ Males  HDB 1- and 2-Room Flats       0  2011
##  2 Ang Mo K~ Ang Mo Kio Town~ 0_to~ Males  HDB 3-Room Flats             10  2011
##  3 Ang Mo K~ Ang Mo Kio Town~ 0_to~ Males  HDB 4-Room Flats             30  2011
##  4 Ang Mo K~ Ang Mo Kio Town~ 0_to~ Males  HDB 5-Room and Executive~    50  2011
##  5 Ang Mo K~ Ang Mo Kio Town~ 0_to~ Males  HUDC Flats (excluding th~     0  2011
##  6 Ang Mo K~ Ang Mo Kio Town~ 0_to~ Males  Landed Properties             0  2011
##  7 Ang Mo K~ Ang Mo Kio Town~ 0_to~ Males  Condominiums and Other A~    40  2011
##  8 Ang Mo K~ Ang Mo Kio Town~ 0_to~ Males  Others                        0  2011
##  9 Ang Mo K~ Ang Mo Kio Town~ 0_to~ Femal~ HDB 1- and 2-Room Flats       0  2011
## 10 Ang Mo K~ Ang Mo Kio Town~ 0_to~ Femal~ HDB 3-Room Flats             10  2011
## # ... with 883,718 more rows
sf_preschool
## Simple feature collection with 1925 features and 2 fields
## geometry type:  POINT
## dimension:      XYZ
## bbox:           xmin: 103.6824 ymin: 1.247759 xmax: 103.9897 ymax: 1.462134
## z_range:        zmin: 0 zmax: 0
## geographic CRS: WGS 84
## First 10 features:
##      Name
## 1   kml_1
## 2   kml_2
## 3   kml_3
## 4   kml_4
## 5   kml_5
## 6   kml_6
## 7   kml_7
## 8   kml_8
## 9   kml_9
## 10 kml_10
##                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         Description
## 1             <center><table><tr><th colspan='2' align='center'><em>Attributes</em></th></tr><tr bgcolor="#E3E3F3"> <th>CENTRE_NAME</th> <td>BRILLIANT TOTS PTE. LTD.</td> </tr><tr bgcolor=""> <th>CENTRE_CODE</th> <td>PT9334</td> </tr><tr bgcolor="#E3E3F3"> <th>ADDRESS</th> <td>610, JURONG WEST STREET 65, #01 - 534, S 640610</td> </tr><tr bgcolor=""> <th>POSTAL_CODE</th> <td>640610</td> </tr><tr bgcolor="#E3E3F3"> <th>INC_CRC</th> <td>0523C7904478A63D</td> </tr><tr bgcolor=""> <th>FMEL_UPD_D</th> <td>20200812235534</td> </tr></table></center>
## 2             <center><table><tr><th colspan='2' align='center'><em>Attributes</em></th></tr><tr bgcolor="#E3E3F3"> <th>CENTRE_NAME</th> <td>BUBBLESLAND PLAYHOUSE PTE LTD</td> </tr><tr bgcolor=""> <th>CENTRE_CODE</th> <td>PT7680</td> </tr><tr bgcolor="#E3E3F3"> <th>ADDRESS</th> <td>238, COMPASSVALE WALK, #01 - 542, S 540238</td> </tr><tr bgcolor=""> <th>POSTAL_CODE</th> <td>540238</td> </tr><tr bgcolor="#E3E3F3"> <th>INC_CRC</th> <td>18BED05A501AA168</td> </tr><tr bgcolor=""> <th>FMEL_UPD_D</th> <td>20200812235534</td> </tr></table></center>
## 3       <center><table><tr><th colspan='2' align='center'><em>Attributes</em></th></tr><tr bgcolor="#E3E3F3"> <th>CENTRE_NAME</th> <td>BUCKET HOUSE PRESCHOOL</td> </tr><tr bgcolor=""> <th>CENTRE_CODE</th> <td>PT9527</td> </tr><tr bgcolor="#E3E3F3"> <th>ADDRESS</th> <td>39, WOODLANDS CLOSE, #01 - 62, MEGA@WOODLANDS, S 737856</td> </tr><tr bgcolor=""> <th>POSTAL_CODE</th> <td>737856</td> </tr><tr bgcolor="#E3E3F3"> <th>INC_CRC</th> <td>C88B9AC31EE71BF6</td> </tr><tr bgcolor=""> <th>FMEL_UPD_D</th> <td>20200812235534</td> </tr></table></center>
## 4            <center><table><tr><th colspan='2' align='center'><em>Attributes</em></th></tr><tr bgcolor="#E3E3F3"> <th>CENTRE_NAME</th> <td>BUMBLE BEE CHILD CARE CENTRE</td> </tr><tr bgcolor=""> <th>CENTRE_CODE</th> <td>PT3150</td> </tr><tr bgcolor="#E3E3F3"> <th>ADDRESS</th> <td>369, WOODLANDS AVENUE 1, #01 - 853, S 730369</td> </tr><tr bgcolor=""> <th>POSTAL_CODE</th> <td>730369</td> </tr><tr bgcolor="#E3E3F3"> <th>INC_CRC</th> <td>64AB8FACA8F60129</td> </tr><tr bgcolor=""> <th>FMEL_UPD_D</th> <td>20200812235534</td> </tr></table></center>
## 5               <center><table><tr><th colspan='2' align='center'><em>Attributes</em></th></tr><tr bgcolor="#E3E3F3"> <th>CENTRE_NAME</th> <td>BUSY BEES SINGAPORE PTE LTD</td> </tr><tr bgcolor=""> <th>CENTRE_CODE</th> <td>PT9117</td> </tr><tr bgcolor="#E3E3F3"> <th>ADDRESS</th> <td>327B, ANCHORVALE ROAD, #01 - 322, S 542327</td> </tr><tr bgcolor=""> <th>POSTAL_CODE</th> <td>542327</td> </tr><tr bgcolor="#E3E3F3"> <th>INC_CRC</th> <td>E1B55AC65B9059E8</td> </tr><tr bgcolor=""> <th>FMEL_UPD_D</th> <td>20200812235534</td> </tr></table></center>
## 6                  <center><table><tr><th colspan='2' align='center'><em>Attributes</em></th></tr><tr bgcolor="#E3E3F3"> <th>CENTRE_NAME</th> <td>BUSY BEES SINGAPORE PTE LTD</td> </tr><tr bgcolor=""> <th>CENTRE_CODE</th> <td>PT9066</td> </tr><tr bgcolor="#E3E3F3"> <th>ADDRESS</th> <td>211A, PUNGGOL WALK, #01 - 623, S 821211</td> </tr><tr bgcolor=""> <th>POSTAL_CODE</th> <td>821211</td> </tr><tr bgcolor="#E3E3F3"> <th>INC_CRC</th> <td>3B5A4AF2696592AA</td> </tr><tr bgcolor=""> <th>FMEL_UPD_D</th> <td>20200812235534</td> </tr></table></center>
## 7       <center><table><tr><th colspan='2' align='center'><em>Attributes</em></th></tr><tr bgcolor="#E3E3F3"> <th>CENTRE_NAME</th> <td>BUSY BEES SINGAPORE PTE LTD</td> </tr><tr bgcolor=""> <th>CENTRE_CODE</th> <td>PT9479</td> </tr><tr bgcolor="#E3E3F3"> <th>ADDRESS</th> <td>2, GAMBAS CRESCENT,  - 01-03, NORDCOM II, S 757044</td> </tr><tr bgcolor=""> <th>POSTAL_CODE</th> <td>757044</td> </tr><tr bgcolor="#E3E3F3"> <th>INC_CRC</th> <td>5F5452B568838620</td> </tr><tr bgcolor=""> <th>FMEL_UPD_D</th> <td>20200812235534</td> </tr></table></center>
## 8          <center><table><tr><th colspan='2' align='center'><em>Attributes</em></th></tr><tr bgcolor="#E3E3F3"> <th>CENTRE_NAME</th> <td>BUSY BEES SINGAPORE PTE.LTD</td> </tr><tr bgcolor=""> <th>CENTRE_CODE</th> <td>PT9127</td> </tr><tr bgcolor="#E3E3F3"> <th>ADDRESS</th> <td>6, SERANGOON NORTH AVENUE 5, #02 - 01, S 554910</td> </tr><tr bgcolor=""> <th>POSTAL_CODE</th> <td>554910</td> </tr><tr bgcolor="#E3E3F3"> <th>INC_CRC</th> <td>3AD4173BBB057D89</td> </tr><tr bgcolor=""> <th>FMEL_UPD_D</th> <td>20200812235534</td> </tr></table></center>
## 9             <center><table><tr><th colspan='2' align='center'><em>Attributes</em></th></tr><tr bgcolor="#E3E3F3"> <th>CENTRE_NAME</th> <td>BUSY BEES SINGAPORE PTE.LTD.</td> </tr><tr bgcolor=""> <th>CENTRE_CODE</th> <td>PT9067</td> </tr><tr bgcolor="#E3E3F3"> <th>ADDRESS</th> <td>348A, YISHUN AVENUE 11, #01 - 557, S 761348</td> </tr><tr bgcolor=""> <th>POSTAL_CODE</th> <td>761348</td> </tr><tr bgcolor="#E3E3F3"> <th>INC_CRC</th> <td>F4D7A4BDA3CBB15F</td> </tr><tr bgcolor=""> <th>FMEL_UPD_D</th> <td>20200812235534</td> </tr></table></center>
## 10 <center><table><tr><th colspan='2' align='center'><em>Attributes</em></th></tr><tr bgcolor="#E3E3F3"> <th>CENTRE_NAME</th> <td>CAELUM JUNIOR @ BENDEMEER PTE. LTD.</td> </tr><tr bgcolor=""> <th>CENTRE_CODE</th> <td>PT9053</td> </tr><tr bgcolor="#E3E3F3"> <th>ADDRESS</th> <td>70, BENDEMEER ROAD, #02 - 01, LUZERNE, S 339940</td> </tr><tr bgcolor=""> <th>POSTAL_CODE</th> <td>339940</td> </tr><tr bgcolor="#E3E3F3"> <th>INC_CRC</th> <td>D55FC7583E8CCBA7</td> </tr><tr bgcolor=""> <th>FMEL_UPD_D</th> <td>20200812235534</td> </tr></table></center>
##                         geometry
## 1  POINT Z (103.7009 1.338325 0)
## 2   POINT Z (103.8987 1.39044 0)
## 3  POINT Z (103.8068 1.438017 0)
## 4  POINT Z (103.7874 1.433436 0)
## 5  POINT Z (103.8886 1.395647 0)
## 6   POINT Z (103.8999 1.40176 0)
## 7  POINT Z (103.8158 1.443185 0)
## 8  POINT Z (103.8691 1.374466 0)
## 9  POINT Z (103.8412 1.427353 0)
## 10 POINT Z (103.8625 1.316266 0)
head(sf_mpsz,n=4)
## Simple feature collection with 4 features and 15 fields
## geometry type:  MULTIPOLYGON
## dimension:      XY
## bbox:           xmin: 26403.48 ymin: 28369.47 xmax: 32362.39 ymax: 30396.46
## projected CRS:  SVY21
##   OBJECTID SUBZONE_NO      SUBZONE_N SUBZONE_C CA_IND      PLN_AREA_N
## 1        1          1   MARINA SOUTH    MSSZ01      Y    MARINA SOUTH
## 2        2          1   PEARL'S HILL    OTSZ01      Y          OUTRAM
## 3        3          3      BOAT QUAY    SRSZ03      Y SINGAPORE RIVER
## 4        4          8 HENDERSON HILL    BMSZ08      N     BUKIT MERAH
##   PLN_AREA_C       REGION_N REGION_C          INC_CRC FMEL_UPD_D   X_ADDR
## 1         MS CENTRAL REGION       CR 5ED7EB253F99252E 2014-12-05 31595.84
## 2         OT CENTRAL REGION       CR 8C7149B9EB32EEFC 2014-12-05 28679.06
## 3         SR CENTRAL REGION       CR C35FEFF02B13E0E5 2014-12-05 29654.96
## 4         BM CENTRAL REGION       CR 3775D82C5DDBEFBD 2014-12-05 26782.83
##     Y_ADDR SHAPE_Leng SHAPE_Area                       geometry
## 1 29220.19   5267.381  1630379.3 MULTIPOLYGON (((31495.56 30...
## 2 29782.05   3506.107   559816.2 MULTIPOLYGON (((29092.28 30...
## 3 29974.66   1740.926   160807.5 MULTIPOLYGON (((29932.33 29...
## 4 29933.77   3313.625   595428.9 MULTIPOLYGON (((27131.28 30...

4.4 Working with projection

4.4.1 Assigning EPSG code to sf_mpsz feature data frame.

sf_mpsz3414 <- st_set_crs(sf_mpsz, 3414)
st_crs(sf_mpsz3414)
## Coordinate Reference System:
##   User input: EPSG:3414 
##   wkt:
## PROJCRS["SVY21 / Singapore TM",
##     BASEGEOGCRS["SVY21",
##         DATUM["SVY21",
##             ELLIPSOID["WGS 84",6378137,298.257223563,
##                 LENGTHUNIT["metre",1]]],
##         PRIMEM["Greenwich",0,
##             ANGLEUNIT["degree",0.0174532925199433]],
##         ID["EPSG",4757]],
##     CONVERSION["Singapore Transverse Mercator",
##         METHOD["Transverse Mercator",
##             ID["EPSG",9807]],
##         PARAMETER["Latitude of natural origin",1.36666666666667,
##             ANGLEUNIT["degree",0.0174532925199433],
##             ID["EPSG",8801]],
##         PARAMETER["Longitude of natural origin",103.833333333333,
##             ANGLEUNIT["degree",0.0174532925199433],
##             ID["EPSG",8802]],
##         PARAMETER["Scale factor at natural origin",1,
##             SCALEUNIT["unity",1],
##             ID["EPSG",8805]],
##         PARAMETER["False easting",28001.642,
##             LENGTHUNIT["metre",1],
##             ID["EPSG",8806]],
##         PARAMETER["False northing",38744.572,
##             LENGTHUNIT["metre",1],
##             ID["EPSG",8807]]],
##     CS[Cartesian,2],
##         AXIS["northing (N)",north,
##             ORDER[1],
##             LENGTHUNIT["metre",1]],
##         AXIS["easting (E)",east,
##             ORDER[2],
##             LENGTHUNIT["metre",1]],
##     USAGE[
##         SCOPE["unknown"],
##         AREA["Singapore"],
##         BBOX[1.13,103.59,1.47,104.07]],
##     ID["EPSG",3414]]

4.4.2 Transforming sf_preschool from wgs84 to svy21

sf_preschool3414 <- st_transform(sf_preschool, 3414)
st_crs(sf_preschool3414)
## Coordinate Reference System:
##   User input: EPSG:3414 
##   wkt:
## PROJCRS["SVY21 / Singapore TM",
##     BASEGEOGCRS["SVY21",
##         DATUM["SVY21",
##             ELLIPSOID["WGS 84",6378137,298.257223563,
##                 LENGTHUNIT["metre",1]]],
##         PRIMEM["Greenwich",0,
##             ANGLEUNIT["degree",0.0174532925199433]],
##         ID["EPSG",4757]],
##     CONVERSION["Singapore Transverse Mercator",
##         METHOD["Transverse Mercator",
##             ID["EPSG",9807]],
##         PARAMETER["Latitude of natural origin",1.36666666666667,
##             ANGLEUNIT["degree",0.0174532925199433],
##             ID["EPSG",8801]],
##         PARAMETER["Longitude of natural origin",103.833333333333,
##             ANGLEUNIT["degree",0.0174532925199433],
##             ID["EPSG",8802]],
##         PARAMETER["Scale factor at natural origin",1,
##             SCALEUNIT["unity",1],
##             ID["EPSG",8805]],
##         PARAMETER["False easting",28001.642,
##             LENGTHUNIT["metre",1],
##             ID["EPSG",8806]],
##         PARAMETER["False northing",38744.572,
##             LENGTHUNIT["metre",1],
##             ID["EPSG",8807]]],
##     CS[Cartesian,2],
##         AXIS["northing (N)",north,
##             ORDER[1],
##             LENGTHUNIT["metre",1]],
##         AXIS["easting (E)",east,
##             ORDER[2],
##             LENGTHUNIT["metre",1]],
##     USAGE[
##         SCOPE["unknown"],
##         AREA["Singapore"],
##         BBOX[1.13,103.59,1.47,104.07]],
##     ID["EPSG",3414]]

4.4.3 Converting point feature data.frame to SpatialPointsDataFrame

sp_preschool <- as_Spatial(sf_preschool3414)
summary(sp_preschool)
## Object of class SpatialPointsDataFrame
## Coordinates:
##                min      max
## coords.x1 11203.01 45404.24
## coords.x2 25596.33 49300.88
## coords.x3     0.00     0.00
## Is projected: TRUE 
## proj4string :
## [+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]
## Number of points: 1925
## Data attributes:
##      Name           Description       
##  Length:1925        Length:1925       
##  Class :character   Class :character  
##  Mode  :character   Mode  :character

4.5 Analysis Step-By-Step For Age Group Numbers In Each Planning Subzone

Data wrangling and transformation. The following data were extracted:

  • Extracting 2019 records only.
  • Extracting Age Group 0-4 years old only.

We are only interested in the above data only because they are the relevant audience for preschools and the year are the latest.

4.5.1 Data Preparation for Age Group Numbers

Step 1: Preparing the data by renaming the headers of the data, replacing “to” to “-” and filtering out any 0 in the population data.

## rename the headers of the data 
names(sgpopdata)[1:7] =
  c("Planning_Area", "Subzone", "Age", "Gender", "Housing_Type","Population","Year")

## replace " to " to "-"
sgpopdata$Age <- str_replace_all(sgpopdata$Age, " to ", "-")

## filter out 0 in population 
sgpopdata<- subset(sgpopdata,sgpopdata$Population>0)

Step 2: Extracting data in 2019 only and Age is 0 to 4 years old.

sgpopdata2019 = subset(sgpopdata,Year == "2019")
sg0to4data2019 = subset(sgpopdata2019,Age == "0_to_4")
## Show the first 5 rows in the data 
head(sgpopdata2019)
## # A tibble: 6 x 7
##   Planning_Area Subzone       Age    Gender Housing_Type        Population  Year
##   <chr>         <chr>         <chr>  <chr>  <chr>                    <dbl> <dbl>
## 1 Ang Mo Kio    Ang Mo Kio T~ 0_to_4 Males  HDB 3-Room Flats            10  2019
## 2 Ang Mo Kio    Ang Mo Kio T~ 0_to_4 Males  HDB 4-Room Flats            10  2019
## 3 Ang Mo Kio    Ang Mo Kio T~ 0_to_4 Males  HDB 5-Room and Exe~         20  2019
## 4 Ang Mo Kio    Ang Mo Kio T~ 0_to_4 Males  Condominiums and O~         50  2019
## 5 Ang Mo Kio    Ang Mo Kio T~ 0_to_4 Femal~ HDB 3-Room Flats            10  2019
## 6 Ang Mo Kio    Ang Mo Kio T~ 0_to_4 Femal~ HDB 4-Room Flats            10  2019
head(sg0to4data2019)
## # A tibble: 6 x 7
##   Planning_Area Subzone       Age    Gender Housing_Type        Population  Year
##   <chr>         <chr>         <chr>  <chr>  <chr>                    <dbl> <dbl>
## 1 Ang Mo Kio    Ang Mo Kio T~ 0_to_4 Males  HDB 3-Room Flats            10  2019
## 2 Ang Mo Kio    Ang Mo Kio T~ 0_to_4 Males  HDB 4-Room Flats            10  2019
## 3 Ang Mo Kio    Ang Mo Kio T~ 0_to_4 Males  HDB 5-Room and Exe~         20  2019
## 4 Ang Mo Kio    Ang Mo Kio T~ 0_to_4 Males  Condominiums and O~         50  2019
## 5 Ang Mo Kio    Ang Mo Kio T~ 0_to_4 Femal~ HDB 3-Room Flats            10  2019
## 6 Ang Mo Kio    Ang Mo Kio T~ 0_to_4 Femal~ HDB 4-Room Flats            10  2019

4.5.2 Plotting Overview of Singapore Population

Drawing a Population Pyramid graph for all age groups in Singapore.

sgallpopdata_PP = sgpopdata2019[,c("Age","Gender","Population")]
sgallpopdata_PP$Age <- factor(sgallpopdata_PP$Age, levels = sgallpopdata_PP$Age,labels =sgallpopdata_PP$Age)

## aggregate the data by gender and age group
sgallpopdata_PP <- aggregate(formula = Population ~ Gender + Age, data = sgallpopdata_PP, FUN = sum)

## Changed the males population into negative value  
sgallpopdata_PP$Population <- ifelse(sgallpopdata_PP$Gender == "Males", -1*sgallpopdata_PP$Population, sgallpopdata_PP$Population)
## pyramid charts are two barcharts with axes flipped
pyramidG <- ggplot(sgallpopdata_PP, aes(x = Age, y = Population, fill = Gender))+
  geom_bar(data = subset(sgallpopdata_PP, Gender == "Females"), stat ="identity")+
  geom_bar(data = subset(sgallpopdata_PP, Gender == "Males"), stat = "identity")+ 
  scale_y_continuous(labels = paste0(as.character(c(seq(2, 0, -1), seq(1, 2, 1))), "m"))+
  coord_flip()+
  labs(title="Singapore Population Pyramid in 2019")+
  theme(plot.title = element_text(hjust = .5),
                axis.ticks = element_blank())+
  scale_fill_brewer(palette = "Dark2")
pyramidG

In 2019, Singapore has the most number of middle age residents (45- 49 years old) and the least number of elder residents above 90 years old. 0 to 4 years old residents are not the smallest number in the population, in fact they are more than elder residents above 70 years old.

4.5.3 Plotting Residents Aged 0 to 4 Years Old By Planning Area

sgpopdata_PS = sg0to4data2019[,c("Age","Planning_Area","Subzone","Population")]

ggplot(sgpopdata_PS, aes(fill=factor(Age), y=Population, x=Planning_Area)) + 
    geom_bar(position="stack", stat="identity")+
  coord_flip()

As seen from the above bar graph, the top 3 planning area with the highest number of residents in the age group from 0 to 4 years old are Sengkang, Punggol and Yishun.

4.5.4 Plotting Residents Aged 0 to 4 Years Old By Planning Subzone Using Choropleth Map

popVol <- popVol %>% filter(Time == 2019) %>%
                      filter(AG == "0_to_4") %>%
                        mutate(SZ = toupper(SZ)) %>%
                        group_by(SZ) %>% 
                        summarise(population = sum(Pop))
popVol
## # A tibble: 323 x 2
##    SZ                     population
##    <chr>                       <dbl>
##  1 ADMIRALTY                     800
##  2 AIRPORT ROAD                    0
##  3 ALEXANDRA HILL                380
##  4 ALEXANDRA NORTH               150
##  5 ALJUNIED                     1290
##  6 ANAK BUKIT                    720
##  7 ANCHORVALE                   3980
##  8 ANG MO KIO TOWN CENTRE        170
##  9 ANSON                           0
## 10 BALESTIER                    1290
## # ... with 313 more rows
popVol2019 <- left_join(sf_mpsz, popVol, 
                              by = c("SUBZONE_N" = "SZ"))
tm_shape(popVol2019)+
  tm_polygons("population")

Note: The population here only refers to the age group from 0 to 4 years old.

4.5.5 Plotting Residents Aged 0 to 4 Years Old By Region

tm_shape(popVol2019) +
  tm_fill("population",
          style = "quantile",
          palette = "Blues",
          thres.poly = 0) + 
  tm_facets(by="REGION_N", 
            free.coords=TRUE, 
            drop.shapes=TRUE) +
  tm_layout(legend.show = FALSE,
            title.position = c("center", "center"), 
            title.size = 20) +
  tm_borders(alpha = 0.5)

As seen earlier results, indeed the East Region, followed by North East Region, then North Region has a high population of 0 to 4 years old residents.

4.6 Analysis Step-By-Step For Number Of Preschool In Each Planning Subzone

4.6.1 By Pre School Number Count

Step 1: Identify pre-schools located inside each Planning Subzone by using st_intersects().

Step 2: Calculate numbers of pre-school fall inside each planning subzone by using length().

sf_mpsz3414$`PreSch Count`<- lengths(st_intersects(sf_mpsz3414, sf_preschool3414))

Step 3: Summarize statistics of the newly derived PreSch Count field

summary(sf_mpsz3414$`PreSch Count`)
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##    0.00    0.00    3.00    5.96    9.00   58.00

Step 4: List the top 3 planning subzone with the most number of of pre-school

top_n(sf_mpsz3414, 3, `PreSch Count`)
## Simple feature collection with 3 features and 16 fields
## geometry type:  MULTIPOLYGON
## dimension:      XY
## bbox:           xmin: 23449.05 ymin: 33973.71 xmax: 42940.57 ymax: 47996.47
## projected CRS:  SVY21 / Singapore TM
##   OBJECTID SUBZONE_NO      SUBZONE_N SUBZONE_C CA_IND PLN_AREA_N PLN_AREA_C
## 1      189          2  TAMPINES EAST    TMSZ02      N   TAMPINES         TM
## 2      199          4    BEDOK NORTH    BDSZ04      N      BEDOK         BD
## 3      290          3 WOODLANDS EAST    WDSZ03      N  WOODLANDS         WD
##       REGION_N REGION_C          INC_CRC FMEL_UPD_D   X_ADDR   Y_ADDR
## 1  EAST REGION       ER 21658EAAF84F4D8D 2014-12-05 41122.55 37392.39
## 2  EAST REGION       ER A2254301F85C1EDF 2014-12-05 39429.21 34737.62
## 3 NORTH REGION       NR C90769E43EE6B0F2 2014-12-05 24506.64 46991.63
##   SHAPE_Leng SHAPE_Area                       geometry PreSch Count
## 1  10180.624    4339824 MULTIPOLYGON (((42196.76 38...           58
## 2   8414.962    3203663 MULTIPOLYGON (((40284.24 35...           31
## 3   6603.608    2553464 MULTIPOLYGON (((24786.75 46...           47

List the top 3 planning subzone with the least number of of pre-school

top_n(sf_mpsz3414, -3, `PreSch Count`)
## Simple feature collection with 92 features and 16 fields
## geometry type:  MULTIPOLYGON
## dimension:      XY
## bbox:           xmin: 2667.538 ymin: 15748.72 xmax: 56396.44 ymax: 50256.33
## projected CRS:  SVY21 / Singapore TM
## First 10 features:
##    OBJECTID SUBZONE_NO               SUBZONE_N SUBZONE_C CA_IND
## 1         1          1            MARINA SOUTH    MSSZ01      Y
## 2         3          3               BOAT QUAY    SRSZ03      Y
## 3        13          1             MARINA EAST    MESZ01      Y
## 4        16          1 JURONG ISLAND AND BUKOM    WISZ01      N
## 5        17          3                  SUDONG    WISZ03      N
## 6        18          2                 SEMAKAU    WISZ02      N
## 7        19          2          SOUTHERN GROUP    SISZ02      N
## 8        21         17          CITY TERMINALS    BMSZ17      N
## 9        23          1            STRAITS VIEW    SVSZ01      Y
## 10       31         11         CENTRAL SUBZONE    DTSZ11      Y
##          PLN_AREA_N PLN_AREA_C       REGION_N REGION_C          INC_CRC
## 1      MARINA SOUTH         MS CENTRAL REGION       CR 5ED7EB253F99252E
## 2   SINGAPORE RIVER         SR CENTRAL REGION       CR C35FEFF02B13E0E5
## 3       MARINA EAST         ME CENTRAL REGION       CR 782A2FAF53029A34
## 4   WESTERN ISLANDS         WI    WEST REGION       WR 699F7210FBF1AFA8
## 5   WESTERN ISLANDS         WI    WEST REGION       WR F718C723E08FBD51
## 6   WESTERN ISLANDS         WI    WEST REGION       WR E69207D4F76DEEA3
## 7  SOUTHERN ISLANDS         SI CENTRAL REGION       CR 5809FC547293EA2D
## 8       BUKIT MERAH         BM CENTRAL REGION       CR 9711879901A8487F
## 9      STRAITS VIEW         SV CENTRAL REGION       CR 21451799CA1AB6EF
## 10    DOWNTOWN CORE         DT CENTRAL REGION       CR 8EFE9EC1AEF2DA0A
##    FMEL_UPD_D   X_ADDR   Y_ADDR SHAPE_Leng SHAPE_Area
## 1  2014-12-05 31595.84 29220.19   5267.381  1630379.3
## 2  2014-12-05 29654.96 29974.66   1740.926   160807.5
## 3  2014-12-05 32344.05 30103.25   6470.950  1844060.7
## 4  2014-12-05 13012.88 27225.87  68083.936 36707720.9
## 5  2014-12-05 15931.76 19579.07  24759.066  4207271.1
## 6  2014-12-05 21206.33 20465.81  18703.681  4963787.1
## 7  2014-12-05 29815.09 23412.59  25626.977  2206319.5
## 8  2014-12-05 28387.34 27536.57  16805.656  3449640.6
## 9  2014-12-05 30832.90 28194.08   5277.761  1127297.2
## 10 2014-12-05 30125.84 28683.04   5002.016  1070723.3
##                          geometry PreSch Count
## 1  MULTIPOLYGON (((31495.56 30...            0
## 2  MULTIPOLYGON (((29932.33 29...            0
## 3  MULTIPOLYGON (((33214.62 29...            0
## 4  MULTIPOLYGON (((14557.7 304...            0
## 5  MULTIPOLYGON (((15772.59 21...            0
## 6  MULTIPOLYGON (((19843.41 21...            0
## 7  MULTIPOLYGON (((29712.51 23...            0
## 8  MULTIPOLYGON (((27891.15 28...            0
## 9  MULTIPOLYGON (((31269.21 28...            0
## 10 MULTIPOLYGON (((30436.73 29...            0

Step 5: Plotting Pre School Numbers By Planning Subzones Using Choropleth Map

tm_shape(sf_mpsz3414)+
  tm_polygons("PreSch Count")

Going by planning subzones, as seen from both the list and the Choropleth map, Tampines East, followed by Woodlands East and Bedok North has the most number of preschools.

Step 6: Plotting by Region.

tm_shape(sf_mpsz3414) +
  tm_fill("PreSch Count",
          style = "quantile",
          palette = "Blues",
          thres.poly = 0) + 
  tm_facets(by="REGION_N", 
            free.coords=TRUE, 
            drop.shapes=TRUE) +
  tm_layout(legend.show = FALSE,
            title.position = c("center", "center"), 
            title.size = 20) +
  tm_borders(alpha = 0.5)

Similarly, the East Region, followed by North East Region, then North Region has a high number of preschools.

Step 7 : Comparing Population and Preschool Count

popcountmap <- tm_shape(popVol2019)+
  tm_polygons("population")

preschcountmap <- tm_shape(sf_mpsz3414)+
  tm_polygons("PreSch Count")


tmap_arrange(popcountmap, preschcountmap)

A further comparison, indeed these subzones has a high number of 0 to 4 years old.

4.6.2 By Density (involving factors such as area)

Step 7: Calculate the density of pre-school by planning subzone.

sf_mpsz3414$Area <- sf_mpsz3414 %>%
  st_area()
sf_mpsz3414 <- sf_mpsz3414 %>%
  mutate(`PreSch Density` = `PreSch Count`/Area * 1000000)
ggplot(data=sf_mpsz3414, 
       aes(x= as.numeric(`PreSch Density`)))+
  geom_histogram(bins=20, 
                 color="black", fill="light blue")

ggplot(data=sf_mpsz3414, 
       aes(y = `PreSch Count`, x= as.numeric(`PreSch Density`)))+
  geom_point(color="black", fill="light blue")

Plotting Pre School Density By Planning Subzones Using Choropleth Map

tm_shape(sf_mpsz3414)+
  tm_polygons("PreSch Density")

4.6.3 Comparing Population vs Pre School Density

tmap_mode("view")
popmap <- tm_shape(popVol2019)+
    tm_fill("population",
          n = 6,
          style = "quantile",
          palette = "Blues") +
  tm_borders(alpha = 0.5)

preschdensitymap <- tm_shape(sf_mpsz3414)+
    tm_fill("PreSch Density",
          n = 6,
          style = "quantile",
          palette = "Blues") +
  tm_borders(alpha = 0.5)


tmap_arrange(popmap, preschdensitymap, asp=1, ncol=2)

Note: The population here similarly only refers to the age group from 0 to 4 years old.

As seen from the above two Choropleth maps,it can be seen that the general trend is that the government is building more preschools for planning subzones or region with more 0 to 4 years old residents to meet its demand. In general, the government is able to manage the supply and demand for preschool.

However, the government need to pay attention to some planning area, such as Yishun (#276), where the population of 0 to 4 years old is very high (in the range from 1147 to 5750) but the density of number of pre schools is very low (in the range of 0.00 to 1.08 per m^2). There will not be enough pre school vacancies for Yishun 0 to 4 years old residents.

4.7 Analysis & Statistical Conclusion (Section A)

The order of top 3 planning areas with the most number of residents in the 0 to 4 years old age group:

  1. Sengkang

  2. Punggol

  3. Yishun

The order of top 3 planning subzones with the most number of residents in the 0 to 4 years old age group:

  1. Tampines East

  2. Woodlands East

  3. Bedok North

From the age group and pre school density by planning subzones analysis, it can be seen that the government is already doing their best to keep up, by building more pre schools for planning subzones with more 0 to 4 years old residents to meet its demands.

Next, I will be doing a Spatial Point Pattern Analysis of the whole Singapore, then drilling down into planning areas Sengkang, Punggol and Yishun.

5 Spatial Point Pattern Analysis (Section B)

5.1 Importing the spatial data with readOGR()

  sg <- readOGR(dsn = "data", layer="CostalOutline")
## OGR data source with driver: ESRI Shapefile 
## Source: "C:\Users\Yong Wei\Documents\Y2\IS415-Geospatial\TakeHome_Ex01\data", layer: "CostalOutline"
## with 60 features
## It has 4 fields
  mpsz <- readOGR(dsn = "data", layer="MP14_SUBZONE_WEB_PL")
## OGR data source with driver: ESRI Shapefile 
## Source: "C:\Users\Yong Wei\Documents\Y2\IS415-Geospatial\TakeHome_Ex01\data", layer: "MP14_SUBZONE_WEB_PL"
## with 323 features
## It has 15 fields

5.2 Ensure that they are projected in same projection system

crs(sp_preschool)
## CRS arguments:
##  +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
crs(mpsz)
## CRS arguments:
##  +proj=tmerc +lat_0=1.36666666666667 +lon_0=103.833333333333 +k=1
## +x_0=28001.642 +y_0=38744.572 +datum=WGS84 +units=m +no_defs
crs(sg)
## CRS arguments:
##  +proj=tmerc +lat_0=1.36666666666667 +lon_0=103.833333333333 +k=1
## +x_0=28001.642 +y_0=38744.572 +datum=WGS84 +units=m +no_defs

5.3 Plot three geospatial data in one plot

plot(sg, border="lightgrey")
plot(sg, add=TRUE)
plot(sp_preschool, add=TRUE )

5.4 Converting the spatial point data frame into generic sp format

Spatstat requires the analytical data in ppp object form. There is no direct way to convert a SpatialDataFrame into ppp object, Hence first I need to convert the SpatialDataFrame into Spatial object.

preschool_sp <- as(sp_preschool, "SpatialPoints")
sg_sp <- as(sg, "SpatialPolygons")
plot(preschool_sp)

5.5 Converting the generic sp format into spatstat’s ppp format

preschool_ppp <- as(preschool_sp, "ppp")
summary(preschool_ppp)
## Planar point pattern:  1925 points
## Average intensity 2.374419e-06 points per square unit
## 
## *Pattern contains duplicated points*
## 
## Coordinates are given to 3 decimal places
## i.e. rounded to the nearest multiple of 0.001 units
## 
## Window: rectangle = [11203.01, 45404.24] x [25596.33, 49300.88] units
##                     (34200 x 23700 units)
## Window area = 810725000 square units
plot(preschool_ppp)

5.6 Summary of the newly created ppp object

summary(preschool_ppp)
## Planar point pattern:  1925 points
## Average intensity 2.374419e-06 points per square unit
## 
## *Pattern contains duplicated points*
## 
## Coordinates are given to 3 decimal places
## i.e. rounded to the nearest multiple of 0.001 units
## 
## Window: rectangle = [11203.01, 45404.24] x [25596.33, 49300.88] units
##                     (34200 x 23700 units)
## Window area = 810725000 square units

5.7 Preschools Location On Point Map

tmap_mode("view")
tm_basemap ("OpenStreetMap")+
tm_shape(sf_preschool)+
tm_bubbles(col = "blue",
           size = 0.2,
           border.col = "black",
           border.lwd = 1)

From the point map, it can be observed that preschools in Singapore exhibits clustering at residential areas.

5.8 Checking for duplicated spatial point events

preschool_ppp_jit <- rjitter(preschool_ppp, retry=TRUE, nsim=1, drop=TRUE)
any(duplicated(preschool_ppp))
## [1] TRUE
sum(multiplicity(preschool_ppp) > 1)
## [1] 302
plot(preschool_ppp_jit)

sg_owin <- as(sg_sp, "owin")
preschoolSG_ppp = preschool_ppp_jit[sg_owin]
plot(preschoolSG_ppp)

5.9 Quadrat Analysis

The test hypotheses are:

Ho = The distribution of Pre Schools in Singapore are randomly distributed.

H1= The distribution of Pre Schools in Singapore are not randomly distributed.

The 95% confident interval will be used, alpha =0.05.

Chi-squared test of CSR using quadrat counts

qt_presch <- quadrat.test(preschoolSG_ppp, 
                   nx = 20, ny = 15)
qt_presch
## 
##  Chi-squared test of CSR using quadrat counts
## 
## data:  preschoolSG_ppp
## X2 = 2935.5, df = 184, p-value < 2.2e-16
## alternative hypothesis: two.sided
## 
## Quadrats: 185 tiles (irregular windows)
plot(preschoolSG_ppp)
plot(qt_presch, add = TRUE, cex =.1)

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

From the test results, we can see that the p-value is 0.004 < 0.05, hence we reject the null hypothesis that pre schools in Singapore are randomly distributed. Since the chi-squared value > 1, the distribution of pre schools in Singapore exhibits clustering. This can also be observed from the quadrat plot.

5.10 Nearest Neighbour Analysis

The test hypotheses are:

Ho = The distribution of Pre Schools in Singapore are randomly distributed.

H1= The distribution of Pre Schools in Singapore are not randomly distributed.

The 95% confident interval will be used.

Testing spatial point patterns using Clark and Evans Test

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

The p-value is 0.02 < 0.05, hence we reject the null hypothesis that pre schools are randomly distributed. R<1, the pattern shows distribution of pre schools exhibits clustering.

5.11 Computing kernel density estimation using automatic bandwidth selection method

kde_preschoolSG_bw <- density(preschoolSG_ppp, sigma=bw.diggle, edge=TRUE, kernel="gaussian") 
plot(kde_preschoolSG_bw)

The density values of the output range from 0 to 0.000035 which is way too small to comprehend. Hence, we need to rescale it and to covert the unit of measurement from meter to kilometer.

preschoolSG_ppp.km <- rescale(preschoolSG_ppp, 1000, "km")
kde_preschool.bw <- density(preschoolSG_ppp.km, sigma=bw.diggle, edge=TRUE, kernel="gaussian")
plot(kde_preschool.bw)

5.12 Computing kernel density estimation using defined bandwidth manually

kde_preschoolSG_pr_km <- density(preschoolSG_ppp, sigma=1.5, edge=TRUE, kernel="quartic") 
plot(kde_preschoolSG_pr_km)

From the kernel density estimation map, we can see that there are high density of the number of preschools around Singapore. For example, the North East Region of Singapore has one of the highest density of preschools.

5.13 Visualising Raster Output in tmap

Converting KDE output into grid object

gridded_kde_preschoolSG_bw <- as.SpatialGridDataFrame.im(kde_preschool.bw)
spplot(gridded_kde_preschoolSG_bw)

Converting gridded output into raster

kde_preschoolSG_bw_raster <- raster(gridded_kde_preschoolSG_bw)
kde_preschoolSG_bw_raster
## class      : RasterLayer 
## dimensions : 128, 128, 16384  (nrow, ncol, ncell)
## resolution : 0.4170614, 0.2647348  (x, y)
## extent     : 2.663926, 56.04779, 16.35798, 50.24403  (xmin, xmax, ymin, ymax)
## crs        : NA 
## source     : memory
## names      : v 
## values     : -1.112625e-14, 29.05251  (min, max)

Assigning projection systems

projection(kde_preschoolSG_bw_raster) <- CRS("+init=EPSG:3414")
kde_preschoolSG_bw_raster
## class      : RasterLayer 
## dimensions : 128, 128, 16384  (nrow, ncol, ncell)
## resolution : 0.4170614, 0.2647348  (x, y)
## extent     : 2.663926, 56.04779, 16.35798, 50.24403  (xmin, xmax, ymin, ymax)
## crs        : +proj=tmerc +lat_0=1.36666666666667 +lon_0=103.833333333333 +k=1 +x_0=28001.642 +y_0=38744.572 +ellps=WGS84 +units=m +no_defs 
## source     : memory
## names      : v 
## values     : -1.112625e-14, 29.05251  (min, max)
tm_shape(kde_preschoolSG_bw_raster) + 
  tm_raster("v") +
  tm_layout(legend.position = c("right", "bottom"), frame = FALSE)

5.14 Comparing Kernel Density Map

Advantage of kernel density map over point map: The kernel density map shows the clear density difference on the map while the point map requires human judgment to identify the density difference.

5.15 Extracting Study Area

Step 1: Extract the target planning areas

sk = mpsz[mpsz@data$PLN_AREA_N == "SENGKANG",]
pg = mpsz[mpsz@data$PLN_AREA_N == "PUNGGOL",]
ys = mpsz[mpsz@data$PLN_AREA_N == "YISHUN",]

bk = mpsz[mpsz@data$PLN_AREA_N == "BEDOK",]
bb = mpsz[mpsz@data$PLN_AREA_N == "BUKIT BATOK",]
hg = mpsz[mpsz@data$PLN_AREA_N == "HOUGANG",]

Step 2: Convert SpatialPolygonDataFrame into generic spatialpolygons objects

childcare_sp = as(sp_preschool, "SpatialPoints")
sk_sp = as(sk, "SpatialPolygons")
pg_sp = as(pg, "SpatialPolygons")
ys_sp = as(ys, "SpatialPolygons")
bk_sp = as(bk, "SpatialPolygons")
bb_sp = as(bb, "SpatialPolygons")
hg_sp = as(hg, "SpatialPolygons")

Step 3: Convert these SpatialPolygons objects into owin objects that is required by spatstat.

sk_owin = as(sk_sp, "owin")
pg_owin = as(pg_sp, "owin")
ys_owin = as(ys_sp, "owin")
bk_owin = as(bk_sp, "owin")
bb_owin = as(bb_sp, "owin")
hg_owin = as(hg_sp, "owin")

Step 4: Combining childcare points and the study area

preschool_sk_ppp = preschool_ppp_jit[sk_owin]
preschool_pg_ppp = preschool_ppp_jit[pg_owin]
preschool_ys_ppp = preschool_ppp_jit[ys_owin]
preschool_bk_ppp = preschool_ppp_jit[bk_owin]
preschool_bb_ppp = preschool_ppp_jit[bb_owin]
preschool_hg_ppp = preschool_ppp_jit[hg_owin]

Step 5: Visualising the ppp objects

plot(preschool_sk_ppp)

Spatial Patterns Observation: General observation for Sengkang, preschools are uniformly distributed.

plot(preschool_pg_ppp)

Spatial Patterns Observation: General observation for Punggol, preschools are uniformly distributed.

plot(preschool_ys_ppp)

Spatial Patterns Observation: General observation for Yishun, preschools has a more clustered distribution(as compared to Sengkang,Punggol, Bedok, Bukit Batok and Hougang).

plot(preschool_bk_ppp)

Spatial Patterns Observation: General observation for Bedok, preschools are uniformly distributed.

plot(preschool_bb_ppp)

Spatial Patterns Observation: General observation for Bukit Batok, preschools are generally uniformly distributed.

plot(preschool_hg_ppp)

Spatial Patterns Observation: General observation for Hougang, preschools are uniformly distributed.

For all the three planning subzones, a further spatial point patterns analysis will be conducted to determine the distribution patterns.

5.16 Analysing Spatial Point Process Using G-Function

5.16.1 Sengkang Study Area

5.16.1.1 Computing L-function estimation

L_sk = Lest(preschool_sk_ppp, correction = "Ripley")
plot(L_sk, . -r ~ r, 
     ylab= "L(d)-r", xlab = "d(m)")

5.16.1.2 Performing Complete Spatial Randomness Test

Ho = The distribution of preschool services at Sengkang are randomly distributed.

H1= The distribution of preschool services at Sengkang are not randomly distributed.

The null hypothesis will be rejected if p-value is smaller than alpha value of 0.001.

Monte Carlo test with L-fucntion

#simulate 1000 spatial point processes
L_sk.csr <- envelope(preschool_sk_ppp, Lest, nsim = 999, rank = 1, glocal=TRUE)
## Generating 999 simulations of CSR  ...
## 1, 2, 3, ......10.........20.........
## 30 [etd 3:07] .........40 [etd 3:06] .........50 [etd 3:06] ........
## .60 [etd 3:01] .........70 [etd 3:01] .........80 [etd 2:58] .......
## ..90 [etd 2:55] .........100 [etd 2:53] .........110 [etd 2:51] ......
## ...120 [etd 2:53] .........130 [etd 2:52] .........140 [etd 2:48] .....
## ....150 [etd 2:46] .........160 [etd 2:44] .........170 [etd 2:41] ....
## .....180 [etd 2:38] .........190 [etd 2:36] .........200 [etd 2:35] ...
## ......210 [etd 2:33] .........220 [etd 2:31] .........230 [etd 2:29] ..
## .......240 [etd 2:27] .........250 [etd 2:24] .........260 [etd 2:22] .
## ........270 [etd 2:21] .........280 [etd 2:18] .........290
##  [etd 2:16] .........300 [etd 2:14] .........310 [etd 2:12] .........
## 320 [etd 2:10] .........330 [etd 2:09] .........340 [etd 2:07] ........
## .350 [etd 2:05] .........360 [etd 2:03] .........370 [etd 2:02] .......
## ..380 [etd 2:00] .........390 [etd 1:58] .........400 [etd 1:56] ......
## ...410 [etd 1:54] .........420 [etd 1:52] .........430 [etd 1:50] .....
## ....440 [etd 1:48] .........450 [etd 1:46] .........460 [etd 1:44] ....
## .....470 [etd 1:42] .........480 [etd 1:40] .........490 [etd 1:38] ...
## ......500 [etd 1:36] .........510 [etd 1:34] .........520 [etd 1:33] ..
## .......530 [etd 1:30] .........540 [etd 1:28] .........550 [etd 1:26] .
## ........560 [etd 1:24] .........570 [etd 1:22] .........580
##  [etd 1:20] .........590 [etd 1:18] .........600 [etd 1:16] .........
## 610 [etd 1:14] .........620 [etd 1:13] .........630 [etd 1:11] ........
## .640 [etd 1:09] .........650 [etd 1:07] .........660 [etd 1:05] .......
## ..670 [etd 1:03] .........680 [etd 1:01] .........690 [etd 59 sec] ......
## ...700 [etd 57 sec] .........710 [etd 55 sec] .........720 [etd 54 sec] .....
## ....730 [etd 52 sec] .........740 [etd 50 sec] .........750 [etd 48 sec] ....
## .....760 [etd 46 sec] .........770 [etd 44 sec] .........780 [etd 42 sec] ...
## ......790 [etd 40 sec] .........800 [etd 38 sec] .........810 [etd 36 sec] ..
## .......820 [etd 34 sec] .........830 [etd 32 sec] .........840 [etd 30 sec] .
## ........850 [etd 28 sec] .........860 [etd 26 sec] .........870
##  [etd 24 sec] .........880 [etd 22 sec] .........890 [etd 20 sec] .........
## 900 [etd 18 sec] .........910 [etd 16 sec] .........920 [etd 14 sec] ........
## .930 [etd 13 sec] .........940 [etd 11 sec] .........950 [etd 9 sec] .......
## ..960 [etd 7 sec] .........970 [etd 5 sec] .........980 [etd 3 sec] ......
## ...990 [etd 2 sec] ........ 999.
## 
## Done.
L_sk.csr
## Pointwise critical envelopes for L(r)
## and observed value for 'preschool_sk_ppp'
## Edge correction: "iso"
## Obtained from 999 simulations of CSR
## Alternative: two.sided
## Significance level of pointwise Monte Carlo test: 2/1000 = 0.002
## .....................................................................
##      Math.label     Description                                      
## r    r              distance argument r                              
## obs  hat(L)[obs](r) observed value of L(r) for data pattern          
## theo L[theo](r)     theoretical value of L(r) for CSR                
## lo   hat(L)[lo](r)  lower pointwise envelope of L(r) from simulations
## hi   hat(L)[hi](r)  upper pointwise envelope of L(r) from simulations
## .....................................................................
## Default plot formula:  .~r
## where "." stands for 'obs', 'theo', 'hi', 'lo'
## Columns 'lo' and 'hi' will be plotted as shading (by default)
## Recommended range of argument r: [0, 706.25]
## Available range of argument r: [0, 706.25]
summary(L_sk.csr)
## Pointwise critical envelopes for L(r)
## and observed value for 'preschool_sk_ppp'
## Obtained from 999 simulations of CSR
## Alternative: two.sided
## Upper envelope: pointwise maximum of simulated curves
## Lower envelope: pointwise minimum of simulated curves
## Significance level of Monte Carlo test: 2/1000 = 0.002
## Data: preschool_sk_ppp
plot(L_sk.csr, . - r ~ r, xlab="d", ylab="L(d)-r")

From the L-function analysis, it can be concluded that Sengkang has a cluster pattern, and it is statistically significant.When an observed L value is greater than its corresponding L(theo)(i.e. red break line) value for a particular distance and above the upper confidence envelop, spatial clustering for that distance is statistically significant. L(r)>0, also indicates observed is geographically concentrated.

We do not reject the null hypothesis, as p-value 0.002 is bigger than alpha value of 0.001. The distribution of preschool services at Sengkang are not randomly distributed.

5.16.1.3 Computing K-function estimation

K_sk = Kest(preschool_sk_ppp, correction = "Ripley")
plot(K_sk, . -r ~ r, 
     ylab= "K(d)-r", xlab = "d(m)", 
     xlim=c(0,1000))

K_sk.csr <- envelope(preschool_sk_ppp, Kest, nsim = 999, rank = 1, glocal=TRUE)
## Generating 999 simulations of CSR  ...
## 1, 2, 3, ......10 [etd 3:21] .........20 [etd 3:12] .........
## 30 [etd 3:14] .........40 [etd 3:13] .........50 [etd 3:10] ........
## .60 [etd 3:07] .........70 [etd 3:06] .........80 [etd 3:04] .......
## ..90 [etd 3:02] .........100 [etd 2:59] .........110 [etd 2:57] ......
## ...120 [etd 2:56] .........130 [etd 2:54] .........140 [etd 2:50] .....
## ....150 [etd 2:48] .........160 [etd 2:47] .........170 [etd 2:45] ....
## .....180 [etd 2:43] .........190 [etd 2:41] .........200 [etd 2:39] ...
## ......210 [etd 2:37] .........220 [etd 2:35] .........230 [etd 2:32] ..
## .......240 [etd 2:30] .........250 [etd 2:28] .........260 [etd 2:26] .
## ........270 [etd 2:24] .........280 [etd 2:22] .........290
##  [etd 2:20] .........300 [etd 2:18] .........310 [etd 2:16] .........
## 320 [etd 2:14] .........330 [etd 2:11] .........340 [etd 2:09] ........
## .350 [etd 2:07] .........360 [etd 2:05] .........370 [etd 2:03] .......
## ..380 [etd 2:01] .........390 [etd 1:59] .........400 [etd 1:58] ......
## ...410 [etd 1:56] .........420 [etd 1:54] .........430 [etd 1:52] .....
## ....440 [etd 1:50] .........450 [etd 1:48] .........460 [etd 1:46] ....
## .....470 [etd 1:44] .........480 [etd 1:42] .........490 [etd 1:40] ...
## ......500 [etd 1:38] .........510 [etd 1:36] .........520 [etd 1:34] ..
## .......530 [etd 1:32] .........540 [etd 1:30] .........550 [etd 1:29] .
## ........560 [etd 1:27] .........570 [etd 1:25] .........580
##  [etd 1:23] .........590 [etd 1:21] .........600 [etd 1:19] .........
## 610 [etd 1:17] .........620 [etd 1:15] .........630 [etd 1:13] ........
## .640 [etd 1:11] .........650 [etd 1:09] .........660 [etd 1:07] .......
## ..670 [etd 1:05] .........680 [etd 1:03] .........690 [etd 1:01] ......
## ...700 [etd 59 sec] .........710 [etd 57 sec] .........720 [etd 55 sec] .....
## ....730 [etd 53 sec] .........740 [etd 51 sec] .........750 [etd 49 sec] ....
## .....760 [etd 47 sec] .........770 [etd 45 sec] .........780 [etd 43 sec] ...
## ......790 [etd 41 sec] .........800 [etd 39 sec] .........810 [etd 37 sec] ..
## .......820 [etd 35 sec] .........830 [etd 33 sec] .........840 [etd 31 sec] .
## ........850 [etd 29 sec] .........860 [etd 27 sec] .........870
##  [etd 25 sec] .........880 [etd 23 sec] .........890 [etd 21 sec] .........
## 900 [etd 19 sec] .........910 [etd 17 sec] .........920 [etd 15 sec] ........
## .930 [etd 14 sec] .........940 [etd 12 sec] .........950 [etd 10 sec] .......
## ..960 [etd 8 sec] .........970 [etd 6 sec] .........980 [etd 4 sec] ......
## ...990 [etd 2 sec] ........ 999.
## 
## Done.
plot(K_sk.csr, . - r ~ r, 
     xlab="d", ylab="K(d)-r", xlim=c(0,500))

The K function complete spatial randomness test for Sengkang shows significant cluster pattern as it is above the envelope.

5.16.2 Punggol Study Area

5.16.2.1 Computing L-function estimation

L_ck = Lest(preschool_pg_ppp, correction = "Ripley")
plot(L_ck, . -r ~ r, 
     ylab= "L(d)-r", xlab = "d(m)")

5.16.2.2 Performing Complete Spatial Randomness Test

Ho = The distribution of preschool services at Punggol are randomly distributed.

H1= The distribution of preschool services at Punggol are not randomly distributed.

The null hypothesis will be rejected if p-value is smaller than alpha value of 0.001.

Monte Carlo test with L-fucntion

#simulate 1000 spatial point processes
L_pg.csr <- envelope(preschool_pg_ppp, Lest, nsim = 999, rank = 1, glocal=TRUE)
## Generating 999 simulations of CSR  ...
## 1, 2, 3, ......10.........20.........30.........40 [etd 3:41] .........50 [etd 4:11] ........
## .60 [etd 4:27] .........70 [etd 4:43] .........80 [etd 4:33] .......
## ..90 [etd 4:39] .........100 [etd 4:42] .........110 [etd 4:45] ......
## ...120 [etd 4:42] .........130 [etd 4:38] .........140 [etd 4:38] .....
## ....150 [etd 4:38] .........160 [etd 4:37] .........170 [etd 4:34] ....
## .....180 [etd 4:32] .........190 [etd 4:30] .........200 [etd 4:30] ...
## ......210 [etd 4:29] .........220 [etd 4:28] .........230 [etd 4:25] ..
## .......240 [etd 4:21] .........250 [etd 4:17] .........260 [etd 4:14] .
## ........270 [etd 4:11] .........280 [etd 4:03] .........290
##  [etd 3:55] .........300 [etd 3:48] .........310 [etd 3:44] .........
## 320 [etd 3:42] .........330 [etd 3:39] .........340 [etd 3:36] ........
## .350 [etd 3:34] .........360 [etd 3:32] .........370 [etd 3:30] .......
## ..380 [etd 3:27] .........390 [etd 3:24] .........400 [etd 3:22] ......
## ...410 [etd 3:19] .........420 [etd 3:16] .........430 [etd 3:13] .....
## ....440 [etd 3:11] .........450 [etd 3:08] .........460 [etd 3:05] ....
## .....470 [etd 3:02] .........480 [etd 2:58] .........490 [etd 2:55] ...
## ......500 [etd 2:52] .........510 [etd 2:50] .........520 [etd 2:46] ..
## .......530 [etd 2:43] .........540 [etd 2:40] .........550 [etd 2:35] .
## ........560 [etd 2:31] .........570 [etd 2:26] .........580
##  [etd 2:21] .........590 [etd 2:17] .........600 [etd 2:12] .........
## 610 [etd 2:08] .........620 [etd 2:04] .........630 [etd 1:59] ........
## .640 [etd 1:55] .........650 [etd 1:51] .........660 [etd 1:47] .......
## ..670 [etd 1:43] .........680 [etd 1:40] .........690 [etd 1:36] ......
## ...700 [etd 1:33] .........710 [etd 1:30] .........720 [etd 1:27] .....
## ....730 [etd 1:24] .........740 [etd 1:20] .........750 [etd 1:16] ....
## .....760 [etd 1:13] .........770 [etd 1:10] .........780 [etd 1:07] ...
## ......790 [etd 1:04] .........800 [etd 1:01] .........810 [etd 59 sec] ..
## .......820 [etd 56 sec] .........830 [etd 52 sec] .........840 [etd 49 sec] .
## ........850 [etd 46 sec] .........860 [etd 43 sec] .........870
##  [etd 40 sec] .........880 [etd 37 sec] .........890 [etd 34 sec] .........
## 900 [etd 31 sec] .........910 [etd 28 sec] .........920 [etd 25 sec] ........
## .930 [etd 22 sec] .........940 [etd 19 sec] .........950 [etd 15 sec] .......
## ..960 [etd 12 sec] .........970 [etd 9 sec] .........980 [etd 6 sec] ......
## ...990 [etd 3 sec] ........ 999.
## 
## Done.
L_pg.csr
## Pointwise critical envelopes for L(r)
## and observed value for 'preschool_pg_ppp'
## Edge correction: "iso"
## Obtained from 999 simulations of CSR
## Alternative: two.sided
## Significance level of pointwise Monte Carlo test: 2/1000 = 0.002
## .....................................................................
##      Math.label     Description                                      
## r    r              distance argument r                              
## obs  hat(L)[obs](r) observed value of L(r) for data pattern          
## theo L[theo](r)     theoretical value of L(r) for CSR                
## lo   hat(L)[lo](r)  lower pointwise envelope of L(r) from simulations
## hi   hat(L)[hi](r)  upper pointwise envelope of L(r) from simulations
## .....................................................................
## Default plot formula:  .~r
## where "." stands for 'obs', 'theo', 'hi', 'lo'
## Columns 'lo' and 'hi' will be plotted as shading (by default)
## Recommended range of argument r: [0, 983.63]
## Available range of argument r: [0, 983.63]
summary(L_pg.csr)
## Pointwise critical envelopes for L(r)
## and observed value for 'preschool_pg_ppp'
## Obtained from 999 simulations of CSR
## Alternative: two.sided
## Upper envelope: pointwise maximum of simulated curves
## Lower envelope: pointwise minimum of simulated curves
## Significance level of Monte Carlo test: 2/1000 = 0.002
## Data: preschool_pg_ppp
plot(L_pg.csr, . - r ~ r, xlab="d", ylab="L(d)-r")

From the L-function analysis, it can be concluded that Punggol has a cluster pattern, and it is statistically significant. When an observed L value is greater than its corresponding L(theo)(i.e. red break line) value for a particular distance and above the upper confidence envelop, spatial clustering for that distance is statistically significant. L(r)>0, also indicates observed is geographically concentrated.

We do not reject the null hypothesis, as p-value 0.002 is bigger than alpha value of 0.001. The distribution of preschool services at Punngol are not randomly distributed.

5.16.2.3 Computing K-function estimation

K_pg = Kest(preschool_pg_ppp, correction = "Ripley")
plot(K_pg, . -r ~ r, 
     ylab= "K(d)-r", xlab = "d(m)", 
     xlim=c(0,1000))

K_pg.csr <- envelope(preschool_pg_ppp, Kest, nsim = 999, rank = 1, glocal=TRUE)
## Generating 999 simulations of CSR  ...
## 1, 2, 3, ......10 [etd 6:25] .........20 [etd 6:14] .........
## 30 [etd 6:06] .........40 [etd 6:06] .........50 [etd 6:05] ........
## .60 [etd 6:03] .........70 [etd 6:00] .........80 [etd 5:55] .......
## ..90 [etd 5:40] .........100 [etd 5:17] .........110 [etd 4:57] ......
## ...120 [etd 4:41] .........130 [etd 4:26] .........140 [etd 4:14] .....
## ....150 [etd 4:03] .........160 [etd 3:53] .........170 [etd 3:44] ....
## .....180 [etd 3:36] .........190 [etd 3:29] .........200 [etd 3:23] ...
## ......210 [etd 3:16] .........220 [etd 3:11] .........230 [etd 3:05] ..
## .......240 [etd 3:00] .........250 [etd 2:56] .........260 [etd 2:51] .
## ........270 [etd 2:47] .........280 [etd 2:43] .........290
##  [etd 2:39] .........300 [etd 2:35] .........310 [etd 2:31] .........
## 320 [etd 2:28] .........330 [etd 2:24] .........340 [etd 2:21] ........
## .350 [etd 2:18] .........360 [etd 2:15] .........370 [etd 2:11] .......
## ..380 [etd 2:08] .........390 [etd 2:06] .........400 [etd 2:04] ......
## ...410 [etd 2:03] .........420 [etd 2:00] .........430 [etd 1:58] .....
## ....440 [etd 1:55] .........450 [etd 1:52] .........460 [etd 1:49] ....
## .....470 [etd 1:50] .........480 [etd 1:48] .........490 [etd 1:46] ...
## ......500 [etd 1:43] .........510 [etd 1:40] .........520 [etd 1:38] ..
## .......530 [etd 1:36] .........540 [etd 1:33] .........550 [etd 1:31] .
## ........560 [etd 1:29] .........570 [etd 1:26] .........580
##  [etd 1:24] .........590 [etd 1:22] .........600 [etd 1:19] .........
## 610 [etd 1:17] .........620 [etd 1:15] .........630 [etd 1:13] ........
## .640 [etd 1:11] .........650 [etd 1:08] .........660 [etd 1:06] .......
## ..670 [etd 1:04] .........680 [etd 1:02] .........690 [etd 1:00] ......
## ...700 [etd 58 sec] .........710 [etd 56 sec] .........720 [etd 54 sec] .....
## ....730 [etd 52 sec] .........740 [etd 50 sec] .........750 [etd 48 sec] ....
## .....760 [etd 47 sec] .........770 [etd 45 sec] .........780 [etd 43 sec] ...
## ......790 [etd 42 sec] .........800 [etd 40 sec] .........810 [etd 39 sec] ..
## .......820 [etd 37 sec] .........830 [etd 36 sec] .........840 [etd 34 sec] .
## ........850 [etd 32 sec] .........860 [etd 30 sec] .........870
##  [etd 28 sec] .........880 [etd 26 sec] .........890 [etd 24 sec] .........
## 900 [etd 22 sec] .........910 [etd 20 sec] .........920 [etd 18 sec] ........
## .930 [etd 16 sec] .........940 [etd 14 sec] .........950 [etd 12 sec] .......
## ..960 [etd 9 sec] .........970 [etd 7 sec] .........980 [etd 5 sec] ......
## ...990 [etd 2 sec] ........ 999.
## 
## Done.
plot(K_pg.csr, . - r ~ r, 
     xlab="d", ylab="K(d)-r", xlim=c(0,500))

The K function complete spatial randomness test for Punggol shows significant cluster pattern as it is above the envelope.

5.16.3 Yishun Study Area

5.16.3.1 Computing L-function estimation

L_ys = Lest(preschool_ys_ppp, correction = "Ripley")
plot(L_ys, . -r ~ r, 
     ylab= "L(d)-r", xlab = "d(m)")

5.16.3.2 Performing Complete Spatial Randomness Test

Ho = The distribution of preschool services at Yishun are randomly distributed.

H1= The distribution of preschool services at Yishun are not randomly distributed.

The null hypothesis will be rejected if p-value is smaller than alpha value of 0.001.

Monte Carlo test with L-fucntion

#simulate 1000 spatial point processes
L_ys.csr <- envelope(preschool_ys_ppp, Lest, nsim = 999, rank = 1, glocal=TRUE)
## Generating 999 simulations of CSR  ...
## 1, 2, 3, ......10 [etd 14:36] .........20 [etd 15:04] .........
## 30 [etd 14:33] .........40 [etd 14:26] .........50 [etd 14:03] ........
## .60 [etd 13:46] .........70 [etd 13:23] .........80 [etd 13:20] .......
## ..90 [etd 13:11] .........100 [etd 13:00] .........110 [etd 12:51] ......
## ...120 [etd 12:38] .........130 [etd 12:31] .........140 [etd 12:24] .....
## ....150 [etd 12:14] .........160 [etd 12:06] .........170 [etd 11:59] ....
## .....180 [etd 11:49] .........190 [etd 11:42] .........200 [etd 11:21] ...
## ......210 [etd 10:54] .........220 [etd 10:29] .........230 [etd 10:06] ..
## .......240 [etd 9:45] .........250 [etd 9:24] .........260 [etd 9:05] .
## ........270 [etd 8:47] .........280 [etd 8:31] .........290
##  [etd 8:15] .........300 [etd 8:00] .........310 [etd 7:46] .........
## 320 [etd 7:32] .........330 [etd 7:19] .........340 [etd 7:06] ........
## .350 [etd 6:55] .........360 [etd 6:43] .........370 [etd 6:32] .......
## ..380 [etd 6:21] .........390 [etd 6:11] .........400 [etd 6:02] ......
## ...410 [etd 5:52] .........420 [etd 5:42] .........430 [etd 5:33] .....
## ....440 [etd 5:24] .........450 [etd 5:16] .........460 [etd 5:07] ....
## .....470 [etd 4:59] .........480 [etd 4:51] .........490 [etd 4:43] ...
## ......500 [etd 4:36] .........510 [etd 4:28] .........520 [etd 4:21] ..
## .......530 [etd 4:14] .........540 [etd 4:07] .........550 [etd 4:00] .
## ........560 [etd 3:53] .........570 [etd 3:47] .........580
##  [etd 3:40] .........590 [etd 3:33] .........600 [etd 3:27] .........
## 610 [etd 3:21] .........620 [etd 3:15] .........630 [etd 3:09] ........
## .640 [etd 3:02] .........650 [etd 2:57] .........660 [etd 2:51] .......
## ..670 [etd 2:45] .........680 [etd 2:39] .........690 [etd 2:33] ......
## ...700 [etd 2:28] .........710 [etd 2:23] .........720 [etd 2:17] .....
## ....730 [etd 2:12] .........740 [etd 2:06] .........750 [etd 2:01] ....
## .....760 [etd 1:56] .........770 [etd 1:50] .........780 [etd 1:45] ...
## ......790 [etd 1:40] .........800 [etd 1:35] .........810 [etd 1:30] ..
## .......820 [etd 1:25] .........830 [etd 1:20] .........840 [etd 1:15] .
## ........850 [etd 1:10] .........860 [etd 1:05] .........870
##  [etd 1:00] .........880 [etd 55 sec] .........890 [etd 51 sec] .........
## 900 [etd 46 sec] .........910 [etd 43 sec] .........920 [etd 42 sec] ........
## .930 [etd 37 sec] .........940 [etd 31 sec] .........950 [etd 26 sec] .......
## ..960 [etd 21 sec] .........970 [etd 15 sec] .........980 [etd 10 sec] ......
## ...990 [etd 5 sec] ........ 999.
## 
## Done.
L_ys.csr
## Pointwise critical envelopes for L(r)
## and observed value for 'preschool_ys_ppp'
## Edge correction: "iso"
## Obtained from 999 simulations of CSR
## Alternative: two.sided
## Significance level of pointwise Monte Carlo test: 2/1000 = 0.002
## .....................................................................
##      Math.label     Description                                      
## r    r              distance argument r                              
## obs  hat(L)[obs](r) observed value of L(r) for data pattern          
## theo L[theo](r)     theoretical value of L(r) for CSR                
## lo   hat(L)[lo](r)  lower pointwise envelope of L(r) from simulations
## hi   hat(L)[hi](r)  upper pointwise envelope of L(r) from simulations
## .....................................................................
## Default plot formula:  .~r
## where "." stands for 'obs', 'theo', 'hi', 'lo'
## Columns 'lo' and 'hi' will be plotted as shading (by default)
## Recommended range of argument r: [0, 1457]
## Available range of argument r: [0, 1457]
summary(L_ys.csr)
## Pointwise critical envelopes for L(r)
## and observed value for 'preschool_ys_ppp'
## Obtained from 999 simulations of CSR
## Alternative: two.sided
## Upper envelope: pointwise maximum of simulated curves
## Lower envelope: pointwise minimum of simulated curves
## Significance level of Monte Carlo test: 2/1000 = 0.002
## Data: preschool_ys_ppp
plot(L_ys.csr, . - r ~ r, xlab="d", ylab="L(d)-r")

From the L-function analysis, it can be concluded that Yishun has a cluster pattern, and it is statistically significant. When an observed L value is greater than its corresponding L(theo)(i.e. red break line) value for a particular distance and above the upper confidence envelop, spatial clustering for that distance is statistically significant. L(r)>0, also indicates observed is geographically concentrated.

We do not reject the null hypothesis, as p-value 0.002 is bigger than alpha value of 0.001. The distribution of preschool services at Yishun are not randomly distributed.

5.16.3.3 Computing K-function estimation

K_ys = Kest(preschool_ys_ppp, correction = "Ripley")
plot(K_ys, . -r ~ r, 
     ylab= "K(d)-r", xlab = "d(m)", 
     xlim=c(0,1000))

K_ys.csr <- envelope(preschool_ys_ppp, Kest, nsim = 999, rank = 1, glocal=TRUE)
## Generating 999 simulations of CSR  ...
## 1, 2, 3, ......10 [etd 6:24] .........20 [etd 6:09] .........
## 30 [etd 5:50] .........40 [etd 5:35] .........50 [etd 5:31] ........
## .60 [etd 5:25] .........70 [etd 5:21] .........80 [etd 5:15] .......
## ..90 [etd 5:15] .........100 [etd 5:11] .........110 [etd 5:08] ......
## ...120 [etd 5:05] .........130 [etd 5:01] .........140 [etd 5:00] .....
## ....150 [etd 4:56] .........160 [etd 4:52] .........170 [etd 4:49] ....
## .....180 [etd 4:44] .........190 [etd 4:41] .........200 [etd 4:38] ...
## ......210 [etd 4:35] .........220 [etd 4:35] .........230 [etd 4:31] ..
## .......240 [etd 4:30] .........250 [etd 4:28] .........260 [etd 4:24] .
## ........270 [etd 4:20] .........280 [etd 4:17] .........290
##  [etd 4:14] .........300 [etd 4:10] .........310 [etd 4:07] .........
## 320 [etd 4:03] .........330 [etd 3:59] .........340 [etd 3:55] ........
## .350 [etd 3:51] .........360 [etd 3:48] .........370 [etd 3:44] .......
## ..380 [etd 3:40] .........390 [etd 3:37] .........400 [etd 3:33] ......
## ...410 [etd 3:29] .........420 [etd 3:26] .........430 [etd 3:22] .....
## ....440 [etd 3:18] .........450 [etd 3:14] .........460 [etd 3:10] ....
## .....470 [etd 3:07] .........480 [etd 3:04] .........490 [etd 3:00] ...
## ......500 [etd 2:56] .........510 [etd 2:52] .........520 [etd 2:49] ..
## .......530 [etd 2:45] .........540 [etd 2:41] .........550 [etd 2:38] .
## ........560 [etd 2:34] .........570 [etd 2:31] .........580
##  [etd 2:27] .........590 [etd 2:24] .........600 [etd 2:20] .........
## 610 [etd 2:17] .........620 [etd 2:13] .........630 [etd 2:09] ........
## .640 [etd 2:06] .........650 [etd 2:02] .........660 [etd 1:59] .......
## ..670 [etd 1:55] .........680 [etd 1:51] .........690 [etd 1:48] ......
## ...700 [etd 1:44] .........710 [etd 1:41] .........720 [etd 1:37] .....
## ....730 [etd 1:34] .........740 [etd 1:30] .........750 [etd 1:27] ....
## .....760 [etd 1:23] .........770 [etd 1:20] .........780 [etd 1:16] ...
## ......790 [etd 1:13] .........800 [etd 1:09] .........810 [etd 1:06] ..
## .......820 [etd 1:02] .........830 [etd 59 sec] .........840 [etd 56 sec] .
## ........850 [etd 52 sec] .........860 [etd 49 sec] .........870
##  [etd 45 sec] .........880 [etd 42 sec] .........890 [etd 38 sec] .........
## 900 [etd 35 sec] .........910 [etd 31 sec] .........920 [etd 28 sec] ........
## .930 [etd 24 sec] .........940 [etd 21 sec] .........950 [etd 17 sec] .......
## ..960 [etd 14 sec] .........970 [etd 10 sec] .........980 [etd 7 sec] ......
## ...990 [etd 3 sec] ........ 999.
## 
## Done.
plot(K_ys.csr, . - r ~ r, 
     xlab="d", ylab="K(d)-r", xlim=c(0,500))

The K function complete spatial randomness test for Yishun shows significant cluster pattern as it is above the envelope.

5.16.4 Bedok Study Area

5.16.4.1 Computing L-function estimation

L_bk = Lest(preschool_bk_ppp, correction = "Ripley")
plot(L_bk, . -r ~ r, 
     ylab= "L(d)-r", xlab = "d(m)")

5.16.4.2 Performing Complete Spatial Randomness Test

Ho = The distribution of preschool services at Bedok are randomly distributed.

H1= The distribution of preschool services at Bedok are not randomly distributed.

The null hypothesis will be rejected if p-value is smaller than alpha value of 0.001.

Monte Carlo test with L-fucntion

#simulate 1000 spatial point processes
L_bk.csr <- envelope(preschool_bk_ppp, Lest, nsim = 999, rank = 1, glocal=TRUE)
## Generating 999 simulations of CSR  ...
## 1, 2, 3, ......10 [etd 4:58] .........20 [etd 4:53] .........
## 30 [etd 4:56] .........40 [etd 4:48] .........50 [etd 4:46] ........
## .60 [etd 4:43] .........70 [etd 4:46] .........80 [etd 4:45] .......
## ..90 [etd 4:39] .........100 [etd 4:36] .........110 [etd 4:32] ......
## ...120 [etd 4:28] .........130 [etd 4:24] .........140 [etd 4:20] .....
## ....150 [etd 4:16] .........160 [etd 4:12] .........170 [etd 4:09] ....
## .....180 [etd 4:06] .........190 [etd 4:03] .........200 [etd 4:00] ...
## ......210 [etd 3:58] .........220 [etd 3:55] .........230 [etd 3:53] ..
## .......240 [etd 3:50] .........250 [etd 3:47] .........260 [etd 3:45] .
## ........270 [etd 3:42] .........280 [etd 3:39] .........290
##  [etd 3:35] .........300 [etd 3:32] .........310 [etd 3:29] .........
## 320 [etd 3:26] .........330 [etd 3:23] .........340 [etd 3:20] ........
## .350 [etd 3:17] .........360 [etd 3:14] .........370 [etd 3:11] .......
## ..380 [etd 3:08] .........390 [etd 3:05] .........400 [etd 3:02] ......
## ...410 [etd 2:59] .........420 [etd 2:56] .........430 [etd 2:53] .....
## ....440 [etd 2:50] .........450 [etd 2:47] .........460 [etd 2:44] ....
## .....470 [etd 2:41] .........480 [etd 2:38] .........490 [etd 2:35] ...
## ......500 [etd 2:32] .........510 [etd 2:29] .........520 [etd 2:26] ..
## .......530 [etd 2:23] .........540 [etd 2:20] .........550 [etd 2:16] .
## ........560 [etd 2:13] .........570 [etd 2:10] .........580
##  [etd 2:07] .........590 [etd 2:05] .........600 [etd 2:01] .........
## 610 [etd 1:58] .........620 [etd 1:55] .........630 [etd 1:52] ........
## .640 [etd 1:49] .........650 [etd 1:46] .........660 [etd 1:43] .......
## ..670 [etd 1:40] .........680 [etd 1:37] .........690 [etd 1:34] ......
## ...700 [etd 1:31] .........710 [etd 1:28] .........720 [etd 1:25] .....
## ....730 [etd 1:22] .........740 [etd 1:19] .........750 [etd 1:16] ....
## .....760 [etd 1:13] .........770 [etd 1:10] .........780 [etd 1:07] ...
## ......790 [etd 1:04] .........800 [etd 1:01] .........810 [etd 58 sec] ..
## .......820 [etd 55 sec] .........830 [etd 52 sec] .........840 [etd 49 sec] .
## ........850 [etd 45 sec] .........860 [etd 42 sec] .........870
##  [etd 39 sec] .........880 [etd 36 sec] .........890 [etd 33 sec] .........
## 900 [etd 30 sec] .........910 [etd 27 sec] .........920 [etd 24 sec] ........
## .930 [etd 21 sec] .........940 [etd 18 sec] .........950 [etd 15 sec] .......
## ..960 [etd 12 sec] .........970 [etd 9 sec] .........980 [etd 6 sec] ......
## ...990 [etd 3 sec] ........ 999.
## 
## Done.
L_bk.csr
## Pointwise critical envelopes for L(r)
## and observed value for 'preschool_bk_ppp'
## Edge correction: "iso"
## Obtained from 999 simulations of CSR
## Alternative: two.sided
## Significance level of pointwise Monte Carlo test: 2/1000 = 0.002
## .....................................................................
##      Math.label     Description                                      
## r    r              distance argument r                              
## obs  hat(L)[obs](r) observed value of L(r) for data pattern          
## theo L[theo](r)     theoretical value of L(r) for CSR                
## lo   hat(L)[lo](r)  lower pointwise envelope of L(r) from simulations
## hi   hat(L)[hi](r)  upper pointwise envelope of L(r) from simulations
## .....................................................................
## Default plot formula:  .~r
## where "." stands for 'obs', 'theo', 'hi', 'lo'
## Columns 'lo' and 'hi' will be plotted as shading (by default)
## Recommended range of argument r: [0, 1292.7]
## Available range of argument r: [0, 1292.7]
summary(L_bk.csr)
## Pointwise critical envelopes for L(r)
## and observed value for 'preschool_bk_ppp'
## Obtained from 999 simulations of CSR
## Alternative: two.sided
## Upper envelope: pointwise maximum of simulated curves
## Lower envelope: pointwise minimum of simulated curves
## Significance level of Monte Carlo test: 2/1000 = 0.002
## Data: preschool_bk_ppp
plot(L_bk.csr, . - r ~ r, xlab="d", ylab="L(d)-r")

From the L-function analysis, it can be concluded that Bedok has a cluster pattern, and it is statistically significant. When an observed L value is greater than its corresponding L(theo)(i.e. red break line) value for a particular distance and above the upper confidence envelop, spatial clustering for that distance is statistically significant. L(r)>0, also indicates observed is geographically concentrated.

We do not reject the null hypothesis, as p-value 0.002 is bigger than alpha value of 0.001. The distribution of preschool services at Bedok are not randomly distributed.

5.16.4.3 Computing K-function estimation

K_bk = Kest(preschool_bk_ppp, correction = "Ripley")
plot(K_bk, . -r ~ r, 
     ylab= "K(d)-r", xlab = "d(m)", 
     xlim=c(0,1000))

K_bk.csr <- envelope(preschool_bk_ppp, Kest, nsim = 999, rank = 1, glocal=TRUE)
## Generating 999 simulations of CSR  ...
## 1, 2, 3, ......10 [etd 4:53] .........20 [etd 4:55] .........
## 30 [etd 4:55] .........40 [etd 4:52] .........50 [etd 4:52] ........
## .60 [etd 4:48] .........70 [etd 4:44] .........80 [etd 4:43] .......
## ..90 [etd 4:40] .........100 [etd 4:35] .........110 [etd 4:29] ......
## ...120 [etd 4:27] .........130 [etd 4:24] .........140 [etd 4:23] .....
## ....150 [etd 4:20] .........160 [etd 4:17] .........170 [etd 4:15] ....
## .....180 [etd 4:13] .........190 [etd 4:10] .........200 [etd 4:07] ...
## ......210 [etd 4:03] .........220 [etd 4:00] .........230 [etd 3:57] ..
## .......240 [etd 3:53] .........250 [etd 3:50] .........260 [etd 3:47] .
## ........270 [etd 3:44] .........280 [etd 3:40] .........290
##  [etd 3:37] .........300 [etd 3:34] .........310 [etd 3:31] .........
## 320 [etd 3:27] .........330 [etd 3:24] .........340 [etd 3:21] ........
## .350 [etd 3:18] .........360 [etd 3:15] .........370 [etd 3:12] .......
## ..380 [etd 3:09] .........390 [etd 3:05] .........400 [etd 3:02] ......
## ...410 [etd 2:59] .........420 [etd 2:56] .........430 [etd 2:53] .....
## ....440 [etd 2:50] .........450 [etd 2:47] .........460 [etd 2:44] ....
## .....470 [etd 2:41] .........480 [etd 2:38] .........490 [etd 2:35] ...
## ......500 [etd 2:32] .........510 [etd 2:29] .........520 [etd 2:26] ..
## .......530 [etd 2:23] .........540 [etd 2:20] .........550 [etd 2:17] .
## ........560 [etd 2:14] .........570 [etd 2:11] .........580
##  [etd 2:08] .........590 [etd 2:05] .........600 [etd 2:02] .........
## 610 [etd 1:59] .........620 [etd 1:56] .........630 [etd 1:53] ........
## .640 [etd 1:49] .........650 [etd 1:46] .........660 [etd 1:43] .......
## ..670 [etd 1:40] .........680 [etd 1:37] .........690 [etd 1:34] ......
## ...700 [etd 1:31] .........710 [etd 1:28] .........720 [etd 1:25] .....
## ....730 [etd 1:22] .........740 [etd 1:19] .........750 [etd 1:16] ....
## .....760 [etd 1:13] .........770 [etd 1:10] .........780 [etd 1:07] ...
## ......790 [etd 1:04] .........800 [etd 1:01] .........810 [etd 58 sec] ..
## .......820 [etd 55 sec] .........830 [etd 52 sec] .........840 [etd 49 sec] .
## ........850 [etd 47 sec] .........860 [etd 44 sec] .........870
##  [etd 41 sec] .........880 [etd 38 sec] .........890 [etd 35 sec] .........
## 900 [etd 31 sec] .........910 [etd 28 sec] .........920 [etd 25 sec] ........
## .930 [etd 22 sec] .........940 [etd 19 sec] .........950 [etd 15 sec] .......
## ..960 [etd 12 sec] .........970 [etd 9 sec] .........980 [etd 6 sec] ......
## ...990 [etd 3 sec] ........ 999.
## 
## Done.
plot(K_bk.csr, . - r ~ r, 
     xlab="d", ylab="K(d)-r", xlim=c(0,500))

The K function complete spatial randomness test for Bedok shows cluster pattern as it is inside the envelope.

5.16.5 Bukit Batok Study Area

5.16.5.1 Computing L-function estimation

L_bb = Lest(preschool_bb_ppp, correction = "Ripley")
plot(L_bb, . -r ~ r, 
     ylab= "L(d)-r", xlab = "d(m)")

5.16.5.2 Performing Complete Spatial Randomness Test

Ho = The distribution of preschool services at Bukit Batok are randomly distributed.

H1= The distribution of preschool services at Bukit Batok are not randomly distributed.

The null hypothesis will be rejected if p-value is smaller than alpha value of 0.001.

Monte Carlo test with L-fucntion

#simulate 1000 spatial point processes
L_bb.csr <- envelope(preschool_bb_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.
L_bb.csr
## Pointwise critical envelopes for L(r)
## and observed value for 'preschool_bb_ppp'
## Edge correction: "iso"
## Obtained from 999 simulations of CSR
## Alternative: two.sided
## Significance level of pointwise Monte Carlo test: 2/1000 = 0.002
## .....................................................................
##      Math.label     Description                                      
## r    r              distance argument r                              
## obs  hat(L)[obs](r) observed value of L(r) for data pattern          
## theo L[theo](r)     theoretical value of L(r) for CSR                
## lo   hat(L)[lo](r)  lower pointwise envelope of L(r) from simulations
## hi   hat(L)[hi](r)  upper pointwise envelope of L(r) from simulations
## .....................................................................
## Default plot formula:  .~r
## where "." stands for 'obs', 'theo', 'hi', 'lo'
## Columns 'lo' and 'hi' will be plotted as shading (by default)
## Recommended range of argument r: [0, 941.25]
## Available range of argument r: [0, 941.25]
summary(L_bb.csr)
## Pointwise critical envelopes for L(r)
## and observed value for 'preschool_bb_ppp'
## Obtained from 999 simulations of CSR
## Alternative: two.sided
## Upper envelope: pointwise maximum of simulated curves
## Lower envelope: pointwise minimum of simulated curves
## Significance level of Monte Carlo test: 2/1000 = 0.002
## Data: preschool_bb_ppp
plot(L_bb.csr, . - r ~ r, xlab="d", ylab="L(d)-r")

From the L-function analysis, it can be concluded that Bukit Batok has a cluster pattern, and it is statistically significant. When an observed L value is greater than its corresponding L(theo)(i.e. red break line) value for a particular distance and above the upper confidence envelop, spatial clustering for that distance is statistically significant. L(r)>0, also indicates observed is geographically concentrated.

We do not reject the null hypothesis, as p-value 0.002 is bigger than alpha value of 0.001. The distribution of preschool services at Bukit Batok are not randomly distributed.

5.16.5.3 Computing K-function estimation

K_bb = Kest(preschool_bb_ppp, correction = "Ripley")
plot(K_bb, . -r ~ r, 
     ylab= "K(d)-r", xlab = "d(m)", 
     xlim=c(0,1000))

K_bb.csr <- envelope(preschool_bb_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_bb.csr, . - r ~ r, 
     xlab="d", ylab="K(d)-r", xlim=c(0,500))

The K function complete spatial randomness test for Bukit Batok shows cluster pattern as it is inside the envelope.

5.16.6 Hougang Study Area

5.16.6.1 Computing L-function estimation

L_hg = Lest(preschool_hg_ppp, correction = "Ripley")
plot(L_hg, . -r ~ r, 
     ylab= "L(d)-r", xlab = "d(m)")

5.16.6.2 Performing Complete Spatial Randomness Test

Ho = The distribution of preschool services at Hougang are randomly distributed.

H1= The distribution of preschool services at Hougang are not randomly distributed.

The null hypothesis will be rejected if p-value is smaller than alpha value of 0.001.

Monte Carlo test with L-fucntion

#simulate 1000 spatial point processes
L_hg.csr <- envelope(preschool_hg_ppp, Lest, nsim = 999, rank = 1, glocal=TRUE)
## Generating 999 simulations of CSR  ...
## 1, 2, 3, ......10 [etd 3:40] .........20 [etd 3:31] .........
## 30 [etd 3:25] .........40 [etd 3:24] .........50 [etd 3:24] ........
## .60 [etd 3:21] .........70 [etd 3:20] .........80 [etd 3:17] .......
## ..90 [etd 3:14] .........100 [etd 3:12] .........110 [etd 3:09] ......
## ...120 [etd 3:06] .........130 [etd 3:04] .........140 [etd 3:01] .....
## ....150 [etd 2:59] .........160 [etd 2:56] .........170 [etd 2:53] ....
## .....180 [etd 2:52] .........190 [etd 2:50] .........200 [etd 2:47] ...
## ......210 [etd 2:46] .........220 [etd 2:44] .........230 [etd 2:42] ..
## .......240 [etd 2:39] .........250 [etd 2:37] .........260 [etd 2:35] .
## ........270 [etd 2:32] .........280 [etd 2:30] .........290
##  [etd 2:28] .........300 [etd 2:25] .........310 [etd 2:23] .........
## 320 [etd 2:21] .........330 [etd 2:19] .........340 [etd 2:16] ........
## .350 [etd 2:14] .........360 [etd 2:12] .........370 [etd 2:10] .......
## ..380 [etd 2:08] .........390 [etd 2:06] .........400 [etd 2:04] ......
## ...410 [etd 2:02] .........420 [etd 2:00] .........430 [etd 1:58] .....
## ....440 [etd 1:56] .........450 [etd 1:54] .........460 [etd 1:51] ....
## .....470 [etd 1:49] .........480 [etd 1:47] .........490 [etd 1:45] ...
## ......500 [etd 1:43] .........510 [etd 1:41] .........520 [etd 1:39] ..
## .......530 [etd 1:37] .........540 [etd 1:35] .........550 [etd 1:33] .
## ........560 [etd 1:30] .........570 [etd 1:28] .........580
##  [etd 1:26] .........590 [etd 1:24] .........600 [etd 1:22] .........
## 610 [etd 1:20] .........620 [etd 1:18] .........630 [etd 1:16] ........
## .640 [etd 1:14] .........650 [etd 1:12] .........660 [etd 1:10] .......
## ..670 [etd 1:08] .........680 [etd 1:06] .........690 [etd 1:03] ......
## ...700 [etd 1:01] .........710 [etd 59 sec] .........720 [etd 57 sec] .....
## ....730 [etd 55 sec] .........740 [etd 53 sec] .........750 [etd 51 sec] ....
## .....760 [etd 49 sec] .........770 [etd 47 sec] .........780 [etd 45 sec] ...
## ......790 [etd 43 sec] .........800 [etd 41 sec] .........810 [etd 39 sec] ..
## .......820 [etd 37 sec] .........830 [etd 35 sec] .........840 [etd 33 sec] .
## ........850 [etd 31 sec] .........860 [etd 29 sec] .........870
##  [etd 27 sec] .........880 [etd 24 sec] .........890 [etd 22 sec] .........
## 900 [etd 20 sec] .........910 [etd 18 sec] .........920 [etd 16 sec] ........
## .930 [etd 14 sec] .........940 [etd 12 sec] .........950 [etd 10 sec] .......
## ..960 [etd 8 sec] .........970 [etd 6 sec] .........980 [etd 4 sec] ......
## ...990 [etd 2 sec] ........ 999.
## 
## Done.
L_hg.csr
## Pointwise critical envelopes for L(r)
## and observed value for 'preschool_hg_ppp'
## Edge correction: "iso"
## Obtained from 999 simulations of CSR
## Alternative: two.sided
## Significance level of pointwise Monte Carlo test: 2/1000 = 0.002
## .....................................................................
##      Math.label     Description                                      
## r    r              distance argument r                              
## obs  hat(L)[obs](r) observed value of L(r) for data pattern          
## theo L[theo](r)     theoretical value of L(r) for CSR                
## lo   hat(L)[lo](r)  lower pointwise envelope of L(r) from simulations
## hi   hat(L)[hi](r)  upper pointwise envelope of L(r) from simulations
## .....................................................................
## Default plot formula:  .~r
## where "." stands for 'obs', 'theo', 'hi', 'lo'
## Columns 'lo' and 'hi' will be plotted as shading (by default)
## Recommended range of argument r: [0, 1027.6]
## Available range of argument r: [0, 1027.6]
summary(L_hg.csr)
## Pointwise critical envelopes for L(r)
## and observed value for 'preschool_hg_ppp'
## Obtained from 999 simulations of CSR
## Alternative: two.sided
## Upper envelope: pointwise maximum of simulated curves
## Lower envelope: pointwise minimum of simulated curves
## Significance level of Monte Carlo test: 2/1000 = 0.002
## Data: preschool_hg_ppp
plot(L_hg.csr, . - r ~ r, xlab="d", ylab="L(d)-r")

From the L-function analysis, it can be concluded that Hougang has a cluster pattern, and it is statistically significant. When an observed L value is greater than its corresponding L(theo)(i.e. red break line) value for a particular distance and above the upper confidence envelop, spatial clustering for that distance is statistically significant. L(r)>0, also indicates observed is geographically concentrated.

We do not reject the null hypothesis, as p-value 0.002 is bigger than alpha value of 0.001. The distribution of preschool services at Hougang are not randomly distributed.

5.16.6.3 Computing K-function estimation

K_hg = Kest(preschool_hg_ppp, correction = "Ripley")
plot(K_hg, . -r ~ r, 
     ylab= "K(d)-r", xlab = "d(m)", 
     xlim=c(0,1000))

K_hg.csr <- envelope(preschool_hg_ppp, Kest, nsim = 999, rank = 1, glocal=TRUE)
## Generating 999 simulations of CSR  ...
## 1, 2, 3, ......10 [etd 3:32] .........20 [etd 3:19] .........
## 30 [etd 3:13] .........40 [etd 3:17] .........50 [etd 3:20] ........
## .60 [etd 3:15] .........70 [etd 3:12] .........80 [etd 3:12] .......
## ..90 [etd 3:09] .........100 [etd 3:06] .........110 [etd 3:04] ......
## ...120 [etd 3:03] .........130 [etd 2:59] .........140 [etd 2:57] .....
## ....150 [etd 2:54] .........160 [etd 2:52] .........170 [etd 2:50] ....
## .....180 [etd 2:48] .........190 [etd 2:47] .........200 [etd 2:44] ...
## ......210 [etd 2:42] .........220 [etd 2:39] .........230 [etd 2:37] ..
## .......240 [etd 2:35] .........250 [etd 2:33] .........260 [etd 2:31] .
## ........270 [etd 2:29] .........280 [etd 2:27] .........290
##  [etd 2:26] .........300 [etd 2:24] .........310 [etd 2:21] .........
## 320 [etd 2:19] .........330 [etd 2:17] .........340 [etd 2:15] ........
## .350 [etd 2:13] .........360 [etd 2:11] .........370 [etd 2:10] .......
## ..380 [etd 2:07] .........390 [etd 2:05] .........400 [etd 2:04] ......
## ...410 [etd 2:01] .........420 [etd 1:59] .........430 [etd 1:57] .....
## ....440 [etd 1:55] .........450 [etd 1:53] .........460 [etd 1:51] ....
## .....470 [etd 1:49] .........480 [etd 1:47] .........490 [etd 1:45] ...
## ......500 [etd 1:43] .........510 [etd 1:41] .........520 [etd 1:39] ..
## .......530 [etd 1:37] .........540 [etd 1:35] .........550 [etd 1:32] .
## ........560 [etd 1:30] .........570 [etd 1:28] .........580
##  [etd 1:26] .........590 [etd 1:24] .........600 [etd 1:22] .........
## 610 [etd 1:20] .........620 [etd 1:18] .........630 [etd 1:16] ........
## .640 [etd 1:14] .........650 [etd 1:12] .........660 [etd 1:10] .......
## ..670 [etd 1:07] .........680 [etd 1:05] .........690 [etd 1:03] ......
## ...700 [etd 1:01] .........710 [etd 59 sec] .........720 [etd 57 sec] .....
## ....730 [etd 55 sec] .........740 [etd 53 sec] .........750 [etd 51 sec] ....
## .....760 [etd 49 sec] .........770 [etd 47 sec] .........780 [etd 45 sec] ...
## ......790 [etd 43 sec] .........800 [etd 41 sec] .........810 [etd 39 sec] ..
## .......820 [etd 37 sec] .........830 [etd 35 sec] .........840 [etd 33 sec] .
## ........850 [etd 31 sec] .........860 [etd 29 sec] .........870
##  [etd 27 sec] .........880 [etd 24 sec] .........890 [etd 22 sec] .........
## 900 [etd 20 sec] .........910 [etd 18 sec] .........920 [etd 16 sec] ........
## .930 [etd 14 sec] .........940 [etd 12 sec] .........950 [etd 10 sec] .......
## ..960 [etd 8 sec] .........970 [etd 6 sec] .........980 [etd 4 sec] ......
## ...990 [etd 2 sec] ........ 999.
## 
## Done.
plot(K_hg.csr, . - r ~ r, 
     xlab="d", ylab="K(d)-r", xlim=c(0,500))

The K function complete spatial randomness test for Hougang shows cluster pattern as it is inside the envelope.

5.17 Analysis & Statistical Conclusion (Section B)

Preschools locations in Singapore exhibits clustering and are planned in a way that is not randomly distributed. This has also been proved in the extracted planing areas.

6 Overall Findings and Recommendations

  • Effort can be seen that the government did careful planning in the building of preschool around Singapore, they are not randomly distributed. They did follow the population number for the respective age group.

  • Effort can be seen the government is trying its best to keep up with the demand for preschools. The bigger the population, the more the number of preschools.Examples can be seen in Tampines East, Woodlands East and Bedok North Subzones.

  • Did a good job in building the number of preschools in Sengkang and Punngol.

  • An recommendation is to conduct further on the ground study the town of Yishun. Even though Yishun has a cluster of preschools but it is not spreaded throughout the entire area of Yishun. Build more preschools in Yishun or else it will not meet the demand.