Learn R Programming

ks (version 1.6.13)

binning: Linear binning for multivariate data

Description

Linear binning for 1- to 4-dimensional data.

Usage

binning(x, H, h, bgridsize, xmin, xmax, supp=3.7, w)

Arguments

x
matrix of data values
H
bandwidth matrix
h
scalar bandwidth
xmin
vector of minimum values for grid
xmax
vector of maximum values for grid
supp
effective support for standard normal is [-supp, supp]
bgridsize
vector of binning grid sizes
w
vector of weights (non-negative and sum is equal to sample size)

Value

  • Returns a list with 2 fields
  • countslinear binning counts
  • eval.pointsvector (d=1) or list (d>2) of grid points in each dimension

Details

Code is used courtesy of Matt Wand. Default bgridsize are d=1: 401; d=2: rep(151, 2); d=3: rep(51, 3); d=4: rep(21,4).

References

Wand, M.P. & Jones, M.C. (1995) Kernel Smoothing. Chapman & Hall. London.

Examples

Run this code
data(unicef)
ubinned <- binning(x=unicef)
ubinned <- binning(x=unicef, xmin=c(0, 20), xmax=c(350, 100))

Run the code above in your browser using DataLab