SMR {ems} | R Documentation |
Standardized Mortality Ratio (SMR)
Description
Calculates the standardized mortality ratio and its confidence interval. SMR, for a group, is defined as the ratio of the observed deaths in this group and the sum of the predicted individual probabilities of death by any model (expected deaths).
SMR.table
estimates at once the overall SMR and the SMR across several groups, e.g. ICU units or clinical characteristics. The SMR.table
can be ordered by the SMR estimate or its confidence intervals, facilitating the comparison of the units ranks.
forest.SMR
shows the SMR.table
output as a forest plot. The plot opens two windows and plot at the left side the values from the SMR.table
and at the right side the points and lines graphically representing each SMR and its confidence interval.
Usage
SMR(
obs.var,
pred.var,
digits = 5,
ci.method = c("Hosmer", "Byar"),
ci.level = 0.95
)
SMR.table(
data,
group.var,
obs.var,
pred.var,
digits = 5,
use.label = FALSE,
var.labels = attr(data, "var.labels")[match(group.var, names(data))],
ci.method = c("Hosmer", "Byar"),
ci.level = 0.95,
reorder = c("no", "SMR", "lower.Cl", "upper.Cl"),
decreasing = FALSE
)
forest.SMR(
x,
mar1 = c(5.1, 1, 4.1, 1),
mar.SMR = c(5.1, 7, 4.1, 1),
overall.arg = list(x = 0.01, font = 2, las = 1, labels = var.labels[1], xpd = NA, adj
= 0),
NOE.overall.args = list(x = c(N.values.arg$x, O.values.arg$x, E.values.arg$x), font =
2, las = 1, xpd = NA),
var.labels.arg = list(x = 0.01, font = 2, las = 1, cex = 1, xpd = NA, adj = 0),
cat.labels.arg = list(x = 0.1, font = 3, las = 1, cex = 0.95, col = gray(0.4), xpd =
NA, adj = 0),
N.values.arg = list(x = 0.5, col = gray(0.4), xpd = NA),
O.values.arg = list(x = 0.675, col = gray(0.4), xpd = NA),
E.values.arg = list(x = 0.85, col = gray(0.4), xpd = NA),
NOE.head.arg = list(font = 2, labels = c("N", "O", "E"), xpd = NA),
Overall.seg.arg = list(col = "navyblue", xpd = NA, lwd = 2),
Overall.p.arg = list(pch = 23, cex = 2, col = "black", bg = gray(0.4), xpd = NA),
Overall.est.arg = list(x = smr.xlim[1] - 0.06, las = 1, font = 2, xpd = NA, adj = 1),
cat.seg.arg = list(col = "navyblue", xpd = NA, lwd = 2),
cat.p.arg = list(pch = 22, cex = 1, col = "black", bg = gray(0.4), xpd = NA),
cat.est.arg = list(x = smr.xlim[1] - 0.06, las = 1, col = gray(0.4), xpd = NA, adj =
1),
SMR.head.arg = list(smr.xlim[1] - 0.06, font = 2, labels = "SMR [95% CIs]", xpd =
NA, adj = 1),
smr.xlab = "Standardized Mortality Ratio",
smr.xlim = "auto",
grid = TRUE,
digits = 3
)
Arguments
obs.var |
Observed death. Accepted values are 0 (absence) or 1 (presence) in a vector. For |
pred.var |
Death individual predictions (ranging from 0 to 1) in a vector. For |
digits |
Number of digits for rounding the output. |
ci.method |
Method to estimate the confidence interval. "Hosmer" (default) or "Byar" are acceptable values. |
ci.level |
Level of the confidence interval. Default is 0.95. |
data |
For |
group.var |
For |
use.label |
Logical. Default is FALSE. For |
var.labels |
A character vector with variables labels. The default is to replace the variable name by the label stored at attr(data, "var.labels"). But one may specify labels directly. |
reorder |
Default is "no". Possible values are: "no", "SMR","lower.Cl", and "upper.Cl". It will make the |
decreasing |
Logical. When 'reorderd' is TRUE, should the order be decreasing or incresing? See |
x |
For the |
mar1 , mar.SMR |
Values to set the margins (mar parameter) of left and right windows. See |
overall.arg |
A list of arguments passed to |
NOE.overall.args |
A list of arguments passed to |
var.labels.arg |
A list of arguments passed to |
cat.labels.arg |
A list of arguments passed to |
N.values.arg |
A list of arguments passed to |
O.values.arg |
A list of arguments passed to |
E.values.arg |
A list of arguments passed to |
NOE.head.arg |
A list of arguments passed to |
Overall.seg.arg |
A list of arguments passed to |
Overall.p.arg |
A list of arguments passed to |
Overall.est.arg |
A list of arguments passed to |
cat.seg.arg |
A list of arguments passed to |
cat.p.arg |
A list of arguments passed to |
cat.est.arg |
A list of arguments passed to |
SMR.head.arg |
A list of arguments passed to |
smr.xlab |
Label of the x axis. Default is "Standardized Mortality Ratio". |
smr.xlim |
Limits of x axis of the |
grid |
Logical. If TRUE (default), it will draw a grid with the |
Value
If SMR, then:
-
N
Number of subjects analyzed. O
Observed number of deaths.-
E
Expected number of deaths. -
SMR
Standardized mortality ratio. -
lower.Cl
lower confidence limit. -
upper.Cl
upper confidence limit.
If SMR.table, then a data.frame with the same information as above, and the additional information is returned: "Variables" (variables names), "Levels" (variables levels).
If forest.SMR, then a plot is returned.
Author(s)
Lunna Borges and Pedro Brasil
References
David W. Hosmer and Stanley Lemeshow. Confidence intervals estimates of an index of quality performance basend on logistic regression models. Statistics in Medicine , vol. 14, 2161-2172 (1995)
See Also
Examples
# Loading a example data
data(icu)
# Setting variable labels to data
attr(icu, "var.labels")[match(c("Unit", "IsMechanicalVentilation1h",
"AdmissionTypeName_pri","Vasopressors_D1"), names(icu))] <-
c("ICU unit","Mechanichal ventilation","Admission type","Vasopressors at admission")
# Some editing
icu$Saps3DeathProbabilityStandardEquation <- icu$Saps3DeathProbabilityStandardEquation /100
icu$IsMechanicalVentilation1h <- as.factor(ifelse(icu$IsMechanicalVentilation1h == 1, "Yes", "No"))
icu$AdmissionTypeName_pri <- as.factor(icu$AdmissionTypeName_pri)
levels(icu$AdmissionTypeName_pri) <- c("Clinical","Elective surgery", "Urgent surgery")
icu$Vasopressors_D1 <- as.factor(ifelse(icu$Vasopressors_D1 == 1, "Yes", "No"))
# The overall SMR for the whole sample
SMR(icu$UnitDischargeName, icu$Saps3DeathProbabilityStandardEquation)
# The overall SMR and for some subgroups
x <- SMR.table(data = icu, obs.var = "UnitDischargeName",
pred.var = "Saps3DeathProbabilityStandardEquation",
group.var = c( "IsMechanicalVentilation1h",
"AdmissionTypeName_pri","Vasopressors_D1"),
reorder = "no",
decreasing = TRUE,
use.label = TRUE)
x
# A forest plot for all groups SMR (resize the window may be required)
forest.SMR(x, digits = 2)
# The same thing but reordering the categories
x <- SMR.table(data = icu, obs.var = "UnitDischargeName",
pred.var = "Saps3DeathProbabilityStandardEquation",
group.var = c( "IsMechanicalVentilation1h",
"AdmissionTypeName_pri", "Vasopressors_D1"),
reorder = "SMR",
decreasing = TRUE,
use.label = TRUE)
forest.SMR(x, digits = 2)
# The overall SMR and for all Units
x <- SMR.table(data = icu, obs.var = "UnitDischargeName",
pred.var = "Saps3DeathProbabilityStandardEquation",
group.var = "Unit",
reorder = "no",
decreasing = TRUE,
use.label = TRUE)
x
# A forest plot for all Units
forest.SMR(x, digits = 2)
# The same thing but reordering the categories
x <- SMR.table(data = icu, obs.var = "UnitDischargeName",
pred.var = "Saps3DeathProbabilityStandardEquation",
group.var = "Unit",
reorder = "SMR",
decreasing = TRUE,
use.label = TRUE)
forest.SMR(x, digits = 2)
rm(x, icu)