Description Usage Arguments Examples
2d local density estimate.
1 2 |
x |
a numeric vector of x positions |
y |
a numeric vector of y positions |
weight |
|
h |
constant bandwidth. Use if you want a constant bandwith, rather
than a bandwidth that varies. If both |
nn |
A vector of length two, giving the span, or nearest neighbour fraction, the proportion of the total used to compute the density. |
scale |
should x and y positions be scaled independently? Use
|
kernel |
Weight function, default is tricubic. Other choices are
|
degree |
degree of polynomial used for smoothing |
bounded |
if |
na.rm |
If |
1 2 3 4 5 6 7 8 | data(baseball, package = "plyr")
dens <- local_density_2d(baseball$g, baseball$ab)
plot(dens)
baseball$dens <- dens(baseball$g, baseball$ab)
plot(local_density_2d(baseball$g, baseball$ab, nn = 0.4))
plot(local_density_2d(baseball$g, baseball$ab, nn = 0.1))
plot(local_density_2d(baseball$g, baseball$ab, bounded = TRUE))
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.