plot.Score: Prediction performance

View source: R/pcoxtimeplots.R

plot.ScoreR Documentation

Prediction performance

Description

Plots predictive performance of pcoxtime in comparison to other models. It uses risk scoring from Score. pcoxtime also supports performance measure scoring by R package pec. See examples.

Usage

## S3 method for class 'Score'
plot(x, ..., type = c("roc", "auc", "brier"), pos = 0.3)

Arguments

x

Score object. See examples.

...

for future implementations.

type

metric to return. Choices are "roc", "auc", "brier".

pos

spacing between the lines.

Details

Implements plot method for Score for time-dependent Brier score, AUC and ROC. However, currently, no support for time-dependent covariate models.

Value

a ggplot object.

Examples


if (packageVersion("survival")>="3.2.9") {
   data(cancer, package="survival")
} else {
   data(veteran, package="survival")
}
# pcoxtime
lam <- 0.1
alp <- 1
pfit1 <- pcoxtime(Surv(time, status) ~ factor(trt) + karno + diagtime + age + prior
	, data = veteran
	, lambda = lam 
	, alpha = alp
)

# coxph 
cfit1 <- coxph(Surv(time, status) ~ factor(trt) + karno + diagtime + age + prior
	, data = veteran
	, method = "breslow" 
	, x = TRUE
	, y = TRUE
)

# Evaluate model performance at 90, 180, 365 time points
score_obj <- Score(list("coxph" = cfit1, "pcox" = pfit1)
	, Surv(time, status) ~ 1
	, data = veteran
	, plots = "roc"
	, metrics = c("auc", "brier")
	, B = 10
	, times = c(90, 180, 365)
)

# Plot AUC
plot(score_obj, type = "auc")
# Plot ROC
plot(score_obj, type = "roc")
# Plot brier
plot(score_obj, type = "brier")

# Prediction error using pec package
## Not run: 
	if (require("pec")) {
		pec_fit <- pec(list("coxph" = cfit1, "pcox" = pfit1)
			, Surv(time, status) ~ 1
			, data = veteran
			, splitMethod = "Boot632plus"
			, keep.matrix = TRUE
		)
		plot(pec_fit)
	}

## End(Not run)


pcoxtime documentation built on May 13, 2022, 1:05 a.m.