kernel2width( vX, vY, wx, wy[, int method=0, int grid=32]) returns the 2D kernel density optimal bandwidths (wx, wy) of X scale and Y scale for datasets (vX, vY) using two different methods.
When method = 0 (default)
Bivariate Kernel Density Estimator method is used.
This method offers bandwidth based on linear diffusion process.
When method = 1
Rule of Thumb method is used.
The estimation of wx and wy simply can be calculated by:
where n is the size of vector vX or vY, is the sample standard variation for dataset vX, and for dataset vY accordingly.
- vX (input, vector)
- x values of distributed samples used to estimate bandwidth
- vY (input, vector)
- y values of distributed samples used to estimate bandwidth
- wx (output, double)
- output width for X scale,
- wy (output, double)
- output width for Y scale,
- method (input, int)
- method = 0 (default) for Bivariate Kernel Density Estimator method or 1 for Rule of Thumb method.
- grid (input, int)
- input number of grids in X/Y direction for method=0, grid is a positive integer.