[R] can I calculate density for only non-negative value?
Prof Brian Ripley
ripley at stats.ox.ac.uk
Tue Aug 20 07:22:15 CEST 2013
On 20/08/2013 03:35, Gallon Li wrote:
> x=rchisq(100,1)
> density(x)
>
> the density plot will give density for negative part also. of course I can
> truncate the plot to only view the non-negative part.
>
> I wonder if there is a program to compute density for a user-specified
> range, in this case, only [0, infinity).
Yes, but it will not be using the same method as density. One place to
look is logspline() in package polspline, but please learn about the
methodology of density estimation before you use any of these.
>
> [[alternative HTML version deleted]]
>
> ______________________________________________
> 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.
>
--
Brian D. Ripley, ripley at stats.ox.ac.uk
Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/
University of Oxford, Tel: +44 1865 272861 (self)
1 South Parks Road, +44 1865 272866 (PA)
Oxford OX1 3TG, UK Fax: +44 1865 272595
More information about the R-help
mailing list