Skip to content

Commit

Permalink
add revise
Browse files Browse the repository at this point in the history
  • Loading branch information
yufree committed Jul 4, 2017
1 parent 4866ab6 commit 95d915a
Show file tree
Hide file tree
Showing 35 changed files with 255 additions and 302 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,5 @@
.Rhistory
.RData
.DS_Store
rsconnect
.gitignore
29 changes: 2 additions & 27 deletions 19-ebayes.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,6 @@ $$\frac{a}{b} = \frac{c}{d} = \frac{a+b}{c+d}$$
- 下面用MLB的数据说明,首先提取出球员的击球数据:

```{r MLB}
library(knitr)
library(dplyr)
library(tidyr)
library(Lahman)
Expand Down Expand Up @@ -185,6 +184,7 @@ ggplot(career_eb, aes(average, eb_estimate, color = AB)) +
- 经验贝叶斯会给出一个后验分布,这个分布可以用来求可信区间

```{r ci}
library(broom)
# 给出后验分布
career <- Batting %>%
filter(AB > 0) %>%
Expand Down Expand Up @@ -223,18 +223,6 @@ yankee_1998 <- c("brosisc01", "jeterde01", "knoblch01", "martiti02", "posadjo01"
yankee_1998_career <- career_eb %>%
filter(playerID %in% yankee_1998)
# 展示球员的后验分布
library(broom)
yankee_beta <- yankee_1998_career %>%
inflate(x = seq(.18, .33, .0002)) %>%
ungroup() %>%
mutate(density = dbeta(x, alpha1, beta1))
ggplot(yankee_beta, aes(x, density, color = name)) +
geom_line() +
stat_function(fun = function(x) dbeta(x, alpha0, beta0),
lty = 2, color = "black")
# 提取可信区间
yankee_1998_career <- yankee_1998_career %>%
mutate(low = qbeta(.025, alpha1, beta1),
Expand Down Expand Up @@ -394,20 +382,7 @@ career_eb %>%

- 前面描述的是击球率如何求,如何进行区间估计与多个体的错误率控制,面向的个体或整体,那么如何解决比较问题

- 设想多个球员,我们考虑如何去比较他们击球率

```{r ht}
# 选三个球员
career_eb %>%
filter(name %in% c("Hank Aaron", "Mike Piazza", "Hideki Matsui")) %>%
inflate(x = seq(.26, .33, .00025)) %>%
mutate(density = dbeta(x, alpha1, beta1)) %>%
ggplot(aes(x, density, color = name)) +
geom_line() +
labs(x = "Batting average", color = "")
```

- 如果两个球员击球率的概率密度曲线比较接近,那么即便均值有不同我们也无法进行区分;如果重叠比较少,那么我们有理由认为他们之间的差异显著
- 设想多个球员,我们考虑如何去比较他们击球率。如果两个球员击球率的概率密度曲线比较接近,那么即便均值有不同我们也无法进行区分;如果重叠比较少,那么我们有理由认为他们之间的差异显著

- 贝叶斯视角下如何定量描述这个差异是否显著?

Expand Down
14 changes: 7 additions & 7 deletions _book/-1.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,8 @@
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>Notes</title>
<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
<meta name="description" content="This is notes from yufree">
<meta name="generator" content="bookdown 0.3 and GitBook 2.6.7">
<meta name="generator" content="bookdown 0.4 and GitBook 2.6.7">

<meta property="og:title" content="Notes" />
<meta property="og:type" content="book" />
Expand All @@ -26,7 +25,7 @@
<meta name="author" content="Miao YU">


<meta name="date" content="2017-05-21">
<meta name="date" content="2017-07-04">

<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="apple-mobile-web-app-capable" content="yes">
Expand All @@ -35,7 +34,6 @@

<link rel="prev" href="section-6.html">
<link rel="next" href="section-8.html">

<script src="libs/jquery-2.2.3/jquery.min.js"></script>
<link href="libs/gitbook-2.6.7/css/style.css" rel="stylesheet" />
<link href="libs/gitbook-2.6.7/css/plugin-bookdown.css" rel="stylesheet" />
Expand Down Expand Up @@ -95,6 +93,7 @@
<body>



<div class="book without-animation with-summary font-size-2 font-family-1" data-basepath=".">

<div class="book-summary">
Expand Down Expand Up @@ -1221,8 +1220,9 @@ <h2><span class="header-section-number">7.18</span> 重采样推断</h2>
</div>
</div>
<a href="section-6.html" class="navigation navigation-prev " aria-label="Previous page"><i class="fa fa-angle-left"></i></a>
<a href="section-8.html" class="navigation navigation-next " aria-label="Next page""><i class="fa fa-angle-right"></i></a>

<a href="section-8.html" class="navigation navigation-next " aria-label="Next page"><i class="fa fa-angle-right"></i></a>
</div>
</div>
<script src="libs/gitbook-2.6.7/js/app.min.js"></script>
<script src="libs/gitbook-2.6.7/js/lunr.js"></script>
<script src="libs/gitbook-2.6.7/js/plugin-search.js"></script>
Expand Down Expand Up @@ -1265,7 +1265,7 @@ <h2><span class="header-section-number">7.18</span> 重采样推断</h2>
(function () {
var script = document.createElement("script");
script.type = "text/javascript";
script.src = "https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML";
script.src = "https://cdn.bootcss.com/mathjax/2.7.1/MathJax.js?config=TeX-MML-AM_CHTML";
if (location.protocol !== "file:" && /^https?:/.test(script.src))
script.src = script.src.replace(/^https?:/, '');
document.getElementsByTagName("head")[0].appendChild(script);
Expand Down
Binary file modified _book/Notes_files/figure-html/ci-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified _book/Notes_files/figure-html/ci-2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified _book/Notes_files/figure-html/unnamed-chunk-55-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
16 changes: 8 additions & 8 deletions _book/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,8 @@
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>Notes</title>
<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
<meta name="description" content="This is notes from yufree">
<meta name="generator" content="bookdown 0.3 and GitBook 2.6.7">
<meta name="generator" content="bookdown 0.4 and GitBook 2.6.7">

<meta property="og:title" content="Notes" />
<meta property="og:type" content="book" />
Expand All @@ -26,7 +25,7 @@
<meta name="author" content="Miao YU">


<meta name="date" content="2017-05-21">
<meta name="date" content="2017-07-04">

<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="apple-mobile-web-app-capable" content="yes">
Expand All @@ -35,7 +34,6 @@


<link rel="next" href="section-1.html">

<script src="libs/jquery-2.2.3/jquery.min.js"></script>
<link href="libs/gitbook-2.6.7/css/style.css" rel="stylesheet" />
<link href="libs/gitbook-2.6.7/css/plugin-bookdown.css" rel="stylesheet" />
Expand Down Expand Up @@ -95,6 +93,7 @@
<body>



<div class="book without-animation with-summary font-size-2 font-family-1" data-basepath=".">

<div class="book-summary">
Expand Down Expand Up @@ -713,7 +712,7 @@ <h1>
<div id="header">
<h1 class="title">Notes</h1>
<h4 class="author"><em>Miao YU</em></h4>
<h4 class="date"><em>2017-05-21</em></h4>
<h4 class="date"><em>2017-07-04</em></h4>
</div>
<div id="e7ac94e8aeb0e6a682e8bfb0" class="section level1 unnumbered">
<h1>笔记概述</h1>
Expand Down Expand Up @@ -768,8 +767,9 @@ <h2>笔记目录(已完成)</h2>
</div>
</div>

<a href="section-1.html" class="navigation navigation-next navigation-unique" aria-label="Next page""><i class="fa fa-angle-right"></i></a>

<a href="section-1.html" class="navigation navigation-next navigation-unique" aria-label="Next page"><i class="fa fa-angle-right"></i></a>
</div>
</div>
<script src="libs/gitbook-2.6.7/js/app.min.js"></script>
<script src="libs/gitbook-2.6.7/js/lunr.js"></script>
<script src="libs/gitbook-2.6.7/js/plugin-search.js"></script>
Expand Down Expand Up @@ -812,7 +812,7 @@ <h2>笔记目录(已完成)</h2>
(function () {
var script = document.createElement("script");
script.type = "text/javascript";
script.src = "https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML";
script.src = "https://cdn.bootcss.com/mathjax/2.7.1/MathJax.js?config=TeX-MML-AM_CHTML";
if (location.protocol !== "file:" && /^https?:/.test(script.src))
script.src = script.src.replace(/^https?:/, '');
document.getElementsByTagName("head")[0].appendChild(script);
Expand Down
14 changes: 7 additions & 7 deletions _book/python.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,8 @@
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>Notes</title>
<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
<meta name="description" content="This is notes from yufree">
<meta name="generator" content="bookdown 0.3 and GitBook 2.6.7">
<meta name="generator" content="bookdown 0.4 and GitBook 2.6.7">

<meta property="og:title" content="Notes" />
<meta property="og:type" content="book" />
Expand All @@ -26,7 +25,7 @@
<meta name="author" content="Miao YU">


<meta name="date" content="2017-05-21">
<meta name="date" content="2017-07-04">

<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="apple-mobile-web-app-capable" content="yes">
Expand All @@ -35,7 +34,6 @@

<link rel="prev" href="section-19.html">
<link rel="next" href="section-21.html">

<script src="libs/jquery-2.2.3/jquery.min.js"></script>
<link href="libs/gitbook-2.6.7/css/style.css" rel="stylesheet" />
<link href="libs/gitbook-2.6.7/css/plugin-bookdown.css" rel="stylesheet" />
Expand Down Expand Up @@ -95,6 +93,7 @@
<body>



<div class="book without-animation with-summary font-size-2 font-family-1" data-basepath=".">

<div class="book-summary">
Expand Down Expand Up @@ -850,8 +849,9 @@ <h2><span class="header-section-number">20.7</span> 参考</h2>
</div>
</div>
<a href="section-19.html" class="navigation navigation-prev " aria-label="Previous page"><i class="fa fa-angle-left"></i></a>
<a href="section-21.html" class="navigation navigation-next " aria-label="Next page""><i class="fa fa-angle-right"></i></a>

<a href="section-21.html" class="navigation navigation-next " aria-label="Next page"><i class="fa fa-angle-right"></i></a>
</div>
</div>
<script src="libs/gitbook-2.6.7/js/app.min.js"></script>
<script src="libs/gitbook-2.6.7/js/lunr.js"></script>
<script src="libs/gitbook-2.6.7/js/plugin-search.js"></script>
Expand Down Expand Up @@ -894,7 +894,7 @@ <h2><span class="header-section-number">20.7</span> 参考</h2>
(function () {
var script = document.createElement("script");
script.type = "text/javascript";
script.src = "https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML";
script.src = "https://cdn.bootcss.com/mathjax/2.7.1/MathJax.js?config=TeX-MML-AM_CHTML";
if (location.protocol !== "file:" && /^https?:/.test(script.src))
script.src = script.src.replace(/^https?:/, '');
document.getElementsByTagName("head")[0].appendChild(script);
Expand Down
Loading

0 comments on commit 95d915a

Please sign in to comment.