For the latest version of JMP Help, visit

Predictive and Specialized Modeling > K Nearest Neighbors > Example of K Nearest Neighbors with Continuous Response
Publication date: 11/29/2021

Image shown hereExample of K Nearest Neighbors with Continuous Response

In this example, you want to predict the percent body fat for males using 13 predictors. The Body sample data table contains percent body fat estimates that are based on underwater weighing and on various body circumference measurements.

1. Select Help > Sample Data Library and open Body

2. Select Analyze > Predictive Modeling > K Nearest Neighbors.

3. Select Percent body fat and click Y, Response.

4. Select Age (years) through Wrist circumference (cm) and click X, Factor.

5. Select Validation and click Validation.

6. Click OK.

7. Click the Percent body fat red triangle and select Plot Actual by Predicted.

Figure 7.3 K Nearest Neighbors ReportĀ 

K Nearest Neighbors Report

The K = 8 model had the lowest RASE for the validation set. Among k nearest neighbor models, the model based on 8 nearest neighbors seems to perform the best. The Actual by Predicted plot for the training set shows that the points fall along the line, signifying that the predicted values are similar to the actual values. Most of the points on the plot for the validation set fall along the line, with a few observations on the upper end that are a bit farther away.

Want more information? Have questions? Get answers in the JMP User Community (