pam.censor: Prediction Accuracy Measures for Regression Models of...

Description Usage Arguments Value Examples

View source: R/pam.censor.R

Description

This function calculates a pair of measures, R-Squared and L-Squared, for any regression models of right-censored data. R-squared is an extension of the classical R2 statistic for a linear model, quantifying the amount of variability in the response that is explained by a corrected prediction based on the original prediction function. L-squared is the proportion of the prediction error of the original prediction function that is explained by the corrected prediction function, quantifying the distance between the corrected and uncorrected predictions. When used together, they give a complete summary of the predictive power of a prediction function.

Usage

1
pam.censor(y, y.predict, delta)

Arguments

y

A numeric vector containing the response values.

y.predict

A numeric vector containing the predicted response values from a fitted model.

delta

A numeric vector indicating the status of the event, normally 0=alive, 1=dead.

Value

A list containing two components: R-squared and L-squared

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
library(survival)
library(PAmeasures)

# Use Mayo Clinic Primary Biliary Cirrhosis Data
data(pbc)

# Fit an exponential model with bilirubin
fit1 <- survreg(Surv(time, status==2) ~ bili, data = pbc,dist="exponential" )

# Obtain predicted response from the fitted exponential model
predict.time<-predict(fit1,type="response")

# Recode status at endpoint, 0 for censored, 1 for dead
delta.pbc<- as.numeric(pbc$status == 2)

# R.squared and L.squared of log-linear model
pam.censor(pbc$time, predict.time, delta.pbc)

PAmeasures documentation built on May 2, 2019, 8:22 a.m.