Approximate Entropy for Testing Randomness.pdf

17

Transcript of Approximate Entropy for Testing Randomness.pdf

  • 5/19/2018 Approximate Entropy for Testing Randomness.pdf

    1/16

    A p p r o x i m a t e E n t r o p y f o r T e s t i n g R a n d o m n e s s

    A n d r e w L . R u k h i n

    A b s t r a c t

    I n t h i s p a p e r a n e w c o n c e p t o f a p p r o x i m a t e e n t r o p y i s m o d i e d

    a n d a p p l i e d t o t h e p r o b l e m o f t e s t i n g f o r r a n d o m n e s s a s t r i n g o f b i -

    n a r y b i t s . T h i s c o n c e p t h a s b e e n i n t r o d u c e d i n a s e r i e s o f p a p e r s

    b y S . P i n c u s a n d c o - a u t h o r s . T h e c o r r e s p o n d i n g s t a t i s t i c i s d e s i g n e d

    t o m e a s u r e t h e d e g r e e o f r a n d o m n e s s o f o b s e r v e d s e q u e n c e s . I t i s

    b a s e d o n i n c r e m e n t a l c o n t r a s t s o f e m p i r i c a l e n t r o p i e s b a s e d o n t h e

    f r e q u e n c i e s o f d i e r e n t p a t t e r n s i n t h e s e q u e n c e . S e q u e n c e s w i t h l a r g e

    a p p r o x i m a t e e n t r o p y m u s t h a v e s u b s t a n t i a l u c t u a t i o n o r i r r e g u l a r i t y .

    A l t e r n a t i v e l y , s m a l l v a l u e s o f t h i s c h a r a c t e r i s t i c i m p l y s t r o n g r e g u l a r -

    i t y , o r l a c k o f r a n d o m n e s s , i n a s e q u e n c e . P i n c u s a n d K a l m a n ( 1 9 9 7 )

    e v a l u a t e d a p p r o x i m a t e e n t r o p i e s f o r b i n a r y a n d d e c i m a l e x p a n s i o n s o f

    e ; ;

    p

    2 a n d

    p

    3 w i t h t h e s u r p r i s i n g c o n c l u s i o n t h a t t h e e x p a n s i o n o f

    p

    3 d e m o n s t r a t e d m u c h m o r e i r r e g u l a r i t y t h a n t h a t o f .

    T r a c t a b l e s m a l l s a m p l e d i s t r i b u t i o n s a r e h a r d l y a v a i l a b l e , a n d t e s t -

    i n g r a n d o m n e s s i s b a s e d , a s a r u l e , o n f a i r l y l o n g s t r i n g s . T h e r e f o r e , t o

    h a v e r i g o r o u s s t a t i s t i c a l t e s t s o f r a n d o m e s s b a s e d o n t h i s a p p r o x i m a t e

    e n t r o p y s t a t i s t i c , o n e n e e d s t h e l i m i t i n g d i s t r i b u t i o n o f t h i s c h a r a c t e r -

    i s t i c u n d e r t h e r a n d o m n e s s a s s u m p t i o n . U n t i l n o w t h i s d i s t r i b u t i o n

    r e m a i n e d u n k n o w n a n d w a s t h o u g h t t o b e d i c u l t t o o b t a i n .

    T h e k e y s t e p l e a d i n g t o t h e l i m i t i n g d i s t r i b u t i o n o f a p p r o x i m a t e

    e n t r o p y i s a m o d i c a t i o n o f i t s d e n i t i o n b a s e d o n t h e f r e q u e n c i e s o f

    d i e r e n t p a t t e r n s i n t h e a u g m e n t e d o r c i r c u l a r v e r s i o n o f t h e o r i g i n a l

    s e q u e n c e . I n S e c t i o n 2 i t i s s h o w n t h a t t h e a p p r o x i m a t e e n t r o p y a s

    w e l l a s i t s m o d i e d v e r s i o n c o n v e r g e s i n d i s t r i b u t i o n t o a

    2

    - r a n d o m

    v a r i a b l e w h e n t h e l e n g t h o f a t e m p l a t e , m , i s x e d . A s i m i l a r r e s u l t

    w h e n m i n c r e a s e s t o i n n i t y i s o b t a i n e d i n S e c t i o n 3 . I n t h i s s i t u a t i o n

    t h e l i m i t i n g d i s t r i b u t i o n i s n o r m a l w i t h t h e p a r a m e t e r s o f t h i s l a w

    d e t e r m i n e d f r o m P o i s s o n a p p r o x i m a t i o n . T h e s e f a c t s p r o v i d e t h e b a s i s

    f o r s t a t i s t i c a l t e s t s o f r a n d o m n e s s v i a t h e a p p r o x i m a t e e n t r o p y . I n

    1

  • 5/19/2018 Approximate Entropy for Testing Randomness.pdf

    2/16

    p a r t i c u l a r , t a i l p r o b a b i l i t i e s f o r t h e a p p r o x i m a t e e n t r o p y t e s t c a n b e

    e v a l u a t e d . A g r a p h o f t h e s e v a l u e s f o r b i n a r y e x p a n s i o n s o f e ; a n d

    p

    3 i l l u s t r a t e s t h e u s e o f t h i s c o n c e p t .

    K e y w o r d s : D e c o m p o s a b l e S t a t i s t i c s , E n t r o p y , I n f o r m a t i o n D i v e r g e n c e , M u l t i -

    n o m i a l D i s t r i b u t i o n , P o i s s o n D i s t r i b u t i o n ,

    2

    - d i s t r i b u t i o n .

    A n d r e w L . R u k h i n i s a P r o f e s s o r i n t h e D e p a r t m e n t o f M a t h e m a t i c s a n d

    S t a t i s t i c s a t U n i v e r s i t y o f M a r y l a n d a t B a l t i m o r e C o u n t y , B a l t i m o r e , M D ,

    2 1 2 5 0 . H e a l s o h a s a f a c u l t y a p p o i n t m e n t i n t h e S t a t i s t i c a l E n g i n e e r i n g D i -

    v i s i o n a t t h e N a t i o n a l I n s t i t u t e o f S t a n d a r d s a n d T e c h n o l o g y , G a i t h e r s b u r g ,

    M D 2 0 8 9 9 - 0 0 0 1 . T h i s w o r k h a s b e e n m o t i v a t e d b y a j o i n t p r o j e c t w i t h t h e

    C o m p u t e r S e c u r i t y D i v i s i o n o f t h e N a t i o n a l I n s t i t u t e o f S t a n d a r d s a n d T e c h -

    n o l o g y .

    1 I n t r o d u c t i o n : A p p r o x i m a t e E n t r o p i e s

    I n t h i s p a p e r I a p p l y a n e w c o n c e p t o f a p p r o x i m a t e e n t r o p y a n d i t s m o d i -

    c a t i o n t o t h e p r o b l e m o f t e s t i n g f o r r a n d o m n e s s a s t r i n g o f b i n a r y b i t s . T h i s

    p r o b l e m g a i n e d i m p o r t a n c e w i t h t h e w i d e u s e o f p u b l i c k e y c r y p t o g r a p h y

    a n d t h e n e e d f o r g o o d s e c u r e e n c r y p t i o n a l g o r i t h m s . A l l s u c h a l g o r i t h m s a r e

    b a s e d o n a g e n e r a t o r o f ( p s e u d o ) r a n d o m n u m b e r s ; t h e t e s t i n g o f s u c h g e n -

    e r a t o r s f o r r a n d o m n e s s b e c a m e c r u c i a l f o r c o m m u n i c a t i o n s i n d u s t r y w h e r e

    d i g i t a l s i g n a t u r e s a n d k e y m a n a g e m e n t a r e v i t a l f o r i n f o r m a t i o n p r o c e s s i n g .

    T o m e a s u r e t h e d e g r e e o f r a n d o m n e s s o f o b s e r v e d s e q u e n c e s P i n c u s a n d

    S i n g e r ( 1 9 9 6 ) s u g g e s t e d t o u s e a g e n e r a l c h a r a c t e r i s t i c , t h e s o - c a l l e d a p p r o x -

    i m a t e e n t r o p y . A c t u a l l y t h i s a p p r o a c h i s p u r s u e d i n a s e r i e s o f p a p e r s b y S .

    P i n c u s a n d c o - a u t h o r s ( P i n c u s ( 1 9 9 1 ) , P i n c u s a n d H u a n g ( 1 9 9 2 ) , P i n c u s a n d

    K a l m a n ( 1 9 9 7 ) ) . I t i s b a s e d o n t h e l i k e l i h o o d t h a t t e m p l a t e s i n t h e s e q u e n c e

    t h a t a r e s i m i l a r w i l l r e m a i n s i m i l a r o n n e x t i n c r e m e n t a l c o m p a r i s o n s .

    T o x t h e i d e a s d e n o t e b y

    1

    ; : : : ;

    n

    , a s e q u e n c e o f i . i . d . r a n d o m v a r i a b l e s

    e a c h t a k i n g v a l u e s i n t h e n i t e s e t f 1 ; : : : ; s g . F o r Y

    i

    ( m ) = (

    i

    ; : : : ;

    i + m ? 1

    ) ,

    1 i n ? m + 1 , l e t

    C

    m

    i

    =

    1

    n + 1 ? m

    # f j : 1 j n ? m + 1 ; Y

    j

    ( m ) = Y

    i

    ( m ) g

    2

  • 5/19/2018 Approximate Entropy for Testing Randomness.pdf

    3/16

    a n d

    ( m )

    =

    1

    n + 1 ? m

    n + 1 ? m

    X

    i = 1

    l o g C

    m

    i

    :

    O b s e r v e t h a t C

    m

    i

    i s t h e r e l a t i v e f r e q u e n c y o f o c c u r r e n c e s o f t h e t e m p l a t e

    Y

    i

    ( m ) i n t h e s e q u e n c e , a n d ?

    ( m )

    i s t h e e n t r o p y o f t h e e m p i r i c a l d i s t r i b u t i o n

    a r i s i n g o n t h e o b s e r v e d s u b s e t o f t h e s e t o f a l l s

    m

    p o s s i b l e p a t t e r n s o f l e n g t h

    m :

    T h e a p p r o x i m a t e e n t r o p y A p E n o f o r d e r m ; m 1 i s d e n e d a s

    A p E n ( m ) =

    ( m )

    ?

    ( m + 1 )

    w i t h A p E n ( 0 ) = ?

    ( 1 )

    : \ A p E n ( m ) m e a s u r e s t h e l o g a r i t h m i c f r e q u e n c y w i t h

    w h i c h b l o c k s o f l e n g t h m t h a t a r e c l o s e t o g e t h e r r e m a i n c l o s e t o g e t h e r f o r

    b l o c k s a u g m e n t e d b y o n e p o s i t i o n . T h u s , s m a l l v a l u e s o f A p E n ( m ) i m p l y

    s t r o n g r e g u l a r i t y , o r p e r s i s t e n c e , i n a s e q u e n c e . A l t e r n a t i v e l y , l a r g e v a l u e s

    o f A p E n ( m ) i m p l y s u b s t a n t i a l u c t u a t i o n , o r i r r e g u l a r i t y . . " ( P i n c u s a n d

    S i n g e r , 1 9 9 6 , p 2 0 8 3 ) .

    P i n c u s a n d S i n g e r ( 1 9 9 6 ) d e n e d a s e q u e n c e t o b e m - i r r e g u l a r ( m - r a n d o m )

    i f i t s a p p r o x i m a t e e n t r o p y A p E n ( m ) t a k e s t h e l a r g e s t p o s s i b l e v a l u e . P i n c u s

    a n d K a l m a n ( 1 9 9 7 ) e v a l u a t e d q u a n t i t i e s A p E n ( m ) ; m = 0 ; 1 ; 2 f o r b i n a r y

    a n d d e c i m a l e x p a n s i o n s o f e ; ;

    p

    2 a n d

    p

    3 w i t h t h e s u r p r i s i n g c o n c l u s i o n

    t h a t t h e e x p a n s i o n o f

    p

    3 d e m o n s t r a t e d m u c h m o r e i r r e g u l a r i t y t h a n t h a t o f

    .

    S i n c e

    ?

    ( m )

    i s t h e e n t r o p y o f t h e e m p i r i c a l d i s t r i b u t i o n w h i c h u n d e r t h e

    r a n d o m n e s s a s s u m p t i o n m u s t b e a l m o s t u n i f o r m , o n e s h o u l d e x p e c t t h a t f o r

    x e d m ;

    ( m )

    ? m l o g s a n d A p E n ( m ) =

    ( m )

    ?

    ( m + 1 )

    ! l o g s ; i n d e e d t h i s

    f a c t f o l l o w s f r o m T h e o r e m 2 i n P i n c u s ( 1 9 9 1 ) . A s f a r a s t h e l i m i t i n g b e h a v i o r

    o f A p E n ( m ) ? l o g s , P i n c u s a n d H u a n g ( 1 9 9 2 ) , p 3 0 7 2 , i n d i c a t e t h a t \ a n a l y t i c

    p r o o f s o f a s y m p t o t i c n o r m a l i t y a n d e s p e c i a l l y e x p l i c i t v a r i a n c e e s t i m a t e s f o r

    A p E n a p p e a r t o b e e x t r e m e l y d i c u l t " .

    T h e k e y s t e p l e a d i n g t o t h e l i m i t i n g d i s t r i b u t i o n o f a p p r o x i m a t e e n t r o p y

    i s a m o d i c a t i o n o f i t s d e n i t i o n . I n t r o d u c e t h e m o d i e d v e r s i o n o f t h e

    e m p i r i c a l d i s t r i b u t i o n e n t r o p y ?

    ( m )

    a s

    ~

    ( m )

    =

    X

    i

    1

    i

    m

    i

    1

    i

    m

    l o g

    i

    1

    i

    m

    : ( 1 )

    H e r e

    i

    1

    i

    m

    = !

    i

    1

    i

    m

    = n d e n o t e s t h e r e l a t i v e f r e q u e n c y o f t h e p a t t e r n

    ( i

    1

    ; ; i

    m

    ) i n t h e a u g m e n t e d ( o r c i r c u l a r ) v e r s i o n o f t h e o r i g i n a l s t r i n g ,

    3

  • 5/19/2018 Approximate Entropy for Testing Randomness.pdf

    4/16

    i . e . i n t h e s t r i n g (

    1

    ; : : : ;

    n

    ;

    1

    ; : : : ;

    m ? 1

    ) . U n d e r t h i s d e n i t i o n !

    i

    1

    i

    m

    =

    P

    k

    !

    i

    1

    i

    m

    k

    , s o t h a t f o r a n y m ;

    P

    i

    1

    i

    m

    i

    1

    i

    m

    = n :

    D e n e t h e m o d i e d a p p r o x i m a t e e n t r o p y a s

    g

    A p E n ( m ) =

    ~

    ( m )

    ?

    ~

    ( m + 1 )

    : ( 2 )

    A d e n i t e a d v a n t a g e o f

    g

    A p E n ( m ) i s t h a t b y J e n s e n ' s i n e q u a l i t y , l o g s

    g

    A p E n ( m ) f o r a n y m , w h e r e a s i t i s p o s s i b l e t h a t l o g s < A p E n ( m ) ( a l b e i t

    t h e p r o b a b i l i t y o f t h i s t e n d s t o z e r o a s n i n c r e a s e s . ) T h e r e f o r e t h e l a r g e s t

    p o s s i b l e v a l u e o f

    g

    A p E n ( m ) i s m e r e l y l o g s . T h e m a x i m a l l y r a n d o m s e q u e n c e s

    u n d e r t h i s d e n i t i o n h a v e t h e r e l a t i v e f r e q u e n c i e s o f a l l p a t t e r n s ( i n a c i r c u l a r

    v e r s i o n o f t h e s e q u e n c e ) o f a g i v e n l e n g t h a r e a s c l o s e t o t h e c o m m o n v a l u e n

    ? 1

    a s p o s s i b l e . F o r e x a m p l e , i n a d d i t i o n t o m a x i m a l l y r a n d o m b i n a r y s t r i n g s

    f r o m t h e p o i n t o f v i e w o f A p E n ( 1 ) 1 ; 1 ; 0 ; 0 ; 1 , 1 ; 0 ; 0 ; 1 ; 1 , 0 ; 0 ; 1 ; 1 ; 0 , a n d

    0 ; 1 ; 1 ; 0 ; 0 m e n t i o n e d b y P i n c u s a n d S i n g e r ( 1 9 9 6 ) p 2 0 8 4 , o n e s h o u l d a d d

    t w o s e q u e n c e s 1 ; 0 ; 0 ; 0 ; 1 , 0 ; 1 ; 1 ; 1 ; 0 , w h i c h a r e r a n d o m f r o m t h e p o i n t o f

    v i e w o f

    g

    A p E n ( 1 ) .

    O n t h e o t h e r h a n d A p E n ( m ) a n d

    g

    A p E n ( m ) c a n n o t d i e r m u c h i f n i s

    l a r g e . I n d e e d f o r Y

    i

    ( m ) = ( i

    1

    ; : : : ; i

    m

    ) , p u t

    0

    i

    1

    i

    m

    = C

    m

    i

    , s o t h a t

    ( m )

    =

    X

    i

    1

    i

    m

    0

    i

    1

    i

    m

    l o g

    0

    i

    1

    i

    m

    :

    T h e n w i t h !

    0

    i

    1

    i

    m

    = ( n ? m + 1 )

    0

    i

    1

    i

    m

    X

    i

    1

    i

    m

    !

    0

    i

    1

    i

    m

    = n ? m + 1 ;

    a n d !

    i

    1

    i

    m

    ? !

    0

    i

    1

    i

    m

    m ? 1 . I t f o l l o w s t h a t

    i

    1

    i

    m

    ?

    0

    i

    1

    i

    m

    m ? 1

    n ? m + 1

    ; ( 3 )

    w h i c h s u g g e s t s t h a t f o r a x e d m , P i n c u s ' a p p r o x i m a t e e n t r o p y a n d

    g

    A p E n ( m )

    m u s t b e c l o s e w h e n n i s l a r g e .

    I n t h e n e x t S e c t i o n I d e r i v e t h e l i m i t i n g d i s t r i b u t i o n o f n l o g s ?

    g

    A p E n ( m ) ]

    w h e n n ! 1 a n d m i s x e d . I t i s a l s o p r o v e n t h a t n A p E n ( m ) ?

    g

    A p E n ( m ) ] =

    O

    P

    ( n

    ? 1

    ) ; s o t h a t t h e l i m i t i n g d i s t r i b u t i o n s o f P i n c u s ' a p p r o x i m a t e e n t r o p y

    4

  • 5/19/2018 Approximate Entropy for Testing Randomness.pdf

    5/16

    a n d o f

    g

    A p E n ( m ) c o i n c i d e . S e c t i o n 3 c o n t a i n s a s i m i l a r r e s u l t w h e n m !

    1 . T h e s e f a c t s p r o v i d e t h e b a s i s f o r s t a t i s t i c a l t e s t s o f r a n d o m n e s s v i a t h e

    a p p r o x i m a t e e n t r o p y .

    I n p a r t i c u l a r , i n S e c t i o n 4 t h e t a i l p r o b a b i l i t i e s f o r t h e a p p r o x i m a t e e n -

    t r o p y t e s t a r e e v a l u a t e d a n d p l o t t e d f o r b i n a r y e x p a n s i o n s o f e ; a n d

    p

    3 .

    2 A s y m p t o t i c B e h a v i o r o f A p p r o x i m a t e E n -

    t r o p y : F i x e d m.

    I t i s s h o w n h e r e t h a t t h e l i m i t i n g d i s t r i b u t i o n o f 2 n l o g s

    ?

    g

    A p E n ( m ) ] a s w e l l

    a s o f 2 n l o g s ? A p E n ( m ) ] i s t h a t o f a

    2

    - r a n d o m v a r i a b l e w i t h ( s ? 1 ) s

    m

    d e g r e e s o f f r e e d o m .

    P r o p o s i t i o n 1 F o r x e d m a s n ! 1 o n e h a s t h e f o l l o w i n g c o n v e r g e n c e i n

    d i s t r i b u t i o n

    2 n

    h

    l o g s ?

    g

    A p E n ( m )

    i

    !

    2

    ( s

    m + 1

    ? s

    m

    ) :

    A l s o

    n A p E n ( m ) ?

    g

    A p E n ( m ) ] = O

    P

    1

    n

    ; ( 4 )

    s o t h a t

    2 n l o g s ? A p E n ( m ) ] !

    2

    ( s

    m + 1

    ? s

    m

    ) :

    P r o o f L e t u s s t a r t w i t h t h e l i m i t t h e o r e m f o r

    g

    A p E n ( m ) . P u t

    Z

    i

    1

    i

    m

    =

    p

    n

    i

    1

    i

    m

    ?

    1

    s

    m

    :

    T h e n t h e v e c t o r f o r m e d b y Z

    i

    1

    i

    m

    h a s a s y m p t o t i c m u l t i v a r i a t e n o r m a l d i s -

    t r i b u t i o n w i t h z e r o m e a n a n d t h e c o v a r i a n c e m a t r i x o f t h e f o r m

    m

    =

    1

    s

    m

    I

    m

    ?

    1

    s

    2 m

    e

    m

    e

    T

    m

    :

    H e r e I

    m

    d e n o t e s t h e s

    m

    s

    m

    i d e n t i t y m a t r i x a n d e

    T

    m

    = ( 1 ; : : : ; 1 ) i s a s

    m

    -

    d i m e n s i o n a l v e c t o r . S i n c e w i t h p r o b a b i l i t y o n e ,

    P

    Z

    i

    1

    i

    m

    = 0 , ( 1 ) s h o w s

    t h a t

    ~

    ( m )

    = ?

    X

    i

    1

    i

    m

    "

    1

    s

    m

    +

    Z

    i

    1

    i

    m

    p

    n

    #

    h

    ? m l o g s +

    s

    m

    Z

    i

    1

    i

    m

    p

    n

    ?

    s

    2 m

    Z

    2

    i

    1

    i

    m

    2 n

    + O

    P

    1

    n

    3 = 2

    i

    5

  • 5/19/2018 Approximate Entropy for Testing Randomness.pdf

    6/16

    ? m l o g s +

    s

    m

    2 n

    X

    i

    1

    i

    m

    Z

    2

    i

    1

    i

    m

    :

    U s i n g a s i m i l a r n o t a t i o n f o r p a t t e r n s o f l e n g t h m + 1 , l e t

    i

    1

    i

    m

    i

    m + 1

    b e t h e

    r e l a t i v e f r e q u e n c i e s , a n d l e t Z

    i

    1

    i

    m

    i

    m + 1

    d e n o t e t h e c o r r e s p o n d i n g d i e r e n c e s

    b e t w e e n e m p i r i c a l a n d t h e o r e t i c a l p r o b a b i l i t i e s . T h e n

    Z

    i

    1

    i

    m

    =

    s

    X

    k = 1

    Z

    i

    1

    i

    m

    k

    a n d

    ~

    ( m + 1 )

    ? ( m + 1 ) l o g s +

    s

    m + 1

    2 n

    X

    i

    1

    i

    m

    i

    m + 1

    Z

    2

    i

    1

    i

    m

    i

    m + 1

    :

    T h u s

    ~

    ( m )

    ?

    ~

    ( m + 1 )

    l o g s ?

    s

    m

    2 n

    2

    4

    X

    i

    1

    i

    m

    X

    k

    Z

    i

    1

    i

    m

    k

    !

    2

    ? s

    X

    i

    1

    i

    m

    i

    m + 1

    Z

    2

    i

    1

    i

    m

    i

    m + 1

    3

    5

    = l o g s ?

    s

    m

    2 n

    Z

    T

    Q Z

    w i t h t h e s

    m + 1

    s

    m + 1

    b l o c k - d i a g o n a l m a t r i x Q f o r m e d b y f o r m e d b y s

    m

    b l o c k s

    Q

    0

    o f s i z e s s ,

    Q

    0

    = s I

    1

    ? e

    1

    e

    T

    1

    ;

    a n d s

    m + 1

    - d i m e n s i o n a l n o r m a l v e c t o r Z . T h e d i s t r i b u t i o n o f t h e q u a d r a t i c

    f o r m Z

    T

    Q Z i s t h a t o f

    P

    l

    i

    1

    i

    m

    i

    m + 1

    W

    2

    i

    1

    i

    m

    i

    m + 1

    w i t h i n d e p e n d e n t s t a n d a r d

    n o r m a l v a r i a b l e s W

    i

    1

    i

    m

    i

    m + 1

    a n d l

    i

    1

    i

    m

    i

    m + 1

    d e n o t i n g t h e e i g e n v a l u e s o f t h e

    m a t r i x

    1 = 2

    Q

    1 = 2

    .

    I t i s e a s y t o c h e c k t h a t

    1 = 2

    m + 1

    =

    1

    s

    ( m + 1 ) = 2

    I

    m + 1

    ?

    1

    s

    3 ( m + 1 ) = 2

    e

    m + 1

    e

    T

    m + 1

    ;

    a n d

    1 = 2

    m + 1

    Q

    1 = 2

    m + 1

    =

    1

    s

    m + 1

    Q :

    T h e e v a l u a t i o n o f t h e d e t e r m i n a n t , d e t

    h

    1 = 2

    m + 1

    Q

    1 = 2

    m + 1

    ? l I

    m + 1

    i

    , s h o w s t h e

    n e e d e d e i g e n v a l u e s a r e e q u a l t o s w i t h m u l t i p l i c i t y ( s ? 1 ) s

    m

    a n d 0 w i t h

    m u l t i p l i c i t y s

    m

    . T h e r e f o r e

    ~

    ( m )

    ?

    ~

    ( m + 1 )

    l o g s ?

    1

    2 n

    2

    ( ( s ? 1 ) s

    m

    )

    6

  • 5/19/2018 Approximate Entropy for Testing Randomness.pdf

    7/16

    a n d

    n

    h

    l o g s ?

    g

    A p E n ( m )

    i

    1

    2

    2

    ( s

    m + 1

    ? s

    m

    ) :

    T h e e s t i m a t e ( 3 ) s h o w s t h a t i f Z

    0

    i

    1

    i

    m

    =

    p

    n

    h

    0

    i

    1

    i

    m

    ? s

    ? m

    i

    t h e n

    j Z

    0

    i

    1

    i

    m

    ? Z

    i

    1

    i

    m

    j ( m ? 1 )

    p

    n = ( n ? m + 1 ) a n d

    ~

    ( m )

    ?

    ( m )

    s

    m

    2 n

    X

    i

    1

    i

    m

    Z

    2

    i

    1

    i

    m

    ?

    X

    i

    1

    i

    m

    Z

    0 2

    i

    1

    i

    m

    s

    2 m

    ( m

    ?1 )

    2

    2 ( n ? m + 1 )

    2

    :

    T h u s ( 4 ) f o l l o w s a n d t h e P r o p o s i t i o n 1 i s p r o v e n . 2

    F o r t h e o b s e r v e d v a l u e A p E n ( m ) , o n e h a s t o d e n e

    2

    ( o b s ) a s

    2

    ( o b s )

    = 2 n j l o g s ? A p E n ( m ) j , w h e r e a s , a s h a s b e e n n o t i c e d , t h e d i e r e n c e l o g s ?

    g

    A p E n ( m ) i s a l w a y s p o s i t i v e . T h e r e p o r t e d P - v a l u e ( t a i l p r o b a b i l i t y ) i s

    P

    n

    ( m ) = 1 ? P

    2

    m ? 1

    ;

    2

    ( o b s ) = 2

    w i t h P d e n o t i n g t h e i n c o m p l e t e g a m m a - f u n c t i o n . T h e n u l l h y p o t h e s i s o f

    r a n d o m n e s s i s r e j e c t e d f o r l a r g e v a l u e s o f

    2

    ( o b s ) .

    T h e a s y m p t o t i c d i s t r i b u t i o n o f t h e s t a t i s t i c s 2 n

    h

    l o g s ?

    g

    A p E n ( m )

    i

    a n d

    2 n l o g s ? A p E n ( m ) ] , e v a l u a t e d u n d e r t h e a l t e r n a t i v e o f t h e f o r m

    i

    1

    i

    m

    i

    m + 1

    =

    s

    ? m ? 1

    + n

    ? 1 = 2

    i

    1

    i

    m

    i

    m + 1

    , w i t h

    T

    e = 0 , i s a n o n c e n t r a l

    2

    - d i s t r i b u t i o n w i t h

    s

    m + 1

    ? s

    m

    d e g r e e s o f f r e e d o m a n d t h e n o n c e n t r a l i t y p a r a m e t e r

    T

    = s

    m + 1

    .

    T h i s f a c t a l l o w s f o r a n a p p r o x i m a t e p o w e r f u n c t i o n o f t h e c o r r e s p o n d i n g t e s t

    o f r a n d o m n e s s .

    3 A s y m p t o t i c B e h a v i o r o f A p p r o x i m a t e E n -

    t r o p y : L a r g e m .

    I n t h i s s e c t i o n I c o n s i d e r t h e s i t u a t i o n w h e n b o t h n a n d m t e n d t o i n n i t y

    s o t h a t

    n

    s

    m + 1

    ! > 0 : ( 5 )

    ( A c t u a l l y t h i s c o n d i t i o n c a n b e r e l a x e d t o m i n

    n

    n

    s

    m + 1

    > 0 . O b s e r v e t h a t

    t h e n u m e r i c a l e v a l u a t i o n o f A p E n ( m ) a n d

    g

    A p E n ( m ) f o r s u c h v a l u e s o f m i s

    f e a s i b l e ; f o r e x a m p l e , t h e v a l u e s s = 2 ; n = 1 0

    5

    ; m = 1 7 w i t h = 0 : 3 8 1 4 7 : :

    h a v e b e e n t r i e d . )

    7

  • 5/19/2018 Approximate Entropy for Testing Randomness.pdf

    8/16

    T o i n v e s t i g a t e t h i s c a s e l e t u s w r i t e t h e f o r m u l a f o r t h e m o d i e d a p p r o x -

    i m a t e e n t r o p y i n t h e f o l l o w i n g f o r m

    g

    A p E n ( m ) =

    X

    i

    1

    i

    m

    i

    1

    i

    m

    l o g

    i

    1

    i

    m

    ?

    X

    i

    1

    i

    m

    i

    m + 1

    i

    1

    i

    m

    i

    m + 1

    l o g

    i

    1

    i

    m

    i

    m + 1

    =

    1

    n

    X

    i

    1

    i

    m

    h

    !

    i

    1

    i

    m

    1

    l o g

    !

    i

    1

    i

    m

    1

    P

    k

    !

    i

    1

    i

    m

    k

    !

    + + !

    i

    1

    i

    m

    s

    l o g

    !

    i

    1

    i

    m

    s

    P

    k

    !

    i

    1

    i

    m

    k

    !

    i

    =

    1

    n

    X

    i

    1

    i

    m

    f ( !

    i

    1

    i

    m

    1

    ; : : : ; !

    i

    1

    i

    m

    s

    ) ( 6 )

    w i t h f ( u

    1

    ; : : : ; u

    s

    ) d e n o t i n g t h e e n t r o p y o f t h e p r o b a b i l i t y d i s t r i b u t i o n d e n e d

    b y p r o b a b i l i t i e s u

    k

    =

    P

    u

    j

    ; k = 1 ; : : : ; s ,

    f ( u

    1

    ; : : : ; u

    s

    ) = ? u

    1

    l o g

    u

    1

    P

    j

    u

    j

    !

    ? ? u

    s

    l o g

    u

    s

    P

    j

    u

    j

    !

    :

    N o t e t h a t o u r f u n c t i o n f h a s a s p e c i a l f o r m , n a m e l y , f ( u

    1

    ; : : : ; u

    s

    ) =

    P

    j

    ( u

    j

    ) ?

    (

    P

    j

    u

    j

    ) w i t h ( u ) = ? u l o g u .

    A s i m i l a r r e p r e s e n t a t i o n w i t h n r e p l a c e d b y n ? m + 1 a l s o h o l d s f o r

    A p E n ( m ) . I n d e e d i n t h e n o t a t i o n o f S e c t i o n 2 , !

    0

    i

    1

    i

    m

    ?

    P

    k

    !

    0

    i

    1

    i

    m

    k

    1

    a n d t h e r e e x i s t s n o m o r e t h a n o n e m - t u p l e i

    1

    ; : : : ; i

    m

    f o r w h i c h !

    0

    i

    1

    i

    m

    6=

    P

    !

    0

    i

    1

    i

    m

    k

    . T h e r e f o r e

    X

    i

    1

    i

    m

    !

    0

    i

    1

    i

    m

    l o g

    !

    0

    i

    1

    i

    m

    n ? m + 1

    ?

    X

    i

    1

    i

    m

    i

    m + 1

    !

    0

    i

    1

    i

    m

    i

    m + 1

    l o g

    !

    0

    i

    1

    i

    m

    i

    m + 1

    n ? m + 1

    m a x

    0 x n ? m + 1

    ( x + 1 ) l o g ( x + 1 ) ? x l o g x ] + l o g ( n ? m + 1 )

    2 l o g n ;

    s o t h a t

    A p E n ( m ) =

    1

    n

    ?m + 1

    X

    i

    1

    i

    m

    h

    !

    0

    i

    1

    i

    m

    1

    l o g

    !

    0

    i

    1

    i

    m

    1

    P

    k

    !

    0

    i

    1

    i

    m

    k

    !

    +

    + !

    0

    i

    1

    i

    m

    s

    l o g

    !

    0

    i

    1

    i

    m

    s

    P

    k

    !

    0

    i

    1

    i

    m

    k

    !

    i

    + O

    P

    l o g n

    n

    !

    :

    T h u s A p E n a l s o a d m i t s t h e r e p r e s e n t a t i o n ( 6 ) , a n d t h e l i m i t i n g d i s t r i b u t i o n

    o f b o t h

    g

    A p E n a n d A p E n i s t h a t o f t h i s d e c o m p o s a b l e s t a t i s t i c . S u m s o f

    8

  • 5/19/2018 Approximate Entropy for Testing Randomness.pdf

    9/16

    t h i s f o r m ( w i t h f u n c t i o n s f o f o n l y o n e a r g u m e n t ) h a v e b e e n e x t e n s i v e l y

    s t u d i e d . S e e H o l s t ( 1 9 7 2 ) , M o r r i s ( 1 9 7 5 ) a n d M e d v e d e v ( 1 9 7 7 ) . A l t h o u g h

    o u r s i t u a t i o n w i t h f d e p e n d i n g o n s f r e q u e n c i e s !

    i

    1

    i

    m

    1

    ; : : : ; !

    i

    1

    i

    m

    s

    d o e s

    n o t f o l l o w d i r e c t l y f r o m t h e s e r e s u l t s , t h e s p e c i a l f o r m o f t h i s f u n c t i o n l e a d s

    t o t h e f o l l o w i n g P r o p o s i t i o n 2 w h i c h c a n b e d e r i v e d f r o m H o l s t ( 1 9 7 2 ) a f t e r

    s o m e m o d i c a t i o n s .

    L e t

    i

    1

    i

    m

    1

    ; : : : ;

    i

    1

    i

    m

    s

    d e n o t e s i n d e p e n d e n t P o i s s o n r a n d o m v a r i a b l e s

    w i t h p a r a m e t e r . I t i s a l s o c o n v e n i e n t t o w r i t e

    1

    ; : : : ;

    s

    o r

    1

    ( ) ; : : : ;

    s

    ( )

    f o r a s - t u p l e o f s u c h r a n d o m v a r i a b l e s . P u t

    n

    =

    1

    n

    X

    i

    1

    i

    m

    E f (

    i

    1

    i

    m

    1

    ; : : : ;

    i

    1

    i

    m

    s

    ) =

    s

    m

    n

    E f (

    1

    ; : : : ;

    s

    )

    =

    1

    s

    E f (

    1

    ; : : : ;

    s

    ) ;

    a n d

    =

    C o v ( f (

    1

    ; : : : ;

    s

    ) ;

    1

    + +

    s

    )

    V a r (

    1

    + +

    s

    )

    =

    1

    s

    C o v ( f (

    1

    ; : : : ;

    s

    ) ;

    1

    +

    +

    s

    ) :

    W i t h

    g ( u

    1

    ; : : : ; u

    s

    ) = f ( u

    1

    ; : : : ; u

    s

    ) ? E f (

    1

    ; : : : ;

    s

    ) ?

    1

    + +

    s

    ? s ] ;

    o n e h a s

    V a r g (

    1

    ; : : : ;

    s

    ) = V a r f (

    1

    ; : : : ;

    s

    ) ? s

    2

    ;

    s o t h a t t h e s u m s

    U

    n

    =

    X

    i

    1

    i

    m

    g (

    i

    1

    i

    m

    1

    ; : : : ;

    i

    1

    i

    m

    s

    )

    a n d

    V

    n

    =

    1

    p

    n

    X

    i

    1

    i

    m

    i

    1

    i

    m

    1

    + +

    i

    1

    i

    m

    s

    ? s ]

    a r e u n c o r r e l a t e d , E U

    n

    V

    n

    = 0 . L e t

    2

    n

    =

    X

    i

    1

    i

    m

    V a r g (

    i

    1

    i

    m

    1

    ; : : : ;

    i

    1

    i

    m

    s

    ) = s

    m

    V a r g (

    1

    ; : : : ;

    s

    ) ;

    9

  • 5/19/2018 Approximate Entropy for Testing Randomness.pdf

    10/1

    t h e n t h e j o i n t a s y m p t o t i c d i s t r i b u t i o n o f U

    n

    =

    n

    a n d V

    n

    i s n o r m a l w i t h z e r o

    m e a n a n d t h e i d e n t i t y c o v a r i a n c e m a t r i x . T h e c o n d i t i o n a l d i s t r i b u t i o n o f

    U

    n

    = n g i v e n V

    n

    = 0 c o i n c i d e s w i t h t h e d i s t r i b u t i o n o f

    g

    A p E n ( m ) ?

    n

    , s i n c e

    t h e c o n d i t i o n a l d i s t r i b u t i o n o f (

    i

    1

    i

    m

    1

    ; : : : ;

    i

    1

    i

    m

    s

    ) g i v e n t h a t

    P

    i

    1

    i

    m

    1

    +

    +

    i

    1

    i

    m

    s

    ] = n i s m u l t i n o m i a l .

    T h e r e f o r e t h e f o l l o w i n g r e s u l t c o n c e r n i n g t h e c o n v e r g e n c e o f n

    g

    A p E n ( m ) ?

    n

    ] =

    n

    a n d o f ( n ? m + 1 ) A p E n ( m ) ?

    n

    ] =

    n

    t o a s t a n d a r d n o r m a l d i s t r i -

    b u t i o n i s n o t s u r p r i s i n g .

    P r o p o s i t i o n 2 U n d e r c o n d i t i o n ( 5 ) f o r n ! 1

    P

    0

    @

    n

    g

    A p E n ( m ) ?

    n

    n

    x

    1

    A

    ! ( x )

    a n d

    P

    n

    A p E n ( m ) ?

    n

    n

    x

    !

    ! ( x )

    S k e t c h o f t h e P r o o f T h e a r g u m e n t a b o v e c a n b e m a d e r i g o r o u s b y e x a m i -

    n a t i o n o f t h e c h a r a c t e r i s t i c f u n c t i o n o f

    g

    A p E n ( m ) a s i n L e m m a s 2 . 1 , 2 . 2 , A 1 ,

    A 2 a n d A 3 o f H o l s t ( 1 9 7 2 ) . W i t h N = s

    m + 1

    a s i n L e m m a 2 . 1 t h e r e

    A

    N

    ( z ) =

    1

    X

    n = 0

    E

    n

    2

    4

    Y

    i

    1

    i

    m

    x

    f (

    i

    1

    i

    m

    1

    ; : : : ;

    i

    1

    i

    m

    s

    )

    i

    1

    i

    m

    3

    5

    ( N z )

    n

    e

    ? N z

    n !

    =

    Y

    i

    1

    i

    m

    X

    j

    1

    : : : j

    s

    z

    j

    1

    + + j

    s

    e

    ? z

    j

    1

    ! j

    s

    !

    x

    f (

    i

    1

    i

    m

    1

    ( z ) ; : : : ;

    i

    1

    i

    m

    s

    ( z ) )

    i

    1

    i

    m

    :

    A s i m i l a r r e p r e s e n t a t i o n f o r t h e c h a r a c t e r i s t i c f u n c t i o n ' ( t )

    = E e x p f i t

    P

    i

    1

    i

    m

    f (

    i

    1

    i

    m

    1

    ; : : : ;

    i

    1

    i

    m

    s

    ) g a s i n L e m m a 2 . 2 f o l l o w s ; t h e o n l y

    d i e r e n c e i s t h a t t h e o r d i n a r y s u m i n t h e r i g h t - h a n d s i d e i s r e p l a c e d b y t h e

    m u l t i p l e s u m

    e

    ? s e

    i

    X

    j

    1

    : : : j

    s

    ( e

    i

    )

    j

    1

    + + j

    s

    j

    1

    ! j

    s

    !

    h

    e

    i t ( j

    1

    ) + + ( j

    s

    ) ] ? i t ( j

    1

    + : : : + j

    s

    )

    ? 1

    i

    :

    T h e s a m e e s t i m a t e s a s i n L e m m a s A 1 a n d A 2 h o l d f o r t h e c o r r e s p o n d i n g

    f u n c t i o n . T h e c o n v e r g e n c e r e s u l t i n L e m m a A 2 a l s o h o l d s b y a n a l y s i s o f

    T a y l o r ' s e x p a n s i o n . 2

    1 0

  • 5/19/2018 Approximate Entropy for Testing Randomness.pdf

    11/1

    F o r e x a m p l e , w h e n s = 2 , o n e h a s t o e v a l u a t e

    ( ) = E

    1

    ( ) l o g

    1

    ( ) = e

    ?

    1

    X

    k = 1

    k

    l o g ( k + 1 )

    k !

    ;

    a n d t h e n

    n

    =

    ( 2 ) ? 2 ( )

    2

    :

    S i m i l a r l y w i t h

    ( ) = E

    1

    ( ) l o g

    1

    ( )

    1

    ( ) ? ] ;

    o n e h a s

    =

    ( 2 ) ? 2 ( )

    2

    :

    A l s o i f

    2

    ( ) = V a r (

    1

    ( ) l o g

    1

    ( ) ) ;

    a n d

    ( ) = C o v (

    1

    ( ) +

    2

    ( ) ] l o g

    1

    ( ) +

    2

    ( ) ] ;

    1

    ( ) l o g

    1

    ( ) )

    = e

    ? 2

    1

    X

    k = 1

    k

    l o g ( k + 1 )

    k !

    k

    ? ( 2 ) ( ) ;

    w h e r e

    k

    =

    k

    X

    j = 1

    ( j + 1 ) l o g ( j + 1 )

    k + 1

    j + 1

    !

    ;

    t h e n

    V a r f (

    1

    ;

    2

    ) =

    2

    ( 2 ) + 2

    2

    ( ) ? 4 ( ) :

    T h u s

    2

    n

    = s

    m

    "

    2

    ( 2 ) + 2

    2

    ( )

    ?4 ( )

    ?

    ( 2 ) ? 2 ( ) ]

    2

    2

    #

    :

    M o r e g e n e r a l l y , t h e a s y m p t o t i c d i s t r i b u t i o n o f t h e s u m

    S =

    1

    n

    X

    i

    1

    i

    m

    f ( !

    i

    1

    i

    m

    1

    ; : : : ; !

    i

    1

    i

    m

    s

    )

    w h e n f ( u

    1

    ; : : : ; u

    s

    ) =

    P

    j

    ( u

    j

    ) ? (

    P

    j

    u

    j

    ) c a n b e s h o w n t o b e n o r m a l u n d e r

    m i l d r e g u l a r i t y c o n d i t i o n s o n f u n c t i o n .

    1 1

  • 5/19/2018 Approximate Entropy for Testing Randomness.pdf

    12/1

    T h e a s y m p t o t i c p o w e r o f t h i s t e s t s t a t i s t i c S u n d e r t h e a l t e r n a t i v e

    i

    1

    i

    m

    i s d e t e r m i n e d b y t h e r a t i o R = l i m E

    S ?

    n

    ] =

    n

    , w h o s e a b s o l u t e v a l u e i s t o

    b e m a x i m i z e d t o h a v e t h e o p t i m a l P i t m a n e c i e n c y .

    U n d e r t h e a l t e r n a t i v e o f t h e f o r m

    i

    1

    i

    m

    i

    m + 1

    = s

    ? m ? 1

    + n

    ? 1 = 4

    i

    1

    i

    m

    i

    m + 1

    w i t h

    i

    1

    i

    m

    =

    Z

    i

    1

    + i

    2

    = s + + ( i

    m

    + 1 ) s

    ? m

    i

    1

    + i

    2

    = s + + i

    m

    s

    ? m

    q ( u ) d u

    s u c h t h a t

    R

    1

    0

    q ( u ) d u = 0 ,

    R =

    Z

    1

    0

    q

    2

    ( u ) d u

    E

    P

    i

    (

    i

    ) ? (

    P

    i

    i

    ) ] (

    P

    i

    i

    ? s )

    2

    ?

    P

    i

    i

    ]

    V a r

    1 = 2

    P

    i

    (

    i

    ) ? (

    P

    i

    i

    ) ?

    P

    i

    i

    ]

    :

    T h i s f o r m u l a s c a n b e u s e d t o s h o w t h a t t h e r e i s n o o p t i m a l s t a t i s t i c S .

    T h i s i s t o b e c o n t r a s t e d w i t h a s y m p t o t i c o p t i m a l i t y o f

    2

    - t e s t i n t h e c l a s s

    o f d e c o m p o s a b l e s t a t i s t i c s w i t h f u n c t i o n f d e p e n d i n g o n l y o n o n e a r g u m e n t

    ( s e e H o l s t , 1 9 7 2 , I v c h e n k o a n d M e d v e d e v , 1 9 7 8 , 1 9 8 0 ) .

    E s s e n t i a l l y t h e s a m e c o n c l u s i o n s a b o u t t h e p o w e r o f t h e a p p r o x i m a t e

    e n t r o p y t e s t a s a b o u t

    2

    - t e s t ( K a l l e n b e r g e t a l , 1 9 8 5 ) c a n b e m a d e .

    4 E x a m p l e s

    H e r e a r e t w o s t r i n g s o f 2 0 b i n a r y b i t s w h i c h h a v e b e e n s u g g e s t e d b y C h a i t i n

    ( 1 9 7 5 )

    ( A ) 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1

    ( B ) 0 1 1 0 1 1 0 0 1 1 0 1 1 1 1 0 0 0 1 0

    F o r a n o n - r a n d o m l y l o o k i n g s e q u e n c e ( A ) ; A p E n ( 0 ) = ?

    ( 1 )

    = ?

    ~

    ( 1 )

    =

    l o g 2 , w h i c h i s t h e l a r g e s t p o s s i b l e v a l u e f o r A p E n . S i n c e t h e r e a r e o n l y t w o

    o c c u r r i n g p a t t e r n s o f l e n g t h 2 , n a m e l y ( 0 ; 1 ) a n d ( 1 ; 0 ) w i t h f r e q u e n c i e s 1 0

    a n d 9 r e s p e c t i v e l y ,

    ( 2 )

    =

    1

    1 9

    1 0 l o g

    1 0

    1 9

    + 9 l o g

    9

    1 9

    = ? 0 : 6 9 1 8 : : :

    T h u s

    A p E n ( 1 ) = 0 : 0 0 1 4 : : :

    w i t h

    2

    ( o b s ) = 4 0 l o g 2 ? A p E n ( 1 ) ] = 2 7 : 6 6 9 9 : : :

    1 2

  • 5/19/2018 Approximate Entropy for Testing Randomness.pdf

    13/1

    F o r t h e m o d i e d e n t r o p y

    ~

    ( 2 )

    =

    1

    2 0

    1 0 l o g

    1 0

    2 0

    + 1 0 l o g

    1 0

    2 0

    = ? l o g 2 ;

    w i t h

    g

    A p E n ( 1 ) = 0 a n d

    2

    ( o b s ) = 4 0 l o g 2 = 2 7 : 7 2 5 8 : : : T h u s f r o m t h e p o i n t

    o f v i e w o f

    g

    A p E n ( 1 ) , t h e s e q u e n c e ( A ) i s c o m p l e t e l y n o n - r a n d o m .

    T h i s i s t o b e c o n t r a s t e d w i t h t h e v a l u e s o f t h e a p p r o x i m a t e e n t r o p y f o r

    t h e s t r i n g ( B ) .

    ( 1 )

    =

    ~

    ( 1 )

    =

    1

    2 0

    9 l o g

    9

    2 0

    + 1 1 l o g

    1 1

    2 0

    = ? 0 : 6 8 8 1 : :

    T h e r e a r e 5 p a t t e r n s ( 1 ; 0 ) , 6 p a t t e r n s ( 1 ; 1 ) , 5 p a t t e r n s ( 0 ; 1 ) , a n d 3 p a t t e r n s

    ( 0 ; 0 ) i n t h i s s t r i n g , s o t h a t

    ( 2 )

    =

    1

    1 9

    5 l o g

    5

    1 9

    + 6 l o g

    6

    1 9

    + 5 l o g

    5

    1 9

    + 3 l o g

    3

    1 9

    = ? 1 : 3 5 8 1 : :

    a n d

    A p E n ( 1 ) = 0 : 6 6 9 9 : : :

    w i t h

    2

    ( o b s ) = 4 0 l o g 2 ? A p E n ( 1 ) ] = 0 : 9 2 9 9 : O n e a l s o h a s

    ~

    ( 2 )

    =

    1

    2 0

    5 l o g

    5

    2 0

    + 6 l o g

    6

    2 0

    + 5 l o g

    5

    2 0

    + 4 l o g

    4

    2 0

    = ? 1 : 3 7 6 2 : :

    a s t h e r e a r e 5 c o p i e s o f ( 1 ; 0 ) , 6 c o p i e s o f ( 1 ; 1 ) , 5 c o p i e s o f ( 0 ; 1 ) , a n d 4 c o p i e s

    o f ( 0 ; 0 ) i n t h e a u g m e n t e d v e r s i o n o f t h i s s t r i n g , T h u s

    g

    A p E n ( 1 ) = 0 : 6 8 8 1 : : ,

    w h i c h i s c l o s e r t o t h e m a x i m u m v a l u e 0 : 6 9 3 1 : : t h a n P i n c u s ' e n t r o p y , a n d

    2

    ( o b s ) = 4 0 l o g 2 ?

    g

    A p E n ( 1 ) ] = 0 : 2 0 2 4 : : i s s m a l l e r .

    T h u s f r o m t h e p o i n t o f v i e w o f a p p r o x i m a t e e n t r o p i e s A p E n ( 1 ) a n d

    g

    A p E n ( 1 ) t h e s e q u e n c e ( A ) d o e s n o t l o o k r a n d o m a t a l l , b u t t h e s t r i n g ( B )

    d o e s a n d e v e n m o r e s o f o r t h e m o d i e d e n t r o p y

    g

    A p E n ( 1 ) . T h e s t r i n g s ( A )

    a n d ( B ) a r e a l s o e x a m i n e d i n P i n c u s a n d K a l m a n ( 1 9 9 7 ) p 3 5 1 4 , w i t h a

    n u m e r i c a l m i s t a k e .

    1 3

  • 5/19/2018 Approximate Entropy for Testing Randomness.pdf

    14/1

    0 50 100 150 200 250 300 350 4000

    0.1

    0.2

    0.3

    0.4

    0.5

    0.6

    0.7

    0.8

    0.9

    1

    F i g u r e 1 C o n s e c u t i v e P - v a l u e s f o r b i n a r y e x p a n s i o n s o f

    p

    3 ( b r o k e n l i n e ) ,

    ( d o t t e d l i n e ) a n d e ( s o l i d l i n e ) w h e n m = 1 .

    I n F i g u r e 1 t h e P - v a l u e s P

    n

    ( 1 ) f r o m S e c t i o n 2 a r e p l o t t e d a g a i n s t t h e r s t

    d i g i t s o f b i n a r y e x p a n s i o n s o f

    p

    3 . a n d e . A c c o r d i n g t o t h i s d a t a , P - v a l u e s

    c o r r e s p o n d i n g t o

    p

    3 a r e m u c h s m a l l e r t h a n t h o s e o f e a n d . T h e s i t u a t i o n ,

    h o w e v e r , i s r e v e r s e f o r m = 7 . w h e n t h e d i g i t s o f a n d

    p

    3 l o o k m u c h m o r e

    r a n d o m t h a n t h e s e o f o f e x p a n s i o n o f e ( F i g u r e 2 ) .

    1 4

  • 5/19/2018 Approximate Entropy for Testing Randomness.pdf

    15/1

    0 100 200 300 400 500 600 700 800 9000

    0.1

    0.2

    0.3

    0.4

    0.5

    0.6

    0.7

    0.8

    F i g u r e 2 C o n s e c u t i v e P - v a l u e s f o r b i n a r y e x p a n s i o n s o f

    p

    3 ( b r o k e n l i n e ) ,

    ( d o t t e d l i n e ) a n d e ( s o l i d l i n e ) w h e n m = 7 .

    T h e p r o c e d u r e s b a s e d o n r a n d o m e s s t e s t v i a a p p r o x i m a t e e n t r o p y f o r m

    n o w a p a r t o f a b a t t e r y o f e m p i r i c a l t e s t s f o r r a n d o m n e s s d e v e l o p e d a t t h e

    C o m p u t e r S e c u r i t y D i v i s i o n o f t h e N a t i o n a l I n s t i t u t e o f S t a n d a r d s a n d T e c h -

    n o l o g y . T h e y a r e b e i n g u s e d f o r i n v e s t i g a t i o n o f v a r i o u s e x i s t i n g r a n d o m

    n u m b e r s g e n e r a t o r s , s u c h a s D a t a E n c r y p t i o n A l g o r i t h m , S e c u r e H a s h A l g o -

    r i t h m , D i g i t a l S i g n a t u r e A l g o r i t h m a n d B l u m , B l u m a n d S h u b g e n e r a t o r .

    R e f e r e n c e s

    1 ] C h a i t i n , G . ( 1 9 7 5 ) , \ R a n d o m n e s s a n d m a t h e m a t i c a l p r o o f , " S c i e n t i c

    A m e r i c a n , 2 3 2 , p p 4 7 { 5 2 .

    1 5

  • 5/19/2018 Approximate Entropy for Testing Randomness.pdf

    16/1

    2 ] H o l s t , L . ( 1 9 7 2 ) , \ A s y m p t o t i c n o r m a l i t y a n d e c i e n c y f o r c e r t a i n

    g o o d n e s - o f - t t e s t s " , B i o m e t r i k a , 5 9 , p p 1 3 7 { 1 4 5 .

    3 ] I v c h e n k o , G . , a n d M e d v e d e v , Y u . I . ( 1 9 7 8 ) , \ S e p a r a b l e s t a t i s t i c s a n d

    h y p o t h e s e s t e s t i n g . T h e c a s e o f s m a l l s a m p l e s , " T h e o r y o f P r o b a b i l i t y

    a n d I t s A p p l i c a t i o n s , 2 3 , p p 7 6 4 { 7 7 5 .

    4 ] I v c h e n k o , G . , a n d M e d v e d e v , Y u . I . ( 1 9 7 8 ) , \ D e c o m p o s a b l e s t a t i s t i c s

    a n d h y p o t h e s i s t e s t i n g f o r g r o u p e d d a t a , " T h e o r y o f P r o b a b i l i t y a n d I t s

    A p p l i c a t i o n s , 2 5 , p p 5 4 0 { 5 5 1 .

    5 ] K a l l e n b e r g , W . C . M . , O o s t e r h o , J . , a n d S c h r i v e r , B . F . ( 1 9 8 5 ) , \ T h e

    n u m b e r o f c l a s s e s i n c h i - s q u a r e d g o o d n e s s - o f - t t e s t s , " J o u r n a l o f t h e

    A m e r i c a n S t a t i s t i c a l A s s o c i a t i o n , 8 0 , p p 9 5 9 { 9 6 8 .

    6 ] M e d v e d e v , Y u . I . ( 1 9 7 7 ) , \ S e p a r a b l e s t a t s i t i c s i n a p o l y n o m i a l s c h e m e .

    I , " T h e o r y o f P r o b a b i l i t y a n d I t s A p p l i c a t i o n s , 2 2 , p p 1 { 1 5 .

    7 ] M o r r i s , C . ( 1 9 7 5 ) , \ C e n t r a l l i m i t t h e o r e m f o r m u l t i n o m i a l s u m s , " A n n a l s

    o f S t a t i s t i c s , 3 , p p 1 6 5 { 1 8 8 .

    8 ] P i n c u s , S . ( 1 9 9 1 ) , \ A p p r o x i m a t e e n t r o p y a s a m e a s u r e o f s y s t e m c o m -

    p l e x i t y , " P r o c e e d i n g s o f t h e N a t i o n a l A c a d e m y o f S c i e n c e s o f t h e U S A ,

    8 8 , p p 2 2 9 7 { 2 3 0 1 .

    9 ] P i n c u s , S . , a n d H u a n g , W . - M . ( 1 9 9 2 ) , \ A p p r o x i m a t e e n t r o p y , s t a t i s t i c a l

    p r o p e r t i e s a n d a p p l i c a t i o n s , " C o m m u n i c a t i o n s i n S t a t i s t i c s , P a r t A -

    T h e o r y a n d M e t h o d s , 2 1 , p p 3 0 6 1 { 3 0 7 7 .

    1 0 ] P i n c u s , S . , a n d K a l m a n , R . E . ( 1 9 9 7 ) , \ N o t a l l ( p o s s i b l y ) \ r a n d o m "

    s e q u e n c e s a r e c r e a t e d e q u a l , " P r o c e e d i n g s o f t h e N a t i o n a l A c a d e m y o f

    S c i e n c e s o f t h e U S A , 9 4 , p p 3 5 1 3 { 3 5 1 8 .

    1 1 ] P i n c u s , S . , a n d S i n g e r , B . H . ( 1 9 9 6 ) , \ R a n d o m n e s s a n d d e g r e e s o f

    i r r e g u l a r i t y , " P r o c e e d i n g s o f t h e N a t i o n a l A c a d e m y o f S c i e n c e s o f t h e

    U S A , 9 3 , p p 2 0 8 3 { 2 0 8 8 .

    1 6