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.

  • $\begingroup$ I don't understand how many variable in your X to predict your Y. $\endgroup$ – lcrmorin Jan 5 at 12:17

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.