Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

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, timeAsFactor=TRUE)

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).

timeAsFactor

Should the time intervals be coded as factor? Default is to use factor. If the argument is false, the column is coded as numeric.

Details

The formula survModelFormula must be in a specific structure: The response on the left side of the formula is the time of the short data format. On the right side are the covariates without time, e. g. Time ~ X1 + X2 if there are only two covariates. The time will be added automatically.

The next formula survModelFormula has similiar structure. The difference is the left side of the formula: This must be the

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). In addition there is the list element orderMarker, which gives the indices of the marker values in increasing order.

Author(s)

References

Matthias Schmid, Gerhard Tutz and Thomas Welchowski, (2017), Discrimination Measures for Discrete Time-to-Event Predictions, Econometrics and Statistics, Elsevier, Doi: 10.1016/j.ecosta.2017.03.008

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

Patrick J. Heagerty and Yingye Zheng, (2005), Survival Model Predictive Accuracy and ROC Curves, Biometrics 61, 92-105

See Also

Examples

# 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)

discSurv

Discrete Time Survival Analysis

v1.4.1
GPL-3
Authors
Thomas Welchowski <welchow@imbie.meb.uni-bonn.de> and Matthias Schmid <matthias.schmid@imbie.uni-bonn.de>
Initial release
2019-12-10

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.