general_diagnosis.MT: General function to implement a diagnosis method for a family...

Description Usage Arguments Value See Also Examples

View source: R/general_MT.R

Description

general_diagnosis.MT is the general function that implements a diagnosis method for a family of Mahalanobis-Taguchi (MT) methods. Each diagnosis method of a family of MT methods can be implemented by setting the parameters of this function appropriately.

Usage

1
2
general_diagnosis.MT(unit_space, newdata, threshold,
  includes_transformed_newdata = FALSE)

Arguments

unit_space

Object generated as a unit space.

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

A list containing the following components is returned.

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 passed by unit_space.

n

The number of samples for newdata.

q

The number of independent variables after the data transformation. According to the data transoformation function, q may be equal to p.

x

If includes_transformed_newdata is TRUE, then the transformed data for newdata are included.

See Also

diagnosis.MT, diagnosis.MTA, and diagnosis.RT

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
                          
# 40 data for versicolor in the iris dataset                            
iris_versicolor <- iris[61:100, -5] 

# The following settings are same as the MT method.                          
unit_space <- general_MT(unit_space_data = iris_versicolor, 
                         generates_transform_function = 
                                            generates_normalization_function,
                         calc_A = function(x) solve(cor(x)),  
                         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 <- general_diagnosis.MT(unit_space = unit_space, 
                                  newdata = iris_test, 
                                  threshold = 4,
                                  includes_transformed_newdata = TRUE)
                              
(diagnosis$distance)
(diagnosis$le_threshold)                          

okayaa/MT documentation built on March 15, 2021, 8:41 a.m.