\HeaderA{kullback.leibler}{Kullback-Leibler divergence}{kullback.leibler}
\keyword{misc}{kullback.leibler}
\begin{Description}\relax
A function for calculating the Kullback-Leibler divergence between
two discrete probability distributions. The vectors specifying the
probability distributions must have the same length.
\end{Description}
\begin{Usage}
\begin{verbatim}
kullback.leibler(p, q)
\end{verbatim}
\end{Usage}
\begin{Arguments}
\begin{ldescription}
\item[\code{p}] A \code{numeric} vector specifying the the first probability
distribution. It has to have the same length as \code{q}.
\item[\code{q}] A \code{numeric} vector specifying the the second probability
distribution.
\end{ldescription}
\end{Arguments}
\begin{Value}
The function returns the Kullback-Leibler divergence between the two
specified descrete probability distributions.
\end{Value}
\begin{Section}{Warning}
The function does not check whether the values in the vectors
specifying the discrete probability distributions sum up to one.
\end{Section}
\begin{Author}\relax
Jasmina Bogojeska
\end{Author}
\begin{SeeAlso}\relax
\code{\LinkA{L1.dist}{L1.dist}}, \code{\LinkA{L2.norm}{L2.norm}},  \code{\LinkA{stability.sim}{stability.sim}}
\end{SeeAlso}
\begin{Examples}
\begin{ExampleCode}
## 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)
\end{ExampleCode}
\end{Examples}

