kullback.leibler          package:Rtreemix          R Documentation

_K_u_l_l_b_a_c_k-_L_e_i_b_l_e_r _d_i_v_e_r_g_e_n_c_e

_D_e_s_c_r_i_p_t_i_o_n:

     A function for calculating the Kullback-Leibler divergence between
     two discrete probability distributions. The vectors specifying the
     probability distributions must have the same length.

_U_s_a_g_e:

     kullback.leibler(p, q)

_A_r_g_u_m_e_n_t_s:

       p: A 'numeric' vector specifying the the first probability
          distribution. It has to have the same length as 'q'.

       q: A 'numeric' vector specifying the the second probability
          distribution.

_V_a_l_u_e:

     The function returns the Kullback-Leibler divergence between the
     two specified descrete probability distributions.

_W_a_r_n_i_n_g:

     The function does not check whether the values in the vectors
     specifying the discrete probability distributions sum up to one.

_A_u_t_h_o_r(_s):

     Jasmina Bogojeska

_S_e_e _A_l_s_o:

     'L1.dist', 'L2.norm',  'stability.sim'

_E_x_a_m_p_l_e_s:

     ## Define two discrete probability distributions with equal lengths.
     p <- c(0.1, 0.2, 0.3, 0.4)
     q <- c(0.2, 0.5, 0.1, 0.2)

     ## Calculate the Kullback-Leibler divergence
     ## between the probability distributions p and q
     kullback.leibler(p, q)

