# diagnosis.MT: Diagnosis method for the Mahalanobis-Taguchi (MT) method In okayaa/MT: Methods in Mahalanobis-Taguchi (MT) System

## Description

`diagnosis.MT` (via `diagnosis`) calculates the mahalanobis distance based on the unit space generated by `MT` or `generates_unit_space`(..., method = "MT") and classifies each sample into positive (`TRUE`) or negative (`FALSE`) by comparing the values with the set threshold value.

## Usage

 ```1 2 3``` ```## S3 method for class 'MT' diagnosis(unit_space, newdata, threshold = 4, includes_transformed_newdata = FALSE) ```

## Arguments

 `unit_space` Object of class "MT" generated by `MT` or `generates_unit_space`(..., method = "MT"). `newdata` Matrix with n rows (samples) and p columns (variables). The data are used to calculate the desired distances from the unit space. All data should be continuous values and should not have missing values. `threshold` Numeric specifying the threshold value to classify each sample into positive (`TRUE`) or negative (`FALSE`). `includes_transformed_newdata` If `TRUE`, then the transformed data for `newdata` are included in a return object.

## Value

`diagnosis.MT` (via `diagnosis`) returns a list containing the following components:

 `distance` Vector with length n. Distances from the unit space to each sample. `le_threshold` Vector with length n. Logical values indicating the distance of each sample is less than or equal to the threhold value (`TRUE`) or not (`FALSE`). `threshold` Numeric value to classify the sample into positive or negative. `unit_space` Object of class "MT" passed by `unit_space`. `n` The number of samples for `newdata`. `q` The number of variables after the data transformation. q equals p. `x` If `includes_transformed_newdata` is `TRUE`, then the transformed data for `newdata` are included.

## References

Taguchi, G. (1995). Pattern Recognition and Quality Engineering (1). Journal of Quality Engineering Society, 3(2), 2-5. (In Japanese)

Taguchi, G., Wu, Y., & Chodhury, S. (2000). Mahalanobis-Taguchi System. McGraw-Hill Professional.

Taguchi, G., & Jugulum, R. (2002). The Mahalanobis-Taguchi strategy: A pattern technology system. John Wiley & Sons.

Woodall, W. H., Koudelik, R., Tsui, K. L., Kim, S. B., Stoumbos, Z. G., & Carvounis, C. P. (2003). A review and analysis of the Mahalanobis-Taguchi system. Technometrics, 45(1), 1-15.

`general_diagnosis.MT` and `MT`
 ``` 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16``` ```# 40 data for versicolor in the iris dataset iris_versicolor <- iris[61:100, -5] unit_space_MT <- MT(unit_space_data = iris_versicolor, includes_transformed_data = TRUE) # 10 data for each kind (setosa, versicolor, virginica) in the iris dataset iris_test <- iris[c(1:10, 51:60, 101:111), -5] diagnosis_MT <- diagnosis(unit_space = unit_space_MT, newdata = iris_test, threshold = 4, includes_transformed_newdata = TRUE) (diagnosis_MT\$distance) (diagnosis_MT\$le_threshold) ```