Link to Rpubs: https://rpubs.com/theodorapo/take-home_ex-01
packages <- c('sf', 'tidyverse')
for (p in packages){
if(!require(p, character.only = T)){
install.packages(p)
}
library(p,character.only = T)
}
## Loading required package: sf
## Linking to GEOS 3.8.0, GDAL 3.0.4, PROJ 6.3.1
## Loading required package: tidyverse
## -- Attaching packages ------------------------------------------------------------------------------- tidyverse 1.3.0 --
## v ggplot2 3.3.0 v purrr 0.3.4
## v tibble 3.0.1 v dplyr 0.8.5
## v tidyr 1.0.3 v stringr 1.4.0
## v readr 1.3.1 v forcats 0.5.0
## -- Conflicts ---------------------------------------------------------------------------------- tidyverse_conflicts() --
## x dplyr::filter() masks stats::filter()
## x dplyr::lag() masks stats::lag()
subzone <- st_read("data/geospatial/MP14_SUBZONE_NO_SEA_PL.shp")
## Reading layer `MP14_SUBZONE_NO_SEA_PL' from data source `C:\Users\amoss\OneDrive\Documents\data\geospatial\MP14_SUBZONE_NO_SEA_PL.shp' 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
st_crs(subzone)
## Coordinate Reference System:
## User input: SVY21
## wkt:
## PROJCRS["SVY21",
## BASEGEOGCRS["SVY21[WGS84]",
## DATUM["World Geodetic System 1984",
## ELLIPSOID["WGS 84",6378137,298.257223563,
## LENGTHUNIT["metre",1]],
## ID["EPSG",6326]],
## PRIMEM["Greenwich",0,
## ANGLEUNIT["Degree",0.0174532925199433]]],
## CONVERSION["unnamed",
## 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["(E)",east,
## ORDER[1],
## LENGTHUNIT["metre",1,
## ID["EPSG",9001]]],
## AXIS["(N)",north,
## ORDER[2],
## LENGTHUNIT["metre",1,
## ID["EPSG",9001]]]]
subzone <- st_transform(subzone, 4326)
st_crs(subzone)
## Coordinate Reference System:
## User input: EPSG:4326
## wkt:
## GEOGCRS["WGS 84",
## DATUM["World Geodetic System 1984",
## ELLIPSOID["WGS 84",6378137,298.257223563,
## LENGTHUNIT["metre",1]]],
## PRIMEM["Greenwich",0,
## ANGLEUNIT["degree",0.0174532925199433]],
## CS[ellipsoidal,2],
## AXIS["geodetic latitude (Lat)",north,
## ORDER[1],
## ANGLEUNIT["degree",0.0174532925199433]],
## AXIS["geodetic longitude (Lon)",east,
## ORDER[2],
## ANGLEUNIT["degree",0.0174532925199433]],
## USAGE[
## SCOPE["unknown"],
## AREA["World"],
## BBOX[-90,-180,90,180]],
## ID["EPSG",4326]]
plot(subzone, max.plot=1)
busstop <- st_read("data/geospatial/BusStop.shp")
## Reading layer `BusStop' from data source `C:\Users\amoss\OneDrive\Documents\data\geospatial\BusStop.shp' using driver `ESRI Shapefile'
## Simple feature collection with 5040 features and 3 fields
## geometry type: POINT
## dimension: XY
## bbox: xmin: 4427.938 ymin: 26482.1 xmax: 48282.5 ymax: 52983.82
## projected CRS: SVY21
busstop$BUS_STOP_N = as.numeric(as.character(busstop$BUS_STOP_N))
st_crs(busstop)
## Coordinate Reference System:
## User input: SVY21
## wkt:
## PROJCRS["SVY21",
## BASEGEOGCRS["WGS 84",
## DATUM["World Geodetic System 1984",
## ELLIPSOID["WGS 84",6378137,298.257223563,
## LENGTHUNIT["metre",1]],
## ID["EPSG",6326]],
## PRIMEM["Greenwich",0,
## ANGLEUNIT["Degree",0.0174532925199433]]],
## CONVERSION["unnamed",
## 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["(E)",east,
## ORDER[1],
## LENGTHUNIT["metre",1,
## ID["EPSG",9001]]],
## AXIS["(N)",north,
## ORDER[2],
## LENGTHUNIT["metre",1,
## ID["EPSG",9001]]]]
busstop <- st_transform(busstop, 4326)
st_crs(busstop)
## Coordinate Reference System:
## User input: EPSG:4326
## wkt:
## GEOGCRS["WGS 84",
## DATUM["World Geodetic System 1984",
## ELLIPSOID["WGS 84",6378137,298.257223563,
## LENGTHUNIT["metre",1]]],
## PRIMEM["Greenwich",0,
## ANGLEUNIT["degree",0.0174532925199433]],
## CS[ellipsoidal,2],
## AXIS["geodetic latitude (Lat)",north,
## ORDER[1],
## ANGLEUNIT["degree",0.0174532925199433]],
## AXIS["geodetic longitude (Lon)",east,
## ORDER[2],
## ANGLEUNIT["degree",0.0174532925199433]],
## USAGE[
## SCOPE["unknown"],
## AREA["World"],
## BBOX[-90,-180,90,180]],
## ID["EPSG",4326]]
View(busstop)
passenger <- read_csv("data/aspatial/passenger_volume_by_busstop.csv")
## Parsed with column specification:
## cols(
## PT_CODE = col_double(),
## TOTAL_TAP_IN_VOLUME = col_double(),
## TOTAL_TAP_OUT_VOLUME = col_double()
## )
# CHANGE VARIABLE NAME
colnames(passenger)[1] = "BUS_STOP_N"
passbus <- inner_join(passenger,busstop,by="BUS_STOP_N")
glimpse(passbus)
## Rows: 194,869
## Columns: 6
## $ BUS_STOP_N <dbl> 67551, 67551, 66541, 66541, 54209, 54209, 6104...
## $ TOTAL_TAP_IN_VOLUME <dbl> 224, 3922, 648, 127, 736, 1388, 92, 140, 442, ...
## $ TOTAL_TAP_OUT_VOLUME <dbl> 22, 122, 364, 109, 325, 920, 72, 143, 117, 284...
## $ BUS_ROOF_N <chr> "B01", "B01", "B01", "B01", "B06", "B06", "B10...
## $ LOC_DESC <chr> "BLK 471A", "BLK 471A", "BLK 980C", "BLK 980C"...
## $ geometry <POINT [°]> POINT (103.8805 1.395861), POINT (103.88...
passbus <- passbus %>% extract(geometry, c('lat', 'lon'), '\\((.*), (.*)\\)', convert = TRUE)
glimpse(passbus)
## Rows: 194,869
## Columns: 7
## $ BUS_STOP_N <dbl> 67551, 67551, 66541, 66541, 54209, 54209, 6104...
## $ TOTAL_TAP_IN_VOLUME <dbl> 224, 3922, 648, 127, 736, 1388, 92, 140, 442, ...
## $ TOTAL_TAP_OUT_VOLUME <dbl> 22, 122, 364, 109, 325, 920, 72, 143, 117, 284...
## $ BUS_ROOF_N <chr> "B01", "B01", "B01", "B01", "B06", "B06", "B10...
## $ LOC_DESC <chr> "BLK 471A", "BLK 471A", "BLK 980C", "BLK 980C"...
## $ lat <dbl> 103.8805, 103.8805, 103.8814, 103.8814, 103.83...
## $ lon <dbl> 1.395861, 1.395861, 1.379980, 1.379980, 1.3763...
map2(passbus$lat, passbus$lon, ~st_point(c(.x, .y))) %>%
st_sfc(crs = 4326) %>%
st_sf(passbus[,-(5:6)], .) -> passbus_sf
passbus_subzone <- bind_cols(
passbus,
subzone[as.numeric(st_within(passbus_sf, subzone)),]
) %>%
dplyr::select(BUS_STOP_N,TOTAL_TAP_IN_VOLUME,TOTAL_TAP_OUT_VOLUME,LOC_DESC,lat, lon, subzone_name=SUBZONE_N) %>%
mutate(subzone_name = str_to_title(subzone_name))
## although coordinates are longitude/latitude, st_within assumes that they are planar
passbus_subzone <- na.omit(passbus_subzone)
View(passbus_subzone)
population <- read_csv("data/aspatial/residentialpopulation_2019.csv")
## Parsed with column specification:
## cols(
## SZ = col_character(),
## Pop = col_double()
## )
subzonepop <- population %>%
group_by(SZ) %>%
summarise(Pop = sum(Pop))
colnames(subzonepop)[1] = "subzone_name"
passbussubpop <- inner_join(passbus_subzone,subzonepop,by="subzone_name")
View(passbussubpop)
library(dplyr)
tapin_ <- passbussubpop %>%
group_by(subzone_name) %>%
summarise(TOTAL_TAP_IN_VOLUME = sum(TOTAL_TAP_IN_VOLUME))
tapout_ <- passbussubpop %>%
group_by(subzone_name) %>%
summarise(TOTAL_TAP_OUT_VOLUME = sum(TOTAL_TAP_OUT_VOLUME))
tapin <- inner_join(tapin_, subzonepop, by="subzone_name")
tapout <- inner_join(tapout_, subzonepop, by="subzone_name")
View(tapin) View(tapout)
datatest <- tapin
tap_in <- datatest$TOTAL_TAP_IN_VOLUME
pop <- datatest$Pop
regfit <- lm(tap_in~pop)
summary(regfit)
##
## Call:
## lm(formula = tap_in ~ pop)
##
## Residuals:
## Min 1Q Median 3Q Max
## -841313 -122165 -63062 46001 1952899
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 1.222e+05 2.130e+04 5.738 2.32e-08 ***
## pop 1.884e+01 9.472e-01 19.886 < 2e-16 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 301000 on 303 degrees of freedom
## Multiple R-squared: 0.5662, Adjusted R-squared: 0.5647
## F-statistic: 395.4 on 1 and 303 DF, p-value: < 2.2e-16
model <- plot(pop, tap_in, main="Linear relationship between population and tap in", xlab="population", ylab="tapin")
abline(regfit, lwd=3, col="red")
datatest2 <- tapout
tap_out <- datatest2$TOTAL_TAP_OUT_VOLUME
popout <- datatest2$Pop
regfit2 <- lm(tap_out~popout)
summary(regfit2)
##
## Call:
## lm(formula = tap_out ~ popout)
##
## Residuals:
## Min 1Q Median 3Q Max
## -802936 -120462 -58450 36240 1647268
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 1.220e+05 2.062e+04 5.915 8.94e-09 ***
## popout 1.875e+01 9.172e-01 20.446 < 2e-16 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 291500 on 303 degrees of freedom
## Multiple R-squared: 0.5798, Adjusted R-squared: 0.5784
## F-statistic: 418.1 on 1 and 303 DF, p-value: < 2.2e-16
plot(popout, tap_out, main="linear relationship between population and tap out", xlab="population", ylab="tapout")
abline(regfit2, lwd=3, col="red")
# plot residuals against population, to get the residuals plot
plot(pop, residuals(regfit), main="Relationship between population and residuals",xlab="population", ylab="residuals")
library(fitdistrplus)
## Loading required package: MASS
##
## Attaching package: 'MASS'
## The following object is masked from 'package:dplyr':
##
## select
## Loading required package: survival
## Loading required package: npsurv
## Loading required package: lsei
fnorm <- fitdist(residuals(regfit), "norm")
plot(fnorm)
result <- gofstat(fnorm, discrete=FALSE)
result
## Goodness-of-fit statistics
## 1-mle-norm
## Kolmogorov-Smirnov statistic 0.2055747
## Cramer-von Mises statistic 4.2289931
## Anderson-Darling statistic 22.2859309
##
## Goodness-of-fit criteria
## 1-mle-norm
## Akaike's Information Criterion 8562.645
## Bayesian Information Criterion 8570.086
# Test KScrit value to see if null hypothesis should be rejected or not
KScritvalue <- 1.36/sqrt(length(tap_in))
KScritvalue
## [1] 0.07787337
## KS stat > KS crit, reject null hypothesis. sufficient evidence that it is not normally distributed
TOTAL_TAP_IN_VOLUME.Pop.lm <- lm(TOTAL_TAP_IN_VOLUME ~ Pop, data = tapin)
summary(TOTAL_TAP_IN_VOLUME.Pop.lm)
##
## Call:
## lm(formula = TOTAL_TAP_IN_VOLUME ~ Pop, data = tapin)
##
## Residuals:
## Min 1Q Median 3Q Max
## -841313 -122165 -63062 46001 1952899
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 1.222e+05 2.130e+04 5.738 2.32e-08 ***
## Pop 1.884e+01 9.472e-01 19.886 < 2e-16 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 301000 on 303 degrees of freedom
## Multiple R-squared: 0.5662, Adjusted R-squared: 0.5647
## F-statistic: 395.4 on 1 and 303 DF, p-value: < 2.2e-16
plot(TOTAL_TAP_IN_VOLUME.Pop.lm)
plot(popout, residuals(regfit2), main="Relationship between population and residuals",xlab="population", ylab="residuals")
library(fitdistrplus)
fnorm <- fitdist(residuals(regfit2), "norm")
plot(fnorm)
result <- gofstat(fnorm, discrete=FALSE)
result
## Goodness-of-fit statistics
## 1-mle-norm
## Kolmogorov-Smirnov statistic 0.2100444
## Cramer-von Mises statistic 3.9543646
## Anderson-Darling statistic 20.5222382
##
## Goodness-of-fit criteria
## 1-mle-norm
## Akaike's Information Criterion 8542.983
## Bayesian Information Criterion 8550.423
KScritvalue <- 1.36/sqrt(length(tap_out))
KScritvalue
## [1] 0.07787337
## KS stat > KS crit, reject null hypothesis. sufficient evidence that it is not normally distributed
TOTAL_TAP_OUT_VOLUME.Pop.lm <- lm(TOTAL_TAP_OUT_VOLUME ~ Pop, data = tapout)
summary(TOTAL_TAP_OUT_VOLUME.Pop.lm)
##
## Call:
## lm(formula = TOTAL_TAP_OUT_VOLUME ~ Pop, data = tapout)
##
## Residuals:
## Min 1Q Median 3Q Max
## -802936 -120462 -58450 36240 1647268
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 1.220e+05 2.062e+04 5.915 8.94e-09 ***
## Pop 1.875e+01 9.172e-01 20.446 < 2e-16 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 291500 on 303 degrees of freedom
## Multiple R-squared: 0.5798, Adjusted R-squared: 0.5784
## F-statistic: 418.1 on 1 and 303 DF, p-value: < 2.2e-16
plot(TOTAL_TAP_OUT_VOLUME.Pop.lm)
View(subzone) View(tapin)
# Rename subzone_n
colnames(tapin)[1] = "SUBZONE_N"
# uppercase all observations in SUBZONE_N
tapin$SUBZONE_N = toupper(tapin$SUBZONE_N)
# change character to attribute
subzone$SUBZONE_N = as.character(subzone$SUBZONE_N)
# join both data set
subzone_tapin <- left_join(tapin,subzone)
## Joining, by = "SUBZONE_N"
# omit NA values
subzone_tapin <- na.omit(subzone_tapin)
# select variables
subzone_tapin <- dplyr::select(subzone_tapin,SUBZONE_N,Pop, TOTAL_TAP_IN_VOLUME,X_ADDR,Y_ADDR,geometry)
View(subzone_tapin)
packages = c('rgdal', 'sf', 'spdep', 'tmap', 'tidyverse')
for (p in packages){
if(!require(p, character.only = T)){
install.packages(p)
}
library(p,character.only = T)
}
## Loading required package: rgdal
## Loading required package: sp
## rgdal: version: 1.4-8, (SVN revision 845)
## Geospatial Data Abstraction Library extensions to R successfully loaded
## Loaded GDAL runtime: GDAL 2.2.3, released 2017/11/20
## Path to GDAL shared files: C:/R/R-4.0.0/library/rgdal/gdal
## GDAL binary built with GEOS: TRUE
## Loaded PROJ.4 runtime: Rel. 4.9.3, 15 August 2016, [PJ_VERSION: 493]
## Path to PROJ.4 shared files: C:/R/R-4.0.0/library/rgdal/proj
## Linking to sp version: 1.4-1
## Loading required package: spdep
## Loading required package: spData
## To access larger datasets in this package, install the spDataLarge
## package with: `install.packages('spDataLarge',
## repos='https://nowosad.github.io/drat/', type='source')`
## Loading required package: tmap
subzone_tapin = st_as_sf(subzone_tapin)
st_make_valid(subzone_tapin)
## Simple feature collection with 305 features and 5 fields
## geometry type: GEOMETRY
## dimension: XY
## bbox: xmin: 103.6057 ymin: 1.210655 xmax: 104.0336 ymax: 1.470775
## geographic CRS: WGS 84
## # A tibble: 305 x 6
## SUBZONE_N Pop TOTAL_TAP_IN_VOL~ X_ADDR Y_ADDR geometry
## <chr> <dbl> <dbl> <dbl> <dbl> <MULTIPOLYGON [°]>
## 1 ADMIRALTY 14110 178509 27091. 48334. (((103.8285 1.458775, 103.8~
## 2 AIRPORT R~ 0 22692 35133. 37075. (((103.9014 1.356171, 103.9~
## 3 ALEXANDRA~ 13780 497549 25359. 29991. (((103.8144 1.285474, 103.8~
## 4 ALEXANDRA~ 2120 59359 26548. 30519. (((103.8174 1.294306, 103.8~
## 5 ALJUNIED 40190 1613882 33593. 32971. (((103.8913 1.321318, 103.8~
## 6 ANAK BUKIT 22250 799579 21127. 35562. (((103.771 1.347908, 103.77~
## 7 ANCHORVALE 46610 472053 34219. 41815. (((103.896 1.399924, 103.89~
## 8 ANG MO KI~ 4890 1100348 29502. 39419. (((103.8485 1.368786, 103.8~
## 9 ANSON 0 73701 29145. 28467. (((103.8441 1.274875, 103.8~
## 10 BALESTIER 32760 1061622 29975. 34194. (((103.8623 1.329565, 103.8~
## # ... with 295 more rows
par(mfrow=c(1,2))
qtm(subzone_tapin, "TOTAL_TAP_IN_VOLUME")
## Warning: The shape subzone_tapin is invalid. See sf::st_is_valid
qtm(subzone_tapin, "Pop")
## Warning: The shape subzone_tapin is invalid. See sf::st_is_valid
wm_q_in <- poly2nb(subzone_tapin, queen=TRUE)
summary(wm_q_in)
## Neighbour list object:
## Number of regions: 305
## Number of nonzero links: 1848
## Percentage nonzero weights: 1.986563
## Average number of links: 6.059016
## Link number distribution:
##
## 2 3 4 5 6 7 8 9 10 11 12 14 17
## 6 11 27 79 74 51 36 14 2 2 1 1 1
## 6 least connected regions:
## 2 41 132 170 228 275 with 2 links
## 1 most connected region:
## 39 with 17 links
wm_r_in <- poly2nb(subzone_tapin, queen=FALSE)
summary(wm_r_in)
## Neighbour list object:
## Number of regions: 305
## Number of nonzero links: 1596
## Percentage nonzero weights: 1.715668
## Average number of links: 5.232787
## Link number distribution:
##
## 1 2 3 4 5 6 7 8 9 10 13 14
## 1 5 24 70 91 62 29 15 4 2 1 1
## 1 least connected region:
## 170 with 1 link
## 1 most connected region:
## 39 with 14 links
centroids <- sf::st_centroid(subzone_tapin$geometry)
## Warning in st_centroid.sfc(subzone_tapin$geometry): st_centroid does not give
## correct centroids for longitude/latitude data
plot(subzone_tapin$geometry, border="lightgrey")
plot(wm_q_in, st_coordinates(centroids), pch=19, cex=0.6, add=TRUE, col="red", main="Queen Contiguity")
plot(subzone_tapin$geometry, border="lightgrey")
plot(wm_r_in, st_coordinates(centroids), pch=19, cex=0.6, add=TRUE, col="red", main="Rook Contiguity")
coords <-st_coordinates(centroids)
k1 <- knn2nb(knearneigh(coords))
k1dists <- unlist(nbdists(k1, coords, longlat=TRUE))
summary(k1dists)
## Min. 1st Qu. Median Mean 3rd Qu. Max.
## 0.1825 0.6167 0.8917 0.9414 1.1699 5.4040
wm_d_in <- dnearneigh(coords,0,6,longlat=TRUE)
wm_d_in
## Neighbour list object:
## Number of regions: 305
## Number of nonzero links: 19302
## Percentage nonzero weights: 20.74926
## Average number of links: 63.28525
str(wm_d_in)
## List of 305
## $ : int [1:29] 85 123 139 145 146 147 158 166 168 169 ...
## $ : int [1:70] 5 7 10 14 15 18 20 21 23 25 ...
## $ : int [1:96] 4 9 12 17 22 26 28 30 35 36 ...
## $ : int [1:103] 3 9 10 12 17 18 22 25 26 28 ...
## $ : int [1:92] 2 10 12 15 17 18 20 21 22 23 ...
## $ : int [1:61] 11 29 31 32 33 34 39 48 54 55 ...
## $ : int [1:46] 2 8 44 50 60 64 75 96 97 98 ...
## $ : int [1:59] 7 10 18 20 21 25 27 39 44 50 ...
## $ : int [1:85] 3 4 10 12 17 18 22 23 26 28 ...
## $ : int [1:115] 2 4 5 8 9 12 17 18 20 21 ...
## $ : int [1:37] 6 29 31 32 33 34 39 48 49 63 ...
## $ : int [1:94] 3 4 5 9 10 17 18 22 23 25 ...
## $ : int [1:18] 14 15 16 69 76 78 81 109 118 121 ...
## $ : int [1:33] 2 13 15 16 64 69 76 78 81 109 ...
## $ : int [1:46] 2 5 13 14 16 20 64 69 76 78 ...
## $ : int [1:22] 13 14 15 69 76 78 81 109 116 118 ...
## $ : int [1:110] 3 4 5 9 10 12 18 20 21 22 ...
## $ : int [1:113] 2 4 5 8 9 10 12 17 20 21 ...
## $ : int [1:25] 24 45 87 88 94 103 106 107 108 124 ...
## $ : int [1:92] 2 5 8 10 15 17 18 21 23 25 ...
## $ : int [1:88] 2 5 8 10 17 18 20 23 25 26 ...
## $ : int [1:99] 3 4 5 9 10 12 17 18 23 25 ...
## $ : int [1:102] 2 5 9 10 12 17 18 20 21 22 ...
## $ : int [1:42] 19 29 31 32 33 34 45 48 71 83 ...
## $ : int [1:106] 2 4 5 8 10 12 17 18 20 21 ...
## $ : int [1:115] 3 4 5 9 10 12 17 18 21 22 ...
## $ : int [1:97] 2 5 8 10 17 18 20 21 22 23 ...
## $ : int [1:107] 3 4 5 9 10 12 17 18 20 21 ...
## $ : int [1:53] 6 11 24 31 32 33 34 45 48 49 ...
## $ : int [1:108] 3 4 5 9 10 12 17 18 20 21 ...
## $ : int [1:57] 6 11 24 29 32 33 34 45 48 49 ...
## $ : int [1:58] 6 11 24 29 31 33 34 39 45 48 ...
## $ : int [1:60] 6 11 24 29 31 32 34 45 48 49 ...
## $ : int [1:56] 6 11 24 29 31 32 33 45 48 49 ...
## $ : int [1:101] 3 4 9 10 12 17 18 22 23 25 ...
## $ : int [1:94] 3 4 9 12 17 22 26 28 30 35 ...
## $ : int [1:87] 3 4 5 9 10 12 17 18 22 23 ...
## $ : int [1:83] 3 4 5 9 10 12 17 18 22 23 ...
## $ : int [1:39] 6 8 11 32 44 61 63 68 72 79 ...
## $ : int [1:9] 41 42 76 140 141 180 236 248 293
## $ : int [1:12] 40 42 76 140 141 179 180 181 182 183 ...
## $ : int [1:16] 40 41 76 140 141 179 180 181 182 183 ...
## $ : int [1:109] 3 4 9 10 12 17 18 22 23 25 ...
## $ : int [1:65] 2 7 8 10 18 20 21 25 27 39 ...
## $ : int [1:41] 19 24 29 31 32 33 34 71 86 87 ...
## $ : int [1:97] 3 4 5 9 10 12 17 18 22 23 ...
## $ : int [1:93] 3 4 5 9 10 12 17 18 22 23 ...
## $ : int [1:40] 6 11 24 29 31 32 33 34 49 63 ...
## $ : int [1:35] 11 29 31 32 33 34 48 63 72 79 ...
## $ : int [1:67] 2 7 8 10 18 20 21 23 25 27 ...
## $ : int [1:103] 3 4 5 9 10 12 17 18 20 22 ...
## $ : int [1:77] 3 4 9 12 17 22 26 28 30 35 ...
## $ : int [1:103] 3 4 5 9 10 12 17 18 22 23 ...
## $ : int [1:54] 3 6 29 31 32 33 34 55 56 57 ...
## $ : int [1:57] 3 6 29 31 32 33 34 54 56 57 ...
## $ : int [1:52] 3 6 31 32 33 34 54 55 57 59 ...
## $ : int [1:54] 3 4 6 31 32 33 34 54 55 56 ...
## $ : int [1:95] 3 4 5 9 10 12 17 18 22 23 ...
## $ : int [1:89] 3 4 6 9 17 22 26 28 35 36 ...
## $ : int [1:53] 2 7 8 20 21 44 50 64 75 96 ...
## $ : int [1:83] 3 4 6 10 25 26 27 32 33 35 ...
## $ : int [1:103] 4 5 9 10 12 17 18 20 21 22 ...
## $ : int [1:43] 6 11 29 31 32 33 34 39 48 49 ...
## $ : int [1:71] 2 5 7 8 10 14 15 18 20 21 ...
## $ : int [1:92] 3 4 9 12 17 22 26 28 30 35 ...
## $ : int [1:110] 3 4 5 9 10 12 17 18 20 21 ...
## $ : int [1:63] 3 4 6 26 31 32 33 35 36 43 ...
## $ : int [1:113] 3 4 6 8 10 17 18 21 22 23 ...
## $ : int [1:38] 2 5 12 13 14 15 16 18 20 23 ...
## $ : int [1:90] 3 4 9 10 12 17 18 22 23 26 ...
## $ : int [1:56] 6 24 29 31 32 33 34 45 54 55 ...
## $ : int [1:36] 6 11 29 31 32 33 34 39 48 49 ...
## $ : int [1:97] 3 4 6 10 17 22 25 26 27 28 ...
## $ : int [1:111] 3 4 5 9 10 12 17 18 20 21 ...
## $ : int [1:54] 2 7 8 20 21 44 50 60 64 96 ...
## $ : int [1:21] 13 14 15 16 40 41 42 140 141 179 ...
## $ : int [1:103] 3 4 5 9 10 12 17 18 22 23 ...
## $ : int [1:35] 2 5 13 14 15 16 20 23 64 69 ...
## $ : int [1:36] 11 29 31 32 39 48 49 63 72 83 ...
## $ : int [1:105] 2 5 10 12 17 18 20 21 22 23 ...
## $ : int [1:66] 2 5 10 12 13 14 15 16 17 18 ...
## $ : int [1:73] 3 4 6 26 31 32 33 35 36 43 ...
## $ : int [1:44] 6 11 24 29 31 32 33 34 39 48 ...
## $ : int [1:119] 3 4 5 9 10 12 17 18 20 21 ...
## $ : int [1:29] 1 79 123 127 145 146 147 158 166 168 ...
## $ : int [1:54] 6 11 24 29 31 32 33 34 39 45 ...
## $ : int [1:19] 19 45 88 103 106 108 124 134 194 208 ...
## $ : int [1:20] 19 24 45 87 103 106 108 124 134 194 ...
## $ : int [1:99] 3 4 9 10 12 17 18 22 26 28 ...
## $ : int [1:83] 3 4 6 10 17 21 25 26 27 32 ...
## $ : int [1:54] 6 11 24 29 31 32 33 34 39 48 ...
## $ : int [1:79] 3 4 6 26 33 35 36 43 53 54 ...
## $ : int [1:68] 3 4 6 11 26 29 31 32 33 34 ...
## $ : int [1:48] 6 19 24 29 31 32 33 34 45 48 ...
## $ : int [1:48] 6 11 24 29 31 32 33 34 45 48 ...
## $ : int [1:68] 2 7 8 15 20 21 25 27 44 50 ...
## $ : int [1:57] 2 7 8 15 20 21 44 50 60 64 ...
## $ : int [1:65] 2 7 8 15 20 21 25 27 44 50 ...
## $ : int [1:107] 3 4 5 9 10 12 17 18 22 23 ...
## [list output truncated]
## - attr(*, "class")= chr "nb"
## - attr(*, "nbtype")= chr "distance"
## - attr(*, "distances")= num [1:2] 0 6
## - attr(*, "region.id")= chr [1:305] "1" "2" "3" "4" ...
## - attr(*, "call")= language dnearneigh(x = coords, d1 = 0, d2 = 6, longlat = TRUE)
## - attr(*, "dnn")= num [1:2] 0 6
## - attr(*, "bounds")= chr [1:2] "GT" "LE"
## - attr(*, "sym")= logi TRUE
plot(subzone_tapin$geometry, border="lightgrey")
plot(wm_d_in, coords, add=TRUE)
plot(k1, coords, add=TRUE, col="red", length=0.08)
wm_knn_in <- knn2nb(knearneigh(coords, k=6))
wm_knn_in
## Neighbour list object:
## Number of regions: 305
## Number of nonzero links: 1830
## Percentage nonzero weights: 1.967213
## Average number of links: 6
## Non-symmetric neighbours list
plot(subzone_tapin$geometry, border="lightgrey")
plot(wm_knn_in, coords, pch=19, cex=0.6, add=TRUE, col="red")
par(mfrow=c(1,2))
plot(subzone_tapin$geometry, border="lightgrey")
plot(wm_d_in, coords, add=TRUE)
plot(k1, coords, add=TRUE, col="red", length=0.08)
plot(subzone_tapin$geometry, border="lightgrey")
plot(wm_knn_in, coords, pch=19, cex=0.6, add=TRUE, col="red")
dist <- nbdists(wm_q_in, coords, longlat=TRUE)
ids <- lapply(dist, function(x)1/(x))
ids
## [[1]]
## [1] 0.8844741 1.0480106 0.8884195 0.7273930 0.7194021 0.8145234
##
## [[2]]
## [1] 5.4804873 0.5914406
##
## [[3]]
## [1] 0.7684313 0.8535230 1.6794906 0.5228568 0.9209379 1.0335332 0.8362314
## [8] 1.1858760
##
## [[4]]
## [1] 0.7684313 0.8561584 1.5861382 1.5851576 0.6885791 1.6141956
##
## [[5]]
## [1] 0.7967051 0.5944818 0.5997141 0.6629291 0.6203724 0.4515680 0.6945245
## [8] 0.6050715 0.5702452
##
## [[6]]
## [1] 0.6512450 0.4671241 0.5523379 0.5381036 0.7563190 0.4293571
##
## [[7]]
## [1] 0.9454551 0.7069300 0.7923350 1.0038999
##
## [[8]]
## [1] 1.2338839 0.7348002 1.2417769 0.9286924 1.1898496 0.7053242 0.7185641
## [8] 0.8303788
##
## [[9]]
## [1] 0.9959641 1.4465246 0.8333802 1.2148883 2.8731441
##
## [[10]]
## [1] 0.7966416 0.7644062 0.9104840 0.5199711 0.7906893 0.5484124 1.0309079
##
## [[11]]
## [1] 0.3340457 1.0083355 1.0893203 1.1046888
##
## [[12]]
## [1] 0.9203617 2.0296518 1.0517067 1.1788886 0.7483162
##
## [[13]]
## [1] 1.0456883 0.3182148 0.3952152 0.3518170
##
## [[14]]
## [1] 0.6605051 0.7274535 0.4081463 0.3335142 0.4247973 0.4347253 0.4996058
## [8] 0.2714662
##
## [[15]]
## [1] 0.6605051 0.5181626 0.4845160 0.5729661 0.3245971 0.7023854
##
## [[16]]
## [1] 1.0456883 0.7274535 0.3591743 0.4215225 0.3491247
##
## [[17]]
## [1] 1.494798 1.310005 1.254374 1.634446 5.480304 1.374106 3.113369
##
## [[18]]
## [1] 0.7966416 1.0681731 1.0154484 0.6284209 0.8855030 0.7727805 0.7862932
## [8] 0.5582583
##
## [[19]]
## [1] 0.4808461 0.5021124 0.8552760 0.4146835 0.4872360 0.8520672 0.3744038
##
## [[20]]
## [1] 1.0407714 0.6501177 1.1361333 1.5437228 1.0316895
##
## [[21]]
## [1] 0.9133713 0.6159350 0.9185460 0.8728618 0.9670262 0.4796687 0.6021557
## [8] 0.5586217 0.5457509
##
## [[22]]
## [1] 2.786039 1.267237 2.117575 1.005309 4.246211 1.961564
##
## [[23]]
## [1] 0.7967051 1.2804026 1.3084566 0.7795739 1.2994920
##
## [[24]]
## [1] 0.8162941 0.8398473 0.8406951 0.4617172 0.5947887 0.8492181 0.5505385
##
## [[25]]
## [1] 1.435667 1.373967 1.301129 1.553840 1.196840
##
## [[26]]
## [1] 1.0772240 1.1926237 0.7632259 1.3811674 1.7409411 2.1360097 1.1732691
## [8] 1.3218132
##
## [[27]]
## [1] 0.9133713 1.4356674 1.1960461 1.0402323 1.1480015
##
## [[28]]
## [1] 1.494798 1.688457 1.806317 2.215308 1.827245
##
## [[29]]
## [1] 0.8033619 1.1060481 0.7749737 0.9886477 0.5712238
##
## [[30]]
## [1] 1.238054 1.127686 1.875910 1.768634 2.907615
##
## [[31]]
## [1] 0.8033619 1.2456534 0.8677066 1.0995651 1.1008159
##
## [[32]]
## [1] 1.2456534 1.1139321 1.2296401 0.9886387
##
## [[33]]
## [1] 0.6512450 0.8677066 1.1139321 0.5251549 0.5749132 0.4975997 0.7172742
## [8] 0.9562401 0.4655908
##
## [[34]]
## [1] 1.1060481 1.0995651 0.5251549 0.4251808 0.8437940 1.1504476 0.8727465
##
## [[35]]
## [1] 0.8561584 0.8849391 1.0580419 0.9130916 1.3190915 1.5405780 1.3468824
##
## [[36]]
## [1] 0.8535230 0.8953934 1.4431053 0.9473712 1.5587781 1.8066475 1.0600227
##
## [[37]]
## [1] 1.945150 1.681763 2.867192 1.639472 2.216894
##
## [[38]]
## [1] 0.9959641 0.9203617 1.9451504 0.4801978 0.8909323 0.6389542 1.1068127
## [8] 1.1632581 1.3729115
##
## [[39]]
## [1] 0.3340457 0.2968846 0.2888334 0.2008093 0.2052084 0.1755475 0.2010533
## [8] 0.1768133 0.2737723 0.2683509 0.3031680 0.2675447 0.2437008 0.3102618
## [15] 0.1645856 0.1596139 0.2470689
##
## [[40]]
## [1] 0.1928125 0.2883690 0.2455807
##
## [[41]]
## [1] 0.1928125 0.4024330
##
## [[42]]
## [1] 0.2883690 0.4024330 0.6129275 1.9940343 0.8012110 0.2990791 0.2256625
##
## [[43]]
## [1] 1.5861382 0.8849391 0.8398056 0.5903987 1.4993784 0.9754874 0.6645181
## [8] 0.6068086 1.1098669
##
## [[44]]
## [1] 1.2338839 1.0523191 0.5523030 0.5613916 0.8274346 0.9741141 0.8390431
##
## [[45]]
## [1] 0.8162941 0.5354624 0.7349362 0.5731777 1.1214091 0.8920002
##
## [[46]]
## [1] 2.786039 1.655131 1.585099 1.188247 4.539164 2.151226
##
## [[47]]
## [1] 1.4465246 1.6817633 1.6551312 1.0095825 4.0676512 1.2752529 2.4095598
## [8] 1.0939357 0.9929413 1.9481332
##
## [[48]]
## [1] 1.2058561 0.9429210 0.8453777 1.1247852 0.1549636
##
## [[49]]
## [1] 1.2058561 0.4999200 0.5894127 0.6608199 0.1555487 1.0815070
##
## [[50]]
## [1] 0.7348002 0.6159350 1.0523191 0.5157744 0.6161005 0.8084862 0.6482094
## [8] 1.2375038
##
## [[51]]
## [1] 1.2672374 1.6884572 1.2380540 0.9940303 1.2837980 0.6653816 1.2277930
## [8] 0.7652348 1.3663294 1.0067668 1.2508523
##
## [[52]]
## [1] 0.8333802 0.4801978 0.9365332 0.5600298 0.3833439 0.5271297 0.3948815
## [8] 0.6004264
##
## [[53]]
## [1] 2.1175745 1.5850988 0.9940303 1.9383979 1.3815174 1.1669983
##
## [[54]]
## [1] 1.2679553 0.9472898 0.9463619 0.7722828 0.9961068
##
## [[55]]
## [1] 1.2679553 0.6445698 0.8307125 0.7361825 1.0745144 0.5206418
##
## [[56]]
## [1] 0.9472898 1.6527189 0.8805075 0.3870804 0.3140803 0.5674396
##
## [[57]]
## [1] 0.9463619 0.6445698 1.6527189 0.7989980 0.7772218 0.4282428 0.7856067
##
## [[58]]
## [1] 2.0296518 0.8909323 1.2837980 1.1211354 2.1805833
##
## [[59]]
## [1] 1.4706887 0.7308158 0.7947949 0.7562514 1.8549252
##
## [[60]]
## [1] 0.9454551 0.5320455 0.7959180 0.7495172 0.5882395 0.8816489 0.9588370
##
## [[61]]
## [1] 0.9569594 0.8914390 0.5038010 0.9232634 0.5109726 0.5691983
##
## [[62]]
## [1] 1.1276855 0.6653816 0.9056074 2.0375888 0.8137809 0.9199540 1.2646240
## [8] 0.7443998
##
## [[63]]
## [1] 1.0083355 0.2968846 0.6160743 0.5959538 0.9512227 0.5635195
##
## [[64]]
## [1] 5.4804873 0.4252456 0.4092100 0.4999176 0.8560016 0.4577477 0.3484185
## [8] 0.5391147 0.7922589
##
## [[65]]
## [1] 1.6794906 0.8953934 0.5532178 0.7800484 1.6215842 0.6991945
##
## [[66]]
## [1] 1.310005 1.806317 1.848831 1.382043 1.810943 1.620788 1.357020
##
## [[67]]
## [1] 0.7989980 0.8487075 1.0756715 0.7005317 1.1515548
##
## [[68]]
## [1] 0.6551446 0.6323499 0.7688724 0.6923502 0.6630384
##
## [[69]]
## [1] 0.3576763 2.7288438 0.5130455 0.4573773
##
## [[70]]
## [1] 1.2148883 1.0095825 0.9365332 0.9376335 1.7858516 0.7647919
##
## [[71]]
## [1] 0.7722828 0.8307125 0.9182911 0.9217925 1.5196015
##
## [[72]]
## [1] 1.0893203 0.2888334 0.5223506 0.8925147 1.7640783
##
## [[73]]
## [1] 0.9569594 1.0927183 0.6092194 1.1052748
##
## [[74]]
## [1] 1.254374 1.847188 1.246549 2.947320 1.905523 1.215226
##
## [[75]]
## [1] 0.7069300 0.5320455 0.4114400 0.6135504 0.4537765 0.5824593 0.6725423
## [8] 0.6052865
##
## [[76]]
## [1] 0.6129275 0.8043294 0.4952155 0.7646293 0.5671159
##
## [[77]]
## [1] 2.2153080 1.2277930 1.9383979 1.8488310 1.0542144 1.4284612 0.9593715
##
## [[78]]
## [1] 0.3182148 0.4081463 0.3591743 0.4050295 0.4590652 0.8120932 0.5132071
## [8] 0.8547808
##
## [[79]]
## [1] 0.2008093 0.4999200 0.5223506 0.3195949 0.4659314 0.6380523 0.6422838
## [8] 0.4497935 0.4809803 0.5992606
##
## [[80]]
## [1] 0.5944818 1.0681731 1.2804026 1.0097213 1.2503065 0.7338037 0.7472477
##
## [[81]]
## [1] 0.5997141 0.4050295 0.4150285 0.7066867 0.8635013 0.4740998 0.5368732
## [8] 0.5367962
##
## [[82]]
## [1] 0.8487075 1.1616463 0.6850966 0.8707461 1.0969734
##
## [[83]]
## [1] 0.6160743 0.6319974 0.5990246 0.7803611 0.8192146 0.7113396 0.5287903
## [8] 0.7192815 0.3073443
##
## [[84]]
## [1] 1.0772240 0.9472528 0.9530090 0.9036667 1.8975126 1.6983369
##
## [[85]]
## [1] 0.9052538 1.6882874 0.7239262 0.4968966 1.0396107 0.6690701
##
## [[86]]
## [1] 0.7749737 1.1008159 1.2296401 0.6319974 0.8888807 0.9712211
##
## [[87]]
## [1] 0.4808461 0.6798021 0.6710674 0.5866048
##
## [[88]]
## [1] 0.5021124 0.6798021 0.6095744 0.5423227 0.3218916 0.3581644 0.4299867
##
## [[89]]
## [1] 1.5851576 1.0580419 1.4431053 0.9068886 1.7085096 1.6868741
##
## [[90]]
## [1] 0.2052084 0.8914390 0.6551446 0.4331565 0.5114785 0.4718265
##
## [[91]]
## [1] 0.4671241 0.9886387 0.5749132 0.5959538 0.5990246 0.8888807 0.6391110
##
## [[92]]
## [1] 1.4706887 1.1616463 1.0185734 0.8388392 1.2334553 0.5743472
##
## [[93]]
## [1] 0.5523379 0.5038010 0.5434165 0.5945844 0.5624522 0.8207609
##
## [[94]]
## [1] 0.8398473 0.5354624 0.4679993 0.5878285 0.5670518 0.5945566 0.7970978
##
## [[95]]
## [1] 0.9886477 0.7803611 0.9712211 0.7024756 0.4660007
##
## [[96]]
## [1] 1.0135684 1.3229506 1.3302127 0.7080008 0.6583602
##
## [[97]]
## [1] 0.7959180 1.0135684 0.7605919 1.3386343 0.6622192
##
## [[98]]
## [1] 0.7495172 1.3229506 0.7605919 0.7633608 0.4080910 0.7176809 1.0333706
##
## [[99]]
## [1] 1.054214 1.728954 2.081489 3.270822
##
## [[100]]
## [1] 0.9182911 1.0416720 0.5005635 0.7230575 0.7987768 0.9121866 0.7359705
##
## [[101]]
## [1] 1.3820435 0.8777783 2.1551137 2.3549864 1.3134107
##
## [[102]]
## [1] 1.1046888 0.9512227 0.8925147 0.8192146 0.8793560 0.7729020 0.7086318
##
## [[103]]
## [1] 0.8552760 0.6095744 0.4655936 0.3033305 0.9296686 0.2975364 0.3175127
## [8] 0.3022505 0.1573922
##
## [[104]]
## [1] 1.0407714 0.7262922 0.5670105 0.9349039 0.9646251 1.0121334 0.8005541
##
## [[105]]
## [1] 1.0416720 0.8205733 1.6226101 1.0939244
##
## [[106]]
## [1] 0.5742682 0.5943254 0.4113321 0.5452498
##
## [[107]]
## [1] 0.5742682 0.6140380 0.4362903 0.4658673 0.5344569 0.5967864 0.4382571
##
## [[108]]
## [1] 0.8406951 0.7349362 0.9415510 0.5528436 1.0636402
##
## [[109]]
## [1] 0.3335142 0.5181626 0.4252456 0.4150285 0.6292237 0.7308923 0.3675036
## [8] 0.4111101
##
## [[110]]
## [1] 1.015448 1.308457 1.009721 1.162562 1.263443
##
## [[111]]
## [1] 0.6629291 0.7795739 1.2503065 0.7262922 0.9737761 1.1552076
##
## [[112]]
## [1] 0.6203724 1.2994920 0.9056074 1.1625619 0.7706998 0.9697024
##
## [[113]]
## [1] 1.8759095 0.7652348 2.0375888 3.2176501
##
## [[114]]
## [1] 0.7644062 0.6284209 1.8471885 0.8777783 0.9677324 1.1733551 0.8659227
## [8] 1.0628311
##
## [[115]]
## [1] 0.9473712 0.5600298 0.9376335 0.9068886 1.2115791 1.7619035 1.2938641
## [8] 1.3185284 1.5874208
##
## [[116]]
## [1] 0.4515680 0.4092100 0.7066867 0.5670105 0.6292237 0.4577219 0.7756175
## [8] 0.5388115
##
## [[117]]
## [1] 0.4999176 1.3302127 1.3386343 0.4791165 0.5220114 1.5436506 0.4699383
##
## [[118]]
## [1] 0.4590652 0.8635013 1.3106704 0.7257642
##
## [[119]]
## [1] 0.9429210 0.7113396 0.7024756 1.0310969 0.8670278 0.4247892
##
## [[120]]
## [1] 1.2417769 1.0061644 1.6064429 0.7500858 0.6527241 1.1553013
##
## [[121]]
## [1] 0.4247973 0.4845160 0.8120932 0.4740998 0.7308923 0.4577219
##
## [[122]]
## [1] 0.5228568 0.5532178 0.4659881 0.6848407 0.7154689 1.1606192 1.2516079
## [8] 0.4898260
##
## [[123]]
## [1] 0.4560956 0.5015524 0.9737212 0.5147668 0.5251365 0.7195327 0.9792542
## [8] 0.6773042
##
## [[124]]
## [1] 0.4617172 0.5731777 0.4655936 0.9415510 0.5971054 0.7045412 0.6752555
##
## [[125]]
## [1] 0.9104840 0.8855030 1.3739673 1.8447553 1.2660919 0.7090568
##
## [[126]]
## [1] 0.7080008 0.7633608 0.4791165 1.0600947 0.6155955 0.6409793 0.6648319
##
## [[127]]
## [1] 0.3347517 0.3706974 0.7000040 0.5612803 0.4524644 0.5409671
##
## [[128]]
## [1] 0.4679993 0.5005635 0.8205733 0.6140380 0.8493902 0.4077919 0.9326988
## [8] 0.6865580
##
## [[129]]
## [1] 0.7727805 0.8137809 1.2465487 1.2634434 0.7706998 0.9677324 1.3857451
## [8] 1.2956422 1.5903328
##
## [[130]]
## [1] 0.7308158 0.9232634 1.0927183 1.0185734 0.5434165 0.3973167 0.4535570
## [8] 0.5543265 0.5751480
##
## [[131]]
## [1] 1.1926237 0.8398056 1.7289543 1.1439498 1.3789246 2.1873170 1.2376825
## [8] 1.5469512
##
## [[132]]
## [1] 0.3268232 0.1589236
##
## [[133]]
## [1] 1.634446 2.947320 1.385745 1.410838 3.151098 1.256131
##
## [[134]]
## [1] 0.4146835 0.3033305 0.5943254 0.4362903 0.7655235 0.4130353 0.4338324
## [8] 1.2109539
##
## [[135]]
## [1] 0.9185460 1.3011294 1.1960461 0.9251273 2.0740006 0.7783528 0.9728857
##
## [[136]]
## [1] 0.8560016 0.6583602 0.5220114 1.0600947 0.5421828 0.6904218 0.6428618
##
## [[137]]
## [1] 0.6501177 0.8728618 0.5157744 0.9251273 1.0775249 0.6159859 0.6438742
## [8] 1.0063526
##
## [[138]]
## [1] 0.4577477 1.5436506 1.1808305 0.6359548 0.5019490
##
## [[139]]
## [1] 0.4560956 0.4381241 0.4159762 0.3833159 0.3158822 0.5882482 0.4798430
## [8] 0.7144880
##
## [[140]]
## [1] 1.9940343 0.8043294 0.9596644
##
## [[141]]
## [1] 0.8012110 0.4952155 0.9596644 0.6448882 0.5569022
##
## [[142]]
## [1] 1.905523 2.155114 1.173355 2.117224
##
## [[143]]
## [1] 0.6945245 0.5368732 0.9349039 0.9737761 0.7756175 0.6925473 0.5453684
##
## [[144]]
## [1] 0.5199711 0.6323499 0.9472528 0.8631758 0.7656371 0.6757964 0.5871453
##
## [[145]]
## [1] 0.1755475 0.5015524 0.7442450 0.3007840 0.4677231 0.4484203 0.4853337
## [8] 0.3315351 0.3264268 0.4951431 0.4649258 0.4851777
##
## [[146]]
## [1] 0.9737212 0.7442450 1.2016692
##
## [[147]]
## [1] 0.2010533 0.3195949 0.3007840 0.2794967 0.4319578 0.7285834 0.6137348
##
## [[148]]
## [1] 0.9209379 0.6885791 0.5903987 0.7947949 0.3973167 1.4487496 0.6863953
## [8] 1.2854792 0.7389841
##
## [[149]]
## [1] 1.051707 1.366329 1.121135 0.919954 0.707254
##
## [[150]]
## [1] 0.3576763 0.3565229 0.7828311 0.7434382
##
## [[151]]
## [1] 1.1788886 0.6389542 0.7072540 0.7820824
##
## [[152]]
## [1] 2.7288438 0.5132071 1.3106704 0.3565229 0.5498483 0.4522282
##
## [[153]]
## [1] 0.3833439 0.4290775 0.2315013 0.3627578 0.9756103 0.7358156 0.8145211
##
## [[154]]
## [1] 0.9670262 0.6161005 0.5989028 0.6123236 0.7815656 0.6897698
##
## [[155]]
## [1] 0.7923350 0.4114400 0.5517190 1.1535795 0.5293861 0.5392787 0.8134473
## [8] 0.5051229
##
## [[156]]
## [1] 2.867192 4.067651 2.561208
##
## [[157]]
## [1] 1.0335332 0.7562514 1.4487496 0.6895619 1.3707566 0.8877237
##
## [[158]]
## [1] 0.9052538 0.7286530 0.5374064 0.8571719 1.2635250 0.8494379
##
## [[159]]
## [1] 2.3549864 0.8659227 0.9323119 1.9315370 1.2191397
##
## [[160]]
## [1] 0.7906893 0.9530090 1.0628311 0.8631758 0.9323119 1.2216780
##
## [[161]]
## [1] 0.1768133 0.7688724 0.4331565 0.7656371 0.5266164 0.6332063
##
## [[162]]
## [1] 0.6050715 0.5130455 0.5367962 0.7257642 0.7828311 0.5498483 0.5835158
##
## [[163]]
## [1] 0.7632259 0.6923502 0.9036667 0.6757964 1.2700510 0.5433986 0.9875742
## [8] 0.7858094
##
## [[164]]
## [1] 0.7772218 1.0756715 0.4659881 0.6138716 0.9035689
##
## [[165]]
## [1] 0.5381036 0.2737723 0.5635195 0.6391110 0.4653930
##
## [[166]]
## [1] 0.2683509 0.5147668 0.4677231 0.2794967 0.8021035 0.3635262
##
## [[167]]
## [1] 1.897513 1.931537 1.221678
##
## [[168]]
## [1] 1.6882874 0.3347517 0.3440207 0.5632434 0.6394194
##
## [[169]]
## [1] 0.7863828 0.6765798 0.7936921 0.6766562 0.9144950
##
## [[170]]
## [1] 1.0237727 0.5317908
##
## [[171]]
## [1] 0.7005317 0.6850966 0.8388392 0.6848407 0.6895619 0.6138716 0.7246413
## [8] 1.4065933
##
## [[172]]
## [1] 1.381167 1.499378 1.143950 2.013966 2.670432
##
## [[173]]
## [1] 1.740941 1.698337 1.270051
##
## [[174]]
## [1] 1.810943 1.428461 2.081489 1.378925 2.105451
##
## [[175]]
## [1] 0.8805075 0.6080403 0.2383592 0.6806124 1.0994479
##
## [[176]]
## [1] 0.4659314 0.3706974 0.4714593 0.5463106 0.1363204 0.7572748
##
## [[177]]
## [1] 0.3870804 0.4282428 0.7154689 0.9035689 0.5264702 0.8238056
##
## [[178]]
## [1] 1.1606192 0.4290775 0.5264702 0.4718700 0.6285524
##
## [[179]]
## [1] 0.7549454 0.8548739 0.8288461 0.5041562 0.8457130
##
## [[180]]
## [1] 0.7646293 0.6448882 0.7549454 0.7522203 0.5443706 0.4372582
##
## [[181]]
## [1] 0.5569022 0.8548739 0.7522203 0.3250162 0.5951573
##
## [[182]]
## [1] 0.3250162 0.6141856 0.5673076 0.3761027 0.4890482 0.3790200 0.3634999
## [8] 0.4832962
##
## [[183]]
## [1] 0.8288461 0.5951573 0.6141856 0.6921918
##
## [[184]]
## [1] 2.1360097 0.9754874 2.1873170 2.0139658 1.2233765
##
## [[185]]
## [1] 0.5729661 0.3675036 0.5117486 0.7198171 0.4840912 0.6385329
##
## [[186]]
## [1] 0.5673076 0.5117486 0.6083635 0.4240189 0.6027918
##
## [[187]]
## [1] 0.3484185 1.1808305 0.3761027 0.6083635 0.5976273
##
## [[188]]
## [1] 1.0053088 0.9130916 1.1882469 1.2752529 1.3815174 2.5428180 1.4708078
## [8] 1.1895831 1.0944313
##
## [[189]]
## [1] 1.553840 1.844755 2.074001 1.130316 1.077190
##
## [[190]]
## [1] 0.8453777 0.5894127 1.0310969 0.4911626 0.1834646
##
## [[191]]
## [1] 0.4113321 0.4658673 0.6080403 0.7957456
##
## [[192]]
## [1] 2.409560 2.542818 1.346062
##
## [[193]]
## [1] 4.246211 4.539164 3.190791
##
## [[194]]
## [1] 0.6710674 0.5423227 0.3598882
##
## [[195]]
## [1] 0.5914406 0.5391147 0.4111101 0.6359548 0.7198171 0.4240189 0.5976273
##
## [[196]]
## [1] 0.3140803 0.2315013 0.2383592 0.8238056 0.4718700
##
## [[197]]
## [1] 0.5484124 0.7862932 0.7338037 1.2660919 0.7783528 1.1303162 1.1249031
## [8] 1.2898274
##
## [[198]]
## [1] 0.5517190 0.4890482 0.5237262 0.9521497 0.6454933 1.2202489
##
## [[199]]
## [1] 1.1535795 1.0237727 0.5237262 0.4482643 0.5900350
##
## [[200]]
## [1] 0.8362314 0.7800484 1.2516079 1.3707566 0.7246413
##
## [[201]]
## [1] 1.961564 1.639472 1.106813 2.151226 1.093936 1.006767 2.180583 3.190791
##
## [[202]]
## [1] 1.1858760 1.6141956 1.5587781 1.7085096 0.6863953
##
## [[203]]
## [1] 0.7000040 0.3268232 0.4714593 0.4248008 0.1192066
##
## [[204]]
## [1] 0.6645181 0.6092194 0.4535570 1.2854792 0.5433986 0.6242597 0.8038132
##
## [[205]]
## [1] 0.5882395 0.6622192 0.4699383 0.5019490 0.5293861 0.3790200 0.9521497
## [8] 1.0807459
##
## [[206]]
## [1] 1.3190915 0.6068086 1.1669983 0.9593715 3.2708222 1.2376825 1.4708078
##
## [[207]]
## [1] 1.768634 1.264624 3.217650 1.295642 4.857047 1.431108
##
## [[208]]
## [1] 0.9296686 0.5971054 0.1884797 0.5864134
##
## [[209]]
## [1] 0.4872360 0.5452498 0.7655235 0.6898072
##
## [[210]]
## [1] 1.7640783 0.6380523 0.8793560 1.5652699
##
## [[211]]
## [1] 5.480304 1.620788 1.215226 1.410838 2.117224
##
## [[212]]
## [1] 0.6135504 0.5392787 0.4482643 0.5809053 0.3945352
##
## [[213]]
## [1] 0.4537765 0.4381241 0.5809053 0.5272022
##
## [[214]]
## [1] 0.5523030 0.5824593 0.7244121 0.7850972 1.0231996 0.5897564 0.6931957
## [8] 0.4085719
##
## [[215]]
## [1] 0.8844741 0.4484203 0.8353524 0.9941691 0.7224300 0.5402783
##
## [[216]]
## [1] 1.0480106 0.7863828 0.9848955 0.7364404 0.5525513
##
## [[217]]
## [1] 0.3031680 1.0061644 0.8851455 0.7331908 0.5283589 0.7911798
##
## [[218]]
## [1] 0.8884195 0.8353524 0.6392443 1.0130489 0.8182763
##
## [[219]]
## [1] 0.7273930 0.4853337 0.6765798 0.9941691 0.9848955 0.7850920
##
## [[220]]
## [1] 0.7194021 0.7364404 0.6477426
##
## [[221]]
## [1] 1.0038999 0.8816489 0.8134473 0.6454933 1.0807459
##
## [[222]]
## [1] 0.6725423 0.4159762 0.3945352 0.5272022 0.7244121 0.5478539
##
## [[223]]
## [1] 0.6422838 0.5287903 0.7729020 1.5652699 1.2445951
##
## [[224]]
## [1] 0.5582583 1.1361333 0.7472477 0.9646251 1.1552076 0.6925473 1.1249031
## [8] 0.9030380
##
## [[225]]
## [1] 0.3440207 0.6392443 0.8143723 0.6328791 0.4385275
##
## [[226]]
## [1] 0.3315351 0.7224300 1.0130489 0.8143723 0.8089478 0.6705902
##
## [[227]]
## [1] 0.7239262 0.7286530 0.5632434 0.6328791 0.8089478 0.8042739
##
## [[228]]
## [1] 0.5271297 0.3627578
##
## [[229]]
## [1] 0.6155955 0.5421828 1.0775249 0.8035498 1.0567880
##
## [[230]]
## [1] 0.4796687 0.5613916 0.8084862 0.4080910 0.6409793 0.6159859 0.8035498
## [8] 0.6716319 0.7414336
##
## [[231]]
## [1] 0.7176809 0.6648319 0.7850972 0.6716319 1.0406271 0.8628155
##
## [[232]]
## [1] 0.8274346 0.6482094 1.0231996 0.7414336 1.0406271 0.6297705
##
## [[233]]
## [1] 0.9286924 1.6064429 0.5989028 0.8851455 0.8631963 0.7535825
##
## [[234]]
## [1] 0.8520672 0.5866048 0.4130353 0.6898072
##
## [[235]]
## [1] 0.3952152 0.4573773 0.8547808 0.4522282
##
## [[236]]
## [1] 0.4347253 0.3245971 0.4215225 0.6441040 0.4568251 0.4758056
##
## [[237]]
## [1] 0.9929413 1.7858516 1.2115791 1.1895831 1.3460620 1.7106658
##
## [[238]]
## [1] 0.7361825 0.7856067 1.1515548 0.8707461 0.5253496 1.3972628
##
## [[239]]
## [1] 1.173269 1.357020 1.313411 1.546951 1.219140 2.105451 1.223376
##
## [[240]]
## [1] 0.2675447 0.5251365 0.3833159 0.3264268 0.8021035 0.5940072 0.4117553
##
## [[241]]
## [1] 0.7483162 1.1632581 0.3948815 0.7820824
##
## [[242]]
## [1] 1.374106 1.590333 3.151098 4.857047 1.274913
##
## [[243]]
## [1] 0.7563190 0.4975997 1.0745144 0.5945844 0.5253496 0.6668643 0.5599429
##
## [[244]]
## [1] 0.4293571 0.2437008 0.5109726 0.5114785 0.5624522 0.4653930
##
## [[245]]
## [1] 0.3102618 0.3158822 0.3635262 0.7331908 0.5940072 0.4993618 0.4552457
## [8] 0.6941495
##
## [[246]]
## [1] 0.7922589 1.0121334 0.5388115 0.6904218 0.5453684 0.8220740
##
## [[247]]
## [1] 0.5947887 1.1214091 0.5878285 0.5344569 0.8493902 0.4338324 0.6055280
##
## [[248]]
## [1] 0.2990791 0.5671159 0.5041562 0.5443706 0.6441040 0.5306867 0.5488513
## [8] 0.2922441
##
## [[249]]
## [1] 0.8457130 0.4372582 0.3634999 0.6921918 0.4840912 0.6027918 0.5306867
## [8] 0.5028630
##
## [[250]]
## [1] 0.4996058 0.7023854 0.6385329 0.4568251 0.5488513 0.5028630
##
## [[251]]
## [1] 1.3218132 1.1098669 0.9875742 2.6704319 0.6242597
##
## [[252]]
## [1] 1.8549252 1.2334553 0.7389841 0.8877237 1.4065933
##
## [[253]]
## [1] 2.873144 2.216894 1.372911 1.948133 2.561208
##
## [[254]]
## [1] 0.5702452 0.7443998 0.9697024 0.7434382 0.5835158
##
## [[255]]
## [1] 0.7230575 0.5967864 0.4077919 0.6806124 0.7957456 0.7478303
##
## [[256]]
## [1] 1.1247852 0.6608199 0.4497935 0.7192815 0.7086318 0.8670278 1.2445951
##
## [[257]]
## [1] 1.6215842 0.4898260 0.9756103 0.6285524 0.7735387
##
## [[258]]
## [1] 0.6004264 0.7647919 1.7619035 0.7358156 1.6947872
##
## [[259]]
## [1] 1.8066475 0.6991945 1.2938641 0.8145211 0.7735387 1.6947872
##
## [[260]]
## [1] 0.5712238 0.4251808 0.3073443 0.5670518 0.4660007 0.4247892 0.4911626
## [8] 0.3887759 0.2087434 0.3542026 0.5275972
##
## [[261]]
## [1] 0.3218916 0.2975364 0.8291476 0.5049576 0.1542575
##
## [[262]]
## [1] 0.8145234 0.8182763 0.6477426 0.4385275
##
## [[263]]
## [1] 1.540578 1.318528 1.094431 1.710666 1.966668
##
## [[264]]
## [1] 1.346882 1.060023 1.686874 1.587421 1.966668
##
## [[265]]
## [1] 1.0309079 1.1968400 1.0402323 0.7090568 0.5871453 0.5266164 1.0746367
##
## [[266]]
## [1] 0.6021557 1.1480015 0.1645856 0.6123236 0.6332063 1.0746367 0.4485643
##
## [[267]]
## [1] 0.7172742 0.8437940 0.7987768 1.6226101 0.7671860 1.1476841
##
## [[268]]
## [1] 0.9562401 0.5206418 0.9217925 0.9121866 0.6668643 0.7671860
##
## [[269]]
## [1] 1.1898496 0.5586217 0.9741141 1.2375038 0.7500858 0.7815656 0.8631963
##
## [[270]]
## [1] 0.9588370 0.6052865 1.0333706 0.5897564 0.8628155
##
## [[271]]
## [1] 0.3581644 0.3598882 0.8084843 0.5520072 0.4484357
##
## [[272]]
## [1] 0.4299867 0.3175127 0.8291476 0.8084843 0.5240704
##
## [[273]]
## [1] 0.5049576 0.5520072 0.5240704 0.2929905 0.1134900 0.1213000
##
## [[274]]
## [1] 0.4484357 0.2929905 0.1850478
##
## [[275]]
## [1] 0.1134900 0.1850478
##
## [[276]]
## [1] 0.3744038 0.8920002 0.3022505 0.4382571 0.7045412 1.2109539 0.6055280
##
## [[277]]
## [1] 0.1596139 0.4809803 0.5612803 0.4319578 0.5463106 0.4248008 0.4915513
## [8] 0.4054007
##
## [[278]]
## [1] 0.5691983 0.6630384 1.1052748 0.4718265 0.5543265 0.7858094 0.8038132
##
## [[279]]
## [1] 1.0969734 0.5743472 0.8207609 0.5751480 1.3972628 0.5599429
##
## [[280]]
## [1] 1.5437228 0.8005541 0.6428618 0.6438742 1.0567880 0.8220740 0.7157434
##
## [[281]]
## [1] 0.2470689 0.6897698 0.5283589 0.7535825 0.4485643
##
## [[282]]
## [1] 3.113369 1.827245 2.907615 1.250852 1.256131 1.431108 1.274913
##
## [[283]]
## [1] 0.5051229 0.5317908 0.4832962 1.2202489 0.5900350
##
## [[284]]
## [1] 0.8492181 0.5945566 0.5528436 0.3887759 0.2854144 0.5447089
##
## [[285]]
## [1] 0.9961068 0.5674396 1.5196015 0.7359705 1.0994479 0.7478303
##
## [[286]]
## [1] 0.1549636 0.1555487 0.1573922 0.1589236 0.1363204 0.1834646 0.1192066
## [8] 0.1884797 0.2087434 0.1542575 0.1213000 0.2854144 0.1471734 0.2384254
##
## [[287]]
## [1] 0.4524644 0.7285834 0.5374064 0.4915513 0.8148601 0.5866934 1.0408171
##
## [[288]]
## [1] 0.4968966 0.4951431 0.8571719 0.5402783 0.6705902 0.8042739 0.6335440
##
## [[289]]
## [1] 1.0396107 1.2635250 0.8148601 0.6916850 1.0034162
##
## [[290]]
## [1] 0.4649258 0.6137348 0.8494379 0.5866934 0.6335440 0.6916850
##
## [[291]]
## [1] 0.6690701 0.5409671 0.6394194 0.4054007 1.0408171 1.0034162
##
## [[292]]
## [1] 1.0316895 0.5457509 0.9728857 1.0063526 1.0771904 1.2898274 0.9030380
## [8] 0.7157434
##
## [[293]]
## [1] 0.3518170 0.2714662 0.3491247 0.2455807 0.2256625 0.4758056 0.2922441
##
## [[294]]
## [1] 1.0815070 0.5992606 0.7572748 0.1471734
##
## [[295]]
## [1] 0.7053242 0.6527241 0.4993618 1.2130854 1.1116498 1.1896508
##
## [[296]]
## [1] 0.7185641 0.8390431 0.6931957 0.6297705 1.2130854 0.7434640
##
## [[297]]
## [1] 0.5882482 0.4085719 0.5478539 0.4552457 1.1116498 0.7434640
##
## [[298]]
## [1] 0.8303788 1.1553013 0.7911798 0.6941495 1.1896508
##
## [[299]]
## [1] 0.7195327 0.7936921 0.9976961 1.0967103 1.1267590
##
## [[300]]
## [1] 0.4798430 0.6766562 0.9976961 0.6996838
##
## [[301]]
## [1] 0.9792542 0.7144880 0.4117553 1.0967103 0.6996838 0.6276027
##
## [[302]]
## [1] 0.6773042 0.4851777 1.2016692 0.9144950 0.5525513 0.7850920 1.1267590
## [8] 0.6276027
##
## [[303]]
## [1] 0.4655908 1.1504476 1.0939244 0.9326988 0.3542026 1.1476841 0.9467308
##
## [[304]]
## [1] 0.8727465 0.7970978 0.6865580 0.5275972 0.9467308
##
## [[305]]
## [1] 0.5505385 1.0636402 0.6752555 0.5864134 0.5447089 0.2384254
rswm_q <- nb2listw(wm_q_in, style="W", zero.policy = TRUE)
rswm_q
## Characteristics of weights list object:
## Neighbour list object:
## Number of regions: 305
## Number of nonzero links: 1848
## Percentage nonzero weights: 1.986563
## Average number of links: 6.059016
##
## Weights style: W
## Weights constants summary:
## n nn S0 S1 S2
## W 305 93025 305 105.9392 1253.617
lm.morantest(regfit, listw=rswm_q, zero.policy = TRUE)
##
## Global Moran I for regression residuals
##
## data:
## model: lm(formula = tap_in ~ pop)
## weights: rswm_q
##
## Moran I statistic standard deviate = -0.27068, p-value = 0.6067
## alternative hypothesis: greater
## sample estimates:
## Observed Moran I Expectation Variance
## -0.013381618 -0.004364448 0.001109728
View(subzone) View(tapout)
# Rename subzone_n
colnames(tapout)[1] = "SUBZONE_N"
# uppercase all observations in SUBZONE_N
tapout$SUBZONE_N = toupper(tapout$SUBZONE_N)
# change character to attribute
subzone$SUBZONE_N = as.character(subzone$SUBZONE_N)
# join both data set
subzone_tapout <- left_join(tapout,subzone)
## Joining, by = "SUBZONE_N"
# omit NA values
subzone_tapout <- na.omit(subzone_tapout)
# select variables
subzone_tapout <- dplyr::select(subzone_tapout,SUBZONE_N,Pop, TOTAL_TAP_OUT_VOLUME,X_ADDR,Y_ADDR,geometry)
View(subzone_tapout)
subzone_tapout = st_as_sf(subzone_tapout)
st_make_valid(subzone_tapout)
## Simple feature collection with 305 features and 5 fields
## geometry type: GEOMETRY
## dimension: XY
## bbox: xmin: 103.6057 ymin: 1.210655 xmax: 104.0336 ymax: 1.470775
## geographic CRS: WGS 84
## # A tibble: 305 x 6
## SUBZONE_N Pop TOTAL_TAP_OUT_VO~ X_ADDR Y_ADDR geometry
## <chr> <dbl> <dbl> <dbl> <dbl> <MULTIPOLYGON [°]>
## 1 ADMIRALTY 14110 228889 27091. 48334. (((103.8285 1.458775, 103.8~
## 2 AIRPORT R~ 0 24524 35133. 37075. (((103.9014 1.356171, 103.9~
## 3 ALEXANDRA~ 13780 603813 25359. 29991. (((103.8144 1.285474, 103.8~
## 4 ALEXANDRA~ 2120 41292 26548. 30519. (((103.8174 1.294306, 103.8~
## 5 ALJUNIED 40190 1704099 33593. 32971. (((103.8913 1.321318, 103.8~
## 6 ANAK BUKIT 22250 745657 21127. 35562. (((103.771 1.347908, 103.77~
## 7 ANCHORVALE 46610 474260 34219. 41815. (((103.896 1.399924, 103.89~
## 8 ANG MO KI~ 4890 1052820 29502. 39419. (((103.8485 1.368786, 103.8~
## 9 ANSON 0 59522 29145. 28467. (((103.8441 1.274875, 103.8~
## 10 BALESTIER 32760 1065839 29975. 34194. (((103.8623 1.329565, 103.8~
## # ... with 295 more rows
par(mfrow=c(1,2))
qtm(subzone_tapout, "TOTAL_TAP_OUT_VOLUME")
## Warning: The shape subzone_tapout is invalid. See sf::st_is_valid
qtm(subzone_tapout, "Pop")
## Warning: The shape subzone_tapout is invalid. See sf::st_is_valid
wm_q_out <- poly2nb(subzone_tapout, queen=TRUE)
summary(wm_q_out)
## Neighbour list object:
## Number of regions: 305
## Number of nonzero links: 1848
## Percentage nonzero weights: 1.986563
## Average number of links: 6.059016
## Link number distribution:
##
## 2 3 4 5 6 7 8 9 10 11 12 14 17
## 6 11 27 79 74 51 36 14 2 2 1 1 1
## 6 least connected regions:
## 2 41 132 170 228 275 with 2 links
## 1 most connected region:
## 39 with 17 links
wm_r_out <- poly2nb(subzone_tapout, queen=FALSE)
summary(wm_r_out)
## Neighbour list object:
## Number of regions: 305
## Number of nonzero links: 1596
## Percentage nonzero weights: 1.715668
## Average number of links: 5.232787
## Link number distribution:
##
## 1 2 3 4 5 6 7 8 9 10 13 14
## 1 5 24 70 91 62 29 15 4 2 1 1
## 1 least connected region:
## 170 with 1 link
## 1 most connected region:
## 39 with 14 links
centroids <- sf::st_centroid(subzone_tapout$geometry)
## Warning in st_centroid.sfc(subzone_tapout$geometry): st_centroid does not give
## correct centroids for longitude/latitude data
plot(subzone_tapout$geometry, border="lightgrey")
plot(wm_q_out, st_coordinates(centroids), pch=19, cex=0.6, add=TRUE, col="red", main="Queen Contiguity")
plot(subzone_tapout$geometry, border="lightgrey")
plot(wm_r_out, st_coordinates(centroids), pch=19, cex=0.6, add=TRUE, col="red", main="Rook Contiguity")
coords_out <-st_coordinates(centroids)
k1_out <- knn2nb(knearneigh(coords_out))
k1dists_out <- unlist(nbdists(k1_out, coords_out, longlat=TRUE))
summary(k1dists_out)
## Min. 1st Qu. Median Mean 3rd Qu. Max.
## 0.1825 0.6167 0.8917 0.9414 1.1699 5.4040
wm_d_out <- dnearneigh(coords_out,0,6,longlat=TRUE)
wm_d_out
## Neighbour list object:
## Number of regions: 305
## Number of nonzero links: 19302
## Percentage nonzero weights: 20.74926
## Average number of links: 63.28525
rswm_q_out <- nb2listw(wm_q_out, style="W", zero.policy = TRUE)
rswm_q_out
## Characteristics of weights list object:
## Neighbour list object:
## Number of regions: 305
## Number of nonzero links: 1848
## Percentage nonzero weights: 1.986563
## Average number of links: 6.059016
##
## Weights style: W
## Weights constants summary:
## n nn S0 S1 S2
## W 305 93025 305 105.9392 1253.617
str(wm_d_in)
## List of 305
## $ : int [1:29] 85 123 139 145 146 147 158 166 168 169 ...
## $ : int [1:70] 5 7 10 14 15 18 20 21 23 25 ...
## $ : int [1:96] 4 9 12 17 22 26 28 30 35 36 ...
## $ : int [1:103] 3 9 10 12 17 18 22 25 26 28 ...
## $ : int [1:92] 2 10 12 15 17 18 20 21 22 23 ...
## $ : int [1:61] 11 29 31 32 33 34 39 48 54 55 ...
## $ : int [1:46] 2 8 44 50 60 64 75 96 97 98 ...
## $ : int [1:59] 7 10 18 20 21 25 27 39 44 50 ...
## $ : int [1:85] 3 4 10 12 17 18 22 23 26 28 ...
## $ : int [1:115] 2 4 5 8 9 12 17 18 20 21 ...
## $ : int [1:37] 6 29 31 32 33 34 39 48 49 63 ...
## $ : int [1:94] 3 4 5 9 10 17 18 22 23 25 ...
## $ : int [1:18] 14 15 16 69 76 78 81 109 118 121 ...
## $ : int [1:33] 2 13 15 16 64 69 76 78 81 109 ...
## $ : int [1:46] 2 5 13 14 16 20 64 69 76 78 ...
## $ : int [1:22] 13 14 15 69 76 78 81 109 116 118 ...
## $ : int [1:110] 3 4 5 9 10 12 18 20 21 22 ...
## $ : int [1:113] 2 4 5 8 9 10 12 17 20 21 ...
## $ : int [1:25] 24 45 87 88 94 103 106 107 108 124 ...
## $ : int [1:92] 2 5 8 10 15 17 18 21 23 25 ...
## $ : int [1:88] 2 5 8 10 17 18 20 23 25 26 ...
## $ : int [1:99] 3 4 5 9 10 12 17 18 23 25 ...
## $ : int [1:102] 2 5 9 10 12 17 18 20 21 22 ...
## $ : int [1:42] 19 29 31 32 33 34 45 48 71 83 ...
## $ : int [1:106] 2 4 5 8 10 12 17 18 20 21 ...
## $ : int [1:115] 3 4 5 9 10 12 17 18 21 22 ...
## $ : int [1:97] 2 5 8 10 17 18 20 21 22 23 ...
## $ : int [1:107] 3 4 5 9 10 12 17 18 20 21 ...
## $ : int [1:53] 6 11 24 31 32 33 34 45 48 49 ...
## $ : int [1:108] 3 4 5 9 10 12 17 18 20 21 ...
## $ : int [1:57] 6 11 24 29 32 33 34 45 48 49 ...
## $ : int [1:58] 6 11 24 29 31 33 34 39 45 48 ...
## $ : int [1:60] 6 11 24 29 31 32 34 45 48 49 ...
## $ : int [1:56] 6 11 24 29 31 32 33 45 48 49 ...
## $ : int [1:101] 3 4 9 10 12 17 18 22 23 25 ...
## $ : int [1:94] 3 4 9 12 17 22 26 28 30 35 ...
## $ : int [1:87] 3 4 5 9 10 12 17 18 22 23 ...
## $ : int [1:83] 3 4 5 9 10 12 17 18 22 23 ...
## $ : int [1:39] 6 8 11 32 44 61 63 68 72 79 ...
## $ : int [1:9] 41 42 76 140 141 180 236 248 293
## $ : int [1:12] 40 42 76 140 141 179 180 181 182 183 ...
## $ : int [1:16] 40 41 76 140 141 179 180 181 182 183 ...
## $ : int [1:109] 3 4 9 10 12 17 18 22 23 25 ...
## $ : int [1:65] 2 7 8 10 18 20 21 25 27 39 ...
## $ : int [1:41] 19 24 29 31 32 33 34 71 86 87 ...
## $ : int [1:97] 3 4 5 9 10 12 17 18 22 23 ...
## $ : int [1:93] 3 4 5 9 10 12 17 18 22 23 ...
## $ : int [1:40] 6 11 24 29 31 32 33 34 49 63 ...
## $ : int [1:35] 11 29 31 32 33 34 48 63 72 79 ...
## $ : int [1:67] 2 7 8 10 18 20 21 23 25 27 ...
## $ : int [1:103] 3 4 5 9 10 12 17 18 20 22 ...
## $ : int [1:77] 3 4 9 12 17 22 26 28 30 35 ...
## $ : int [1:103] 3 4 5 9 10 12 17 18 22 23 ...
## $ : int [1:54] 3 6 29 31 32 33 34 55 56 57 ...
## $ : int [1:57] 3 6 29 31 32 33 34 54 56 57 ...
## $ : int [1:52] 3 6 31 32 33 34 54 55 57 59 ...
## $ : int [1:54] 3 4 6 31 32 33 34 54 55 56 ...
## $ : int [1:95] 3 4 5 9 10 12 17 18 22 23 ...
## $ : int [1:89] 3 4 6 9 17 22 26 28 35 36 ...
## $ : int [1:53] 2 7 8 20 21 44 50 64 75 96 ...
## $ : int [1:83] 3 4 6 10 25 26 27 32 33 35 ...
## $ : int [1:103] 4 5 9 10 12 17 18 20 21 22 ...
## $ : int [1:43] 6 11 29 31 32 33 34 39 48 49 ...
## $ : int [1:71] 2 5 7 8 10 14 15 18 20 21 ...
## $ : int [1:92] 3 4 9 12 17 22 26 28 30 35 ...
## $ : int [1:110] 3 4 5 9 10 12 17 18 20 21 ...
## $ : int [1:63] 3 4 6 26 31 32 33 35 36 43 ...
## $ : int [1:113] 3 4 6 8 10 17 18 21 22 23 ...
## $ : int [1:38] 2 5 12 13 14 15 16 18 20 23 ...
## $ : int [1:90] 3 4 9 10 12 17 18 22 23 26 ...
## $ : int [1:56] 6 24 29 31 32 33 34 45 54 55 ...
## $ : int [1:36] 6 11 29 31 32 33 34 39 48 49 ...
## $ : int [1:97] 3 4 6 10 17 22 25 26 27 28 ...
## $ : int [1:111] 3 4 5 9 10 12 17 18 20 21 ...
## $ : int [1:54] 2 7 8 20 21 44 50 60 64 96 ...
## $ : int [1:21] 13 14 15 16 40 41 42 140 141 179 ...
## $ : int [1:103] 3 4 5 9 10 12 17 18 22 23 ...
## $ : int [1:35] 2 5 13 14 15 16 20 23 64 69 ...
## $ : int [1:36] 11 29 31 32 39 48 49 63 72 83 ...
## $ : int [1:105] 2 5 10 12 17 18 20 21 22 23 ...
## $ : int [1:66] 2 5 10 12 13 14 15 16 17 18 ...
## $ : int [1:73] 3 4 6 26 31 32 33 35 36 43 ...
## $ : int [1:44] 6 11 24 29 31 32 33 34 39 48 ...
## $ : int [1:119] 3 4 5 9 10 12 17 18 20 21 ...
## $ : int [1:29] 1 79 123 127 145 146 147 158 166 168 ...
## $ : int [1:54] 6 11 24 29 31 32 33 34 39 45 ...
## $ : int [1:19] 19 45 88 103 106 108 124 134 194 208 ...
## $ : int [1:20] 19 24 45 87 103 106 108 124 134 194 ...
## $ : int [1:99] 3 4 9 10 12 17 18 22 26 28 ...
## $ : int [1:83] 3 4 6 10 17 21 25 26 27 32 ...
## $ : int [1:54] 6 11 24 29 31 32 33 34 39 48 ...
## $ : int [1:79] 3 4 6 26 33 35 36 43 53 54 ...
## $ : int [1:68] 3 4 6 11 26 29 31 32 33 34 ...
## $ : int [1:48] 6 19 24 29 31 32 33 34 45 48 ...
## $ : int [1:48] 6 11 24 29 31 32 33 34 45 48 ...
## $ : int [1:68] 2 7 8 15 20 21 25 27 44 50 ...
## $ : int [1:57] 2 7 8 15 20 21 44 50 60 64 ...
## $ : int [1:65] 2 7 8 15 20 21 25 27 44 50 ...
## $ : int [1:107] 3 4 5 9 10 12 17 18 22 23 ...
## [list output truncated]
## - attr(*, "class")= chr "nb"
## - attr(*, "nbtype")= chr "distance"
## - attr(*, "distances")= num [1:2] 0 6
## - attr(*, "region.id")= chr [1:305] "1" "2" "3" "4" ...
## - attr(*, "call")= language dnearneigh(x = coords, d1 = 0, d2 = 6, longlat = TRUE)
## - attr(*, "dnn")= num [1:2] 0 6
## - attr(*, "bounds")= chr [1:2] "GT" "LE"
## - attr(*, "sym")= logi TRUE
plot(subzone_tapout$geometry, border="lightgrey")
plot(wm_d_out, coords_out, add=TRUE)
plot(k1_out, coords_out, add=TRUE, col="red", length=0.08)
wm_knn_out <- knn2nb(knearneigh(coords_out, k=6))
wm_knn_out
## Neighbour list object:
## Number of regions: 305
## Number of nonzero links: 1830
## Percentage nonzero weights: 1.967213
## Average number of links: 6
## Non-symmetric neighbours list
plot(subzone_tapout$geometry, border="lightgrey")
plot(wm_knn_out, coords_out, pch=19, cex=0.6, add=TRUE, col="red")
par(mfrow=c(1,2))
plot(subzone_tapout$geometry, border="lightgrey")
plot(wm_d_out, coords_out, add=TRUE)
plot(k1_out, coords_out, add=TRUE, col="red", length=0.08)
plot(subzone_tapout$geometry, border="lightgrey")
plot(wm_knn_out, coords_out, pch=19, cex=0.6, add=TRUE, col="red")
dist_out <- nbdists(wm_q_out, coords_out, longlat=TRUE)
ids_out <- lapply(dist_out, function(x)1/(x))
ids_out
## [[1]]
## [1] 0.8844741 1.0480106 0.8884195 0.7273930 0.7194021 0.8145234
##
## [[2]]
## [1] 5.4804873 0.5914406
##
## [[3]]
## [1] 0.7684313 0.8535230 1.6794906 0.5228568 0.9209379 1.0335332 0.8362314
## [8] 1.1858760
##
## [[4]]
## [1] 0.7684313 0.8561584 1.5861382 1.5851576 0.6885791 1.6141956
##
## [[5]]
## [1] 0.7967051 0.5944818 0.5997141 0.6629291 0.6203724 0.4515680 0.6945245
## [8] 0.6050715 0.5702452
##
## [[6]]
## [1] 0.6512450 0.4671241 0.5523379 0.5381036 0.7563190 0.4293571
##
## [[7]]
## [1] 0.9454551 0.7069300 0.7923350 1.0038999
##
## [[8]]
## [1] 1.2338839 0.7348002 1.2417769 0.9286924 1.1898496 0.7053242 0.7185641
## [8] 0.8303788
##
## [[9]]
## [1] 0.9959641 1.4465246 0.8333802 1.2148883 2.8731441
##
## [[10]]
## [1] 0.7966416 0.7644062 0.9104840 0.5199711 0.7906893 0.5484124 1.0309079
##
## [[11]]
## [1] 0.3340457 1.0083355 1.0893203 1.1046888
##
## [[12]]
## [1] 0.9203617 2.0296518 1.0517067 1.1788886 0.7483162
##
## [[13]]
## [1] 1.0456883 0.3182148 0.3952152 0.3518170
##
## [[14]]
## [1] 0.6605051 0.7274535 0.4081463 0.3335142 0.4247973 0.4347253 0.4996058
## [8] 0.2714662
##
## [[15]]
## [1] 0.6605051 0.5181626 0.4845160 0.5729661 0.3245971 0.7023854
##
## [[16]]
## [1] 1.0456883 0.7274535 0.3591743 0.4215225 0.3491247
##
## [[17]]
## [1] 1.494798 1.310005 1.254374 1.634446 5.480304 1.374106 3.113369
##
## [[18]]
## [1] 0.7966416 1.0681731 1.0154484 0.6284209 0.8855030 0.7727805 0.7862932
## [8] 0.5582583
##
## [[19]]
## [1] 0.4808461 0.5021124 0.8552760 0.4146835 0.4872360 0.8520672 0.3744038
##
## [[20]]
## [1] 1.0407714 0.6501177 1.1361333 1.5437228 1.0316895
##
## [[21]]
## [1] 0.9133713 0.6159350 0.9185460 0.8728618 0.9670262 0.4796687 0.6021557
## [8] 0.5586217 0.5457509
##
## [[22]]
## [1] 2.786039 1.267237 2.117575 1.005309 4.246211 1.961564
##
## [[23]]
## [1] 0.7967051 1.2804026 1.3084566 0.7795739 1.2994920
##
## [[24]]
## [1] 0.8162941 0.8398473 0.8406951 0.4617172 0.5947887 0.8492181 0.5505385
##
## [[25]]
## [1] 1.435667 1.373967 1.301129 1.553840 1.196840
##
## [[26]]
## [1] 1.0772240 1.1926237 0.7632259 1.3811674 1.7409411 2.1360097 1.1732691
## [8] 1.3218132
##
## [[27]]
## [1] 0.9133713 1.4356674 1.1960461 1.0402323 1.1480015
##
## [[28]]
## [1] 1.494798 1.688457 1.806317 2.215308 1.827245
##
## [[29]]
## [1] 0.8033619 1.1060481 0.7749737 0.9886477 0.5712238
##
## [[30]]
## [1] 1.238054 1.127686 1.875910 1.768634 2.907615
##
## [[31]]
## [1] 0.8033619 1.2456534 0.8677066 1.0995651 1.1008159
##
## [[32]]
## [1] 1.2456534 1.1139321 1.2296401 0.9886387
##
## [[33]]
## [1] 0.6512450 0.8677066 1.1139321 0.5251549 0.5749132 0.4975997 0.7172742
## [8] 0.9562401 0.4655908
##
## [[34]]
## [1] 1.1060481 1.0995651 0.5251549 0.4251808 0.8437940 1.1504476 0.8727465
##
## [[35]]
## [1] 0.8561584 0.8849391 1.0580419 0.9130916 1.3190915 1.5405780 1.3468824
##
## [[36]]
## [1] 0.8535230 0.8953934 1.4431053 0.9473712 1.5587781 1.8066475 1.0600227
##
## [[37]]
## [1] 1.945150 1.681763 2.867192 1.639472 2.216894
##
## [[38]]
## [1] 0.9959641 0.9203617 1.9451504 0.4801978 0.8909323 0.6389542 1.1068127
## [8] 1.1632581 1.3729115
##
## [[39]]
## [1] 0.3340457 0.2968846 0.2888334 0.2008093 0.2052084 0.1755475 0.2010533
## [8] 0.1768133 0.2737723 0.2683509 0.3031680 0.2675447 0.2437008 0.3102618
## [15] 0.1645856 0.1596139 0.2470689
##
## [[40]]
## [1] 0.1928125 0.2883690 0.2455807
##
## [[41]]
## [1] 0.1928125 0.4024330
##
## [[42]]
## [1] 0.2883690 0.4024330 0.6129275 1.9940343 0.8012110 0.2990791 0.2256625
##
## [[43]]
## [1] 1.5861382 0.8849391 0.8398056 0.5903987 1.4993784 0.9754874 0.6645181
## [8] 0.6068086 1.1098669
##
## [[44]]
## [1] 1.2338839 1.0523191 0.5523030 0.5613916 0.8274346 0.9741141 0.8390431
##
## [[45]]
## [1] 0.8162941 0.5354624 0.7349362 0.5731777 1.1214091 0.8920002
##
## [[46]]
## [1] 2.786039 1.655131 1.585099 1.188247 4.539164 2.151226
##
## [[47]]
## [1] 1.4465246 1.6817633 1.6551312 1.0095825 4.0676512 1.2752529 2.4095598
## [8] 1.0939357 0.9929413 1.9481332
##
## [[48]]
## [1] 1.2058561 0.9429210 0.8453777 1.1247852 0.1549636
##
## [[49]]
## [1] 1.2058561 0.4999200 0.5894127 0.6608199 0.1555487 1.0815070
##
## [[50]]
## [1] 0.7348002 0.6159350 1.0523191 0.5157744 0.6161005 0.8084862 0.6482094
## [8] 1.2375038
##
## [[51]]
## [1] 1.2672374 1.6884572 1.2380540 0.9940303 1.2837980 0.6653816 1.2277930
## [8] 0.7652348 1.3663294 1.0067668 1.2508523
##
## [[52]]
## [1] 0.8333802 0.4801978 0.9365332 0.5600298 0.3833439 0.5271297 0.3948815
## [8] 0.6004264
##
## [[53]]
## [1] 2.1175745 1.5850988 0.9940303 1.9383979 1.3815174 1.1669983
##
## [[54]]
## [1] 1.2679553 0.9472898 0.9463619 0.7722828 0.9961068
##
## [[55]]
## [1] 1.2679553 0.6445698 0.8307125 0.7361825 1.0745144 0.5206418
##
## [[56]]
## [1] 0.9472898 1.6527189 0.8805075 0.3870804 0.3140803 0.5674396
##
## [[57]]
## [1] 0.9463619 0.6445698 1.6527189 0.7989980 0.7772218 0.4282428 0.7856067
##
## [[58]]
## [1] 2.0296518 0.8909323 1.2837980 1.1211354 2.1805833
##
## [[59]]
## [1] 1.4706887 0.7308158 0.7947949 0.7562514 1.8549252
##
## [[60]]
## [1] 0.9454551 0.5320455 0.7959180 0.7495172 0.5882395 0.8816489 0.9588370
##
## [[61]]
## [1] 0.9569594 0.8914390 0.5038010 0.9232634 0.5109726 0.5691983
##
## [[62]]
## [1] 1.1276855 0.6653816 0.9056074 2.0375888 0.8137809 0.9199540 1.2646240
## [8] 0.7443998
##
## [[63]]
## [1] 1.0083355 0.2968846 0.6160743 0.5959538 0.9512227 0.5635195
##
## [[64]]
## [1] 5.4804873 0.4252456 0.4092100 0.4999176 0.8560016 0.4577477 0.3484185
## [8] 0.5391147 0.7922589
##
## [[65]]
## [1] 1.6794906 0.8953934 0.5532178 0.7800484 1.6215842 0.6991945
##
## [[66]]
## [1] 1.310005 1.806317 1.848831 1.382043 1.810943 1.620788 1.357020
##
## [[67]]
## [1] 0.7989980 0.8487075 1.0756715 0.7005317 1.1515548
##
## [[68]]
## [1] 0.6551446 0.6323499 0.7688724 0.6923502 0.6630384
##
## [[69]]
## [1] 0.3576763 2.7288438 0.5130455 0.4573773
##
## [[70]]
## [1] 1.2148883 1.0095825 0.9365332 0.9376335 1.7858516 0.7647919
##
## [[71]]
## [1] 0.7722828 0.8307125 0.9182911 0.9217925 1.5196015
##
## [[72]]
## [1] 1.0893203 0.2888334 0.5223506 0.8925147 1.7640783
##
## [[73]]
## [1] 0.9569594 1.0927183 0.6092194 1.1052748
##
## [[74]]
## [1] 1.254374 1.847188 1.246549 2.947320 1.905523 1.215226
##
## [[75]]
## [1] 0.7069300 0.5320455 0.4114400 0.6135504 0.4537765 0.5824593 0.6725423
## [8] 0.6052865
##
## [[76]]
## [1] 0.6129275 0.8043294 0.4952155 0.7646293 0.5671159
##
## [[77]]
## [1] 2.2153080 1.2277930 1.9383979 1.8488310 1.0542144 1.4284612 0.9593715
##
## [[78]]
## [1] 0.3182148 0.4081463 0.3591743 0.4050295 0.4590652 0.8120932 0.5132071
## [8] 0.8547808
##
## [[79]]
## [1] 0.2008093 0.4999200 0.5223506 0.3195949 0.4659314 0.6380523 0.6422838
## [8] 0.4497935 0.4809803 0.5992606
##
## [[80]]
## [1] 0.5944818 1.0681731 1.2804026 1.0097213 1.2503065 0.7338037 0.7472477
##
## [[81]]
## [1] 0.5997141 0.4050295 0.4150285 0.7066867 0.8635013 0.4740998 0.5368732
## [8] 0.5367962
##
## [[82]]
## [1] 0.8487075 1.1616463 0.6850966 0.8707461 1.0969734
##
## [[83]]
## [1] 0.6160743 0.6319974 0.5990246 0.7803611 0.8192146 0.7113396 0.5287903
## [8] 0.7192815 0.3073443
##
## [[84]]
## [1] 1.0772240 0.9472528 0.9530090 0.9036667 1.8975126 1.6983369
##
## [[85]]
## [1] 0.9052538 1.6882874 0.7239262 0.4968966 1.0396107 0.6690701
##
## [[86]]
## [1] 0.7749737 1.1008159 1.2296401 0.6319974 0.8888807 0.9712211
##
## [[87]]
## [1] 0.4808461 0.6798021 0.6710674 0.5866048
##
## [[88]]
## [1] 0.5021124 0.6798021 0.6095744 0.5423227 0.3218916 0.3581644 0.4299867
##
## [[89]]
## [1] 1.5851576 1.0580419 1.4431053 0.9068886 1.7085096 1.6868741
##
## [[90]]
## [1] 0.2052084 0.8914390 0.6551446 0.4331565 0.5114785 0.4718265
##
## [[91]]
## [1] 0.4671241 0.9886387 0.5749132 0.5959538 0.5990246 0.8888807 0.6391110
##
## [[92]]
## [1] 1.4706887 1.1616463 1.0185734 0.8388392 1.2334553 0.5743472
##
## [[93]]
## [1] 0.5523379 0.5038010 0.5434165 0.5945844 0.5624522 0.8207609
##
## [[94]]
## [1] 0.8398473 0.5354624 0.4679993 0.5878285 0.5670518 0.5945566 0.7970978
##
## [[95]]
## [1] 0.9886477 0.7803611 0.9712211 0.7024756 0.4660007
##
## [[96]]
## [1] 1.0135684 1.3229506 1.3302127 0.7080008 0.6583602
##
## [[97]]
## [1] 0.7959180 1.0135684 0.7605919 1.3386343 0.6622192
##
## [[98]]
## [1] 0.7495172 1.3229506 0.7605919 0.7633608 0.4080910 0.7176809 1.0333706
##
## [[99]]
## [1] 1.054214 1.728954 2.081489 3.270822
##
## [[100]]
## [1] 0.9182911 1.0416720 0.5005635 0.7230575 0.7987768 0.9121866 0.7359705
##
## [[101]]
## [1] 1.3820435 0.8777783 2.1551137 2.3549864 1.3134107
##
## [[102]]
## [1] 1.1046888 0.9512227 0.8925147 0.8192146 0.8793560 0.7729020 0.7086318
##
## [[103]]
## [1] 0.8552760 0.6095744 0.4655936 0.3033305 0.9296686 0.2975364 0.3175127
## [8] 0.3022505 0.1573922
##
## [[104]]
## [1] 1.0407714 0.7262922 0.5670105 0.9349039 0.9646251 1.0121334 0.8005541
##
## [[105]]
## [1] 1.0416720 0.8205733 1.6226101 1.0939244
##
## [[106]]
## [1] 0.5742682 0.5943254 0.4113321 0.5452498
##
## [[107]]
## [1] 0.5742682 0.6140380 0.4362903 0.4658673 0.5344569 0.5967864 0.4382571
##
## [[108]]
## [1] 0.8406951 0.7349362 0.9415510 0.5528436 1.0636402
##
## [[109]]
## [1] 0.3335142 0.5181626 0.4252456 0.4150285 0.6292237 0.7308923 0.3675036
## [8] 0.4111101
##
## [[110]]
## [1] 1.015448 1.308457 1.009721 1.162562 1.263443
##
## [[111]]
## [1] 0.6629291 0.7795739 1.2503065 0.7262922 0.9737761 1.1552076
##
## [[112]]
## [1] 0.6203724 1.2994920 0.9056074 1.1625619 0.7706998 0.9697024
##
## [[113]]
## [1] 1.8759095 0.7652348 2.0375888 3.2176501
##
## [[114]]
## [1] 0.7644062 0.6284209 1.8471885 0.8777783 0.9677324 1.1733551 0.8659227
## [8] 1.0628311
##
## [[115]]
## [1] 0.9473712 0.5600298 0.9376335 0.9068886 1.2115791 1.7619035 1.2938641
## [8] 1.3185284 1.5874208
##
## [[116]]
## [1] 0.4515680 0.4092100 0.7066867 0.5670105 0.6292237 0.4577219 0.7756175
## [8] 0.5388115
##
## [[117]]
## [1] 0.4999176 1.3302127 1.3386343 0.4791165 0.5220114 1.5436506 0.4699383
##
## [[118]]
## [1] 0.4590652 0.8635013 1.3106704 0.7257642
##
## [[119]]
## [1] 0.9429210 0.7113396 0.7024756 1.0310969 0.8670278 0.4247892
##
## [[120]]
## [1] 1.2417769 1.0061644 1.6064429 0.7500858 0.6527241 1.1553013
##
## [[121]]
## [1] 0.4247973 0.4845160 0.8120932 0.4740998 0.7308923 0.4577219
##
## [[122]]
## [1] 0.5228568 0.5532178 0.4659881 0.6848407 0.7154689 1.1606192 1.2516079
## [8] 0.4898260
##
## [[123]]
## [1] 0.4560956 0.5015524 0.9737212 0.5147668 0.5251365 0.7195327 0.9792542
## [8] 0.6773042
##
## [[124]]
## [1] 0.4617172 0.5731777 0.4655936 0.9415510 0.5971054 0.7045412 0.6752555
##
## [[125]]
## [1] 0.9104840 0.8855030 1.3739673 1.8447553 1.2660919 0.7090568
##
## [[126]]
## [1] 0.7080008 0.7633608 0.4791165 1.0600947 0.6155955 0.6409793 0.6648319
##
## [[127]]
## [1] 0.3347517 0.3706974 0.7000040 0.5612803 0.4524644 0.5409671
##
## [[128]]
## [1] 0.4679993 0.5005635 0.8205733 0.6140380 0.8493902 0.4077919 0.9326988
## [8] 0.6865580
##
## [[129]]
## [1] 0.7727805 0.8137809 1.2465487 1.2634434 0.7706998 0.9677324 1.3857451
## [8] 1.2956422 1.5903328
##
## [[130]]
## [1] 0.7308158 0.9232634 1.0927183 1.0185734 0.5434165 0.3973167 0.4535570
## [8] 0.5543265 0.5751480
##
## [[131]]
## [1] 1.1926237 0.8398056 1.7289543 1.1439498 1.3789246 2.1873170 1.2376825
## [8] 1.5469512
##
## [[132]]
## [1] 0.3268232 0.1589236
##
## [[133]]
## [1] 1.634446 2.947320 1.385745 1.410838 3.151098 1.256131
##
## [[134]]
## [1] 0.4146835 0.3033305 0.5943254 0.4362903 0.7655235 0.4130353 0.4338324
## [8] 1.2109539
##
## [[135]]
## [1] 0.9185460 1.3011294 1.1960461 0.9251273 2.0740006 0.7783528 0.9728857
##
## [[136]]
## [1] 0.8560016 0.6583602 0.5220114 1.0600947 0.5421828 0.6904218 0.6428618
##
## [[137]]
## [1] 0.6501177 0.8728618 0.5157744 0.9251273 1.0775249 0.6159859 0.6438742
## [8] 1.0063526
##
## [[138]]
## [1] 0.4577477 1.5436506 1.1808305 0.6359548 0.5019490
##
## [[139]]
## [1] 0.4560956 0.4381241 0.4159762 0.3833159 0.3158822 0.5882482 0.4798430
## [8] 0.7144880
##
## [[140]]
## [1] 1.9940343 0.8043294 0.9596644
##
## [[141]]
## [1] 0.8012110 0.4952155 0.9596644 0.6448882 0.5569022
##
## [[142]]
## [1] 1.905523 2.155114 1.173355 2.117224
##
## [[143]]
## [1] 0.6945245 0.5368732 0.9349039 0.9737761 0.7756175 0.6925473 0.5453684
##
## [[144]]
## [1] 0.5199711 0.6323499 0.9472528 0.8631758 0.7656371 0.6757964 0.5871453
##
## [[145]]
## [1] 0.1755475 0.5015524 0.7442450 0.3007840 0.4677231 0.4484203 0.4853337
## [8] 0.3315351 0.3264268 0.4951431 0.4649258 0.4851777
##
## [[146]]
## [1] 0.9737212 0.7442450 1.2016692
##
## [[147]]
## [1] 0.2010533 0.3195949 0.3007840 0.2794967 0.4319578 0.7285834 0.6137348
##
## [[148]]
## [1] 0.9209379 0.6885791 0.5903987 0.7947949 0.3973167 1.4487496 0.6863953
## [8] 1.2854792 0.7389841
##
## [[149]]
## [1] 1.051707 1.366329 1.121135 0.919954 0.707254
##
## [[150]]
## [1] 0.3576763 0.3565229 0.7828311 0.7434382
##
## [[151]]
## [1] 1.1788886 0.6389542 0.7072540 0.7820824
##
## [[152]]
## [1] 2.7288438 0.5132071 1.3106704 0.3565229 0.5498483 0.4522282
##
## [[153]]
## [1] 0.3833439 0.4290775 0.2315013 0.3627578 0.9756103 0.7358156 0.8145211
##
## [[154]]
## [1] 0.9670262 0.6161005 0.5989028 0.6123236 0.7815656 0.6897698
##
## [[155]]
## [1] 0.7923350 0.4114400 0.5517190 1.1535795 0.5293861 0.5392787 0.8134473
## [8] 0.5051229
##
## [[156]]
## [1] 2.867192 4.067651 2.561208
##
## [[157]]
## [1] 1.0335332 0.7562514 1.4487496 0.6895619 1.3707566 0.8877237
##
## [[158]]
## [1] 0.9052538 0.7286530 0.5374064 0.8571719 1.2635250 0.8494379
##
## [[159]]
## [1] 2.3549864 0.8659227 0.9323119 1.9315370 1.2191397
##
## [[160]]
## [1] 0.7906893 0.9530090 1.0628311 0.8631758 0.9323119 1.2216780
##
## [[161]]
## [1] 0.1768133 0.7688724 0.4331565 0.7656371 0.5266164 0.6332063
##
## [[162]]
## [1] 0.6050715 0.5130455 0.5367962 0.7257642 0.7828311 0.5498483 0.5835158
##
## [[163]]
## [1] 0.7632259 0.6923502 0.9036667 0.6757964 1.2700510 0.5433986 0.9875742
## [8] 0.7858094
##
## [[164]]
## [1] 0.7772218 1.0756715 0.4659881 0.6138716 0.9035689
##
## [[165]]
## [1] 0.5381036 0.2737723 0.5635195 0.6391110 0.4653930
##
## [[166]]
## [1] 0.2683509 0.5147668 0.4677231 0.2794967 0.8021035 0.3635262
##
## [[167]]
## [1] 1.897513 1.931537 1.221678
##
## [[168]]
## [1] 1.6882874 0.3347517 0.3440207 0.5632434 0.6394194
##
## [[169]]
## [1] 0.7863828 0.6765798 0.7936921 0.6766562 0.9144950
##
## [[170]]
## [1] 1.0237727 0.5317908
##
## [[171]]
## [1] 0.7005317 0.6850966 0.8388392 0.6848407 0.6895619 0.6138716 0.7246413
## [8] 1.4065933
##
## [[172]]
## [1] 1.381167 1.499378 1.143950 2.013966 2.670432
##
## [[173]]
## [1] 1.740941 1.698337 1.270051
##
## [[174]]
## [1] 1.810943 1.428461 2.081489 1.378925 2.105451
##
## [[175]]
## [1] 0.8805075 0.6080403 0.2383592 0.6806124 1.0994479
##
## [[176]]
## [1] 0.4659314 0.3706974 0.4714593 0.5463106 0.1363204 0.7572748
##
## [[177]]
## [1] 0.3870804 0.4282428 0.7154689 0.9035689 0.5264702 0.8238056
##
## [[178]]
## [1] 1.1606192 0.4290775 0.5264702 0.4718700 0.6285524
##
## [[179]]
## [1] 0.7549454 0.8548739 0.8288461 0.5041562 0.8457130
##
## [[180]]
## [1] 0.7646293 0.6448882 0.7549454 0.7522203 0.5443706 0.4372582
##
## [[181]]
## [1] 0.5569022 0.8548739 0.7522203 0.3250162 0.5951573
##
## [[182]]
## [1] 0.3250162 0.6141856 0.5673076 0.3761027 0.4890482 0.3790200 0.3634999
## [8] 0.4832962
##
## [[183]]
## [1] 0.8288461 0.5951573 0.6141856 0.6921918
##
## [[184]]
## [1] 2.1360097 0.9754874 2.1873170 2.0139658 1.2233765
##
## [[185]]
## [1] 0.5729661 0.3675036 0.5117486 0.7198171 0.4840912 0.6385329
##
## [[186]]
## [1] 0.5673076 0.5117486 0.6083635 0.4240189 0.6027918
##
## [[187]]
## [1] 0.3484185 1.1808305 0.3761027 0.6083635 0.5976273
##
## [[188]]
## [1] 1.0053088 0.9130916 1.1882469 1.2752529 1.3815174 2.5428180 1.4708078
## [8] 1.1895831 1.0944313
##
## [[189]]
## [1] 1.553840 1.844755 2.074001 1.130316 1.077190
##
## [[190]]
## [1] 0.8453777 0.5894127 1.0310969 0.4911626 0.1834646
##
## [[191]]
## [1] 0.4113321 0.4658673 0.6080403 0.7957456
##
## [[192]]
## [1] 2.409560 2.542818 1.346062
##
## [[193]]
## [1] 4.246211 4.539164 3.190791
##
## [[194]]
## [1] 0.6710674 0.5423227 0.3598882
##
## [[195]]
## [1] 0.5914406 0.5391147 0.4111101 0.6359548 0.7198171 0.4240189 0.5976273
##
## [[196]]
## [1] 0.3140803 0.2315013 0.2383592 0.8238056 0.4718700
##
## [[197]]
## [1] 0.5484124 0.7862932 0.7338037 1.2660919 0.7783528 1.1303162 1.1249031
## [8] 1.2898274
##
## [[198]]
## [1] 0.5517190 0.4890482 0.5237262 0.9521497 0.6454933 1.2202489
##
## [[199]]
## [1] 1.1535795 1.0237727 0.5237262 0.4482643 0.5900350
##
## [[200]]
## [1] 0.8362314 0.7800484 1.2516079 1.3707566 0.7246413
##
## [[201]]
## [1] 1.961564 1.639472 1.106813 2.151226 1.093936 1.006767 2.180583 3.190791
##
## [[202]]
## [1] 1.1858760 1.6141956 1.5587781 1.7085096 0.6863953
##
## [[203]]
## [1] 0.7000040 0.3268232 0.4714593 0.4248008 0.1192066
##
## [[204]]
## [1] 0.6645181 0.6092194 0.4535570 1.2854792 0.5433986 0.6242597 0.8038132
##
## [[205]]
## [1] 0.5882395 0.6622192 0.4699383 0.5019490 0.5293861 0.3790200 0.9521497
## [8] 1.0807459
##
## [[206]]
## [1] 1.3190915 0.6068086 1.1669983 0.9593715 3.2708222 1.2376825 1.4708078
##
## [[207]]
## [1] 1.768634 1.264624 3.217650 1.295642 4.857047 1.431108
##
## [[208]]
## [1] 0.9296686 0.5971054 0.1884797 0.5864134
##
## [[209]]
## [1] 0.4872360 0.5452498 0.7655235 0.6898072
##
## [[210]]
## [1] 1.7640783 0.6380523 0.8793560 1.5652699
##
## [[211]]
## [1] 5.480304 1.620788 1.215226 1.410838 2.117224
##
## [[212]]
## [1] 0.6135504 0.5392787 0.4482643 0.5809053 0.3945352
##
## [[213]]
## [1] 0.4537765 0.4381241 0.5809053 0.5272022
##
## [[214]]
## [1] 0.5523030 0.5824593 0.7244121 0.7850972 1.0231996 0.5897564 0.6931957
## [8] 0.4085719
##
## [[215]]
## [1] 0.8844741 0.4484203 0.8353524 0.9941691 0.7224300 0.5402783
##
## [[216]]
## [1] 1.0480106 0.7863828 0.9848955 0.7364404 0.5525513
##
## [[217]]
## [1] 0.3031680 1.0061644 0.8851455 0.7331908 0.5283589 0.7911798
##
## [[218]]
## [1] 0.8884195 0.8353524 0.6392443 1.0130489 0.8182763
##
## [[219]]
## [1] 0.7273930 0.4853337 0.6765798 0.9941691 0.9848955 0.7850920
##
## [[220]]
## [1] 0.7194021 0.7364404 0.6477426
##
## [[221]]
## [1] 1.0038999 0.8816489 0.8134473 0.6454933 1.0807459
##
## [[222]]
## [1] 0.6725423 0.4159762 0.3945352 0.5272022 0.7244121 0.5478539
##
## [[223]]
## [1] 0.6422838 0.5287903 0.7729020 1.5652699 1.2445951
##
## [[224]]
## [1] 0.5582583 1.1361333 0.7472477 0.9646251 1.1552076 0.6925473 1.1249031
## [8] 0.9030380
##
## [[225]]
## [1] 0.3440207 0.6392443 0.8143723 0.6328791 0.4385275
##
## [[226]]
## [1] 0.3315351 0.7224300 1.0130489 0.8143723 0.8089478 0.6705902
##
## [[227]]
## [1] 0.7239262 0.7286530 0.5632434 0.6328791 0.8089478 0.8042739
##
## [[228]]
## [1] 0.5271297 0.3627578
##
## [[229]]
## [1] 0.6155955 0.5421828 1.0775249 0.8035498 1.0567880
##
## [[230]]
## [1] 0.4796687 0.5613916 0.8084862 0.4080910 0.6409793 0.6159859 0.8035498
## [8] 0.6716319 0.7414336
##
## [[231]]
## [1] 0.7176809 0.6648319 0.7850972 0.6716319 1.0406271 0.8628155
##
## [[232]]
## [1] 0.8274346 0.6482094 1.0231996 0.7414336 1.0406271 0.6297705
##
## [[233]]
## [1] 0.9286924 1.6064429 0.5989028 0.8851455 0.8631963 0.7535825
##
## [[234]]
## [1] 0.8520672 0.5866048 0.4130353 0.6898072
##
## [[235]]
## [1] 0.3952152 0.4573773 0.8547808 0.4522282
##
## [[236]]
## [1] 0.4347253 0.3245971 0.4215225 0.6441040 0.4568251 0.4758056
##
## [[237]]
## [1] 0.9929413 1.7858516 1.2115791 1.1895831 1.3460620 1.7106658
##
## [[238]]
## [1] 0.7361825 0.7856067 1.1515548 0.8707461 0.5253496 1.3972628
##
## [[239]]
## [1] 1.173269 1.357020 1.313411 1.546951 1.219140 2.105451 1.223376
##
## [[240]]
## [1] 0.2675447 0.5251365 0.3833159 0.3264268 0.8021035 0.5940072 0.4117553
##
## [[241]]
## [1] 0.7483162 1.1632581 0.3948815 0.7820824
##
## [[242]]
## [1] 1.374106 1.590333 3.151098 4.857047 1.274913
##
## [[243]]
## [1] 0.7563190 0.4975997 1.0745144 0.5945844 0.5253496 0.6668643 0.5599429
##
## [[244]]
## [1] 0.4293571 0.2437008 0.5109726 0.5114785 0.5624522 0.4653930
##
## [[245]]
## [1] 0.3102618 0.3158822 0.3635262 0.7331908 0.5940072 0.4993618 0.4552457
## [8] 0.6941495
##
## [[246]]
## [1] 0.7922589 1.0121334 0.5388115 0.6904218 0.5453684 0.8220740
##
## [[247]]
## [1] 0.5947887 1.1214091 0.5878285 0.5344569 0.8493902 0.4338324 0.6055280
##
## [[248]]
## [1] 0.2990791 0.5671159 0.5041562 0.5443706 0.6441040 0.5306867 0.5488513
## [8] 0.2922441
##
## [[249]]
## [1] 0.8457130 0.4372582 0.3634999 0.6921918 0.4840912 0.6027918 0.5306867
## [8] 0.5028630
##
## [[250]]
## [1] 0.4996058 0.7023854 0.6385329 0.4568251 0.5488513 0.5028630
##
## [[251]]
## [1] 1.3218132 1.1098669 0.9875742 2.6704319 0.6242597
##
## [[252]]
## [1] 1.8549252 1.2334553 0.7389841 0.8877237 1.4065933
##
## [[253]]
## [1] 2.873144 2.216894 1.372911 1.948133 2.561208
##
## [[254]]
## [1] 0.5702452 0.7443998 0.9697024 0.7434382 0.5835158
##
## [[255]]
## [1] 0.7230575 0.5967864 0.4077919 0.6806124 0.7957456 0.7478303
##
## [[256]]
## [1] 1.1247852 0.6608199 0.4497935 0.7192815 0.7086318 0.8670278 1.2445951
##
## [[257]]
## [1] 1.6215842 0.4898260 0.9756103 0.6285524 0.7735387
##
## [[258]]
## [1] 0.6004264 0.7647919 1.7619035 0.7358156 1.6947872
##
## [[259]]
## [1] 1.8066475 0.6991945 1.2938641 0.8145211 0.7735387 1.6947872
##
## [[260]]
## [1] 0.5712238 0.4251808 0.3073443 0.5670518 0.4660007 0.4247892 0.4911626
## [8] 0.3887759 0.2087434 0.3542026 0.5275972
##
## [[261]]
## [1] 0.3218916 0.2975364 0.8291476 0.5049576 0.1542575
##
## [[262]]
## [1] 0.8145234 0.8182763 0.6477426 0.4385275
##
## [[263]]
## [1] 1.540578 1.318528 1.094431 1.710666 1.966668
##
## [[264]]
## [1] 1.346882 1.060023 1.686874 1.587421 1.966668
##
## [[265]]
## [1] 1.0309079 1.1968400 1.0402323 0.7090568 0.5871453 0.5266164 1.0746367
##
## [[266]]
## [1] 0.6021557 1.1480015 0.1645856 0.6123236 0.6332063 1.0746367 0.4485643
##
## [[267]]
## [1] 0.7172742 0.8437940 0.7987768 1.6226101 0.7671860 1.1476841
##
## [[268]]
## [1] 0.9562401 0.5206418 0.9217925 0.9121866 0.6668643 0.7671860
##
## [[269]]
## [1] 1.1898496 0.5586217 0.9741141 1.2375038 0.7500858 0.7815656 0.8631963
##
## [[270]]
## [1] 0.9588370 0.6052865 1.0333706 0.5897564 0.8628155
##
## [[271]]
## [1] 0.3581644 0.3598882 0.8084843 0.5520072 0.4484357
##
## [[272]]
## [1] 0.4299867 0.3175127 0.8291476 0.8084843 0.5240704
##
## [[273]]
## [1] 0.5049576 0.5520072 0.5240704 0.2929905 0.1134900 0.1213000
##
## [[274]]
## [1] 0.4484357 0.2929905 0.1850478
##
## [[275]]
## [1] 0.1134900 0.1850478
##
## [[276]]
## [1] 0.3744038 0.8920002 0.3022505 0.4382571 0.7045412 1.2109539 0.6055280
##
## [[277]]
## [1] 0.1596139 0.4809803 0.5612803 0.4319578 0.5463106 0.4248008 0.4915513
## [8] 0.4054007
##
## [[278]]
## [1] 0.5691983 0.6630384 1.1052748 0.4718265 0.5543265 0.7858094 0.8038132
##
## [[279]]
## [1] 1.0969734 0.5743472 0.8207609 0.5751480 1.3972628 0.5599429
##
## [[280]]
## [1] 1.5437228 0.8005541 0.6428618 0.6438742 1.0567880 0.8220740 0.7157434
##
## [[281]]
## [1] 0.2470689 0.6897698 0.5283589 0.7535825 0.4485643
##
## [[282]]
## [1] 3.113369 1.827245 2.907615 1.250852 1.256131 1.431108 1.274913
##
## [[283]]
## [1] 0.5051229 0.5317908 0.4832962 1.2202489 0.5900350
##
## [[284]]
## [1] 0.8492181 0.5945566 0.5528436 0.3887759 0.2854144 0.5447089
##
## [[285]]
## [1] 0.9961068 0.5674396 1.5196015 0.7359705 1.0994479 0.7478303
##
## [[286]]
## [1] 0.1549636 0.1555487 0.1573922 0.1589236 0.1363204 0.1834646 0.1192066
## [8] 0.1884797 0.2087434 0.1542575 0.1213000 0.2854144 0.1471734 0.2384254
##
## [[287]]
## [1] 0.4524644 0.7285834 0.5374064 0.4915513 0.8148601 0.5866934 1.0408171
##
## [[288]]
## [1] 0.4968966 0.4951431 0.8571719 0.5402783 0.6705902 0.8042739 0.6335440
##
## [[289]]
## [1] 1.0396107 1.2635250 0.8148601 0.6916850 1.0034162
##
## [[290]]
## [1] 0.4649258 0.6137348 0.8494379 0.5866934 0.6335440 0.6916850
##
## [[291]]
## [1] 0.6690701 0.5409671 0.6394194 0.4054007 1.0408171 1.0034162
##
## [[292]]
## [1] 1.0316895 0.5457509 0.9728857 1.0063526 1.0771904 1.2898274 0.9030380
## [8] 0.7157434
##
## [[293]]
## [1] 0.3518170 0.2714662 0.3491247 0.2455807 0.2256625 0.4758056 0.2922441
##
## [[294]]
## [1] 1.0815070 0.5992606 0.7572748 0.1471734
##
## [[295]]
## [1] 0.7053242 0.6527241 0.4993618 1.2130854 1.1116498 1.1896508
##
## [[296]]
## [1] 0.7185641 0.8390431 0.6931957 0.6297705 1.2130854 0.7434640
##
## [[297]]
## [1] 0.5882482 0.4085719 0.5478539 0.4552457 1.1116498 0.7434640
##
## [[298]]
## [1] 0.8303788 1.1553013 0.7911798 0.6941495 1.1896508
##
## [[299]]
## [1] 0.7195327 0.7936921 0.9976961 1.0967103 1.1267590
##
## [[300]]
## [1] 0.4798430 0.6766562 0.9976961 0.6996838
##
## [[301]]
## [1] 0.9792542 0.7144880 0.4117553 1.0967103 0.6996838 0.6276027
##
## [[302]]
## [1] 0.6773042 0.4851777 1.2016692 0.9144950 0.5525513 0.7850920 1.1267590
## [8] 0.6276027
##
## [[303]]
## [1] 0.4655908 1.1504476 1.0939244 0.9326988 0.3542026 1.1476841 0.9467308
##
## [[304]]
## [1] 0.8727465 0.7970978 0.6865580 0.5275972 0.9467308
##
## [[305]]
## [1] 0.5505385 1.0636402 0.6752555 0.5864134 0.5447089 0.2384254
rswm_q_out <- nb2listw(wm_q_out, style="W", zero.policy = TRUE)
rswm_q_out
## Characteristics of weights list object:
## Neighbour list object:
## Number of regions: 305
## Number of nonzero links: 1848
## Percentage nonzero weights: 1.986563
## Average number of links: 6.059016
##
## Weights style: W
## Weights constants summary:
## n nn S0 S1 S2
## W 305 93025 305 105.9392 1253.617
lm.morantest(regfit2, rswm_q_out, alternative="greater", spChk=NULL, zero.policy = TRUE)
##
## Global Moran I for regression residuals
##
## data:
## model: lm(formula = tap_out ~ popout)
## weights: rswm_q_out
##
## Moran I statistic standard deviate = 0.26085, p-value = 0.3971
## alternative hypothesis: greater
## sample estimates:
## Observed Moran I Expectation Variance
## 0.004325173 -0.004364448 0.001109728
packages = c('rgdal', 'spdep', 'tmap', 'tidyverse')
for (p in packages){
if(!require(p, character.only = T)){
install.packages(p)
}
library(p,character.only = T)
}
fips <- order(subzone_tapin$Pop)
localMI <- localmoran(subzone_tapin$TOTAL_TAP_IN_VOLUME, rswm_q)
head(localMI)
## Ii E.Ii Var.Ii Z.Ii Pr(z > 0)
## 1 0.10398996 -0.003289474 0.1552387 0.2722805 0.39270318
## 2 0.46528109 -0.003289474 0.4716059 0.6823157 0.24751967
## 3 -0.10380168 -0.003289474 0.1156928 -0.2955056 0.61619616
## 4 0.07510718 -0.003289474 0.1552387 0.1989746 0.42114132
## 5 0.45915802 -0.003289474 0.1025108 1.4443673 0.07431785
## 6 -0.27572788 -0.003289474 0.1552387 -0.6914621 0.75536240
subzone_tapin.localMI <- cbind(subzone_tapin, localMI)
tm_shape(subzone_tapin.localMI)+
tm_fill(col="Ii",
style="pretty",
title="local moran tap in statistics")+
tm_borders(alpha=0.5)
## Warning: The shape subzone_tapin.localMI is invalid. See sf::st_is_valid
## Variable(s) "Ii" contains positive and negative values, so midpoint is set to 0. Set midpoint = NA to show the full spectrum of the color palette.
tm_shape(subzone_tapin.localMI) +
tm_fill(col="Pr.z...0.",
breaks=c(-Inf, 0.001, 0.01, 0.05, 0.1, Inf),
palette="-Blues",
title="local Moran's I tap in p-values") +
tm_borders(alpha=0.5)
## Warning: The shape subzone_tapin.localMI is invalid. See sf::st_is_valid
localMI.map <- tm_shape(subzone_tapin.localMI) +
tm_fill(col="Ii",
style="pretty",
title="local moran tap in statistics")+
tm_borders(alpha=0.5)
pvalue.map <- tm_shape(subzone_tapin.localMI)+
tm_fill(col="Pr.z...0.",
breaks=c(-Inf, 0.001, 0.01, 0.05, 0.1, Inf),
palette="-Blues",
title="local Moran's I tap in p-values")+
tm_borders(alpha=0.5)
tmap_arrange(localMI.map, pvalue.map, asp=1, ncol=2)
## Warning: The shape subzone_tapin.localMI is invalid. See sf::st_is_valid
## Variable(s) "Ii" contains positive and negative values, so midpoint is set to 0. Set midpoint = NA to show the full spectrum of the color palette.
## Warning: The shape subzone_tapin.localMI is invalid. See sf::st_is_valid
nci <- moran.plot(subzone_tapin$TOTAL_TAP_IN_VOLUME, rswm_q, labels=as.character(subzone_tapin$Pop), xlab="TOTAL TAP IN VOLUME", ylab="Spatially Lag Tap in Volume")
subzone_tapin$z.TOTAL_TAP_IN_VOLUME <- scale(subzone_tapin$TOTAL_TAP_IN_VOLUME) %>% as.vector
nci2 <- moran.plot(subzone_tapin$z.TOTAL_TAP_IN_VOLUME, rswm_q, labels=as.character(subzone_tapin$Pop, xlab="z-Total tap in volume", ylab="Spatially lag tap in volume"))
quadrant <- vector(mode="numeric", length=nrow(localMI))
DV <- subzone_tapin$TOTAL_TAP_IN_VOLUME - mean(subzone_tapin$TOTAL_TAP_IN_VOLUME)
C_mI <- localMI[,1] - mean(localMI[,1])
signif <- 0.05
quadrant[DV >0 & C_mI>0] <- 4
quadrant[DV <0 & C_mI<0] <- 1
quadrant[DV <0 & C_mI>0] <- 2
quadrant[DV >0 & C_mI<0] <- 3
quadrant[localMI[,5]>signif] <- 0
subzone_tapin.localMI$quadrant <- quadrant
colors <- c("#ffffff", "#2c7bb6", "#abd9e9", "#fdae61", "#d7191c")
clusters <- c("insignificant", "low-low", "low-high", "high-low", "high-high")
tm_shape(subzone_tapin.localMI) +
tm_fill(col = "quadrant", style = "cat", palette = colors[c(sort(unique(quadrant)))+1], labels = clusters[c(sort(unique(quadrant)))+1], popup.vars = c("Postal.Code")) +
tm_view(set.zoom.limits = c(11,17)) +
tm_borders(alpha=0.5)
## Warning: The shape subzone_tapin.localMI is invalid. See sf::st_is_valid
centroids <- sf::st_centroid(subzone_tapin$geometry)
## Warning in st_centroid.sfc(subzone_tapin$geometry): st_centroid does not give
## correct centroids for longitude/latitude data
dnb <- dnearneigh(st_coordinates(centroids), 0, 26, longlat=TRUE)
dnb
## Neighbour list object:
## Number of regions: 305
## Number of nonzero links: 90590
## Percentage nonzero weights: 97.38242
## Average number of links: 297.0164
plot(subzone_tapin$geometry, border='lightgrey')
plot(dnb,st_coordinates(centroids), add=TRUE, col='red')
dnb_lw <- nb2listw(dnb, style='B')
summary(dnb_lw)
## Characteristics of weights list object:
## Neighbour list object:
## Number of regions: 305
## Number of nonzero links: 90590
## Percentage nonzero weights: 97.38242
## Average number of links: 297.0164
## Link number distribution:
##
## 169 211 227 230 240 247 248 251 262 263 266 268 269 270 272 273 276 277 279 280
## 1 1 1 1 1 1 1 2 1 1 1 1 1 1 1 1 2 3 4 1
## 281 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301
## 1 1 1 4 2 1 3 2 4 5 1 1 5 8 4 12 6 6 7 16
## 302 303 304
## 35 53 100
## 1 least connected region:
## 275 with 169 links
## 100 most connected regions:
## 3 4 6 9 11 12 17 22 26 28 30 35 36 37 38 39 43 46 47 51 52 53 58 59 61 63 65 66 67 68 70 72 73 74 77 82 84 89 90 92 93 99 101 114 115 122 130 131 133 142 144 147 148 153 156 157 159 160 161 163 164 165 167 171 172 173 174 177 178 184 188 192 193 200 201 202 204 206 211 228 237 238 239 241 243 244 251 252 253 257 258 259 263 264 265 266 278 279 281 282 with 304 links
##
## Weights style: B
## Weights constants summary:
## n nn S0 S1 S2
## B 305 93025 90590 181180 107893080
coords <- st_coordinates(centroids)
knb2 <- knn2nb(knearneigh(coords, k=8, longlat = TRUE), row.names=row.names(subzone_tapin$TOTAL_TAP_IN_VOLUME))
knb_lw2 <- nb2listw(knb2, style = 'B')
summary(knb_lw2)
## Characteristics of weights list object:
## Neighbour list object:
## Number of regions: 305
## Number of nonzero links: 2440
## Percentage nonzero weights: 2.622951
## Average number of links: 8
## Non-symmetric neighbours list
## Link number distribution:
##
## 8
## 305
## 305 least connected regions:
## 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 with 8 links
## 305 most connected regions:
## 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 with 8 links
##
## Weights style: B
## Weights constants summary:
## n nn S0 S1 S2
## B 305 93025 2440 4412 79922
plot(subzone_tapin$geometry, border="lightgrey")
plot(knb2, st_coordinates(centroids), pch=19, cex=0.6, add=TRUE, col="red")
par(mfrow=c(1,2))
plot(subzone_tapin$geometry, border = 'lightgrey')
plot(dnb, st_coordinates(centroids), add=TRUE, col='red')
plot(subzone_tapin$geometry, border="lightgrey")
plot(knb2, st_coordinates(centroids), pch=19, cex=0.6, add=TRUE, col="red")
fips <- order(subzone_tapin$Pop)
gi.fixed <- localG(subzone_tapin$TOTAL_TAP_IN_VOLUME, dnb_lw)
gi.fixed
## [1] 0.986446710 1.762346256 NaN NaN 1.241930239
## [6] -Inf 1.865853392 0.724835938 NaN 0.724797759
## [11] NaN Inf 1.186524111 0.846301775 2.240845641
## [16] 1.042956282 -Inf 0.725536075 -2.980556693 1.108830638
## [21] 0.724780247 NaN 1.104765289 -2.404336686 0.728067579
## [26] NaN 0.727836691 NaN 0.013145881 NaN
## [31] -0.222686286 -0.851940559 -0.852167866 0.013691599 NaN
## [36] NaN NaN NaN NaN -0.560557589
## [41] 0.685282445 0.788827900 NaN 0.724802606 -2.130828955
## [46] NaN NaN -0.225331235 -0.215763798 0.725362951
## [51] NaN NaN NaN -0.865926921 -0.855698534
## [56] -0.215501401 -0.852530356 NaN NaN 1.755073667
## [61] NaN 0.727828229 NaN 1.758941040 NaN
## [66] NaN NaN NaN 1.977920210 NaN
## [71] -0.213581887 NaN NaN NaN 1.561170053
## [76] 0.822370715 NaN 2.108372441 -0.851453874 1.106026234
## [81] 1.749550064 NaN -0.851790232 NaN -0.085777422
## [86] -0.851633929 -3.009274389 -3.051075626 NaN NaN
## [91] -0.851941918 NaN NaN 0.508521884 -0.216860987
## [96] 1.748079616 2.028327523 1.747515521 NaN -0.212990045
## [101] NaN -0.861891380 -2.657815924 1.248183473 0.003233697
## [106] -2.366790864 0.531080964 -4.320417302 2.020977166 0.727487650
## [111] 1.106618685 1.108137950 0.729636439 NaN NaN
## [116] 1.749263206 1.867986467 1.869689506 -0.216115156 0.726622830
## [121] 1.881493966 NaN 0.726921806 -3.800510057 0.728778727
## [126] 1.243839809 -0.288065251 0.853544952 0.725675446 NaN
## [131] NaN -3.548653746 NaN -2.277950026 0.727916206
## [136] 1.586594575 0.987960021 2.038478422 0.986183050 0.909087356
## [141] 0.851232710 NaN 1.589532179 Inf 0.729297424
## [146] 0.730155622 NaN NaN 0.728346810 1.600974606
## [151] 0.885839928 1.861481733 NaN 0.725322009 2.021220255
## [156] NaN NaN 0.726513034 -Inf NaN
## [161] NaN 1.596675345 NaN NaN NaN
## [166] 0.730002758 NaN -0.098611424 0.982741331 2.303257692
## [171] NaN NaN NaN NaN -0.213259489
## [176] 0.238560917 NaN NaN 1.287551030 0.667976764
## [181] 0.697670949 1.977020787 1.061064786 NaN 2.257809866
## [186] 2.254033046 1.898492457 NaN 0.728315834 0.508080973
## [191] 0.614031038 NaN -Inf -3.330740402 1.897548984
## [196] -0.213532397 0.985780680 2.291858197 2.035505819 NaN
## [201] NaN NaN 0.516084721 NaN 1.883519492
## [206] NaN 0.729739633 -2.980480024 -3.799319727 -0.851446842
## [211] NaN 1.759123425 1.250588905 1.108206301 0.981101877
## [216] 0.987653224 0.729498542 0.984424551 0.986411317 1.448684016
## [221] 2.024149863 1.110215353 -0.851938193 1.105353154 0.987109644
## [226] 0.728528815 0.728917673 NaN 1.100888155 1.101680736
## [231] 1.244608491 1.108180091 0.727542653 -2.618271605 1.869243861
## [236] 1.294055822 NaN NaN NaN 0.730068311
## [241] NaN 0.729515121 Inf NaN 0.729031677
## [246] 1.593458596 0.512227603 1.304141200 0.861629597 0.696118506
## [251] NaN NaN NaN 1.107117156 0.607935663
## [256] -0.853269770 -Inf NaN NaN 0.856744999
## [261] -3.414901958 0.988107470 NaN NaN NaN
## [266] -Inf 0.012247102 -0.851464363 0.726530491 1.747905541
## [271] -3.335909415 -3.397654692 -2.838280440 -3.118145358 -3.676544439
## [276] -2.440483580 -0.851685474 NaN Inf 1.246791805
## [281] NaN NaN 2.295908133 -2.443011296 -0.212835652
## [286] -3.166206058 -0.853346547 0.726237680 -0.108702229 0.726193728
## [291] -0.092251900 0.988091930 1.074896267 -0.217833265 0.726051121
## [296] 0.987135660 0.729524150 0.727026526 0.982334852 0.981055226
## [301] 0.981202094 0.981943093 0.606825972 0.846300534 -3.645476751
## attr(,"gstari")
## [1] FALSE
## attr(,"call")
## localG(x = subzone_tapin$TOTAL_TAP_IN_VOLUME, listw = dnb_lw)
## attr(,"class")
## [1] "localG"
subzone.gi <- cbind(subzone_tapin, as.matrix(gi.fixed))
names(subzone.gi)[7] <- "gstat"
tm_shape(subzone.gi)+
tm_fill(col="gstat",
style="pretty",
palette="-RdBu",
title="local Gi")+
tm_borders(alpha=0.5)
## Warning: The shape subzone.gi is invalid. See sf::st_is_valid
## Variable(s) "gstat" contains positive and negative values, so midpoint is set to 0. Set midpoint = NA to show the full spectrum of the color palette.
gi.adaptive <- localG(subzone_tapin$TOTAL_TAP_IN_VOLUME, knb_lw2)
subzone.gi_adaptive <- cbind(subzone_tapin, as.matrix(gi.adaptive))
names(subzone.gi_adaptive)[7] <- "gstat_adaptive"
tm_shape(subzone.gi_adaptive) +
tm_fill(col= "gstat_adaptive",
style = "pretty",
palette="-RdBu",
title = "local Gi") +
tm_borders(alpha = 0.5)
## Warning: The shape subzone.gi_adaptive is invalid. See sf::st_is_valid
## Variable(s) "gstat_adaptive" contains positive and negative values, so midpoint is set to 0. Set midpoint = NA to show the full spectrum of the color palette.
packages = c('rgdal', 'spdep', 'tmap', 'tidyverse')
for (p in packages){
if(!require(p, character.only = T)){
install.packages(p)
}
library(p,character.only = T)
}
fips_out <- order(subzone_tapout$Pop)
localMI_out <- localmoran(subzone_tapout$TOTAL_TAP_OUT_VOLUME, rswm_q_out)
head(localMI_out)
## Ii E.Ii Var.Ii Z.Ii Pr(z > 0)
## 1 0.07984235 -0.003289474 0.1554506 0.2108488 0.4165026
## 2 0.44108414 -0.003289474 0.4722590 0.6466334 0.2589346
## 3 -0.19563860 -0.003289474 0.1158495 -0.5651231 0.7140050
## 4 0.08695043 -0.003289474 0.1554506 0.2288772 0.4094822
## 5 0.40540291 -0.003289474 0.1026492 1.2756126 0.1010462
## 6 -0.21606701 -0.003289474 0.1554506 -0.5396716 0.7052883
subzone_tapout.localMI <- cbind(subzone_tapout, localMI_out)
tm_shape(subzone_tapout.localMI)+
tm_fill(col="Ii",
style="pretty",
title="local moran tap out statistics")+
tm_borders(alpha=0.5)
## Warning: The shape subzone_tapout.localMI is invalid. See sf::st_is_valid
## Variable(s) "Ii" contains positive and negative values, so midpoint is set to 0. Set midpoint = NA to show the full spectrum of the color palette.
tm_shape(subzone_tapout.localMI) +
tm_fill(col="Pr.z...0.",
breaks=c(-Inf, 0.001, 0.01, 0.05, 0.1, Inf),
palette="-Blues",
title="local Moran's I tap out p-values") +
tm_borders(alpha=0.5)
## Warning: The shape subzone_tapout.localMI is invalid. See sf::st_is_valid
localMI.map_out <- tm_shape(subzone_tapout.localMI) +
tm_fill(col="Ii",
style="pretty",
title="local moran tap out statistics")+
tm_borders(alpha=0.5)
pvalue.map_out <- tm_shape(subzone_tapout.localMI)+
tm_fill(col="Pr.z...0.",
breaks=c(-Inf, 0.001, 0.01, 0.05, 0.1, Inf),
palette="-Blues",
title="local Moran's I tap outp-values")+
tm_borders(alpha=0.5)
tmap_arrange(localMI.map_out, pvalue.map_out, asp=1, ncol=2)
## Warning: The shape subzone_tapout.localMI is invalid. See sf::st_is_valid
## Variable(s) "Ii" contains positive and negative values, so midpoint is set to 0. Set midpoint = NA to show the full spectrum of the color palette.
## Warning: The shape subzone_tapout.localMI is invalid. See sf::st_is_valid
nci_out <- moran.plot(subzone_tapout$TOTAL_TAP_OUT_VOLUME, rswm_q_out, labels=as.character(subzone_tapout$Pop), xlab="TOTAL TAP OUT VOLUME", ylab="Spatially Lag Tap Out Volume")
subzone_tapout$z.TOTAL_TAP_OUT_VOLUME <- scale(subzone_tapout$TOTAL_TAP_OUT_VOLUME) %>% as.vector
nci2_out <- moran.plot(subzone_tapout$z.TOTAL_TAP_OUT_VOLUME, rswm_q_out, labels=as.character(subzone_tapout$Pop, xlab="z-Total tap out volume", ylab="Spatially lag tap out volume"))
quadrant_out <- vector(mode="numeric", length=nrow(localMI_out))
DV_out <- subzone_tapout$TOTAL_TAP_OUT_VOLUME - mean(subzone_tapout$TOTAL_TAP_OUT_VOLUME)
C_mI_out <- localMI_out[,1] - mean(localMI_out[,1])
signif <- 0.05
quadrant_out[DV_out >0 & C_mI_out>0] <- 4
quadrant_out[DV_out <0 & C_mI_out<0] <- 1
quadrant_out[DV_out <0 & C_mI_out>0] <- 2
quadrant_out[DV_out >0 & C_mI_out<0] <- 3
quadrant_out[localMI_out[,5]>signif] <- 0
subzone_tapout.localMI$quadrant_out <- quadrant_out
colors <- c("#ffffff", "#2c7bb6", "#abd9e9", "#fdae61", "#d7191c")
clusters <- c("insignificant", "low-low", "low-high", "high-low", "high-high")
tm_shape(subzone_tapout.localMI) +
tm_fill(col = "quadrant_out", style = "cat", palette = colors[c(sort(unique(quadrant_out)))+1], labels = clusters[c(sort(unique(quadrant_out)))+1], popup.vars = c("Postal.Code")) +
tm_view(set.zoom.limits = c(11,17)) +
tm_borders(alpha=0.5)
## Warning: The shape subzone_tapout.localMI is invalid. See sf::st_is_valid
centroids <- sf::st_centroid(subzone_tapout$geometry)
## Warning in st_centroid.sfc(subzone_tapout$geometry): st_centroid does not give
## correct centroids for longitude/latitude data
dnb_out <- dnearneigh(st_coordinates(centroids), 0, 26, longlat=TRUE)
dnb_out
## Neighbour list object:
## Number of regions: 305
## Number of nonzero links: 90590
## Percentage nonzero weights: 97.38242
## Average number of links: 297.0164
plot(subzone_tapout$geometry, border='lightgrey')
plot(dnb,st_coordinates(centroids), add=TRUE, col='red')
dnb_lw_out <- nb2listw(dnb_out, style='B')
summary(dnb_lw_out)
## Characteristics of weights list object:
## Neighbour list object:
## Number of regions: 305
## Number of nonzero links: 90590
## Percentage nonzero weights: 97.38242
## Average number of links: 297.0164
## Link number distribution:
##
## 169 211 227 230 240 247 248 251 262 263 266 268 269 270 272 273 276 277 279 280
## 1 1 1 1 1 1 1 2 1 1 1 1 1 1 1 1 2 3 4 1
## 281 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301
## 1 1 1 4 2 1 3 2 4 5 1 1 5 8 4 12 6 6 7 16
## 302 303 304
## 35 53 100
## 1 least connected region:
## 275 with 169 links
## 100 most connected regions:
## 3 4 6 9 11 12 17 22 26 28 30 35 36 37 38 39 43 46 47 51 52 53 58 59 61 63 65 66 67 68 70 72 73 74 77 82 84 89 90 92 93 99 101 114 115 122 130 131 133 142 144 147 148 153 156 157 159 160 161 163 164 165 167 171 172 173 174 177 178 184 188 192 193 200 201 202 204 206 211 228 237 238 239 241 243 244 251 252 253 257 258 259 263 264 265 266 278 279 281 282 with 304 links
##
## Weights style: B
## Weights constants summary:
## n nn S0 S1 S2
## B 305 93025 90590 181180 107893080
coords <- st_coordinates(centroids)
knb2_out <- knn2nb(knearneigh(coords, k=8, longlat = TRUE), row.names=row.names(subzone_tapout$TOTAL_TAP_OUT_VOLUME))
knb_lw2_out <- nb2listw(knb2_out, style = 'B')
summary(knb_lw2_out)
## Characteristics of weights list object:
## Neighbour list object:
## Number of regions: 305
## Number of nonzero links: 2440
## Percentage nonzero weights: 2.622951
## Average number of links: 8
## Non-symmetric neighbours list
## Link number distribution:
##
## 8
## 305
## 305 least connected regions:
## 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 with 8 links
## 305 most connected regions:
## 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 with 8 links
##
## Weights style: B
## Weights constants summary:
## n nn S0 S1 S2
## B 305 93025 2440 4412 79922
plot(subzone_tapout$geometry, border="lightgrey")
plot(knb2_out, st_coordinates(centroids), pch=19, cex=0.6, add=TRUE, col="red")
par(mfrow=c(1,2))
plot(subzone_tapout$geometry, border = 'lightgrey')
plot(dnb_out, st_coordinates(centroids), add=TRUE, col='red')
plot(subzone_tapout$geometry, border="lightgrey")
plot(knb2_out, st_coordinates(centroids), pch=19, cex=0.6, add=TRUE, col="red")
fips <- order(subzone_tapout$Pop)
gi.fixed_out <- localG(subzone_tapout$TOTAL_TAP_OUT_VOLUME, dnb_lw_out)
gi.fixed_out
## [1] 0.88419980 1.76586457 NaN NaN 1.20569304 NaN
## [7] 1.88856562 0.71589342 NaN 0.71590375 NaN NaN
## [13] 1.21007452 0.88253282 2.29895744 1.07380166 NaN 0.71651538
## [19] -3.09028720 1.08318928 0.71597955 NaN 1.07853468 -2.42521653
## [25] 0.71863018 NaN 0.71904073 Inf 0.04861064 -Inf
## [31] -0.29649697 -0.94212161 -0.94271955 0.04892443 NaN NaN
## [37] NaN NaN NaN -0.55780734 0.62621178 0.72564732
## [43] NaN 0.71617190 -2.13924132 NaN NaN -0.29876179
## [49] -0.28941745 0.71598799 NaN NaN NaN -0.95423736
## [55] -0.94624717 -0.29007742 -0.94293808 NaN NaN 1.75844627
## [61] NaN 0.71876493 NaN 1.76086700 NaN NaN
## [67] NaN NaN 1.97636096 NaN -0.28757733 NaN
## [73] NaN NaN 1.56085536 0.77598896 NaN 2.15570653
## [79] -0.94199490 1.07953933 1.75157453 NaN -0.94174311 NaN
## [85] -0.15625916 -0.94263508 -3.11863301 -3.12938599 NaN NaN
## [91] -0.94253728 NaN NaN 0.48772492 -0.29020778 1.75120494
## [97] 2.02597107 1.75115820 NaN -0.28704005 NaN -0.95282539
## [103] -2.73678533 1.21071062 0.03943779 -2.41785857 0.51093489 -4.37739260
## [109] 2.01793001 0.71806456 1.08076022 1.08139032 0.72083020 NaN
## [115] NaN 1.75213380 1.89113738 1.89214489 -0.29141061 0.71834590
## [121] 1.91642802 -Inf 0.71624829 -3.87020969 0.72079978 1.20727031
## [127] -0.38793068 0.83124504 0.71693571 NaN Inf -3.57359487
## [133] NaN -2.24918076 0.71876381 1.56919147 0.88620548 2.03572386
## [139] 0.88494130 0.84955249 0.76214716 -Inf 1.57232620 -Inf
## [145] 0.72092298 0.72144736 NaN NaN 0.71938244 1.58385665
## [151] 0.94895131 1.88490774 NaN 0.71688949 2.01803528 NaN
## [157] NaN 0.71774547 NaN NaN NaN 1.57937576
## [163] NaN NaN NaN 0.72115840 NaN -0.16798473
## [169] 0.88122972 2.36189149 NaN NaN Inf NaN
## [175] -0.28720161 0.24429834 NaN NaN 1.29767168 0.64623242
## [181] 0.67339635 1.98935234 1.09008825 NaN 2.31514330 2.31121861
## [187] 1.93328186 NaN 0.71907499 0.54011168 0.59896748 NaN
## [193] NaN -3.37355984 1.93341576 -0.28752933 0.88365043 2.35109684
## [199] 2.08248837 NaN NaN NaN 0.54731697 NaN
## [205] 1.91813309 NaN 0.72088078 -3.08954597 -3.86858981 -0.94194378
## [211] NaN 1.76259039 1.21351107 1.08084099 0.87958962 0.88539770
## [217] 0.72021858 0.88216101 0.88493915 1.43857190 2.02055021 1.08384784
## [223] -0.94304602 1.07955955 0.88508813 0.71994622 0.72010200 NaN
## [229] 1.07365592 1.07532319 1.20685744 1.08176853 0.71803806 -2.61438362
## [235] 1.93517575 1.30535872 NaN NaN NaN 0.72109124
## [241] NaN 0.72061139 NaN NaN 0.72010326 1.57762385
## [247] 0.49053884 1.31549688 0.89540198 0.72172879 NaN NaN
## [253] NaN 1.08081386 0.59171024 -0.94348374 NaN NaN
## [259] NaN 0.83487298 -3.45604018 0.88715287 NaN NaN
## [265] NaN NaN 0.04778962 -0.94217748 0.71841932 1.75155125
## [271] -3.44867371 -3.43098347 -2.87224114 -3.13797093 -3.81761633 -2.44353424
## [277] -0.94232041 NaN NaN 1.20811915 NaN NaN
## [283] 2.35315992 -2.44565117 -0.28735270 -3.27691412 -0.94281484 0.71838050
## [289] -0.17651944 0.71743297 -0.16683263 0.88571759 1.04761860 -0.29241754
## [295] 0.71717464 0.88503678 0.72075058 0.71834419 0.88048392 0.87942421
## [301] 0.88059065 0.87915744 0.59145231 0.82545672 -3.68404413
## attr(,"gstari")
## [1] FALSE
## attr(,"call")
## localG(x = subzone_tapout$TOTAL_TAP_OUT_VOLUME, listw = dnb_lw_out)
## attr(,"class")
## [1] "localG"
subzone.gi_out <- cbind(subzone_tapout, as.matrix(gi.fixed_out))
names(subzone.gi_out)[6] <- "gstat"
tm_shape(subzone.gi_out)+
tm_fill(col="gstat",
stype="pretty",
palette="-RdBu",
title="local Gi")+
tm_borders(alpha=0.5)
## Warning: The shape subzone.gi_out is invalid. See sf::st_is_valid
## Variable(s) "gstat" contains positive and negative values, so midpoint is set to 0. Set midpoint = NA to show the full spectrum of the color palette.
gi.adaptive_out <- localG(subzone_tapout$TOTAL_TAP_OUT_VOLUME, knb_lw2_out)
subzone.gi_adaptive_out <- cbind(subzone_tapout, as.matrix(gi.adaptive_out))
names(subzone.gi_adaptive_out)[6] <- "gstat_adaptive"
tm_shape(subzone.gi_adaptive_out) +
tm_fill(col= "gstat_adaptive",
style = "pretty",
palette="-RdBu",
title = "local Gi") +
tm_borders(alpha = 0.5)
## Warning: The shape subzone.gi_adaptive_out is invalid. See sf::st_is_valid
## Variable(s) "gstat_adaptive" contains positive and negative values, so midpoint is set to 0. Set midpoint = NA to show the full spectrum of the color palette.
packages <- c('tmap', 'sf', 'rgdal', 'lwgeom', 'leaflet')
for (p in packages){
if(!require(p, character.only = T)){
install.packages(p)
}
library(p,character.only = T)
}
## Loading required package: lwgeom
## Linking to liblwgeom 3.0.0beta1 r16016, GEOS 3.6.1, PROJ 4.9.3
## Warning in fun(libname, pkgname): GEOS versions differ: lwgeom has 3.6.1 sf has
## 3.8.0
## Warning in fun(libname, pkgname): PROJ versions differ: lwgeom has 4.9.3 sf has
## 6.3.1
## Loading required package: leaflet
tmap_mode("view")
## tmap mode set to interactive viewing
listing_distribution <- leaflet(passbus_subzone) %>%
addTiles() %>%
addMarkers(~lat, ~lon, labelOptions = labelOptions(noHide = F),
clusterOptions = markerClusterOptions(),
popup = paste0("<b> subzone_name: </b>", passbus_subzone$subzone_name,
"<br/><b> bus stop number: </b>", passbus_subzone$BUS_STOP_N,
"<br> <b> Location Description: </b>", passbus_subzone$LOC_DESC,
"<br/> <b> Total tap in volume: </b>",subzone_tapin$TOTAL_TAP_IN_VOLUME)) %>%
addProviderTiles("CartoDB.Positron")
# To mute the background, and highlight the cluster details.
print(listing_distribution)
tmap_mode("plot")
## tmap mode set to plotting