SMR: Standardized Mortality Ratio (SMR)

Description Usage Arguments Value Author(s) References See Also Examples

View source: R/SMR.R

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

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
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 SMR.table it must be a character indicating the name of the variable in the data.

pred.var

Death individual predictions (ranging from 0 to 1) in a vector. For SMR.table it must be a character indicating the name of the variable in the data.

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 SMR.table, a dataset where pred.var, obs.var and group.var are in.

group.var

For SMR.table, this is a character vector indicating the name(s) of the variable(s) in the data that will form the groups where SMR will be calculated. The variables must be factors.

use.label

Logical. Default is FALSE. For SMR.table this option will replace the variables names by its labels in var.labels argument.

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 SMR.table to be ordered within each varibale by its original order, or by SMR order, or by lower.Cl order, or by upper.Cl.

decreasing

Logical. When 'reorderd' is TRUE, should the order be decreasing or incresing? See order

x

For the forest.SMR this is the output of SMR.table.

mar1, mar.SMR

Values to set the margins (mar parameter) of left and right windows. See par

overall.arg

A list of arguments passed to text for plotting the overall label. Internally, 'y' coordinate is replaced.

NOE.overall.args

A list of arguments passed to text for plotting the overall N (number of observations), O (observed deaths) and E (expected deaths). Internally, 'labels' and 'y' arguments are replaced.

var.labels.arg

A list of arguments passed to text for plotting the variables labels. Internally, 'y' coordinate is replaced.

cat.labels.arg

A list of arguments passed to text for plotting the categories labels. Internally, 'y' coordinate is replaced.

N.values.arg

A list of arguments passed to text for plotting the values of N (number of observations) of each subgroup. Internally, the arguments 'label' and 'y' coordinate are replaced.

O.values.arg

A list of arguments passed to text for plotting the values of Observed deaths of each subgroup. Internally, the arguments 'label' and 'y' coordinate are replaced.

E.values.arg

A list of arguments passed to text for plotting the values of Expected deaths of each subgroup. Internally, the arguments 'label' and 'y' coordinate are replaced.

NOE.head.arg

A list of arguments passed to text for plotting the labels of the columns N, E and O on the top of the graph. Internally, the 'x' and 'y' coordinates are replaced. The x coordinates are taken from the x in N.values.arg, O.values.arg and E.values.arg.

Overall.seg.arg

A list of arguments passed to segments for plotting the lines corresponding to overall SMR confidence intervals. Internally, 'x' and 'y' coordinates are replaced.

Overall.p.arg

A list of arguments passed to points for plotting the points corresponding to overall SMR. Internally, 'x' and 'y' coordinates are replaced.

Overall.est.arg

A list of arguments passed to text for plotting the overall SMR beside the graph. Internally, 'y' coordinate and 'label' argument are replaced.

cat.seg.arg

A list of arguments passed to segments for plotting the lines corresponding to SMR confidence intervals for all groups. Internally, 'x' and 'y' coordinates are replaced.

cat.p.arg

A list of arguments passed to points for plotting the points corresponding to all categoreis SMR. Internally, 'x' and 'y' coordinates are replaced.

cat.est.arg

A list of arguments passed to text for plotting the categories SMR beside the graph. Internally, 'y' coordinate and 'label' arguments are replaced.

SMR.head.arg

A list of arguments passed to text for plotting the label of the SMR column on the top of the graph. Internally, the 'y' coordinate is replaced.

smr.xlab

Label of the x axis. Default is "Standardized Mortality Ratio".

smr.xlim

Limits of x axis of the forest.SMR plot. Default is "auto", which internally will pick the highest values of all upper.Cl and the lowest lower.Cl. Besides "auto", only a vector of 2 numbers is valid, and will be passed to plot.default.

grid

Logical. If TRUE (default), it will draw a grid with the grid default arguments.

Value

If SMR, then:

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

SRU, reclass, funnel

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
# 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)

Example output

          N    Observed    Expected         SMR    lower.Cl    upper.Cl 
13709.00000  1000.00000  1929.72560     0.51821     0.48337     0.55555 
                  Variables           Levels     N Observed  Expected     SMR
1                   Overall             <NA> 13709     1000 1929.7256 0.51821
2   Mechanichal ventilation               No 11992      475 1379.1279 0.34442
3                      <NA>              Yes  1690      519  549.9631 0.94370
4            Admission type         Clinical  9689      850 1664.8627 0.51055
5                      <NA> Elective surgery  3297       62  134.8148 0.45989
6                      <NA>   Urgent surgery   723       88  130.0481 0.67667
7 Vasopressors at admission               No 11990      496 1382.3766 0.35880
8                      <NA>              Yes  1692      498  546.7144 0.91090
  lower.Cl upper.Cl
1  0.48337  0.55555
2  0.30189  0.39295
3  0.89012  1.00051
4  0.47339  0.55063
5  0.32906  0.64273
6  0.55843  0.81995
7  0.31625  0.40708
8  0.85709  0.96808
   Variables Levels     N Observed  Expected     SMR lower.Cl upper.Cl
1    Overall   <NA> 13709     1000 1929.7256 0.51821  0.48337  0.55555
2   ICU unit      A   760       56   78.8304 0.71039  0.54313  0.92914
3       <NA>      B   662       30   59.6522 0.50292  0.32563  0.77672
4       <NA>      C   729       44  105.6499 0.41647  0.28978  0.59855
5       <NA>      D  2985      102  328.9128 0.31011  0.22862  0.42066
6       <NA>      E  2658      136  324.9898 0.41847  0.33582  0.52147
7       <NA>      F  1635      124  241.9412 0.51252  0.41901  0.62690
8       <NA>      G   580       34   70.6007 0.48158  0.31765  0.73010
9       <NA>      H  1188       90  198.6324 0.45310  0.35866  0.57240
10      <NA>      I  1182       72  205.3119 0.35069  0.26040  0.47228
11      <NA>      J  1330      312  315.2043 0.98983  0.91490  1.07091

ems documentation built on May 2, 2019, 3:26 p.m.