# NOT RUN {
# Simulate data set with binary outcome
dfBinary <- quickSim(type="binary")
# Logistic regression, used as algorithm to predict the response variable
# (estimated probability of outcome being present).
glmRes <- glm(y~x1+x2,data=dfBinary,family="binomial")
# Extract measured outcome and the predicted probability (fitted values)
# from the logistic regression output, put both in a data.frame.
glmDf <- data.frame(measOutcome=dfBinary$y,
fitted=glmRes$fitted.values)
# Apply function binBinary, generate 5 equal bins (probabilities in
# percent, bin width 20, yields 5 bins).
x100b <- binBinary(x=glmDf, measColumn = 1, binWidth = 20)
# }
Run the code above in your browser using DataLab