A transformation function for three-class ROC data in order to obtain normally distributed classes.

boxcoxROC(
  x,
  y,
  z,
  lambda = seq(-2, 2, 0.05),
  lambda2 = NULL,
  eps = 0.02,
  verbose = TRUE
)

Arguments

x, y, z

vectors containing the data of the three classes "healthy", "intermediate" and "diseased" to be transformed. In two-class ROC analysis only.

lambda

vector of possible lambdas the log-likelihood function is evaluated.

lambda2

numeric shifting parameter. For the implemented Box-Cox transformation positive measurements in x, y, z are required. lambda2 is used to shift these measurements.

eps

numeric; indicating the bandwith around zero, where lambda is treated to be zero and the data is log-transformed.

verbose

logical; indicating whether output should be displayed (default) or not.

Value

A list with components:

xbc, ybc, zbc

The transformed vectors.

lambda

estimated optimal parameter.

shapiro.p.value

p-values obtained from shapiro.test() of the original and transformed data.

Details

A Box-Cox transformation computing

$$X^{(\lambda)} = \left\{ \begin{array}{ll} (X^\lambda -1)/\lambda, & \mbox{if } \; \lambda \neq 0,\\ \log(X), & \mbox{else } \; \lambda = 0, \end{array} \right.$$

with optimal \(\lambda\) estimated from the likelihood kernel function, as formally described in the supplementary material in Bantis et al. (2017). If the data include any nonpositive observations, a shifting parameter lambda2 can be included in the transformation given by:

$$X^{(\lambda)} = \left\{ \begin{array}{ll} ((X+\lambda_2)^\lambda -1)/\lambda, & \mbox{if } \, \lambda \neq 0,\\ \log(X+\lambda_2), & \mbox{else } \; \lambda = 0. \end{array} \right.\\ $$

References

Bantis LE, Nakas CT, Reiser B, Myall D and Dalrymple-Alford JC (2015) Construction of joint confidence regions for the optimal true class fractions of receiver operating characteristic (roc) surfaces and manifolds. Statistical Methods in Medical Research 26(3): 1429–1442.

Box, G. E. P. and Cox, D. R. (1964). An analysis of transformations (with discussion). Journal of the Royal Statistical Society, Series B, 26, 211–252.

See also

shapiro.test and boxcox from the package MASS.

Examples

data(cancer)
x1 <- with(cancer, cancer[trueClass=="healthy", 9])
y1 <- with(cancer, cancer[trueClass=="intermediate", 9])
z1 <- with(cancer, cancer[trueClass=="diseased", 9])

boxcoxROC(x1, y1, z1)
#> --------------------------------------------------------------------- 
#>  Optimal lambda       = 2
#>  Shift param. lambda2 = 0
#> 
#>  Shapiro p-values for original data: 
#>  x = 0.07584068, y = 0.9498752, z = 0.3545137
#> 
#>  Shapiro p-values for Box-Cox transformed data: 
#>  x = 0.08442367, y = 0.9398613, z = 0.3688632
#> ---------------------------------------------------------------------