Description Usage Arguments Details Value Side Effects References See Also Examples
This function selects a smoothing parameter for density estimation in one or two dimensions and for nonparametric regression with one or two covariates. Several methods of selection are available.
1 
x 
a vector, or twocolumn matrix. 
y 
a vector of responses, in regression case. 
weights 
a vector of integers representing frequencies of individual
observations. Use of this parameter is incompatible with

group 
a vector of groups indicators (numeric or character values) or a factor 
... 
other optional parameters are passed to the 
see the two references below for discussion of the methods of smoothing parameter selection.
If the sample size is large, binning will be employed. In the
case of method = "cv"
the answer will therefore be
different from that obtained through the function hcv
where binning is not used.
When the group
argument is set, the chosen method of
smoothing parameter selection is applied to each group and the
value returned is the geometric mean of these. This is intended
for use in sm.density.compare
and
sm.ancova
, where
the same smoothing parameter is used for all groups so that
the principal bias terms cancel when the estimates are compared.
the value of the selected smoothing parameter.
none
Bowman, A.W. and Azzalini, A. (1997). Applied Smoothing Techniques for Data Analysis: the Kernel Approach with SPlus Illustrations. Oxford University Press, Oxford.
Hurvich, C.M., Simonoff, J.S. and Tsai, C.L. (1998). Smoothing parameter selection in nonparametric regression using an improved Akaike information criterion. J. R. Statistic. Soc., Series B, 60, 271293.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17  x < rnorm(50)
h.select(x)
h.select(x, method = "sj")
x < matrix(rnorm(100), ncol = 2)
h.select(x)
sm.density(x, method = "cv")
x < rnorm(50)
y < x^2 + rnorm(50)
h.select(x, y)
sm.regression(x, y, method = "aicc")
x < matrix(rnorm(100), ncol = 2)
y < x[,1]^2 + x[,2]^2 + rnorm(50)
h.select(x, y, method = "cv", structure.2d = "common")
sm.regression(x, y, df = 8)

Package 'sm', version 2.25.4: type help(sm) for summary information
[1] 0.4465847
[1] 0.2486255
[1] 0.5226070 0.5909681
Loading required package: rgl
Loading required package: rpanel
Loading required package: tcltk
Error: package or namespace load failed for 'tcltk':
.onLoad failed in loadNamespace() for 'tcltk', details:
call: fun(libname, pkgname)
error: Can't find a usable init.tcl in the following directories:
/usr/share/tcltk/tcl8.6 ./lib/tcl8.6 ./lib/tcl8.6 ./library ./library ./tcl8.6.1/library ./tcl8.6.1/library
/usr/share/tcltk/tcl8.6/init.tcl: couldn't read file "/usr/share/tcltk/tcl8.6/init.tcl": permission denied
couldn't read file "/usr/share/tcltk/tcl8.6/init.tcl": permission denied
while executing
"source /usr/share/tcltk/tcl8.6/init.tcl"
("uplevel" body line 1)
invoked from within
"uplevel #0 [list source $tclfile]"
This probably means that Tcl wasn't installed properly.
Failed with error: 'package 'tcltk' could not be loaded'
In addition: Warning messages:
1: In rgl.init(initValue, onlyNULL) : RGL: unable to open X11 display
2: 'rgl_init' failed, running with rgl.useNULL = TRUE
3: .onUnload failed in unloadNamespace() for 'rgl', details:
call: fun(...)
error: object 'rgl_quit' not found
[1] 0.405744
[1] 0.7293659 0.7293659
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.