Using KNN to find the nearest neighbor

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Using KNN to find the nearest neighbor

Andy W
I'm using KNN to simply match a set of base data to its nearest neighbor in new test data, but I'm getting some odd results I'm hoping someone can explain. Here is the syntax to replicate my results, https://dl.dropbox.com/s/73itwwrhp0cnn3o/KNN_test.sps?dl=0. (Just alittle long to post here directly on NABBLE.)

So two specific questions:

1: When using APPLYMODEL with "DISTANCE", it always returns a distance of zero. What is this suppossed to return?
2: You can see in the graph produced (shown below) the Test dataset is not always matched to the nearest ID in the base dataset. Why is this?

The graph shows the base data as hollow circles, and the test data as red filled in circles with an arrow to the matched base id. A grid is drawn to show the areas associated with the base ids.

For either I don't doubt I misspecified the original KNN model somehow to do what I want.

Thank you,
Andy

Andy W
apwheele@gmail.com
http://andrewpwheeler.wordpress.com/