[R] two densities with same stepsize

Antje niederlein-rstat at yahoo.de
Tue Feb 5 09:22:16 CET 2008


Hi there,

I have two series of data. plotting the density function of both gives me an 
idea about the difference of the data. But I would like to quantify the 
difference I see.

a <- rnorm(100)
b <- rnorm(100)

da <- density(a)
db <- density(b)

The problem is that da$x and db$x are different and so I have difficulties to 
compare them... Is there any way to force the density funtion to produce the 
values for the same x-steps?
Or is there any other statistical approach I should use for comparing two 
density functions? I need to quantify how much the data-series differ (density 
function is rather complex in my case with skew and several maximas, so not 
easily to describe as a mathematical function.
Sorry, I'm not that deep into statistics. Any comments / keywords on this is 
welcome...

Antje



More information about the R-help mailing list