[R] density function cannot work well on UNIX R version 2.13.
David Winsemius
dwinsemius at comcast.net
Wed Aug 31 21:27:40 CEST 2011
On Aug 31, 2011, at 1:04 PM, alex46015 at yahoo.com wrote:
>
> Hi, there,
>
> I found density function cannot work well on UNIX.R
> version 2.13.1 (2011-07-08), Platform: i386-pc-solaris2.10 (32-bit)
>
> Here is an example from R doucments which can work well on other
> version.
>
> plot(density(c(-20,rep(0,98),20)), xlim = c(-4,4))#
What do you get with just this:
density(c(-20,rep(0,98),20))
Here's what we are seeing:
Call:
density.default(x = c(-20, rep(0, 98), 20))
Data: c(-20, rep(0, 98), 20) (100 obs.); Bandwidth 'bw' = 1.019
x y
Min. :-2.306e+01 Min. :0.000e+00
1st Qu.:-1.153e+01 1st Qu.:1.125e-12
Median :-1.776e-15 Median :6.311e-06
Mean :-1.593e-15 Mean :2.167e-02
3rd Qu.: 1.153e+01 3rd Qu.:1.884e-03
Max. : 2.306e+01 Max. :3.828e-01
> density(c(-20,rep(0,98),20))$y[
which.min(abs( density(c(-20,rep(0,98),20))$x ) )
]
[1] 0.382816
>
> But right now the estimated probablity =0 for all point.
That is not what the rest of us are seeing.
>
> Do I need do something about float point?
>
> Thanks.
> Alex
>
> ______________________________________________
> 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.
David Winsemius, MD
West Hartford, CT
More information about the R-help
mailing list