h.select: Selection of the smoothing parameter

h.selectR Documentation

Selection of the smoothing parameter

Description

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.

Usage

 h.select(x, y = NA, weights = NA, group = NA, ...)

Arguments

x

a vector, or two-column 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 binning; hence nbins must then be set to 0 or left at its default value NA.

group

a vector of groups indicators (numeric or character values) or a factor

...

other optional parameters are passed to the sm.options function, through a mechanism which limits their effect only to this call of the function. There are three which are relevant for this function, namely method, which specifies the method of smoothing parameter selection, df, which specifies the approximate degrees of freedom associated with the selected smoothing parameter, and structure.2d which determines the form of the smoothing parameters in the two-dimensional case. A full description of these arguments are given in the documentation of sm.options.

Details

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.

Value

the value of the selected smoothing parameter.

Side Effects

none

References

Bowman, A.W. and Azzalini, A. (1997). Applied Smoothing Techniques for Data Analysis: the Kernel Approach with S-Plus 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, 271-293.

See Also

sm, hcv, hsj, hnorm

Examples

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)

sm documentation built on May 29, 2024, 2:28 a.m.

Related to h.select in sm...