[R] density plot & probabilities

Uwe Ligges ligges at statistik.tu-dortmund.de
Sun Feb 1 15:53:09 CET 2009



gregor rolshausen wrote:
> hello !
> I have question concerning *kernel density plots*:
> 
> how to plot <density vs. the probability> of a vector, when that vector 
> is very short (5-10 values)?
> I tried:
> 
>  > plot(density(x))
> 
> or
> 
>  > hist(x,probability=T,border="white")
>  > lines(density(x))
> 
> for small length of vectors, the ylab is not 0<ylab<1 but fro example 
> from 0 to 3. thats confusing for a density... why is that?

Why do you think a density is smaller than one?
Consider a uniform distribution from 0 to 0.5, hope it still has a value 
of 2 between 0 and 0.5 ...

Uwe Ligges



> thanks for your time.
> cheers,
> gregor
> 
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide 
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.




More information about the R-help mailing list