This question is general- I have a data set of n observations, consisting
of a single response variable y and p regressor variables.( n ~50, p~3 or
I am planning to implement Nadaraya-Watson regression model, with
bandwidths optimized via cross-validation.
For cross-validation, I will need to choose 10 outsample/test data sets of
a given size ( =n/10 ) for each choice of the bandwidth vector, and then
choose the optimum bandwidth vector (in terms of MSE or any reasonable loss
function-we can take it to be MSE, as example).
The difficulty is I can't find any code to do this under:
A) multiple regressors (p>1) AND
B) I'll get to choose to the outsample datasets.
Thanks for any help/insight you can provide.
> I am planning to implement Nadaraya-Watson regression model, with
I'm not sure what you mean by "implement".
Write a package, fit a model, or something else...
Reading your whole post, I get the impression you want mid-level
"building blocks", so you customize the model fitting process, in some
But maybe I've got that wrong...
If you want fine control over the model fitting process (including the
cross validation), then you may have to write your own package,
including your own building blocks.
Otherwise, I think you should just use what's available.
Also, I'm not familiar with every flavor of nonparametric regression available.
If I wanted to fit a nonparametric regression model, I would start
with the mgcv package, which is hard to beat.