panel.groups.segplot: Panel to Plot Confidence Intervals by Groups in 'segplot()'

Description Usage Arguments Author(s) See Also Examples

View source: R/panel.groups.segplot.R

Description

This function allows non overlapping error bars in latticeExtra::segplot(). It has the groups = argument.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
panel.groups.segplot(
  x,
  y,
  z,
  centers,
  groups,
  gap = NULL,
  data,
  subscripts,
  ...
)

Arguments

x, y, z, centers, data, subscripts, ...

Arguments passed to segplot().

groups

The grouping variable (factor), with the same length of lwr e upr.

gap

Scalar that is the distance among segments. Default is 0.1. If the grouping factor has k levels, so 0 ≤q \textrm{gap} < 1/k. A negative value for gap will put the segments in a reversed order.

Author(s)

Walmes Zeviani, walmes@ufpr.br.

See Also

segplot().

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
library(latticeExtra)

m0 <- lm(log(breaks) ~ wool * tension, data = warpbreaks)

pred <- with(warpbreaks, expand.grid(KEEP.OUT.ATTRS = TRUE,
                                     wool = levels(wool),
                                     tension = levels(tension)))

pred <- cbind(pred,
              predict(m0, newdata = pred, interval = "confidence"))
str(pred)

segplot(wool ~ lwr + upr, centers = fit, data = pred,
        draw = FALSE, horizontal = FALSE)

segplot(wool ~ lwr + upr, centers = fit, data = pred,
        draw = FALSE, horizontal = FALSE,
        groups = tension, gap = 0.05,
        panel = panel.groups.segplot)

walmes/wzRfun documentation built on Aug. 10, 2021, 2:19 p.m.