calcurve {ems} | R Documentation |
Calibration Curve
Description
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.
Usage
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 class 'calcurve'
print(x, ...)
## S3 method for class '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
)
Arguments
deaths |
a numerical vector that only contains 0 and 1, indicating whether the patient was alive or dead, respectively. |
pred |
a numerical vector that contains the mortality rate predicted by the main score, in percentage, for each patient. |
score |
a numerical vector that contains the main score punctuation for each patient, or NULL. |
name_score |
a character string which determines the name of the main score. |
other_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). |
name_other_score |
if other_score variable is different from NULL, this argument must be a vector with the name(s) of the score(s) given. |
categories_option |
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'. |
table |
logical; if |
plot |
logical; if |
title_label |
main title for |
y1axis_label , y2axis_label |
labels of the main vertical axis and the secondary axis, respectively, for |
score_color |
a vector with the colors to be used in the score traces for |
bar_color |
color of the bars for |
points |
a vector with markers types of the scores for |
cultureCode |
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'. |
legend_inset |
inset distance(s) from the margins as a fraction of the plot region when legend is placed by keyword. See |
x |
an object of class 'calcurve'. |
... |
further arguments passed to |
xlab |
label of the horizontal axis for |
ylab2 |
label of the secondary vertical axis for |
main |
main title for |
text |
label of the secondary vertical axis for |
ylab |
label of the main vertical axis for |
col |
character vector with the colors of the bars and score traces, in this order, for |
pch |
a vector with markers types of the scores for |
Details
If
categories_option = 'score'
, the categories will refer to the deciles of the main score punctuation. Ifcategories_option = 'predicted'
, the categories will refer to fixed intervals of the predicted mortality rate. Ifcategories_option = 'patients'
the categories will refer to the deciles of patients.
Author(s)
Camila Cardoso
Examples
# 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)