[R] Density estimation: scale back for calendar time

David Winsemius dwinsemius at comcast.net
Thu Mar 26 18:12:35 CET 2009

Pradeep Raje <raje.pradeep <at> gmail.com> writes:

> Thanks David for your response.I had done that. 

But not shared it.

> Problem is not with the
> computations, but in the interpretation.
> Assume that x ordinates are 'time' [1:3472], and y are associated parameter
> values.
> Now density gives me 512/1024/2048 x-ordinates, of which some (7 to be
> precise) are negative. What do I make of the non-zero probability at
> **negative** times?

Obviously you are having problems with interpretation which is why I suggested 
that you provide a worked example. Since you appear to be resisting that 
suggestion, let's talk about hypotheticals. Two results of a density 
estimation will be density(dat)$x and density(dat)$y. The first of these is not 
a probability and could be negative in any instances where negative numbers 
were in the domain of the dat object. And it might be negative in situations 
with postive values where an estimation extended slightly beyond the original 
dataset. It is the y values that are necessarily positive. 

The idea that dates associated with a numerical object could be used to label a 
density plot seems strange. The process of density estimation would scrample 
the order of the original data so that the densities could be calculated. In a 
sense the y-axis of the original object will become the new x-axis of the 
density object. There would be no way to restore that "date" order. It had been 
my hope that a request for an example would make that more clear. Back to you.

David Winsemius

More information about the R-help mailing list