comp.cutpoints {CatPredi} | R Documentation |
Selection of optimal number of cut points
Description
Compares two objects of class "catpredi".
Usage
comp.cutpoints(obj1, obj2, V = 100)
Arguments
obj1 |
an object inheriting from class "catpredi" for k number of cut points |
obj2 |
an object inheriting from class "catpredi" for k+1 number of cut points |
V |
Number of bootstrap resamples. By default V=100 |
Value
This function returns an object of class "comp.cutpoints" with the following components:
AUC.cor.diff |
the difference of the bias corrected AUCs for the two categorical variables. |
icb.auc.diff |
bootstrap based confidence interval for the bias corrected AUC difference. |
Author(s)
Irantzu Barrio, Maria Xose Rodriguez-Alvarez and Inmaculada Arostegui
References
I Barrio, I Arostegui, M.X Rodriguez-Alvarez and J.M Quintana (2015). A new approach to categorising continuous variables in prediction models: proposal and validation. Statistical Methods in Medical Research (in press).
See Also
See Also as catpredi
.
Examples
library(CatPredi)
set.seed(127)
#Simulate data
n = 100
#Predictor variable
xh <- rnorm(n, mean = 0, sd = 1)
xd <- rnorm(n, mean = 1.5, sd = 1)
x <- c(xh, xd)
#Response
y <- c(rep(0,n), rep(1,n))
# Data frame
df <- data.frame(y = y, x = x)
# Select 2 optimal cut points using the AddFor algorithm. Correct the AUC
res.addfor.k2 <- catpredi(formula = y ~ 1, cat.var = "x", cat.points = 2,
data = df, method = "addfor", range=NULL, correct.AUC=TRUE,
control=controlcatpredi(addfor.g=100))
# Select 3 optimal cut points using the AddFor algorithm. Correct the AUC
res.addfor.k3 <- catpredi(formula = y ~ 1, cat.var = "x", cat.points = 3,
data = df, method = "addfor", range=NULL, correct.AUC=TRUE,
control=controlcatpredi(addfor.g=100))
# Select optimal number of cut points
comp <- comp.cutpoints(res.addfor.k2, res.addfor.k3, V = 100)