Learn R Programming

Compositional (version 5.5)

Cross validation for the kernel regression with Euclidean response data: 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.

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.

Details

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

References

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

See Also

kern.reg, aknnreg.tune, aknn.reg

Examples

Run this code
# NOT RUN {
y <- iris[, 1]
x <- iris[, 2:4]
mod <- kernreg.tune(y, x, h = c(0.1, 0.2, 0.3) )
# }

Run the code above in your browser using DataLab