kernreg.tune: Cross validation for the kernel regression with Euclidean...

View source: R/kernreg.tune.R

Cross validation for the kernel regression with Euclidean response dataR Documentation

Cross validation for the kernel regression with Euclidean response data

Description

Cross validation for the kernel regression with Euclidean response data.

Usage

kernreg.tune(y, x, h = seq(0.1, 1, length = 10), type = "gauss",
nfolds = 10, folds = NULL, seed = NULL, graph = FALSE, ncores = 1)

Arguments

y

A matrix or a vector with the Euclidean response.

x

A matrix with the available predictor variables.

h

A vector with the bandwidth value(s) h to consider.

type

The type of kernel to use, "gauss" or "laplace".

nfolds

The number of folds. Set to 10 by default.

folds

If you have the list with the folds supply it here. You can also leave it NULL and it will create folds.

seed

You can specify your own seed number here or leave it NULL.

graph

If graph is TRUE (default value) a plot will appear.

ncores

The number of cores to use. Default value is 1.

Details

A k-fold cross validation for the kernel regression with a euclidean response is performed.

Value

A list including:

mspe

The mean squared prediction error (MSPE) for each fold and value of h.

h

The optimal h that leads to the minimum MSPE.

performance

The minimum MSPE.

runtime

The runtime of the cross-validation procedure.

Author(s)

Michail Tsagris.

R implementation and documentation: Michail Tsagris mtsagris@uoc.gr.

References

Wand M. P. and Jones M. C. (1994). Kernel smoothing. CRC press.

See Also

kern.reg, aknnreg.tune, aknn.reg

Examples

y <- iris[, 1]
x <- iris[, 2:4]
mod <- kernreg.tune(y, x, h = c(0.1, 0.2, 0.3) )

Compositional documentation built on Oct. 9, 2024, 5:10 p.m.