SlideShare a Scribd company logo
1 of 26
Download to read offline
ラーメン屋さんになりたい
-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)小地域ごとの人口でコロプレス描画
①データ準備
各小地域ごとのポリゴン内の代表点を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で学ぶデータサイエンス 地理空間データ分析 谷村 晋 著

More Related Content

Featured

How Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthHow Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental Health
ThinkNow
 
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)

2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by Hubspot2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by Hubspot
 
Everything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPTEverything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPT
 
Product Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage EngineeringsProduct Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage Engineerings
 
How Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthHow Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental Health
 
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfAI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
 
Skeleton Culture Code
Skeleton Culture CodeSkeleton Culture Code
Skeleton Culture Code
 
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...
 

Sappo ro#6資料2 ー完全版ー