Description Usage Arguments Details Value Examples
This function estimates the NRI for competing risk prediction models
with binary response variable. glm
objects, predictors, and
predicted risks can be used as input data for the calculation.
The risk category based NRI and the risk difference based NRI can be
calculated.
The percentile bootstrap method is used for an interval estimation.
1 2 3 4 
event 
Vector of event indicators, 1 for event of interest, 0 for nonevent. 
mdl.std, mdl.new 

z.std, z.new 
Matrix of predictors for a standard and a new risk prediction model, respectively. Neither factor nor character nor missing values are allowed. 
p.std, p.new 
Vector of predicted risks from a standard and a new prediction model, respectively. 
updown 
Character to specify the method to determine 
cut 
Scalar or vector values to specify the cutoff value(s) of predicted
risks for determining 
niter 
Scalar value to determine the number of bootstratp sampling. When

link 
Character to specify a link function for a glm fitting. 
alpha 
1alpha confidence intervals are calcualted. 
msg 
Logical value to display computation process.
Setting 
Either one set of the following arguments should be specified for the
NRI calculation: (mdl.std
, mdl.new
);
(event
, z.std
, z.new
);
and (event
, p.std
, p.new
).
In the first set of the argument, (mdl.std
, mdl.new
),
fitted results are used for the NRI calculation.
event
, z.std
, and z.new
are extracted from fitted
result objects.
The variance of model parameters are accounted for an interval
estimation of the NRI.
When event
is specified in arguments, those specified is used
without extracting from glm
object.
In the second set of the argument, (event
, z.std
,
z.new
), a standard and a new prediction models are fitted
inside this function with specified link
.
The variance of model parameters are also accounted for an interval
estimation of the NRI.
In the third set of the argument, (event
, p.std
,
p.new
), predicted risks are used.
Since fit of prediction models are not conducted while in a bootstrap,
this can be used for a validation study by an external data source or
by a crossvalidation.
For the risk category based NRI calculation, cutoff values of risk
category can be specified by cut
, which is a scalar for the
case of two risk categories and is a vector for the case of more than
two risk categories.
UP
and DOWN
are determined by the movement in risk
categories.
For the risk difference based NRI calculation, cutoff values of risk
difference can also be specified by cut
, where UP
and
DOWN
are defiend as p_{new}  p_{standard} > δ and
p_{standard}  p_{new} > δ, respectively.
p_{standard} and p_{new} are predicted individual risks
from a standard and a new prediction model, respectively, and
δ corresponds to cut
.
The continuous NRI, which is the special version of the risk
difference based NRI, can be calculated by specifying both
updown = "diff"
and cut = 0
.
Interval estimation is based on the percentile bootstrap method.
Returns a list of the following items:
nri 
Point and interval estimates of the NRI and its components. 
mdl.std, mdl.new 
Fitted 
z.std, z.new 
Predictors of a standard and a new prediction model, respectively.
These items are provided when they are extracted from 
p.std, p.new 
Predicted risks by a standard and a new prediction model, respectively. 
up, down 
Logical values to show subjects who belong to 
rtab, rtab.case, rtab.ctrl 

bootstrapsample 
Results of each bootstrap sample. 
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40  ## here consider pbc dataset in survival package as an example
library(survival)
dat = pbc[1:312,]
dat$sex = ifelse(dat$sex=='f', 1, 0)
## subjects censored before 2000 days are excluded
dat = dat[ dat$time > 2000  (dat$time < 2000 & dat$status == 2), ]
## predciting the event of 'death' before 2000 days
event = ifelse(dat$time < 2000 & dat$status == 2, 1, 0)
## standard prediction model: age, bilirubin, and albumin
z.std = as.matrix(subset(dat, select = c(age, bili, albumin)))
## new prediction model: age, bilirubin, albumin, and protime
z.new = as.matrix(subset(dat, select = c(age, bili, albumin, protime)))
## glm fit (logistic model)
mstd = glm(event ~ ., binomial(logit), data.frame(event, z.std), x=TRUE)
mnew = glm(event ~ ., binomial(logit), data.frame(event, z.new), x=TRUE)
## predicted risk
p.std = mstd$fitted.values
p.new = mnew$fitted.values
## Calculation of risk difference NRI using ('mdl.std', 'mdl.std').
nribin(mdl.std = mstd, mdl.new = mnew, cut = 0.02, niter = 0,
updown = 'diff')
## Calculation of risk difference NRI using ('event', 'z.std', 'z.std').
nribin(event = event, z.std = z.std, z.new = z.new, cut = 0.02,
niter = 0, updown = 'diff')
## Calculation of risk difference NRI using ('event', 'p.std', 'p.std').
nribin(event = event, p.std = p.std, p.new = p.new, cut = 0.02,
niter = 0, updown = 'diff')
## Calculation of risk category NRI using ('mdl.std', 'mdl.std').
nribin(mdl.std = mstd, mdl.new = mnew, cut = c(0.2, 0.4),
niter = 0, updown = 'category')

Loading required package: survival
UP and DOWN calculation:
#of total, case, and control subjects at t0: 232 88 144
#of subjects with 'p.new  p.std > cut' for all, case, control: 34 17 17
#of subjects with 'p.std  p.new < cut' for all, case, control: 36 13 23
NRI estimation:
Point estimates:
Estimate
NRI 0.04310345
NRI+ 0.01724138
NRI 0.02586207
Pr(UpCase) 0.07327586
Pr(DownCase) 0.05603448
Pr(DownCtrl) 0.09913793
Pr(UpCtrl) 0.07327586
STANDARD prediction model:
Estimate Std. Error z value Pr(>z)
(Intercept) 0.98927136 2.20809035 0.4480212 6.541379e01
age 0.07128234 0.01988079 3.5854876 3.364490e04
bili 0.61686651 0.10992947 5.6114755 2.006087e08
albumin 1.95859156 0.53031693 3.6932473 2.214085e04
NEW prediction model:
Estimate Std. Error z value Pr(>z)
(Intercept) 1.16682234 2.92204889 0.3993165 6.896600e01
age 0.06659224 0.02032242 3.2767864 1.049958e03
bili 0.59995139 0.11022521 5.4429600 5.240243e08
albumin 1.88620553 0.53144647 3.5491919 3.864153e04
protime 0.20127560 0.18388726 1.0945598 2.737095e01
UP and DOWN calculation:
#of total, case, and control subjects at t0: 232 88 144
#of subjects with 'p.new  p.std > cut' for all, case, control: 34 17 17
#of subjects with 'p.std  p.new < cut' for all, case, control: 36 13 23
NRI estimation:
Point estimates:
Estimate
NRI 0.04310345
NRI+ 0.01724138
NRI 0.02586207
Pr(UpCase) 0.07327586
Pr(DownCase) 0.05603448
Pr(DownCtrl) 0.09913793
Pr(UpCtrl) 0.07327586
UP and DOWN calculation:
#of total, case, and control subjects at t0: 232 88 144
#of subjects with 'p.new  p.std > cut' for all, case, control: 34 17 17
#of subjects with 'p.std  p.new < cut' for all, case, control: 36 13 23
NRI estimation:
Point estimates:
Estimate
NRI 0.04310345
NRI+ 0.01724138
NRI 0.02586207
Pr(UpCase) 0.07327586
Pr(DownCase) 0.05603448
Pr(DownCtrl) 0.09913793
Pr(UpCtrl) 0.07327586
UP and DOWN calculation:
#of total, case, and control subjects at t0: 232 88 144
Reclassification Table for all subjects:
New
Standard < 0.2 < 0.4 >= 0.4
< 0.2 110 3 0
< 0.4 3 30 0
>= 0.4 0 2 84
Reclassification Table for case:
New
Standard < 0.2 < 0.4 >= 0.4
< 0.2 7 0 0
< 0.4 0 8 0
>= 0.4 0 2 71
Reclassification Table for control:
New
Standard < 0.2 < 0.4 >= 0.4
< 0.2 103 3 0
< 0.4 3 22 0
>= 0.4 0 0 13
NRI estimation:
Point estimates:
Estimate
NRI 0.00862069
NRI+ 0.00862069
NRI 0.00000000
Pr(UpCase) 0.00000000
Pr(DownCase) 0.00862069
Pr(DownCtrl) 0.01293103
Pr(UpCtrl) 0.01293103
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.