The key point process of MT method is that we make the inverse covariance matrix with data of unit space only. And we use the diffinition of No.4. or No.5 in the page of MD.
sample file is an exapmle of No.5 to calculate by Excel.
This is the example of No.4 calculation by R.
setwd("C:/Rtest") # Set the working spalce as "C:/Rtest"
Data1 <- read.table("Data1.csv", header=T, sep=",") # Input the data of unit space
Data2 <- read.table("Data2.csv", header=T, sep=",") # Input the data of signal space
MD1 <- mahalanobis(Data1, colMeans(Data1), var(Data1)*(nrow(Data1)-1)/nrow(Data1))/ncol(Data1) # Calculate the MD^2 of unit space
MD2 <- mahalanobis(Data2, colMeans(Data1), var(Data1)*(nrow(Data1)-1)/nrow(Data1))/ncol(Data1) # Calculate the MD^2 of signal space (Point is the use of "Data1")
write.csv(MD1, file = "MD1.csv") # Output the MD^2 of unit space to file
write.csv(MD2, file = "MD2.csv") # Output the MD^2 of signal space to file
If the each data of signal space is not in the area of unit space, the model is good.
And if we identify the variables of the good model, this process is used as the method of Cause and Effect Analysis .