I have test data and train data in test.csv and train.csv respectively.
train$X are volt to current ratio and
train$y are the measured (noisy) outputs.
I created a k-NN model using the training data to estimate the values of y for the train data and by cv found the optimal value of k = 5.
How can I apply the bootstrap procedure to the y values estimated by k-NN? Then using the outputs of the bootstrap function boot(), how can I plot an approximate 95% confidence interval for the estimated y values for the X values in ms.test along with the true y in ms.test (given in the csv file) and the average of the bootstrap estimates of y.
I have to run it for at least 100 bootstrap iterations and discuss the confidence interval in comparison to the true y values. We are required to use the $t field of the object returned by boot() which gives us access to the bootstrap estimates for each bootstrap iteration as a matrix.