mathComb: Combine two diagnostic tests with several mathematical...

View source: R/mathComb.R

mathCombR Documentation

Combine two diagnostic tests with several mathematical operators and distance measures.

Description

The mathComb function returns the combination results of two diagnostic tests with different mathematical operators, distance measures, standardization, and transform options.

Usage

mathComb(
  markers = NULL,
  status = NULL,
  event = NULL,
  method = c("add", "multiply", "divide", "subtract", "distance", "baseinexp",
    "expinbase"),
  distance = c("euclidean", "manhattan", "chebyshev", "kulczynski_d", "lorentzian",
    "avg", "taneja", "kumar-johnson"),
  standardize = c("none", "min_max_scale", "zScore", "tScore", "scale_mean_to_one",
    "scale_sd_to_one"),
  transform = c("none", "log", "exp", "sin", "cos"),
  show.plot = TRUE,
  direction = c("auto", "<", ">"),
  conf.level = 0.95,
  cutoff.method = c("CB", "MCT", "MinValueSp", "MinValueSe", "ValueSp", "ValueSe",
    "MinValueSpSe", "MaxSp", "MaxSe", "MaxSpSe", "MaxProdSpSe", "ROC01", "SpEqualSe",
    "Youden", "MaxEfficiency", "Minimax", "MaxDOR", "MaxKappa", "MinValueNPV",
    "MinValuePPV", "ValueNPV", "ValuePPV", "MinValueNPVPPV", "PROC01", "NPVEqualPPV",
    "MaxNPVPPV", "MaxSumNPVPPV", "MaxProdNPVPPV", "ValueDLR.Negative",
    "ValueDLR.Positive", "MinPvalue", "ObservedPrev", "MeanPrev", "PrevalenceMatching"),
  show.result = FALSE,
  ...
)

Arguments

markers

a numeric data frame that includes two diagnostic tests results

status

a factor vector that includes the actual disease status of the patients

event

a character string that indicates the event in the status to be considered as positive event

method

a character string specifying the method used for combining the markers. The available methods are:

  • add: Combination score obtained by adding markers

  • multiply: Combination score obtained by multiplying markers

  • divide: Combination score obtained by dividing markers

  • subtract: Combination score obtained by subtracting markers

  • distance: Combination score obtained with the help of distance measures.

  • baseinexp: Combination score obtained by marker1 power marker2.

  • expinbase: Combination score obtained by marker2 power marker1.

distance

a character string specifying the method used for combining the markers. The available methods are:

  • Euclidean (euclidean): c_i = {\sqrt{(x_{i1}-0)^2+(x_{i2}-0)^2}}

  • Manhattan(manhattan): c_i = |x_{i1}-0|+|x_{i2}-0|

  • Chebyshev (chebyshev): c_i = max{|x_{i1}-0|,|x_{i2}-0|}

  • Kulczynski (kulczynski_d): c_i = \frac{|x_{i1}-0|+|x_{i2}-0|}{min(x_{i1},x_{i2})}

  • Lorentzian (lorentzian): c_i = (ln(1+|x_{i1}-0|))+ (ln(1+|x_{i2}-0|))

  • Taneja (taneja): c_i = z_1\times\Biggl(log\frac{z_1}{\sqrt{(x_{i1}\times \epsilon )}}\Biggl)+z_2\times\Biggl(log\frac{z_2}{\sqrt{(x_{i2}\times\epsilon)}}\Biggl)

  • Kumar-Johnson (kumar-johnson): c_i = {\frac{(x_{i1}-0)^2}{2(x_{i1}\times\epsilon)}}+{\frac{(x_{i2}-0)^2}{2(x_{i2}\times\epsilon)}}, \epsilon = 0.00001

  • Avg (avg):

    (L_1, L_n) = \frac{|x_{i1}-0|+|x_{i2}-0| + max{(x_{i1}-0),(x_{i2}-0)}}{2}

standardize

a character string indicating the name of the standardization method. The default option is no standardization applied. Available options are:

  • Z-score (zScore): This method scales the data to have a mean of 0 and a standard deviation of 1. It subtracts the mean and divides by the standard deviation for each feature. Mathematically,

    Z-score = \frac{x - (\overline x)}{sd(x)}

    where x is the value of a marker, \overline{x} is the mean of the marker and sd(x) is the standard deviation of the marker.

  • T-score (tScore): T-score is commonly used in data analysis to transform raw scores into a standardized form. The standard formula for converting a raw score x into a T-score is:

    T-score = \Biggl(\frac{x - (\overline x)}{sd(x)}\times 10 \Biggl) +50

    where x is the value of a marker, \overline{x} is the mean of the marker and sd(x) is the standard deviation of the marker.

  • min_max_scale (min_max_scale): This method transforms data to a specific scale, between 0 and 1. The formula for this method is:

    min_max_scale = \frac{x - min(x)}{max(x) - min(x)}

  • scale_mean_to_one (scale_mean_to_one): This method scales the arithmetic mean to 1. The formula for this method is:

    scale_mean_to_one = \frac{x}{\overline{x}}

    where x is the value of a marker and \overline{x} is the mean of the marker.

  • scale_sd_to_one (scale_sd_to_one): This method, which allows for comparison of individual data points in relation to the overall spread of the data, scales the standard deviation to 1. The formula for this method is:

    scale_sd_to_one = \frac{x}{sd(x)}

    where x is the value of a marker and sd(x) is the standard deviation of the marker.

transform

A character string specifying the mathematical transformation method. Available options: "log", "exp", "sin", "cos".

  • log: Applies logarithm transform to markers before calculating combination score

  • exp: Applies exponential transform to markers before calculating combination score

  • sin: Applies sinus trigonometric transform to markers before calculatin combination score

  • cos: Applies cosinus trigonometric transform to markers before calculating combination score

show.plot

a logical. If TRUE, a ROC curve is plotted. Default is TRUE

direction

a character string determines in which direction the comparison will be made. ">": if the predictor values for the control group are higher than the values of the case group (controls > cases). "<": if the predictor values for the control group are lower or equal than the values of the case group (controls < cases).

conf.level

a numeric values determines the confidence interval for the roc curve(0.95, default).

cutoff.method

a character string determines the cutoff method for the roc curve.

show.result

A logical value indicating whether the results should be printed to the console.

...

further arguments. Currently has no effect on the results.

Value

A list containing the computed combination scores and, optionally, diagnostic performance metrics.

Author(s)

Serra Ilayda Yerlitas, Serra Bersan Gengec, Necla Kochan, Gozde Erturk Zararsiz, Selcuk Korkmaz, Gokmen Zararsiz

Examples


data(laparotomy)
markers <- laparotomy[, -1]
status <- factor(laparotomy$group, levels = c("not_needed", "needed"))
event <- "needed"
direction <- "<"
cutoff.method <- "Youden"

score1 <- mathComb(
  markers = markers, status = status, event = event,
  method = "distance", distance = "avg", direction = direction, show.plot = FALSE,
  standardize = "none", cutoff.method = cutoff.method
)

score2 <- mathComb(
  markers = markers, status = status, event = event,
  method = "baseinexp", transform = "exp", direction = direction,
  cutoff.method = cutoff.method
)

score3 <- mathComb(
  markers = markers, status = status, event = event,
  method = "subtract", direction = "auto", cutoff.method = "MinValueSp", transform = "sin"
)


dtComb documentation built on April 13, 2025, 5:12 p.m.