Announcement

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

  • Error: Dist not found


    Hello, I'm trying to calculate the Silhouette coefficient after applying a cluster analysis, I'm using the following code:

    egen idvar = seq(), from(1) to(`=_N') block(1)
    gen dist = .
    replace dist = sqrt((age - age[_N])^2 + (monthly_expenses - monthly_expenses[_N])^2)
    gen silhouette_var = .
    silhouette silhouette_var, idvar(idvar) distmat(dist) cluster(Groups)

    As you can see the "dist" variable is created, but when calculating the coefficient, the program says it can't find it. Does anyone have any idea what the error is?

  • #2
    This command is unknown to me. Please refer to FAQ Advice #12 regarding the requirement to state the provenance of community-contributed commands. My guess is that

    distmat(dist)
    refers to a matrix and not a variable. Look at the documentation and if this does not help, contact the authors.

    Comment


    • #3
      I think you need to create a matrix of dist.

      mkmat

      HTML Code:
      https://www.stata.com/meeting/france17/slides/France17_Halpin.pdf

      Comment

      Working...
      X