Learn R Programming

discSurv (version 1.1.2)

tprUno: True positive Rate Uno

Description

Estimates the true positive rate based on Uno et al. to evaluate the predictive accuracy of discrete generalized, linear survival models by cross validation.

Usage

tprUno(timepoint, dataSet, trainIndices, survModelFormula, 
censModelFormula, linkFunc = "logit", idColumn = NULL)

Arguments

timepoint
Discrete time interval given that the false positive rate is evaluated (integer scalar)
dataSet
Original data in short format. Should be of class "data.frame".
trainIndices
List of Indices from original data used for training (list of integer vectors). The length of the list is equal to the number of cross validation samples.
survModelFormula
Formula of the discrete survival model. It is used in a generalized, linear model.
censModelFormula
Formula of the censoring model. It is used in a generalized, linear model. Usually this is done without covariates.
linkFunc
Link function of the generalized, linear model.
idColumn
Name of the column with identification numbers of persons. Default NULL means, that each row equals one person (no repeated measurements).

Value

  • List with objects
    • Output:
    {Data frame with two columns: "cutoff" gives the different marker values and "tpr" the true positive rates}
  • Input:
  • {A list of given argument input values (saved for reference)}

References

Patrick J. Heagerty and Yingye Zheng, (2005), Survival Model Predictive Accuracy and ROC Curves, Biometrics 61, 92-105 Hajime Uno and Tianxi Cai and Lu Tian and L. J. Wei, (2007), Evaluating Prediction Rules for t-Year Survivors With Censored Regression Models, Journal of the American Statistical Association

See Also

tprUnoShort, fprUno, fprUnoShort, aucUno, concorIndex, createFolds, glm

Examples

Run this code
# Example with cross validation and unemployment data 
library(Ecdat)
library(caret)
data(UnempDur)
summary(UnempDur$spell)

# Extract subset of data
set.seed(635)
IDsample <- sample(1:dim(UnempDur)[1], 100)
UnempDurSubset <- UnempDur [IDsample, ]
head(UnempDurSubset)
range(UnempDurSubset$spell)
set.seed(7550)
CVfolds <- createFolds (y=UnempDurSubset$spell, returnTrain=TRUE, k=2)

# Estimate true positive rate of time interval 7: 
# Correspondes to three and a half month duration (each interval is of length two weeks)
tryTPR <- tprUno (timepoint=7, dataSet=UnempDurSubset, 
trainIndices=CVfolds, survModelFormula=spell ~ age + logwage, 
censModelFormula=censor1 ~ 1, linkFunc="logit", idColumn=NULL)
tryTPR
plot(tryTPR)

Run the code above in your browser using DataLab