byGroupLOS.boxplot: Boxplot of length of stay by groups

Description Usage Arguments Value See Also Examples

View source: R/LOSplotFns.R

Description

Box plots for length of stay for each specified group with error bars.

Usage

1
byGroupLOS.boxplot(output.LOS, offset = 0, ADD = FALSE, axis = "s", col = "black")

Arguments

output.LOS
offset

How much to offset the bars from integer values. Used when plotting multiple bars on a single plot.

ADD

Indicates if this plot is to be overlayed on to a previous plot.

axis

Default is to label axis but this can be suppressed with "n".

col

Colour of bars.

Value

NULL

See Also

byGroupLOS

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
##---- Should be DIRECTLY executable !! ----
##-- ==>  Define data, use random,
##--	or do  help(data=index)  for the standard data sets.

## The function is currently defined as
function (output.LOS, offset = 0, ADD = FALSE, axis = "s", col = "black") 
{
    namesGroup.short <- names(output.LOS)
    wmeans <- se <- NA
    numGroup <- length(output.LOS)
    neworder <- 1:numGroup
    for (i in 1:numGroup) {
        if (is.null(output.LOS[[i]]$clos.data$e.phi)) {
            wmeans[i] <- se[i] <- 0
        }
        else {
            wmeans[i] <- output.LOS[[i]]$clos.data$e.phi
            se[i] <- output.LOS[[i]]$se
        }
    }
    wmeans <- unlist(wmeans)[neworder]
    se <- se[neworder]
    par(mar = c(5, 9, 2, 0.5))
    bp <- boxplot(0, plot = FALSE, color = "yellow")
    bp$stats <- rbind(wmeans - (2.33 * se), wmeans - (1.96 * 
        se), wmeans, wmeans + (1.96 * se), wmeans + (2.33 * se))
    rownames(bp$stats) <- c("", "", "", "", "")
    bp$n <- rep(20, numGroup)
    bp$conf <- rbind(wmeans - (2.33 * se), wmeans + (2.33 * se))
    bp$names <- namesGroup.short[neworder]
    bxp(bp, horizontal = T, xlab = "Excess length of stay (days)", 
        boxwex = 0.25, las = 1, add = ADD, at = (1:numGroup) + 
            offset, border = col, yaxt = axis)
    abline(v = 0, col = "red", lty = 2)
  }

n8thangreen/HESmanip documentation built on March 21, 2020, 12:20 a.m.