Question
This problem should be solved with R version 3.5.3. For R, partition the data sets into 60% training and 40% validation and implement the 10-fold
This problem should be solved with R version 3.5.3. For R, partition the data sets into 60% training and 40% validation and implement the 10-fold cross-validation. Use the statement set.seed(1) to specify the random seed for data partitioning and cross-validation. When searching for the optimal value of k, search within possible k values from 1 to 10. If the predictor variable values are in the character format, then treat the predictor variable as a categorical variable. Otherwise, treat the predictor variable as a numerical variable. The accompanying file contains 60 observations with the binary target variable y along with the predictor variables x1 and x2.
a. Perform KNN analysis. What is the optimal value of k. Enter the optimal k in below:
optimal k:
b-1. Report the accuracy, specificity, sensitivity, and precision rates for the validation data set. (Round your answers to 2 decimal places.)
Accuracy -
Specificity -
Sensitivity -
Precision -
Excel Data
X1 1 2 3 0 0 11.39 9.79 11.5 4 0 5 1 0 6 7 9.74 10.48 16.17 4.57 X2 9.1 12.27 11.42 8.53 12.89 9.62 12.94 11.94 3.87 9.1 1 4.63 7.74 7.88 7.04 8.65 4.33 15.84 18.15 4.46 10.4 8.08 11.96 2.76 6.81 6.55 11.32 11.63 10.22 3.2 7.27 2.34 8 0 9 0 10 1 11 1 12 0 13 1 14 0 15 1 16 0 17 0 18 0 19 1 20 0 21 1 22 1 23 0 24 0 25 0 26 0 27 0 28 0 29 O 30 0 31 1 32 1 33 1 34 O 35 0 36 0 37 0 38 1 12.81 12.32 2.34 10.12 10.21 3.45 13.19 18.59 5.59 15.87 15.25 4.83 10.57 5.96 12.04 17.59 7.79 4.86 4.32 6.61 11.15 12.45 6.91 7.09 5.43 13.34 12.88 13.97 6.42 3.63 5.73 10.01 11.67 13.08 5.48 2.17 3911 40 1 410 4210 43 1 4410 450 4610 4710 48 1 49 11 50 1 510 520 5310 54 1 55 1 5611 570 580 7.16 18.56 4.97 14.44 18.45 5.45 10.77 11.21 8.31 13.09 1972 18.06 8.13 6.26 5.31 19.83 7 9.77 19.83 9.87 6.31 17.01 4.59 3.07 9.37 13.72 13.93 3.16 8.51 10.04 10.02 9.5 2.66 9.61 9.24 932 4.19 10.89 3.33 7.27 5.66 13.03 8.06 8.99 10.6 5910 60 1 6111 8.08 X1 1 2 3 0 0 11.39 9.79 11.5 4 0 5 1 0 6 7 9.74 10.48 16.17 4.57 X2 9.1 12.27 11.42 8.53 12.89 9.62 12.94 11.94 3.87 9.1 1 4.63 7.74 7.88 7.04 8.65 4.33 15.84 18.15 4.46 10.4 8.08 11.96 2.76 6.81 6.55 11.32 11.63 10.22 3.2 7.27 2.34 8 0 9 0 10 1 11 1 12 0 13 1 14 0 15 1 16 0 17 0 18 0 19 1 20 0 21 1 22 1 23 0 24 0 25 0 26 0 27 0 28 0 29 O 30 0 31 1 32 1 33 1 34 O 35 0 36 0 37 0 38 1 12.81 12.32 2.34 10.12 10.21 3.45 13.19 18.59 5.59 15.87 15.25 4.83 10.57 5.96 12.04 17.59 7.79 4.86 4.32 6.61 11.15 12.45 6.91 7.09 5.43 13.34 12.88 13.97 6.42 3.63 5.73 10.01 11.67 13.08 5.48 2.17 3911 40 1 410 4210 43 1 4410 450 4610 4710 48 1 49 11 50 1 510 520 5310 54 1 55 1 5611 570 580 7.16 18.56 4.97 14.44 18.45 5.45 10.77 11.21 8.31 13.09 1972 18.06 8.13 6.26 5.31 19.83 7 9.77 19.83 9.87 6.31 17.01 4.59 3.07 9.37 13.72 13.93 3.16 8.51 10.04 10.02 9.5 2.66 9.61 9.24 932 4.19 10.89 3.33 7.27 5.66 13.03 8.06 8.99 10.6 5910 60 1 6111 8.08
Step by Step Solution
There are 3 Steps involved in it
Step: 1
![blur-text-image](https://dsd5zvtm8ll6.cloudfront.net/includes/images/document_product_info/blur-text-image.webp)
Get Instant Access with AI-Powered Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
![blur-text-image](https://dsd5zvtm8ll6.cloudfront.net/includes/images/document_product_info/blur-subtext-image.webp)
Step: 3
![blur-text-image](https://dsd5zvtm8ll6.cloudfront.net/includes/images/document_product_info/blur-subtext-image.webp)
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started