SlideShare a Scribd company logo
1 of 49
Download to read offline
本の紹介: 通称「緑本」
@tnoda_
Kobe.R #18
<2015-05-16 Sat>
背景
背景
Kobe.R の印象(参加前)
背景
Kobe.R の印象(参加前)
• R 専門家が自慢の業を競い合う場
背景
Kobe.R の印象(参加前)
• R 専門家が自慢の業を競い合う場
• きびしい勉強会
背景
Kobe.R の印象(参加前)
• R 専門家が自慢の業を競い合う場
• きびしい勉強会
• こわそう
背景
Kobe.R の印象(参加前)
• R 専門家が自慢の業を競い合う場
• きびしい勉強会
• こわそう
背景
Kobe.R の印象(参加前)
• R 専門家が自慢の業を競い合う場
• きびしい勉強会
• こわそう
Kobe.R の印象(参加後)
背景
Kobe.R の印象(参加前)
• R 専門家が自慢の業を競い合う場
• きびしい勉強会
• こわそう
Kobe.R の印象(参加後)
• そんなことはなかった
背景
Kobe.R の印象(参加前)
• R 専門家が自慢の業を競い合う場
• きびしい勉強会
• こわそう
Kobe.R の印象(参加後)
• そんなことはなかった
• 以外と「どうしていいのか分からない人」が多い
背景
Kobe.R の印象(参加前)
• R 専門家が自慢の業を競い合う場
• きびしい勉強会
• こわそう
Kobe.R の印象(参加後)
• そんなことはなかった
• 以外と「どうしていいのか分からない人」が多い
• R の使い方に困っているわけではない
背景
Kobe.R の印象(参加前)
• R 専門家が自慢の業を競い合う場
• きびしい勉強会
• こわそう
Kobe.R の印象(参加後)
• そんなことはなかった
• 以外と「どうしていいのか分からない人」が多い
• R の使い方に困っているわけではない
• 手法の選択に困っている
背景
Kobe.R の印象(参加前)
• R 専門家が自慢の業を競い合う場
• きびしい勉強会
• こわそう
Kobe.R の印象(参加後)
• そんなことはなかった
• 以外と「どうしていいのか分からない人」が多い
• R の使い方に困っているわけではない
• 手法の選択に困っている
• e.g. 弁当屋の販売数予測
通称「緑本」
通称「緑本」
• 著者
• 久保拓也(北大)
• ウミガメ上陸数のベイズ統計モデリ
ング
• エゾアカヤマアリ敵対性実験の統計モ
デリング
• タイトル
• データ解析のための統計モデリング入
門 — 一般化線形モデル・階層ベイズモ
デル・MCMC (確率と情報の科学)
• 出版社
• 岩波書店
• ISBN
• 978-4-00-006973-1
• 定価
• 本体 3,800 円 + 税
Outline
緑本の概要
• 本書が解説している範囲
• おすすめポイント
• 対象読者
緑本が解説している内容
• モデル選択の基本と GLM まで
• (GLMM 以降は次回以降に)
本書の対象範囲 (1)
本書の対象範囲 (1)
本書の対象範囲 (2)
おすすめポイント
おすすめポイント
学部生向け
• 高校数学
• 統計の初歩
おすすめポイント
学部生向け
• 高校数学
• 統計の初歩
例が身近
• 架空の植物
• 特定分野の知識不要
おすすめポイント
学部生向け
• 高校数学
• 統計の初歩
例が身近
• 架空の植物
• 特定分野の知識不要
R の実例
• 本書で使用するデータはダウンロード可
• 自分で試してみることができる
Checkpoint 1
Checkpoint 1
緑本はこんな人におすすめ
• 直線番長
• モデリングしたいけど何から勉強していいか分からない
特徴
• 線形モデルの発展からベイズ化へ
• R による実例・再現が容易
Checkpoint 1
緑本はこんな人におすすめ
• 直線番長
• モデリングしたいけど何から勉強していいか分からない
特徴
• 線形モデルの発展からベイズ化へ
• R による実例・再現が容易
ではない
• 統計を学ぶために最初に手に取る
• R プログラミングを学びたい
統計モデリングとは?
統計モデリングとは?
確率分布を選ぶ
離散か連続か
• ポアソン分布・二項分布
• 正規分布・ガンマ分布
範囲
• 0 以上、上限とくになし
• {0, ..., N}
分散と平均との関係
• 分散 ≈ 平均
• 分散は平均の関数
パラメータを推定する
ポワソン分布
p(y|λ) =
λy exp(−λ)
y!
(1)
• 平均が λ であるときにポワソン分布に従う確率変数の値が y
となる確率
パラメータを推定する
ポワソン分布
p(y|λ) =
λy exp(−λ)
y!
(1)
• 平均が λ であるときにポワソン分布に従う確率変数の値が y
となる確率
ポワソン分布のパラメータ
平均 λ が唯一のパラメータ
一般化線形モデル
種子数 y がポワソン分布に従う架空植物の例
• 平均 λ
• 説明変数 xi ( x1i , x2i , . . . )
• たとえば、植物の大きさ、施肥処理したかどうか、など
• 応答変数 y は平均 λ のポワソン分布に従う
• すなわち、「ある個体 i の平均種子数が λi 」
一般化線形モデルの二つの特徴
logλi = β0 + β1x1i + β2x2i + · · · (2)
• 左辺の log . . . リンク関数
• 右辺 . . . 線形予測子
リンク関数と線形予測子
logλi = β0 + β1x1i + β2x2i + · · · (3)
なぜ log をとるの?
• 右辺の線形予測子が負になっても λ は負にならない
• わかりやすい(和→積)、計算しやすい(積→和)
パラメータ推定
• λ の推定 → β0, β1, · · · の推定
• 最尤推定値を探せばよい
最尤推定
最尤推定
緑本の展開
• きちんと尤度の説明から対数尤度の最大化まで式を導出しな
がら解説
最尤推定
緑本の展開
• きちんと尤度の説明から対数尤度の最大化まで式を導出しな
がら解説
実務的には
• R の glm 関数におまかせ
• 標準でついてきます
• くわしくは help(glm)
> fit <- glm(y ~ x, data = d, family = poisson)
リンク関数を指定しなければ glm 関数が正準リンク関数として対
数リンク関数(デフォルト)を使用
モデルのあてはまりのよさ
観測されたデータを全て説明変数に使えばよい?
logλi = β0 + β1x1i + β2x2i + · · · (4)
logλi = β0 + β1x1i (5)
モデルのあてはまりのよさ
観測されたデータを全て説明変数に使えばよい?
logλi = β0 + β1x1i + β2x2i + · · · (4)
logλi = β0 + β1x1i (5)
緑本の展開
最大対数尤度 → 逸脱度 (deviance) → AIC
モデルのあてはまりのよさ
観測されたデータを全て説明変数に使えばよい?
logλi = β0 + β1x1i + β2x2i + · · · (4)
logλi = β0 + β1x1i (5)
緑本の展開
最大対数尤度 → 逸脱度 (deviance) → AIC
実務的には
• R の MASS パッケージの stepAIC 関数(緑本 6 章)
• いい感じに AIC 最小のモデルを選択してくれる
Checkpoint 2
GLM
• 確率分布を選んでモデルを推定
• リンク関数と線形予測子
• モデルのあてはまりの良さ (AIC)
実務的には
• R の glm 関数
• R の MASS パッケージの stepAIC 関数
緑本の対応範囲
第 1 章から第 4 章まで(一部第 6 章)
おわりに
緑本の紹介
入門向けに線形モデルからベイズ化までの学習に最適
おわりに
緑本の紹介
入門向けに線形モデルからベイズ化までの学習に最適
(仮)緑本快速輪講
• 緑本 5 章以降を速いペースで読んでいきます
おわりに
緑本の紹介
入門向けに線形モデルからベイズ化までの学習に最適
(仮)緑本快速輪講
• 緑本 5 章以降を速いペースで読んでいきます
• 2 章 / 週、 担当 2 名 / 週
おわりに
緑本の紹介
入門向けに線形モデルからベイズ化までの学習に最適
(仮)緑本快速輪講
• 緑本 5 章以降を速いペースで読んでいきます
• 2 章 / 週、 担当 2 名 / 週
• 各週担当者が担当範囲のレジュメを用意して説明
おわりに
緑本の紹介
入門向けに線形モデルからベイズ化までの学習に最適
(仮)緑本快速輪講
• 緑本 5 章以降を速いペースで読んでいきます
• 2 章 / 週、 担当 2 名 / 週
• 各週担当者が担当範囲のレジュメを用意して説明
• 参加者が集まりそうなら開催するかも
おわりに
緑本の紹介
入門向けに線形モデルからベイズ化までの学習に最適
(仮)緑本快速輪講
• 緑本 5 章以降を速いペースで読んでいきます
• 2 章 / 週、 担当 2 名 / 週
• 各週担当者が担当範囲のレジュメを用意して説明
• 参加者が集まりそうなら開催するかも
• 毎週平日夜 1 時間程度を想定
おわりに
緑本の紹介
入門向けに線形モデルからベイズ化までの学習に最適
(仮)緑本快速輪講
• 緑本 5 章以降を速いペースで読んでいきます
• 2 章 / 週、 担当 2 名 / 週
• 各週担当者が担当範囲のレジュメを用意して説明
• 参加者が集まりそうなら開催するかも
• 毎週平日夜 1 時間程度を想定
• 第一回の内容(案)
おわりに
緑本の紹介
入門向けに線形モデルからベイズ化までの学習に最適
(仮)緑本快速輪講
• 緑本 5 章以降を速いペースで読んでいきます
• 2 章 / 週、 担当 2 名 / 週
• 各週担当者が担当範囲のレジュメを用意して説明
• 参加者が集まりそうなら開催するかも
• 毎週平日夜 1 時間程度を想定
• 第一回の内容(案)
• 第 4 章までのおさらいと疑問の解決
おわりに
緑本の紹介
入門向けに線形モデルからベイズ化までの学習に最適
(仮)緑本快速輪講
• 緑本 5 章以降を速いペースで読んでいきます
• 2 章 / 週、 担当 2 名 / 週
• 各週担当者が担当範囲のレジュメを用意して説明
• 参加者が集まりそうなら開催するかも
• 毎週平日夜 1 時間程度を想定
• 第一回の内容(案)
• 第 4 章までのおさらいと疑問の解決
• 第 5 章

More Related Content

Featured

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 HubspotMarius Sescu
 
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 ChatGPTExpeed Software
 
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 EngineeringsPixeldarts
 
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 HealthThinkNow
 
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.pdfmarketingartwork
 
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 2024Neil Kimberley
 
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)contently
 
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 2024Albert Qian
 
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 InsightsKurio // The Social Media Age(ncy)
 
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 2024Search Engine Journal
 
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 summarySpeakerHub
 
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 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 Tessa Mero
 
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 IntentLily Ray
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best PracticesVit Horky
 
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 managementMindGenius
 
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...RachelPearson36
 

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...
 

Kobe.R #18: 本の紹介: 通称「緑本」