Announcement

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

  • Mahalanobis distance

    Hi All,

    I am trying to calculate Mahalanobis distance between two variables Xj and Xu in Stata. However, I am not sure what code to use for the transpose operator T. This is the formula I am using:

    MD(Xj,Xu)=√((Xj-Xu)^T C^(-1) (Xj-Xu))

    Any advice would be greatly appreciated.

    Thank you!

  • #2
    In both Stata and Mata, the transpose operator is just a straight quote mark (') placed after the name of the matrix, if the matrix is real. If you are dealing with a matrix of complex numbers in Mata, then that operator gives you the Hermitian conjugate instead.

    Comment


    • #3
      Thank you very much for your help!

      Boryana

      Comment

      Working...
      X