| Library: | smoother |
| See also: | denbwsel denrot denest |
| Macro: | denbwcrit | |
| Description: | determines the optimal from a range of bandwidths by one of the following bandwidth selection criteria: Least Squares Cross Validation (lscv), Biased Cross Validation (bcv), Smoothed Cross Validation (scv), Jones, Marron and Park Cross Validation (jmp), Park and Marron Plug-in (pm), Sheather and Jones Plug-in (sj), and Silverman's rule of thumb. |
Haerdle (1991): Smoothing Techniques
Haerdle, Mueller, Sperlich, Werwatz (1999): Non- and Semiparametric Modelling
| Usage: | {hopt, ch} = denbwcrit(crit, x {,h {,K} {,d} }) | |
| Input: | ||
| crit | string, criterion for bandwidth selection: "lscv", "bcv", "scv", "jmp", "pm", "sj". | |
| x | n x 1 vector, the data. | |
| h | m x 1 vector, vector of bandwidths. | |
| K | string, kernel function on [-1,1] or Gaussian kernel "gau". If not given, "gau" is used. | |
| d | scalar, discretization binwidth. d must be smaller than h. If not given, the minimum of min(h)/3 and (max(x)-min(x))/200 is used. | |
| Output: | ||
| hopt | scalar, optimal bandwidth. (If negative in case of "pm" or "sj", denbwcrit needs to be run again with different h range.) | |
| ch | m x 2 vector, the criterion function for h values. | |
library("smoother")
x=normal(500)
h=grid(0.05,0.1,10)
{hopt,ch}=denbwcrit("lscv",x,h)
hopt
library("plot")
ch=setmask(ch,"line","blue")
plot(ch)
setgopt(plotdisplay,1,1,"title",string("hopt=%1.6g",hopt))
hopt is the LSCV optimal bandwidth for these data. The resulting curve for the LSCV criterion is plotted.
| Library: | smoother |
| See also: | denbwsel denrot denest |