wkde2d: Weighted 2D kernel density estimation

Description Usage Arguments Value Author(s) Examples

View source: R/kde.R

Description

Weighted 2D kernel density estimation

Usage

1
wkde2d(x, y, w, h, adjust = 1, n = 100, lims = c(range(x), range(y)))

Arguments

x

Dimension 1

y

Dimension 2

w

Weight variable

h

vector of bandwidths for x and y directions. Defaults to normal reference bandwidth (ks::hpi). A scalar value will be taken to apply to both directions.

adjust

Bandwidth adjustment

n

Number of grid points in each direction. Can be scalar or a length-2 integer vector.

lims

The limits of the rectangle covered by the grid as c(xl, xu, yl, yu).

Value

A list of three components.

Author(s)

Jose Alquicira-Hernandez

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
set.seed(1)
x <- rnorm(100)

set.seed(2)
y <- rnorm(100)

set.seed(3)
w <- sample(c(0, 1), 100, replace = TRUE)

dens <- Nebulosa:::wkde2d(x, y, w)

powellgenomicslab/Nebulosa documentation built on May 5, 2021, 6:14 p.m.