Um_factor: Calculate the Um factor

View source: R/Um_factor.R

Um_factorR Documentation

Calculate the Um factor

Description

The function calculates the Um factor associated with an ordering of the rows and columns of a distance matrix. Lower values indicate a better grouping of similar objects. This was the original objective function proposed in the MaCzek program for producing Czekanowski's Diagram.

Usage

Um_factor(
  distMatrix,
  order = NULL,
  matrix_conversion_coefficient = 1,
  inverse_um = TRUE
)

Arguments

distMatrix

a 'dist' object, matrix of distances between observations.

order

a vector, if NULL, then the value of the factor is calculate for the distance matrix as is, otherwise the rows and columns are reordered according to the vector order.

matrix_conversion_coefficient

numeric, value to be added to the distances, so that a division by 0 error is not thrown.

inverse_um

logical, if TRUE, then the negative is returned. Default TRUE as the function is called in the genetic algorithm maximization procedures.

Value

The function returns a numeric value equalling the Um_factor.

Examples

# Set data ####
x<-mtcars

mD<-stats::dist(scale(x))
mCz<-czek_matrix(x)
Um_factor(mD)
Um_factor(mD,order=attr(mCz,"order"))

kelly-ly/RMaCzek documentation built on Sept. 15, 2022, 7:31 p.m.