[R] density() with from, to or cut and comparrison of density()

Uwe Ligges ligges at statistik.uni-dortmund.de
Wed Aug 30 13:01:52 CEST 2006



Rainer M Krug wrote:
> Hi
> 
> the function density() does normally integrate to one - I've checked it
> and it works and I also read the previous threads.
> But I realised that it does not integrate to one if I use from, to or cut.
> 
> My scenario: I simulated densities of a plants originating from an sseed
> source at distance zero. Therefore the density of the plants will be
> highest close to zero. Is there anything I can do to have this pattern?
> If I use 'from' or 'cut', the resulting densities do not integrate to
> one which I need as I want to compare different density curves.

The kernel chosen might be not the ideal one for such a restriction. If 
the density outside the "cut" range is extremely small, you might want 
to do a dirty transformation so that the values sum up to 1 again.

> Ny second question is concerning the bandwidth. An I correct in saying
> that if I want to compare different density estimates that the bandwidth
> should be the same for all of them?

Yes.

Uwe Ligges


> Thanks in advance for your help,
> 
> Rainer
>



More information about the R-help mailing list