doROC: A doROC Function

View source: R/doROC.R

doROCR Documentation

A doROC Function

Description

Creación de curvas ROC (representación gráfica de la sensibilidad en frente a la especificidad) con o sin regresión logística mediante el paquete pROC y optimalCutpoints. Se calcula el punto de corte optimo mediante youden y se obtienen las medidas de clasificacion.

Usage

doROC(
  frml,
  x,
  group,
  dat,
  tag.healthy = NULL,
  title = NULL,
  modGLM = NULL,
  doPlot = TRUE,
  cex.main = 2,
  cex.text = 1.4,
  cex.sub = 0.9,
  cex = 0.5,
  show.lg = TRUE,
  show.cascon = TRUE,
  show.detail = TRUE,
  xtab = FALSE,
  xtab.type = "latex",
  direction = c("<", ">"),
  ...
)

Arguments

frml

an object of class "formula" (or one that can be coerced to that class): a symbolic description of the model to be fitted. Es necesario usar este parametro cuando tengamos mas de una variable explicativa.

x

either a character string with the name of the diagnostic test variable. (Potser una variable numerica o per exemple, una probabilitat de un model de regressio logistica)

group

a character string with the name of the variable that distinguishes healthy from diseased individuals

dat

data frame containing the variables in the formula.

tag.healthy

IMPORTANTE! the value codifying healthy individuals in the status variable. Por defecto nivel de referencia levels(dat[,group])[1]

title

a main title for the plot

modGLM

OBLIGATORIO! Valor logico que indica si se realiza regresion logistica. En el caso de indicar TRUE, el 'thres.best' indicara el punto de corte como probabilidad de predicción. En el caso de indicar FALSE, 'cutoff' nos indicara el punto de corte real en la variable. Es necesario indicar TRUE cuando querramos evaluar mas de una variable.

doPlot

A logical value indicating whether show a plot. Default value is TRUE

cex.main

expansion factor for main names (size main)

cex.text

expansion factor for text (size cases controls text)

show.lg

A logical value indicating whether show a legend Default value is TRUE

show.cascon

A logical value indicating whether show number cases/controls. Default value is TRUE

show.detail

A logical value indicating whether show detail output. Default value is TRUE

xtab

A logical value indicating whether the output is a xtable. Default value is FALSE.

xtab.type

A character string. Possible values are latex, html, markdown, pandoc, and rst; this will be automatically determined if the function is called within knitr; it can also be set in the global option knitr.table.format. If format is a function, it must return a character string.

direction

character string specifying the direction to compute the ROC curve. By default individuals with a test value lower than the cutoff are classified as healthy (negative test), whereas patients with a test value greater than (or equal to) the cutoff are classified as diseased (positive test). If this is not the case, however, and the high values are related to health, this argument should be established at ">".

Value

auc: Area bajo la curva y correspondiente intervalo de confianza

cutoff.probability: en el caso de haber realizado modGLM, punto de corte óptimo de la probabilidad de predicción calculado con el indice de Youden

cutoff.variable: punto de corte de la variable cuantitativa. SOLO CUANDO EVALUAMOS UNA UNICA VARIABLE CUANTITATIVA.

youden: the optimal value of the method considered for selecting the optimal cutpoint, i.e., the value of the criterion at the optimal cutpoint.

res_detail: taula detallada amb totes les sensibilitats i especificitats

res_sum: the optimal cutpoint(s) obtained with the method(s) selected; its/their accuracy measures and the area under ROC curve (AUC)

dat: base de datos original incluyendo predicción de la variable respuesta teniendo en cuenta como punto de corte indice de Youden y predicción en forma de probabilidad en el caso de modGLM = TRUE.

table: the results of table on data and reference

positive.class: the positive result level

Author(s)

Miriam Mota mmota.foix@gmail.com

Examples


# univariate
doROC(x = "mpg", group = "am", dat = mtc_bis, modGLM = FALSE)
doROC(frml = am~mpg, dat = mtc_bis, modGLM = FALSE)

#univariate model (mateix resultat que univariate)
doROC(x = "mpg", group = "am", dat = mtc_bis, modGLM = TRUE)
doROC(frml = am~mpg, dat = mtc_bis, modGLM = TRUE)

#multivariate model
doROC(x = c("mpg", "drat"), group = "am", dat = mtc_bis, modGLM = TRUE)
doROC(frml = am~mpg+drat, dat = mtc_bis, modGLM = TRUE)



miriamMota/mmotaF documentation built on Jan. 12, 2023, 4 a.m.