Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Comparing Kernel Density Estimation plots

I am actually a novice to R and stats.. Could something like this be done in R

Determining the density estimates of two samples ( 2 Vectors )..?? I have done this Using R and obtained 2 density curves for the 2 samples using kernel density estimation ..

Is there anyway to quantitatively compare how similar/Dissimilar the density estimates of 2 samples are..?

I am trying to find out which data sample exhibits has a similar distribution to a particular distribution..

I am using R Language... Can somebody please help..??

like image 649
Pradeep Avatar asked Apr 18 '11 06:04

Pradeep


2 Answers

You can use Kolmogorov-Smirnov test (ks.test) to compare two distributions. Cramer-von-Mises test is another one. There is this PDF Fitting Distributions with R where they also list other tests that are available (although the nortest package that he uses only tests for normality).

like image 160
Apprentice Queue Avatar answered Sep 20 '22 21:09

Apprentice Queue


Apprentice Queue is right about using the Kolmogorov-Smirnoff test, but I wanted to add a warning: don't use it on its own. You should visually compare the distributions as well, either with two kernel density plots or histograms, or with a qqplot. Human brains are very good at playing spot-the-difference.

like image 43
Richie Cotton Avatar answered Sep 16 '22 21:09

Richie Cotton