Kruschke, J. K. and Liddell, T. M. (2018). The bayesian
new statistics: Hypothesis testing, estimation, meta-
analysis, and power analysis from a bayesian perspec-
tive. Psychonomic Bulletin & Review, 25(1):178–206.
Lavine, M. and Schervish, M. J. (1999). Bayes factors:
What they are and what they are not. The American
Statistician, 53(2):119–122.
Lee, M. D. and Wagenmakers, E.-J. (2014). Bayesian cog-
nitive modeling: A practical course. Cambridge uni-
versity press.
Lin, J. (1991). Divergence measures based on the shannon
entropy. IEEE Transactions on Information Theory,
37(1):145–151.
Meurer, A., Smith, C. P., Paprocki, M.,
ˇ
Cert
´
ık, O., Kir-
pichev, S. B., Rocklin, M., Kumar, A., Ivanov, S.,
Moore, J. K., Singh, S., Rathnayake, T., Vig, S.,
Granger, B. E., Muller, R. P., Bonazzi, F., Gupta, H.,
Vats, S., Johansson, F., Pedregosa, F., Curry, M. J.,
Terrel, A. R., Rou
ˇ
cka, v., Saboo, A., Fernando, I., Ku-
lal, S., Cimrman, R., and Scopatz, A. (2017). Sympy:
symbolic computing in python. PeerJ Computer Sci-
ence, 3:e103.
Morey, R. D. and Rouder, J. N. (2018). BAYESFACTOR:
computation of bayes factors for common designs. r
package version 0.9.12-4.2. http://CRAN.R-project.
org/package=BayesFactor.
Welch, B. L. (1938). The significance of the difference be-
tween two means when the population variances are
unequal. Biometrika, 29(3/4):350–362.
APPENDIX
Code
The following Python code implements the compari-
son sketched on Figure 2.
import numpy a s np
from m a t p l o t l i b import p y p l o t a s p l t
H=lambda p , q:−p ∗np . l o g ( q)−(1−p ) ∗ np . l o g (1−q )
KL=lambda p , q :H( p , q)−H( p , p )
JS=lambda p , q : ( KL( p , ( p+q ) / 2 ) + KL( q , ( p+q ) / 2 ) ) / 2
Welch=lambda p , q : ( p−q ) / np . s q r t ( p∗(1 −p )+ q∗(1 −q ) )
r b a y e s = lambda p , q : np . l o g ( 1 0 ) / ( 2 ∗ JS ( p , q ) )
r f r e q = lambda p , q : 1 . 9 ∗∗2 ∗Welch ( p , q )∗∗( −2)
p= np . l i n s p a c e ( 0 , 0 . 5 , 2 0 1 )
d e l t a = 0 . 1
q= p ∗(1+ d e l t a )
p l t . f i g u r e ( f i g s i z e = ( 1 2 , 6 ) )
p l t . p l o t ( r b a y e s ( p , q ) , \
l a b e l = ’ b a y e s i a n ( JS ) ’ )
p l t . p l o t ( r f r e q ( p , q ) , \
l a b e l = ’ f r e q u e n t i o n i s t s ( Welch−t ) ’ )
p l t . y s c a l e ( ’ l o g ’ )
p l t . x t i c k s ( np . a r a n g e ( 0 , 2 0 1 , 1 0 ) , \
np . l i n s p a c e ( 0 , 0 . 5 , 2 1 ) . round ( 3 ) )
p l t . l e g e n d ( )
p l t . y l a b e l ( ’ sa m p l e s ’ )
p l t . x l a b e l ( ’ b a s e l i n e p ’ )
p l t . show ( )
Proof of Lemma 3
Below we compute the formula in Claim 3
import sympy
p , q , d = sympy . s y m bo l s ( r ’ p q d ’ )
# d e f i n e JS and Welch ’ s t
wel c h = ( p−q ) ∗∗2 / ( p∗(1−p ) + q∗(1−q ) )
H = −p ∗sympy . l o g ( p)−(1−p ) ∗sympy . l o g (1−p )
JS = H . s u b s ( p , ( p+q ) / 2 ) − 1 / 2 ∗H − 1 / 2 ∗H . s u b s ( p , q )
# s e c o n d d e r i v a t i v e s
o u t 1 = JS . s u b s ( p , q+d ) . d i f f ( d , 2 ) . su b s ( d , p−q )
o u t 2 = wel c h . s u b s ( p , q+d ) . d i f f ( d , 2 ) . s u b s ( d , p−q )
# r a t i o o f s e c o n d d e r i v a t i v e s
( o u t 1 / o u t 2 ) . f a c t o r ( )
o u t
Below we include the code used to derive formu-
las in the proof of Claim 5
import sympy
p , q = sympy . s ym bo l s ( r ’ p q ’ )
U = ( p ∗∗2 − 2∗p∗q − q ∗∗2 + 2∗q )
V = (−2∗p ∗∗3∗q + p ∗∗3 + 3∗p ∗∗2∗q \
+6∗p∗q ∗∗3 − 9∗p ∗q ∗∗2 − 3∗q ∗∗3 + 4∗q ∗∗2 )
(U∗p ∗(1−p ) −1/2 ∗V ) . f a c t o r ( )
The following piece of code is used to validate the
claim about the global minimum at δ = 0, the end of
the proof of Lemma 3
import sympy
wel c h = ( p−q ) ∗∗2 / ( p∗(1−p ) + q∗(1−q ) )
H = −p ∗sympy . l o g ( p)−(1−p ) ∗sympy . l o g (1−p )
JS = H . s u b s ( p , ( p+q ) / 2 ) − 1 / 2 ∗H − 1 / 2 ∗H . s u b s ( p , q )
# ou t 1 = JS . s u b s ( p , q+d ) . d i f f ( d , 2 ) . s u b s ( d , p−q )
# ou t 2 = w e l c h . s u b s ( p , q+d ) . d i f f ( d , 2 ) . s u b s ( d , p−q )
# ( o u t 1 / o u t 2 ) . f a c t o r ( )
d e r i v a t i v e = ( JS −1/32∗we lc h ) . s u b s ( p , q+d ) . d i f f ( d , 1 )
d e r i v a t i v e . s u b s ( d , 0 )
The next piece of code evaluates the second
derivative in Lemma 2
H = −p ∗sympy . l o g ( p)−(1−p ) ∗sympy . l o g (1−p )
JS = H . s u b s ( p , ( p+q ) / 2 ) − 1 / 2 ∗H − 1 / 2 ∗H . s u b s ( p , q )
JS . s u b s ( p , q+d ) . d i f f ( d , 2 ) . s u b s ( d , p−q ) . f a c t o r ( )
DATA 2019 - 8th International Conference on Data Science, Technology and Applications
338