SlideShare a Scribd company logo
1 of 26
ラーメン屋さんにな
りたい
-Locational Analysis with R-
SappoRo.R#6
@WAFdata
自己紹介
http://wafdata.hatenablog.com/
@WAFdata
@WAFdata_kudo
Rとお寿司とらーめn|
ラーメン、美味しい。し
あわせ。
私も人を幸せにしたいので、
ラーメン屋さんになる方法について考え
てみました。
~ラーメン屋さんへの道~
☑ 店の名前
☑ 初期投資、資金計画
☑ 立地計画
・札幌市中央区
・人が集まりやすい所
☑ メニュー
・醤油 ・味噌
・塩 ・豚骨
~ラーメン屋さんへの道~
☑ 店の名前
☑ 初期投資、資金計画
☑ 立地計画
・札幌市中央区
・人が集まりやすい所
☑ メニュー
・醤油 ・味噌
・塩 ・豚骨
𝑚𝑖𝑛
𝑖−1
𝑛
𝑗−1
𝑛
𝑎𝑖 𝐼𝑖𝑗 𝑑𝑖𝑗
𝑗=1
𝑛
𝐼𝑖𝑗 = 1 𝑖 = 1, … , 𝑛
𝑗=1
𝑛
𝐼𝐽𝐽 = 𝑝
𝐼𝑖𝑗 ≤ 𝐼𝑗𝑗 𝑖 ≠j
S.t)
-立地分析におけるp-メディアン問題-
需要地点から施設立地点までの移動費用の総和を最小にすることを考える。
→今回は需要地点=各世帯、施設=ラーメン屋
P個の施設数のメディアン(総移動距離最小地点)を求めるとき
𝑎𝑖 = 地点iの需要
𝑑𝑖𝑗 = 地点iとjの移動コスト(距離)
I𝑖𝑗 = 地点iからjへの需要有無(1,0) とすると
出店したいラーメン屋は1つなので p=1のMinSum問題に帰結。
世帯A
N=1
世帯B
N=3
世帯D
N=5
世帯C
N=8
札幌市中央区にこのように世帯が配置されているとし
ます。
世帯A
N=1
世帯B
N=3
世帯D
N=5
世帯C
N=8
各世帯から距離(𝑑𝑖𝑗)が最小となる点がここだとすると…..
→この位置だと西側の需要(=世帯人口)を反映できていない
世帯A
N=1
世帯B
N=3
世帯D
N=5
世帯C
N=8
各地点を世帯人数(𝑎𝑖)で重み付けられた距離の総和を最小にする
と…
→ここにラーメン屋を出せばいいよね!
これをRでやる
①データ準備
札幌市中央区の小地域shapefile
1)SpatialPolygonDataframeとして読み込み
2)小地域ごとの人口でコロプレス描画
※H22年国勢調査(小地域)
http://e-stat.go.jp/SG2/eStatGIS/page/download.html>
①データ準備
各小地域ごとのポリゴン内の代表点をcoordinates関数により抽出し、座標をデータ
に格納
①データ準備
この点ひとつひとつを世帯と考え、各小地域の人口を世帯人数と読み替えて考えま
す。
②立地分析
{orloca}パッケージを使ってMinSum問題を解きます。
loca<-loca.p( x=Chuo.dc$X_cen, y=Chuo.dc$Y_CEN, w=Chuo.dc$JINKO)
各世帯の座標 重み付け(世帯人口)
1) loca.pクラスオブジェクトを作成
Point<- zsummin(loca)
2) zsummin関数で重み付き距離の総和が最小となる点を算出
loca.pクラスオブジェクト
結果) ラーメン屋さん座標
③可視化
各世帯から、ラーメン屋さんに向かって矢印を引く
③可視化
各世帯から、ラーメン屋さんに向かって矢印を引く
③可視化
{leaflet}パッケージで見やすい地図を描いてみる
小地域ポリゴン → 中央区全体で一つのポリゴンに統合
③可視化
結果をとりまとめて
各世帯→ラーメン屋の
線を引く
Popupも付けちゃう
③可視化
④寄ってみる
④寄ってみる
そんな完璧な立地に先客が。
奥○商店………
スープカレーにはかなわない。
Enjoy!!
<参考文献>
◎ Rで学ぶデータサイエンス 地理空間データ分析 谷村 晋 著
<データ>
◎H22年国勢調査(小地域)
http://e-stat.go.jp/SG2/eStatGIS/page/download.html

More Related Content

Featured

Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie Insights
Kurio // The Social Media Age(ncy)
 

Featured (20)

PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024
 
Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)
 
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie Insights
 
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024
 
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary
 
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd
 
Getting into the tech field. what next
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next
 
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentGoogle's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search Intent
 
How to have difficult conversations
How to have difficult conversations How to have difficult conversations
How to have difficult conversations
 
Introduction to Data Science
Introduction to Data ScienceIntroduction to Data Science
Introduction to Data Science
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best Practices
 
The six step guide to practical project management
The six step guide to practical project managementThe six step guide to practical project management
The six step guide to practical project management
 
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
 
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
 
12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at Work12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at Work
 
ChatGPT webinar slides
ChatGPT webinar slidesChatGPT webinar slides
ChatGPT webinar slides
 
More than Just Lines on a Map: Best Practices for U.S Bike Routes
More than Just Lines on a Map: Best Practices for U.S Bike RoutesMore than Just Lines on a Map: Best Practices for U.S Bike Routes
More than Just Lines on a Map: Best Practices for U.S Bike Routes
 
Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...
Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...
Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...
 
Barbie - Brand Strategy Presentation
Barbie - Brand Strategy PresentationBarbie - Brand Strategy Presentation
Barbie - Brand Strategy Presentation
 

SappoRoR#6_Rとleafletと立地分析