Learn R Programming

broman (version 0.84)

ciplot: Effect plot with multiple CIs for different groups

Description

Uses grayplot() to plot a set of confidence intervals.

Usage

ciplot(
  est,
  se = NULL,
  lo = NULL,
  hi = NULL,
  SEmult = 2,
  labels = NULL,
  rotate = FALSE,
  ...
)

Value

None.

Arguments

est

Vector of estimates

se

Vector of standard errors

lo

Vector of lower values for the intervals

hi

Vector of upper values for the intervals

SEmult

SE multiplier to create intervals

labels

Labels for the groups (vector of character strings)

rotate

If TRUE, have group as y-axis; default (FALSE) has group on x-axis.

...

Optional graphics arguments

Details

Calls grayplot() with special choices of graphics parameters, as in dotplot().

Provide either se or both lo and hi. In the case that se is used, the intervals will be est +/- SEmult * se.

If labels is not provided, group names are taken from the names(est). If that is also missing, we use capital letters.

You can control the CI line widths with ci_lwd and the color of the CI segments with ci_col. You can control the width of the segments at the top and bottom with ci_endseg.

See Also

grayplot(), dotplot()

Examples

Run this code
set.seed(97536917)
x <- rnorm(40, c(1,3))
g <- rep(c("A", "B"), 20)
me <- tapply(x, g, mean)
se <- tapply(x, g, function(a) sd(a)/sqrt(sum(!is.na(a))))
ciplot(me, se) # default is +/- 2 SE
ciplot(me, se, SEmult=1)
ciplot(me, se, rotate=TRUE)
lo <- me - 2*se
hi <- me + 2*se
ciplot(me, lo=lo, hi=hi)

Run the code above in your browser using DataLab