Download - 「ベータ分布の謎に迫る」第6回 プログラマのための数学勉強会 LT資料
![Page 1: 「ベータ分布の謎に迫る」第6回 プログラマのための数学勉強会 LT資料](https://reader036.vdocuments.site/reader036/viewer/2022062523/58f9a921760da3da068b6b4b/html5/thumbnails/1.jpg)
![Page 4: 「ベータ分布の謎に迫る」第6回 プログラマのための数学勉強会 LT資料](https://reader036.vdocuments.site/reader036/viewer/2022062523/58f9a921760da3da068b6b4b/html5/thumbnails/4.jpg)
![Page 5: 「ベータ分布の謎に迫る」第6回 プログラマのための数学勉強会 LT資料](https://reader036.vdocuments.site/reader036/viewer/2022062523/58f9a921760da3da068b6b4b/html5/thumbnails/5.jpg)
![Page 6: 「ベータ分布の謎に迫る」第6回 プログラマのための数学勉強会 LT資料](https://reader036.vdocuments.site/reader036/viewer/2022062523/58f9a921760da3da068b6b4b/html5/thumbnails/6.jpg)
f(x) =x
↵�1(1� x)��1
B(↵,�)
B(x, y) =
Z 1
0t
x�1(1� t)y�1dt
B(↵,�)
0 x 1
↵
↵+ �
↵�
(↵+ �)2(↵+ � + 1)
x, y > 0,
↵,� > 0,
![Page 9: 「ベータ分布の謎に迫る」第6回 プログラマのための数学勉強会 LT資料](https://reader036.vdocuments.site/reader036/viewer/2022062523/58f9a921760da3da068b6b4b/html5/thumbnails/9.jpg)
![Page 10: 「ベータ分布の謎に迫る」第6回 プログラマのための数学勉強会 LT資料](https://reader036.vdocuments.site/reader036/viewer/2022062523/58f9a921760da3da068b6b4b/html5/thumbnails/10.jpg)
(́・ω・) ん?
(́・ω・) で、どういう事象がこの分布するの?
![Page 11: 「ベータ分布の謎に迫る」第6回 プログラマのための数学勉強会 LT資料](https://reader036.vdocuments.site/reader036/viewer/2022062523/58f9a921760da3da068b6b4b/html5/thumbnails/11.jpg)
![Page 12: 「ベータ分布の謎に迫る」第6回 プログラマのための数学勉強会 LT資料](https://reader036.vdocuments.site/reader036/viewer/2022062523/58f9a921760da3da068b6b4b/html5/thumbnails/12.jpg)
0 x 1
f(p) =p↵�1(1� p)��1
B(↵,�), 0 p 1
0 t 1
B(↵,�) =
Z 1
0p↵�1(1� p)��1dp
![Page 13: 「ベータ分布の謎に迫る」第6回 プログラマのための数学勉強会 LT資料](https://reader036.vdocuments.site/reader036/viewer/2022062523/58f9a921760da3da068b6b4b/html5/thumbnails/13.jpg)
0 x 1
f(p) =p↵�1(1� p)��1
B(↵,�), 0 p 1
0 t 1
B(↵,�) =
Z 1
0p↵�1(1� p)��1dp
![Page 14: 「ベータ分布の謎に迫る」第6回 プログラマのための数学勉強会 LT資料](https://reader036.vdocuments.site/reader036/viewer/2022062523/58f9a921760da3da068b6b4b/html5/thumbnails/14.jpg)
Z 1
0f(p) =
Z 1
0
p↵�1(1� p)��1
B(↵,�)dp
=
Z 1
0p↵�1(1� p)��1dp
1
B(↵,�)
=B(↵,�)
B(↵,�)= 1
![Page 15: 「ベータ分布の謎に迫る」第6回 プログラマのための数学勉強会 LT資料](https://reader036.vdocuments.site/reader036/viewer/2022062523/58f9a921760da3da068b6b4b/html5/thumbnails/15.jpg)
f(p) =p↵�1(1� p)��1
B(↵,�)/ p↵�1(1� p)��1
B(↵,�)
![Page 16: 「ベータ分布の謎に迫る」第6回 プログラマのための数学勉強会 LT資料](https://reader036.vdocuments.site/reader036/viewer/2022062523/58f9a921760da3da068b6b4b/html5/thumbnails/16.jpg)
f(p) =p↵�1(1� p)��1
B(↵,�), 0 p 1
f(p) =p↵�1(1� p)��1
B(↵,�), 0 p 1
![Page 17: 「ベータ分布の謎に迫る」第6回 プログラマのための数学勉強会 LT資料](https://reader036.vdocuments.site/reader036/viewer/2022062523/58f9a921760da3da068b6b4b/html5/thumbnails/17.jpg)
(́・ω・) ん?
f(p) =p↵�1(1� p)��1
B(↵,�), 0 p 1
![Page 18: 「ベータ分布の謎に迫る」第6回 プログラマのための数学勉強会 LT資料](https://reader036.vdocuments.site/reader036/viewer/2022062523/58f9a921760da3da068b6b4b/html5/thumbnails/18.jpg)
(́・ω・) ん?
(́・ω・) よく見るとコイン投げ?
f(p) =p↵�1(1� p)��1
B(↵,�), 0 p 1
![Page 19: 「ベータ分布の謎に迫る」第6回 プログラマのための数学勉強会 LT資料](https://reader036.vdocuments.site/reader036/viewer/2022062523/58f9a921760da3da068b6b4b/html5/thumbnails/19.jpg)
x = 1 x = 0
f(x; p) =
8<
:p if x = 1,
1� p if x = 0.
f(x; p) = p
x(1� p)1�x
, x = {0, 1}
x
p
p
1� p
![Page 20: 「ベータ分布の謎に迫る」第6回 プログラマのための数学勉強会 LT資料](https://reader036.vdocuments.site/reader036/viewer/2022062523/58f9a921760da3da068b6b4b/html5/thumbnails/20.jpg)
f(x1, · · · , xn
; p) =nY
i=1
p
xi(1� p)1�xi, x
i
= {0, 1}
f(x1, · · · , xn; p) = p
a(1� p)b a =nX
i=1
xi, b = n� a
![Page 21: 「ベータ分布の謎に迫る」第6回 プログラマのための数学勉強会 LT資料](https://reader036.vdocuments.site/reader036/viewer/2022062523/58f9a921760da3da068b6b4b/html5/thumbnails/21.jpg)
f(x1, · · · , xn
; p) =nY
i=1
p
xi(1� p)1�xi, x
i
= {0, 1}
f(x1, · · · , xn; p) = p
a(1� p)b a =nX
i=1
xi, b = n� a
f(p) =p↵�1(1� p)��1
B(↵,�)/ p↵�1(1� p)��1
![Page 22: 「ベータ分布の謎に迫る」第6回 プログラマのための数学勉強会 LT資料](https://reader036.vdocuments.site/reader036/viewer/2022062523/58f9a921760da3da068b6b4b/html5/thumbnails/22.jpg)
f(p) = p↵�1(1� p)��1
f(x1, · · · , xn; p) = p
a(1� p)b a =nX
i=1
xi, b = n� a
x1, · · · , xn
🌾
![Page 23: 「ベータ分布の謎に迫る」第6回 プログラマのための数学勉強会 LT資料](https://reader036.vdocuments.site/reader036/viewer/2022062523/58f9a921760da3da068b6b4b/html5/thumbnails/23.jpg)
f(x1, · · · , xn; p) = p
a(1� p)b a =nX
i=1
xi, b = n� a
x1, · · · , xn
🌾
f(p) = p↵�1(1� p)��1
![Page 24: 「ベータ分布の謎に迫る」第6回 プログラマのための数学勉強会 LT資料](https://reader036.vdocuments.site/reader036/viewer/2022062523/58f9a921760da3da068b6b4b/html5/thumbnails/24.jpg)
f(x1, · · · , xn; p) = p
a(1� p)b a =nX
i=1
xi, b = n� a
x1, · · · , xn
🌾
f(p) = p↵�1(1� p)��1
![Page 25: 「ベータ分布の謎に迫る」第6回 プログラマのための数学勉強会 LT資料](https://reader036.vdocuments.site/reader036/viewer/2022062523/58f9a921760da3da068b6b4b/html5/thumbnails/25.jpg)
でもこのpを確率変数とみなしちゃう、 そう、ベイズならね (๑•̀ㅁ•́๑)✧
![Page 26: 「ベータ分布の謎に迫る」第6回 プログラマのための数学勉強会 LT資料](https://reader036.vdocuments.site/reader036/viewer/2022062523/58f9a921760da3da068b6b4b/html5/thumbnails/26.jpg)
< < < < < < < <
< < < < < < < <
![Page 27: 「ベータ分布の謎に迫る」第6回 プログラマのための数学勉強会 LT資料](https://reader036.vdocuments.site/reader036/viewer/2022062523/58f9a921760da3da068b6b4b/html5/thumbnails/27.jpg)
… …
n = i+ j � 1
f(p) =
(n!
(i�1)!(n�i)! pi�1
(1� p)j�1if 0 p 1
0 otherwise
<< < < < <
p ⇠ Unif(0, 1)
![Page 28: 「ベータ分布の謎に迫る」第6回 プログラマのための数学勉強会 LT資料](https://reader036.vdocuments.site/reader036/viewer/2022062523/58f9a921760da3da068b6b4b/html5/thumbnails/28.jpg)
f(p) =
(n!
(i�1)!(n�i)! pi�1
(1� p)j�1if 0 p 1
0 otherwise
… …<< < < < <
i-1個
p ⇠ Unif(0, 1)
![Page 29: 「ベータ分布の謎に迫る」第6回 プログラマのための数学勉強会 LT資料](https://reader036.vdocuments.site/reader036/viewer/2022062523/58f9a921760da3da068b6b4b/html5/thumbnails/29.jpg)
f(p) =
(n!
(i�1)!(n�i)! pi�1
(1� p)j�1if 0 p 1
0 otherwise
… …<< < < < <
i-1個
p ⇠ Unif(0, 1)
![Page 30: 「ベータ分布の謎に迫る」第6回 プログラマのための数学勉強会 LT資料](https://reader036.vdocuments.site/reader036/viewer/2022062523/58f9a921760da3da068b6b4b/html5/thumbnails/30.jpg)
B(a, b) =�(a)�(b)
�(a+ b)�(n+ 1) = n!、
=1
B(i, j)
n = i+ j � 1 ! n� i = j � 1
n!
(i� 1)!(n� i)!=
n!
(j � 1)!(i� 1)!=
�(n+ 1)
�(i)�(j)=
�(i+ j)
�(i)�(j)
![Page 31: 「ベータ分布の謎に迫る」第6回 プログラマのための数学勉強会 LT資料](https://reader036.vdocuments.site/reader036/viewer/2022062523/58f9a921760da3da068b6b4b/html5/thumbnails/31.jpg)
f(p) =
(n!
(i�1)!(j�1)!pi�1
(1� p)j�1if 0 p 1
0 otherwise
=
(1
B(i,j)!pi�1
(1� p)j�1if 0 p 1
0 otherwise
f(p)
🌾
![Page 32: 「ベータ分布の謎に迫る」第6回 プログラマのための数学勉強会 LT資料](https://reader036.vdocuments.site/reader036/viewer/2022062523/58f9a921760da3da068b6b4b/html5/thumbnails/32.jpg)
f(p) =
(n!
(i�1)!(j�1)!pi�1
(1� p)j�1if 0 p 1
0 otherwise
=
(1
B(i,j)!pi�1
(1� p)j�1if 0 p 1
0 otherwise
f(p)
🌾
![Page 33: 「ベータ分布の謎に迫る」第6回 プログラマのための数学勉強会 LT資料](https://reader036.vdocuments.site/reader036/viewer/2022062523/58f9a921760da3da068b6b4b/html5/thumbnails/33.jpg)
@interact(a=(1,15,1), b=(1,15,1)) def draw_norm_dist(a=2, b=2): set_size = a+b-‐1 trial_size = 30000 bin_width = 51
def gen_orderd_unif(size):
unif = rd.rand(size)
unif.sort() return unif
result = [gen_orderd_unif(set_size)[a-‐1] for _ in np.arange(trial_size)]
plt.hist(result, bins=np.linspace(0,1,bin_width))
plt.plot(p, st.beta.pdf(p, a, b)*trial_size/bin_width, c="g", lw=3) plt.show()
![Page 34: 「ベータ分布の謎に迫る」第6回 プログラマのための数学勉強会 LT資料](https://reader036.vdocuments.site/reader036/viewer/2022062523/58f9a921760da3da068b6b4b/html5/thumbnails/34.jpg)
![Page 35: 「ベータ分布の謎に迫る」第6回 プログラマのための数学勉強会 LT資料](https://reader036.vdocuments.site/reader036/viewer/2022062523/58f9a921760da3da068b6b4b/html5/thumbnails/35.jpg)
おわり
![Page 36: 「ベータ分布の謎に迫る」第6回 プログラマのための数学勉強会 LT資料](https://reader036.vdocuments.site/reader036/viewer/2022062523/58f9a921760da3da068b6b4b/html5/thumbnails/36.jpg)
どうしても順序統計量が 気になる人のためのAPPENDIX
![Page 37: 「ベータ分布の謎に迫る」第6回 プログラマのための数学勉強会 LT資料](https://reader036.vdocuments.site/reader036/viewer/2022062523/58f9a921760da3da068b6b4b/html5/thumbnails/37.jpg)
FX(x)
fX(x)
X1, X2, · · · , Xn FX(x) fX(x)
X(1), X(2), · · · , X(n) Xi
X(j), j = 1, 2, · · · , n
fX(j)=
n!
(j � 1)!(n� j)!fX(x)[FX(x)]j�1[1� FX(x)]n�j
1� FX(x)FX(x)
x
fX(x)
i
j
![Page 38: 「ベータ分布の謎に迫る」第6回 プログラマのための数学勉強会 LT資料](https://reader036.vdocuments.site/reader036/viewer/2022062523/58f9a921760da3da068b6b4b/html5/thumbnails/38.jpg)
Y = #{Xj , j = 1, 2, · · · , n|Xj x}
x
Y個
Zj =
(1 if {Xj x}0 otherwise
x
Z4=1Z3=1
Z9=1Z8=1 Z6=1
Z2=1 Z1=0Z5=0
Z7=0
Y =nX
j=1
Zj
![Page 39: 「ベータ分布の謎に迫る」第6回 プログラマのための数学勉強会 LT資料](https://reader036.vdocuments.site/reader036/viewer/2022062523/58f9a921760da3da068b6b4b/html5/thumbnails/39.jpg)
P(Zj = 1) = Pi = FX(x)
1
1O
FX(x)
Xi
Zi
Zi
xP(Zj = 1) = Pi = FX(x)
x
Zi
Pi
![Page 40: 「ベータ分布の謎に迫る」第6回 プログラマのための数学勉強会 LT資料](https://reader036.vdocuments.site/reader036/viewer/2022062523/58f9a921760da3da068b6b4b/html5/thumbnails/40.jpg)
FX(j)(x) = P(Y � j) =
nX
k=j
✓n
k
◆[FX(x)]k[1� FX(x)]n�k
1
FX(x) = P6
x
Y � j
Xi � x
![Page 41: 「ベータ分布の謎に迫る」第6回 プログラマのための数学勉強会 LT資料](https://reader036.vdocuments.site/reader036/viewer/2022062523/58f9a921760da3da068b6b4b/html5/thumbnails/41.jpg)
FX(j)(x) fX(j)
(x)
fX(j)(x) =
dFX(j)(x)
dx
(f · g)0 = f 0g + fg0
=d
dx
nX
k=j
✓n
k
◆[FX(x)]k[1� FX(x)]n�k
[f(g(x))]0 = f
0(g(x))g0(x)
=nX
k=j
✓n
k
◆�kfX(x)[FX(x)]k�1[1� FX(x)]n�k � (n� k)fX(x)[FX(x)]k[1� FX(x)]n�k�1
�
=
✓n
k
◆jfX(x)[FX(x)]j�1[1� FX(x)]n�j
+nX
k=j+1
✓n
k
◆kfX(x)[FX(x)]k�1[1� FX(x)]n�k
�n�1X
k=j
(n� k)fX(x)[FX(x)]k[1� FX(x)]n�k�1
![Page 42: 「ベータ分布の謎に迫る」第6回 プログラマのための数学勉強会 LT資料](https://reader036.vdocuments.site/reader036/viewer/2022062523/58f9a921760da3da068b6b4b/html5/thumbnails/42.jpg)
=n!
(j � 1)!(n� j)!fX(x)[FX(x)]j�1[1� FX(x)]n�j
+n�1X
k=j
✓n
k + 1
◆(k + 1)fX(x)[FX(x)]k[1� FX(x)]n�k�1
�n�1X
k=j
✓n
k
◆(n� k)fX(x)[FX(x)]k[1� FX(x)]n�k�1
=
✓n
k
◆jfX(x)[FX(x)]j�1[1� FX(x)]n�j
+nX
k=j+1
✓n
k
◆kfX(x)[FX(x)]k�1[1� FX(x)]n�k
�n�1X
k=j
✓n
k
◆(n� k)fX(x)[FX(x)]k[1� FX(x)]n�k�1
![Page 43: 「ベータ分布の謎に迫る」第6回 プログラマのための数学勉強会 LT資料](https://reader036.vdocuments.site/reader036/viewer/2022062523/58f9a921760da3da068b6b4b/html5/thumbnails/43.jpg)
=n!
(j � 1)!(n� j)!fX(x)[FX(x)]j�1[1� FX(x)]n�j
+n�1X
k=j
✓n
k + 1
◆(k + 1)fX(x)[FX(x)]k[1� FX(x)]n�k�1
�n�1X
k=j
✓n
k
◆(n� k)fX(x)[FX(x)]k[1� FX(x)]n�k�1
=n!
(j � 1)!(n� j)!fX(x)[FX(x)]j�1[1� FX(x)]n�j
+ fX(x)[FX(x)]k[1� FX(x)]n�k�1
0
@n�1X
k=j
✓n
k + 1
◆(k + 1)�
n�1X
k=j
✓n
k
◆(n� k)
1
A
= 0
✓n
k + 1
◆(k + 1) =
n!
k!(n� k � 1)!=
✓n
k
◆(n� k)
=n!
(j � 1)!(n� j)!fX(x)[FX(x)]j�1[1� FX(x)]n�j
![Page 44: 「ベータ分布の謎に迫る」第6回 プログラマのための数学勉強会 LT資料](https://reader036.vdocuments.site/reader036/viewer/2022062523/58f9a921760da3da068b6b4b/html5/thumbnails/44.jpg)
【証明】(cont.)X1, X2, · · · , Xn
fX(j)(x) =
n!
(j � 1)!(n� j)!fX(x)[FX(x)]j�1[1� FX(x)]n�j
fX(x) =
(1 0 < x < 1
0 otherwise
FX(x) =
8><
>:
0 x 0,
x 0 < x < 1,
1 x � 1
= 1, (0 < x < 1) = x, (0 < x < 1)
fX(j)(x) =
(
0 otherwise
n!
(j � 1)!(n� j)!x
j�1(1� x)n�j, 0 < x < 1
n = j + i� 1 ! n� j = i� 1
! n!
(j � 1)!(i� 1)!x
j�1(1� x)i�1