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

brierScore

Brier Score Calculation


Description

Computes the brier score of each person based on a generalized, linear model with cross validation.

Usage

brierScore(dataSet, trainIndices, survModelFormula, 
linkFunc = "logit", censColumn, idColumn = NULL)

Arguments

dataSet

Original data in short format. Must be of class "data.frame".

trainIndices

Must be a list of indices used for training data sets. E. g. if a 10-fold cross validation should be conducted, then the list should have length 10 and in each element a integer vector of training indices.

survModelFormula

Gives the specified relationship of discrete response and covariates. The formula is designed, that the intercepts for the time dependent base line hazards are always included. Therefore only covariates should be given in this formula. This argument is required to be of class "formula".

linkFunc

Specifies the desired link function in use of generalized, linear models.

censColumn

Gives the column name of the event indicator (1=observed, 0=censored). Must be of type "character".

idColumn

Gives the column name of the identification number of each person. The argument must be of type "character". Default NULL means, that each row equals one person (no repeated measurements).

Details

At normal circumstances a covariate free model for the censoring weights is sufficient.

Value

Numeric vector of brier scores for each person in the original data.

Note

It is assumed that all time points up to the last interval [a_q, Inf) are available in short format. If not already present, these can be added manually.

Author(s)

References

Gerhard Tutz and Matthias Schmid, (2016), Modeling discrete time-to-event data, Springer series in statistics, Doi: 10.1007/978-3-319-28158-2

Gerds T. A. and M. Schumacher, (2006), Consistent estimation of the expected Brier score in general survival models with right-censored event times, Biometrical Journal, Vol. 48, No. 6, pages 1029-1040

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)

# Calculate brier score
tryBrierScore <- brierScore (dataSet=UnempDurSubset, trainIndices=CVfolds, 
survModelFormula=spell ~ age + logwage, linkFunc="logit", 
censColumn="censor1", idColumn=NULL)
tryBrierScore

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.