Library: | smoother |
See also: | Rdenxest denbbwcrit binweights binlindata |
Quantlet: | Rdenbest | |
Description: | evaluates a kernel estimate of an integrated squared density (derivative) using the normal kernel for a (vector of) bandwidth(s) h. This quantlet is a variation of Rdenxest and uses linearly prebinned data for faster computation. |
Usage: | Rh = Rdenbest(der, nx, binw, d, h, diag) | |
Input: | ||
der | scalar, order of derivative der = 0,1,2,... | |
nx | scalar, number of data points | |
binw | m x 1 vector of bin weights = autocovariance of the bin counts | |
d Defintion scalar, binwidth | p x 1 vector of bandwidths | |
h | scalar; if set to 0, the diagonal terms are removed from the estimate, otherwise included | |
Output: | ||
Rh | p x 1 vector of the functional estimates |
library("smoother") library("xplore") randomize(0) n = 1000 s = 2 diag = 1 h = #(0.1, 0.2, 0.3) d = 0.01 {w,mu,sigma} = normalmixselect("Marron_Wand_3") x = normalmix(n, w, mu, sigma) {bingrid, bincounts} = binlindata(x, d, 0) binw = binweights(bincounts) Rh = Rdenbest(s, n, binw, d, h, diag) h ~ Rh
computes the kernel estimates for the integrated squared second density derivative at three different bandwidths based on a sample of size 1000 generated from a normal mixture example density using linear binned data: Contents of _tmp [1,] 0.1 1020.1 [2,] 0.2 145.35 [3,] 0.3 32.609