意匠の時空間的分析

基礎な手法を用いて日本における登録意匠の時空間的分析などを探検する目的で、このブログによって、手法などについてシェアしたり、意見交換したりします。

CSRの帰無仮設を棄却する検定手順(3)F関数とF統計量(データクリーニング後)

f:id:ttcrossroads09:20181203101443p:plain


CSR検定手法として、Diggle(2003),p28が二つの手法、すなわち、G関数の検定とF関数の検定を勧める。G検定の結果はすでにブログに載せました。ここではF 検定の手順と結果を載せます。

古谷(2009)*1参照:

F関数とF統計量は任意の地点から他の最近隣地点までの距離について、F関数を使って得られる統計量です。F関数は任意の地点からの半径rを用いて、次式のように表されます。

Rでは、Fest()関数を用いてF統計量をけいさんすることができます。ここでCSRエンベロープシミュレーション*2*3を用いて行います。各地図に示される地点から計算された結果、本ポストの図に示します。

CSRモンテカルロ・シミュェーション


> library(lattice)
> library(spatstat)
> r <- seq(0, sqrt(2)/6, by = 0.001)
> FenvSagaFukuoka <- envelope(as(pppSagaFukuoka,"ppp"), fun = Fest, r=r, nrank=2, nsim=99)
Generating 99 simulations of CSR  ...
1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86,
87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98,  99.

Done.
> FenvFukuokaChikushino <- envelope(as(pppFukuokaChikushino,"ppp"), fun = Fest, r=r, nrank=2, nsim=99)
Generating 99 simulations of CSR  ...
1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86,
87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98,  99.

Done.
> FenvChuoHakata <- envelope(as(pppChuoHakata,"ppp"), fun = Fest, r=r, nrank=2, nsim=99)
Generating 99 simulations of CSR  ...
1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86,
87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98,  99.

Done.
> FenvKasuga <- envelope(as(pppKasuga,"ppp"), fun = Fest, r=r, nrank=2, nsim=99)
Generating 99 simulations of CSR  ...
1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86,
87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98,  99.

Done.
> Fresults <- rbind(FenvSagaFukuoka, FenvFukuokaChikushino, FenvChuoHakata,FenvKasuga )
> Fresults <- cbind(Fresults, DATASET = 
+ rep(c("Saga-Fukuoka Prefs", "Fukuoka-Chikushino Cities","Chuo-Hakata Wards","Kasuga"), each = length(r)))
> png(file="Fest-Saga-FukuokaC.png", width=600, height=480)
> print(xyplot(obs~theo|y , data=Fresults, type="l", 
+ xlab = "theoretical", ylab = "observed",
+ panel=function(x, y, subscripts) {
+    lpolygon(c(x, rev(x)), 
+    c(Fresults$lo[subscripts], rev(Fresults$hi[subscripts])),
+    border="gray", col="gray"
+ )
+ llines(x, y, col="black", lwd=2)
+ }))
> dev.off()

観察

G検定のように、春日市以外、集中パターンがはっきり判別されます。

CSRの帰無仮設を棄却する検定手順(2)G関数とG統計量(データクリーニング後)

f:id:ttcrossroads09:20181203100552p:plain

 

古谷(2009)*1参照:

任意の地点からの最近隣距離の分布を計測することにより、G統計量が得られる。ある地点iから他の地点j(≠i)との距離のうち、最小となる組み合わせ(=最近隣距離)をdijとし、dijrとなる地点の数をN(dij;dijr,∀i)と書くことにする。このとき、G統計量を得るためのG関数は次式のように書くことができる。

f:id:ttcrossroads09:20181023220411p:plain

点過程が完全ランダムであるとき、G統計量は次式のように表わされる。

f:id:ttcrossroads09:20181025145341p:plain

CSRモンテカルロ・シミュェーション


> library(maptools)
> library(spatstat)
> library(lattice)
> r <- seq(0, sqrt(2)/6, by = 0.001)
> genvSagaFukuoka <- envelope(as(pppSagaFukuoka,"ppp"), fun = Gest, r=r, nrank=2, nsim=99)
Generating 99 simulations of CSR  ...
1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52,
53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98,  99.

Done.
> genvFukuokaChikushino <- envelope(as(pppFukuokaChikushino,"ppp"), fun = Gest, r=r, nrank=2, nsim=99)
Generating 99 simulations of CSR  ...
1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52,
53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98,  99.

Done.
> genvChuoHakata <- envelope(as(pppChuoHakata,"ppp"), fun = Gest, r=r, nrank=2, nsim=99)
Generating 99 simulations of CSR  ...
1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52,
53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98,  99.

Done.
> genvKasuga <- envelope(as(pppKasuga,"ppp"), fun = Gest,  nrank=2, r=r, nsim=99)
Generating 99 simulations of CSR  ...
1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52,
53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98,  99.

Done.
> Gresults <- rbind(genvSagaFukuoka, genvFukuokaChikushino, genvChuoHakata,genvKasuga )
> Gresults <- cbind(Gresults, DATASET = 
+ rep(c("Saga-Fukuoka Prefs", "Fukuoka-Chikushino Cities","Chuo-Hakata Wards","Kasuga"), each = length(r)))
> png(file="Gest-Saga-FukuokaC.png", width=600, height=480)
> print(xyplot(obs~theo|y , data=Gresults, type="l", 
+ xlab = "theoretical", ylab = "observed",
+ panel=function(x, y, subscripts) {
+    lpolygon(c(x, rev(x)), 
+    c(Gresults$lo[subscripts], rev(Gresults$hi[subscripts])),
+    border="gray", col="gray"
+ )
+ llines(x, y, col="black", lwd=2)
+ }))
> dev.off()

観察

春日市以外のデータはCSRの帰無仮設を強く棄却し、集中パターンがはっきり判別される。しかし、佐賀県‐福岡県全域や福岡市‐筑紫野市全域、や福岡市中央区博多区にはそれらの人口分布も不均一であり、集中パターンがはっきり表わされる。しかし、(わざわざ選べた)春日市のデータはCSRが棄却さらず、均一な人口分布の場合、意匠登録者の分布がランドムである可能性が残される。意匠登録者の分布は人口分布上のランドム性検証が必要であろう。

CSRの帰無仮設を棄却する検定手順(1)背景と分析地区(データクリーニング後)

  1. 背景

    点過程データを分析する際、その最初のステップとして、CSR(Complete Spatial Randomness)という帰無仮設を置き、最近隣距離法若しくは法格法を用いて、その仮設を棄却する確率を算出する。*1*2ここでは、Rのspatstatというパッケージ*3を用いて、佐賀県と福岡県の意匠登録者の空間点過程データをBivand, Pebesma, Gómez-Rubio (2008)が説明するDiggle(2003) の例に従って、分析する。

    続きを読む

データクリーニングを通してDatasetSFPcの作成

ここまで用いた点過程データ(DatasetSFP)は複数の意匠登録者が同一座標が付けられているケースがある。原因を調べた結果、以下の三つが見つかった。

  1. 複数の文字列が同一住所を指定するケース
  2. 利用したジオコーディング・サービスが番地レベルまでしか同定しておらず、同一の番地に複数の登録者が存在するケース
  3. 複数の登録者が同一建物に入居するケース

以上のケースを訂正するため、当てはめる住所文字列の座標が以下のマップサイトを用いて同定された。

  1. Yahoo!地図

  2. Google マップ

  3. 地理院地図

更に、複数の登録者が同一建物に入居する場合、伊藤香織(2004)の手法に従って建築面積に応じて位置座標の分散を行った。建築面積として、地理院地図上の家形を計測した値を利用した。

伊藤香織(2004)を参考とする手法

>f:id:ttcrossroads09:20181113105509j:plain

位置の分散は以下の手順で行う。住所に対応する家形の面積Aを地理院地図上の計測によって得て、家形中心の座標をGoogleマップから得る。東西軸x南北軸y(平面直角座標系第9系)に平行な一辺√Aの平方形で建物を近似する。x座標y座標をそれぞれ図の確率密度に従う乱数によって決定し、中心点から移動させる。

SQL Server上の計算:

f:id:ttcrossroads09:20181113113444p:plain


select
F1.[AddressID],
case when F1.[RanX] + F1.[RanXz] > 1.0 
then (F1.[RanX] - 1.0)* F1.AFactor
else F1.[RanX] * F1.[AFactor] end as [ShiftLong],
case when F1.[RanY] + F1.[RanYz] > 1.0 
then (F1.[RanY] - 1.0)* F1.AFactor
else F1.[RanY] * F1.[AFactor] end as [ShiftLat]
from
(
select
A1.AddressID,
SQRT(A1.Area) / 222638.0 as [AFactor],
RAND(CHECKSUM(newid())) as [RanX],
RAND(CHECKSUM(newid())) as [RanXz],
RAND(CHECKSUM(newid())) as [RanY],
RAND(CHECKSUM(newid())) as [RanYz]
from [AddressAreas] as A1
) as F1

以上の作業により、DatasetSFPのポイント1193点がDatasetSFPcの1255点まで減らされた。


CSRの帰無仮設を棄却する検定手順(2)G関数とG統計量

f:id:ttcrossroads09:20181025142629p:plain

 

古谷(2009)*1参照:

任意の地点からの最近隣距離の分布を計測することにより、G統計量が得られる。ある地点iから他の地点j(≠i)との距離のうち、最小となる組み合わせ(=最近隣距離)をdijとし、dijrとなる地点の数をN(dij;dijr,∀i)と書くことにする。このとき、G統計量を得るためのG関数は次式のように書くことができる。

f:id:ttcrossroads09:20181023220411p:plain

点過程が完全ランダムであるとき、G統計量は次式のように表わされる。

f:id:ttcrossroads09:20181025145341p:plain

CSRモンテカルロ・シミュェーション


> library(lattice)
> envSagaFukuoka <- envelope(as(pppSagaFukuoka,"ppp"), fun = Gest, r=r, nrank=2, nsim=99)
Generating 99 simulations of CSR  ...
1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48,
49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96,
97, 98,  99.

Done.
> envFukuokaChikushino <- envelope(as(pppFukuokaChikushino,"ppp"), fun = Gest, r=r, nrank=2, nsim=99)
Generating 99 simulations of CSR  ...
1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48,
49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96,
97, 98,  99.

Done.
> envChuoHakata <- envelope(as(pppChuoHakata,"ppp"), fun = Gest, r=r, nrank=2, nsim=99)
Generating 99 simulations of CSR  ...
1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48,
49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96,
97, 98,  99.

Done.
> envKasuga <- envelope(as(pppKasuga,"ppp"), fun = Gest, r=r, nrank=2, nsim=99)
Generating 99 simulations of CSR  ...
1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48,
49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96,
97, 98,  99.

Done.
> Gresults <- rbind(envSagaFukuoka, envFukuokaChikushino, envChuoHakata,envKasuga )
> Gresults <- cbind(Gresults, DATASET = 
+ rep(c("Saga-Fukuoka Prefs", "Fukuoka-Chikushino Cities","Chuo-Hakata Wards","Kasuga"), each = length(r)))
> png(file="Gest-Saga-Fukuoka.png", width=600, height=480)
> print(xyplot(obs~theo|y , data=Gresults, type="l", 
+ xlab = "theoretical", ylab = "observed",
+ panel=function(x, y, subscripts) {
+    lpolygon(c(x, rev(x)), 
+    c(Gresults$lo[subscripts], rev(Gresults$hi[subscripts])),
+    border="gray", col="gray"
+ )
+ llines(x, y, col="black", lwd=2)
+ }))
> dev.off()

観察

春日市以外のデータはCSRの帰無仮設を強く棄却し、集中パターンがはっきり判別される。しかし、佐賀県‐福岡県全域や福岡市‐筑紫野市全域、や福岡市中央区博多区にはそれらの人口分布も不均一であり、集中パターンがはっきり表わされる。しかし、(わざわざ選べた)春日市のデータはCSRが棄却さらず、均一な人口分布の場合、意匠登録者の分布がランドムである可能性が残される。意匠登録者の分布は人口分布上のランドム性検証が必要であろう。

CSRの帰無仮設を棄却する検定手順(1)背景と分析地区

f:id:ttcrossroads09:20181023185847p:plain

  1. 背景

    点過程データを分析する際、その最初のステップとして、CSR(Complete Spatial Randomness)という帰無仮設を置き、最近隣距離法若しくは法格法を用いて、その仮設を棄却する確率を算出する。*1*2ここでは、Rのspatstatというパッケージ*3を用いて、佐賀県と福岡県の意匠登録者の空間点過程データをBivand, Pebesma, Gómez-Rubio (2008)が説明するDiggle(2003) の例に従って、分析する。

  2. 分析地区

    spパッケージのSpatialPointsオブジェクトに対して、spatstatがpppオブジェクトを利用するため、spatstatの機能を利用するようにspSagaFukuokaの地区を抽出した後、pppオブジェクトに変換しなければならない。

    • 佐賀県と福岡県の全地区(pppSagaFukuoka)

      
      > ## Bivand, Pebesma, Gómez-Rubio (2008)pp156-158
      > library(maptools)
      > summary(spSagaFukuoka)
      Object of class SpatialPoints
      Coordinates:
              min       max
      x 129.81595 131.11875
      y  33.00453  33.95653
      Is projected: FALSE 
      proj4string : [+proj=longlat +ellps=WGS84]
      Number of points: 1193
      > library(spatstat)
      > ## convert to unit square
      > spSagaFukuokaSQ <- elide(spSagaFukuoka, scale=TRUE, unitsq = TRUE)
      > summary(spSagaFukuokaSQ)
      Object of class SpatialPoints
      Coordinates:
           min max
      [1,]   0   1
      [2,]   0   1
      Is projected: NA 
      proj4string : [NA]
      Number of points: 1193
      > pppSagaFukuoka <- as( spSagaFukuokaSQ, "ppp")
      > summary(pppSagaFukuoka)
      Planar point pattern:  1193 points
      Average intensity 1193 points per square unit
      
      *Pattern contains duplicated points*
      
      Coordinates are given to 8 decimal places
      
      Window: rectangle = [0, 1] x [0, 1] units
      Window area = 1 square unit
      
    • 福岡市―筑紫野市(pppFukuokaChikushino)

      
      > ## done in earlier session
      > llCRS <- CRS("+proj=longlat +ellps=WGS84")
      > ## coordinates
      > Sr1 = Polygon(cbind(
      + c(130.191354,130.626400,130.626400,130.191354, 130.191354),
      + c(33.718652,33.718652,33.423697,33.423697,33.718652)
      + ))
      > Srs1 = Polygons(list(Sr1), "bbFukuokaChikushino")
      > spbbFukuokaChikushino = SpatialPolygons(list(Srs1), 1:1, proj4string = llCRS)
      > summary(spbbFukuokaChikushino)
      Object of class SpatialPolygons
      Coordinates:
             min       max
      x 130.1914 130.62640
      y  33.4237  33.71865
      Is projected: FALSE 
      proj4string : [+proj=longlat +ellps=WGS84]
      > spFukuokaChikushino <- spSagaFukuoka[spbbFukuokaChikushino,]
      > summary(spFukuokaChikushino)
      Object of class SpatialPoints
      Coordinates:
              min       max
      x 130.19690 130.58931
      y  33.42709  33.71665
      Is projected: FALSE 
      proj4string : [+proj=longlat +ellps=WGS84]
      Number of points: 566
      >
      

      f:id:ttcrossroads09:20181023174655p:plain

      
      > ## convert to unit square
      > plot(spFukuokaChikushino, pch=1)
      > spFCSQ <- elide(spFukuokaChikushino, scale=TRUE, unitsq = TRUE)
      > summary(spFCSQ)
      Object of class SpatialPoints
      Coordinates:
           min max
      [1,]   0   1
      [2,]   0   1
      Is projected: NA 
      proj4string : [NA]
      Number of points: 566
      > pppFukuokaChikushino <- as(spFCSQ, "ppp")
      > summary( pppFukuokaChikushino)
      Planar point pattern:  566 points
      Average intensity 566 points per square unit
      
      *Pattern contains duplicated points*
      
      Coordinates are given to 8 decimal places
      
      Window: rectangle = [0, 1] x [0, 1] units
      Window area = 1 square unit
      > png(file="pppFukuokaChikushino.png", width=600, height=480)
      > plot( pppFukuokaChikushino, pch=1)
      > dev.off()
         
      

      f:id:ttcrossroads09:20181023174505p:plain

    • 福岡市の中央区博多区(pppChuoHakata)

      
      > ########## ChuoHakata 
      > Sr2 = Polygon(cbind(
      + c(130.354992,130.486107,130.486107,130.354992, 130.354992),
      + c(33.613987,33.613987,33.535556,33.535556,33.613987)
      + ))
      > Srs2 = Polygons(list(Sr2), "bbChuoHakata")
      > spbbChuoHakata = SpatialPolygons(list(Srs2), 1:1, proj4string = llCRS)
      > summary(spbbChuoHakata)
      Object of class SpatialPolygons
      Coordinates:
              min       max
      x 130.35499 130.48611
      y  33.53556  33.61399
      Is projected: FALSE 
      proj4string : [+proj=longlat +ellps=WGS84]
      > spChuoHakata <- spSagaFukuoka[spbbChuoHakata,]
      > summary(spChuoHakata)
      Object of class SpatialPoints
      Coordinates:
              min       max
      x 130.35518 130.48578
      y  33.53611  33.61334
      Is projected: FALSE 
      proj4string : [+proj=longlat +ellps=WGS84]
      Number of points: 325
      >
      

      f:id:ttcrossroads09:20181023185724p:plain

      
      > ## convert to unit square
      > spCHSQ <- elide(spChuoHakata, scale=TRUE, unitsq = TRUE)
      > summary(spCHSQ)
      Object of class SpatialPoints
      Coordinates:
           min max
      [1,]   0   1
      [2,]   0   1
      Is projected: NA 
      proj4string : [NA]
      Number of points: 325
      > pppChuoHakata <- as(spCHSQ, "ppp")
      > summary(pppChuoHakata)
      Planar point pattern:  325 points
      Average intensity 325 points per square unit
      
      *Pattern contains duplicated points*
      
      Coordinates are given to 8 decimal places
      
      Window: rectangle = [0, 1] x [0, 1] units
      Window area = 1 square unit
      
      

      f:id:ttcrossroads09:20181023185847p:plain

    • 春日市(pppKasuga)

      
      > ## Earlier Saga-Fukuoka, Fukuoka-Chikushino Cities, Chuo-Hakata Wards 
      > ## subsets show high degrees of aggregation. But this is to be expected 
      > ## from terrain and population. This subset is from an area of Kasuga City  
      > ## Chikushino cities that has had a lot of planned development with 
      > ## that are newer developments with large areas of single family dwellings.
      > ## 33.556279, 130.481984
      > ## 33.516162, 130.409705
      > latNE = 33.556279
      > longNE = 130.481984
      > latSW = 33.516162
      > longSW = 130.409705
      > Sr1 = Polygon(cbind(
      + c(longNE ,longNE ,longSW ,longSW , longNE ),
      + c(latNE,latSW ,latSW ,latNE,latNE)
      + ))
      > Srs1 = Polygons(list(Sr1), "bbKasuga")
      > spbbKasuga = SpatialPolygons(list(Srs1), 1:1, proj4string = llCRS)
      > summary(spbbKasuga)
      Object of class SpatialPolygons
      Coordinates:
              min       max
      x 130.40971 130.48198
      y  33.51616  33.55628
      Is projected: FALSE 
      proj4string : [+proj=longlat +ellps=WGS84]
      > spKasuga <- spSagaFukuoka[spbbKasuga,]
      > summary(spKasuga)
      Object of class SpatialPoints
      Coordinates:
              min      max
      x 130.40993 130.4798
      y  33.51632  33.5561
      Is projected: FALSE 
      proj4string : [+proj=longlat +ellps=WGS84]
      Number of points: 48
      >
      

      f:id:ttcrossroads09:20181025150725p:plain

      
      > ## convert to unit square
      > spKasugaSQ <- elide(spKasuga, scale=TRUE, unitsq = TRUE)
      > summary(spKasugaSQ)
      Object of class SpatialPoints
      Coordinates:
           min max
      [1,]   0   1
      [2,]   0   1
      Is projected: NA 
      proj4string : [NA]
      Number of points: 48
      > 
      > pppKasuga <- as(spKasugaSQ, "ppp")
      > summary(pppKasuga)
      Planar point pattern:  48 points
      Average intensity 48 points per square unit
      
      *Pattern contains duplicated points*
      
      Coordinates are given to 8 decimal places
      
      Window: rectangle = [0, 1] x [0, 1] units
      Window area = 1 square unit    
      

      f:id:ttcrossroads09:20181025150750p:plain

福岡市中心における意匠の登録者

f:id:ttcrossroads09:20181011172242p:plain

福岡市付近における意匠の登録者の続きです。

 


## use extents
# Change these parameters
scale.parameter = 0.1  # scaling parameter. less than 1 is zooming in, more than 1 zooming out. 
xshift = -0.05  # Shift to right in map units. 
yshift = 0.1  # Shift to left in map units. 
original.bbox = spSagaFukuoka@bbox  # Pass bbox of your Spatial* Object. 

# Just copy-paste the following
edges = original.bbox

edges[1, ] <- (edges[1, ] - mean(edges[1, ])) * scale.parameter + mean(edges[1, 
    ]) + xshift
edges[2, ] <- (edges[2, ] - mean(edges[2, ])) * scale.parameter + mean(edges[2, 
    ]) + yshift

png(file="DesignRegistrantsFukuokaCityArea.png", width=600, height=480)
plot(spSagaFukuoka, axes=TRUE, pch=1,xlim = edges[1, ], ylim = edges[2, ],
main="Design Registrants in Fukuoka City Area, 2001-2017" )
plot(saga, add=TRUE,xlim = edges[1, ], ylim = edges[2, ], border="red")
plot(fukuoka, add=TRUE,xlim = edges[1, ], ylim = edges[2, ], border="blue")
dev.off()