[R] Question on density values obtained from kde2d() from package MASS
Peter Löwenberg
peter.lowenberg.neto at gmail.com
Thu Jan 23 20:04:06 CET 2014
Hello Andy,
Do you already understand kde2d output?
if I run
> max(tmp$z)
do I take the maximum value of the 2d density?
Cheers,
Peter
Em quinta-feira, 24 de novembro de 2011 16h12min19s UTC-2, Andreas Klein
escreveu:
>
> Hello,
>
> I am a little bit confused regarding the density values obtained from the
> function kde2d() from the package MASS because the are not in the intervall
> [0,1] as I would expect them to be. Here is an example:
>
> x <-
> c(0.0036,0.0088,0.0042,0.0022,-0.0013,0.0007,0.0028,-0.0028,0.0019,0.0026,-0.0029,-0.0081,-0.0024,0.0090,0.0088,0.0038,0.0022,0.0068,0.0089,-0.0015,-0.0062,0.0066)
> y <-
> c(0.00614,0.00194,0.00264,0.00064,0.00344,0.00314,-0.00006,-0.00066,0.00174,0.00274,-0.00076,0.00024,-0.00236,0.00234,0.00504,0.00114,0.00054,-0.00116,-0.00016,-0.00566,0.00044,0.00404)
>
> tmp <- kde2d(x=x, y=y, n=100)
> range(tmp$z)
> #3.621288 11989.060924
>
> Do I have to transform them further? Or what scale are they?
> Or did I get something wrong regarding the output because in the help file
> it reads:
> "zAn n[1] by n[2] matrix of the estimated density: rows
> correspond to the value of x, columns to the value of y."
>
>
> Regards,
> Andy.
>
>
> ______________________________________________
> R-h... at r-project.org <javascript:> 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