# Re: [R] Comparing distributions

From: Tommy Chheng <tommy.chheng_at_gmail.com>
Date: Wed, 23 Jun 2010 16:00:36 -0700

Check out the KL divergence test
http://en.wikipedia.org/wiki/Kullback%E2%80%93Leibler_divergence <http://en.wikipedia.org/wiki/Kullback%E2%80%93Leibler_divergence>

@tommychheng

On 6/23/10 12:33 PM, Ralf B wrote:
> I am trying to do something in R and would appreciate a push into the
> right direction. I hope some of you experts can help.
>
> I have two distributions obtrained from 10000 datapoints each (about
> 10000 datapoints each, non-normal with multi-model shape (when
> eye-balling densities) but other then that I know little about its
> distribution). When plotting the two distributions together I can see
> that the two densities are alike with a certain distance to each other
> (e.g. 50 units on the X axis). I tried to plot a simplified picture of
> the density plot below:
>
>
>
>
> |
> | *
> | * *
> | * + *
> | * + + *
> | * + * + + *
> | * +* + * + + *
> | * + * + +*
> | * + +*
> | * + +*
> | * + + *
> | * + + *
> |___________________________________________________________________
>
>
> What I would like to do is to formally test their similarity or
> otherwise measure it more reliably than just showing and discussing a
> plot. Is there a general approach other then using a Mann-Whitney test
> which is very strict and seems to assume a perfect match. Is there a
> test that takes in a certain 'band' (e.g. 50,100, 150 units on X) or
> are there any other similarity measures that could give me a statistic
> about how close these two distributions are to each other ? All I can
> say from eye-balling is that they seem to follow each other and it
> appears that one distribution is shifted by a amount from the other.
> Any ideas?
>
> Ralf
>
> ______________________________________________
> R-help_at_r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help