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:
  • Pn x nbins, first probability distribution

  • Q1 x nbins or n x nbins (one to one), second probability distribution

OUTPUTS:

distn x 1 Kullback-Leibler distance for each row

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

OUTPUTS:

dist – an array of KL Distances at each iteration