Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • discrim knn- identifying the nearest neighbor obs

    Stata implements the k nearest neighbor algorithm in discrim knn. I would like to identify which observation(s) are the nearest neighbors. Below is an example
    with k=3. The prediction works fine. I want to identify which 3 neighbors are used each time. Any thoughts?


    version 15
    clear
    set obs 400

    gen y=uniform()
    replace y= round(y)
    gen x1=uniform()
    gen x2=uniform()

    discrim knn x1 x2 , k(3) group(y)
    predict myclass, classification


  • #2
    I would also like to know the answer to this question.

    Comment

    Working...
    X