Description Usage Arguments Value Author(s) References See Also Examples
Returns an object with the optimal cut points to categorise a continuous predictor variable in a logistic regression model
1 2 3 |
formula |
An object of class |
cat.var |
Name of the continuous variable to categorise. |
cat.points |
Number of cut points to look for. |
data |
Data frame containing all needed variables. |
method |
The algorithm selected to search for the optimal cut points. "addfor" if the AddFor algorithm is choosen and "genetic" otherwise. |
range |
The range of the continuous variable in which to look for the cut points. By default NULL, i.e, all the range. |
correct.AUC |
A logical value. If TRUE the bias corrected AUC is estimated. |
control |
Output of the controlcatpredi() function. |
... |
Further arguments for passing on to the function |
Returns an object of class "catpredi" with the following components:
call |
the matched call. |
method |
the algorithm selected in the call. |
formula |
an object of class |
cat.var |
name of the continuous variable to categorise. |
data |
the data frame with the variables used in the call. |
correct.AUC |
The logical value used in the call. |
results |
a list with the estimated cut points, AUC and bias corrected AUC. |
control |
the control parameters used in the call. |
For each of the methods used in the call, a list with the following components is obtained:
"cutpoints" |
Estimated optimal cut points. |
"AUC" |
Estimated AUC. |
"AUC.cor" |
Estimated bias corrected AUC. |
Irantzu Barrio, Maria Xose Rodriguez-Alvarez and Inmaculada Arostegui
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).
S.N Wood (2006). Generalized Additive Models: An Introduction with R. Chapman and Hall/CRC.
See Also as controlcatpredi
, comp.cutpoints
, plot.catpredi
,
summary.catpredi
.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 | library(CatPredi)
set.seed(127)
#Simulate data
n = 200
#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))
#Covariate
zh <- rnorm(n, mean=1.5, sd=1)
zd <- rnorm(n, mean=1, sd=1)
z <- c(zh, zd)
# Data frame
df <- data.frame(y = y, x = x, z = z)
# Select optimal cut points using the AddFor algorithm
res.addfor <- catpredi(formula = y ~ z, cat.var = "x", cat.points = 3,
data = df, method = "addfor", range=NULL, correct.AUC=FALSE)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.