# KLdistance¶

KLDis(P, Q)[source]

Calculates the Kullback-Leibler Distance of two discrete probability distributions. P and Q are automatically normalised to have the sum of one on rows have the length of one at each.

Usage

dist = KLDis(P, Q)

Inputs

• P = n x nbins
• Q = 1 x nbins or n x nbins(one to one)

Output

• dist = n x 1
KLdistance(data1, data2, num_iter, parameters)[source]

This function calculates the Kullback-Leibler Distance (KLD) between two distributions then runs a certain number of iterations where the labels are randomised and the KLD is calculated. Then, the distribution of the Disergences is plotted. Usage

dist = KLdistance(data1, data2, num_iter, parameters);

Inputs

• data1 – n x m matrix where each column reprensents the values of a certain parameter for one of the populations (e.g. controls)
• data2 – same as data1 for the population to compare
• num_iter – number of randomisations
• parameters – a cell array of strings containing the name of each parameter

Output

• dist – an array of KL Distances at each iteration