reclass: Risk reclassification table

Description Usage Arguments Details Value Author(s) See Also Examples

Description

Tabulate grouped risks predicted by two different methods, models, algorithms

Usage

1
reclass(list, newdata, cuts = seq(0, 100, 25), digits = 1)

Arguments

list

A list with two elements. Each element should either be a vector with probabilities, or an object for which predictStatusProb can extract predicted risk based on newdata.

newdata

Passed on to predictStatusProb

cuts

Risk quantiles to group risk

digits

Number of digits to show for the predicted risks

Details

All risks are multiplied by 100 before

Value

reclassification table

Author(s)

Thomas A. Gerds <tag@biostat.ku.dk>

See Also

predictStatusProb

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
set.seed(40)
N <- 40
X1 <- rnorm(N)
X2 <- rbinom(N,1,.4)
X3 <- rnorm(N)
expit <- function(x) exp(x)/(1+exp(x))
lp <- expit(X1 + X2 + X3)
Y <- factor(rbinom(N,1,lp))
dat <- data.frame(Y=Y,X1=X1,X2=X2,X3=X3)
lm1 <- glm(Y~X1,data=dat,family="binomial")
lm2 <- glm(Y~X1+X2,data=dat,family="binomial")

rc <- reclass(list("lrm.X1"=lm1,"lrm.X1.X2"=lm2),newdata=dat)
print(rc)
plot(rc)

rc2 <- reclass(list("lrm.X1"=lm1,"lrm.X1.X2"=lm2),newdata=dat,cuts=c(0,5,10,50,100))
print(rc2)
plot(rc2)

Example output

         lrm.X1.X2
lrm.X1    0-25% 25-50% 50-75% 75-100%
  0-25%       4      1      0       0
  25-50%      2     10      3       0
  50-75%      0      1     14       0
  75-100%     0      0      0       5
         lrm.X1.X2
lrm.X1    0-5% 5-10% 10-50% 50-100%
  0-5%       0     0      0       0
  5-10%      0     0      0       0
  10-50%     0     0     17       3
  50-100%    0     0      1      19

ModelGood documentation built on May 2, 2019, 3:02 a.m.

Related to reclass in ModelGood...