calcurve
function returns a data.frame containing the number of patients, the observed mortality rate and the predicted mortality rate for each category of the predicted mortality rate. If any other acute physiology score is given, the function will also return the mortality rate predicted by this score for each category.
calcurve(
deaths,
pred,
score = NULL,
name_score = "Saps3",
other_score = NULL,
name_other_score = NULL,
categories_option = c("predicted", "score", "patients"),
table = FALSE,
plot = TRUE,
title_label = "Calibration Curve",
y1axis_label = "Patients (n)",
y2axis_label = "Mortality Rate (%)",
score_color = c("#cac7cc", "#ffc341", "#33cca3"),
bar_color = "#1f77b4",
points = c(19, 18, 17),
cultureCode = "en-US",
legend_inset = -0.7
)# S3 method for calcurve
print(x, ...)
# S3 method for calcurve
plot(
x,
...,
xlab = NULL,
ylab2 = NULL,
main = x$title_label,
text = x$y2axis_label,
ylab = x$y1axis_label,
col = c(x$bar_color, x$score_color),
pch = x$points,
cultureCode = x$cultureCode,
legend_inset = x$legend_inset
)
a numerical vector that only contains 0 and 1, indicating whether the patient was alive or dead, respectively.
a numerical vector that contains the mortality rate predicted by the main score, in percentage, for each patient.
a numerical vector that contains the main score punctuation for each patient, or NULL.
a character string which determines the name of the main score.
a list of numerical vectors, where each vector contains the mortality rate predicted by other score, in percentage, for each patient, or NULL (the default).
if other_score variable is different from NULL, this argument must be a vector with the name(s) of the score(s) given.
a character string which determines if the categories will refer to the main score or to the predicted mortality rate. Accepted values are 'predicted' (the default), 'score' or 'patients'.
logical; if TRUE
prints the data.frame
.
logical; if TRUE
(the default) plots the categories chosen versus the mortality rates in the secondary vertical axis. The main vertical axis refers to the number of patients in each category, represented by the bars.
main title for calcurve
.
labels of the main vertical axis and the secondary axis, respectively, for calcurve
.
a vector with the colors to be used in the score traces for calcurve
.
color of the bars for calcurve
.
a vector with markers types of the scores for calcurve
.
a character specifying which language should be used for plot x axis title and legends. Possible values are 'pt-BR' and 'en-US'. The default is 'en-US'.
inset distance(s) from the margins as a fraction of the plot region when legend is placed by keyword. See legend
.
an object of class 'calcurve'.
further arguments passed to plot
.
label of the horizontal axis for plot.calcurve
, defaults to NULL
.
label of the secondary vertical axis for plot.calcurve
, defaults to NULL
.
main title for plot.calcurve
.
label of the secondary vertical axis for plot.calcurve
.
label of the main vertical axis for plot.calcurve
.
character vector with the colors of the bars and score traces, in this order, for plot.calcurve
.
a vector with markers types of the scores for plot.curve
.
If categories_option = 'score'
, the categories will refer to the deciles of the main score punctuation. If categories_option = 'predicted'
, the categories will refer to fixed intervals of the predicted mortality rate. If categories_option = 'patients'
the categories will refer to the deciles of patients.
# NOT RUN {
# Loading the dataset
data(icu)
# Calibration Curve Plot
a <- calcurve(deaths = icu$UnitDischargeName,
pred = icu$Saps3DeathProbabilityStandardEquation,
score = icu$Saps3Points, name_score = 'Saps3',
categories_option = 'predicted', table = FALSE, plot = TRUE)
# }
Run the code above in your browser using DataLab