Learn R Programming

viper (version 1.6.0)

approxk2d: approxk2d

Description

This function uses a gaussian kernel to estimate the joint density distribution at the specified points

Usage

approxk2d(x, gridsize = 128, pos = x)

Arguments

x
Matrix of x and y points
gridsize
number or vector indicating the size of the greed where to estimate the density
pos
Matrix of coordinates to evaluate the density

Value

Vector of density estimates

Examples

Run this code
x <- rnorm(500)
y <- x+rnorm(500)
kde2 <- approxk2d(cbind(x, y))
plot(x, y, pch=20, col=hsv(0, kde2/max(kde2), 1))

Run the code above in your browser using DataLab