How can I calculate the Squared Mahalanobis Distance for two columns in R studio?

If I have a text file which has 7 variables:

Wind Solar_Radiation CO NO NO2 O3 HC
  8      98           7  2  12  8  2
  7      107          4  3  9  5  3
  7      103          4  3  5  6  3
  10     88           5  2  8  15  4
  6      91           4  2  8  10  3
  8      90           5  2  12  12  4
  9      84           7  4  12  15  5
  5      72           6  4  21  14  4
  7      82           5  1  11  11  3
  8      64           5  2  13  9  4

But I just want to calculate the Squared Mahalanobis Distance for X5(NO2) and X6(O3), where Xj=(Xj5,Xj6)'. How can I do it? Thanks!



Read more here: https://stackoverflow.com/questions/64396535/how-can-i-calculate-the-squared-mahalanobis-distance-for-two-columns-in-r-studio

Content Attribution

This content was originally published by Darren Pan at Recent Questions - Stack Overflow, and is syndicated here via their RSS feed. You can read the original post over there.

%d bloggers like this: