Cross validation for the kernel regression with Euclidean response data | R Documentation |
Cross validation for the kernel regression with Euclidean response data.
kernreg.tune(y, x, h = seq(0.1, 1, length = 10), type = "gauss",
nfolds = 10, folds = NULL, seed = NULL, graph = FALSE, ncores = 1)
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) |
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. |
A k-fold cross validation for the kernel regression with a euclidean response is performed.
A list including:
mspe |
The mean squared prediction error (MSPE) for each fold and value of |
h |
The optimal |
performance |
The minimum MSPE. |
runtime |
The runtime of the cross-validation procedure. |
Michail Tsagris.
R implementation and documentation: Michail Tsagris mtsagris@uoc.gr.
Wand M. P. and Jones M. C. (1994). Kernel smoothing. CRC press.
kern.reg, aknnreg.tune, aknn.reg
y <- iris[, 1]
x <- iris[, 2:4]
mod <- kernreg.tune(y, x, h = c(0.1, 0.2, 0.3) )
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.