radial_cld: Radial Plot for a Compact Letter Display Vector

Description Usage Arguments Value Author(s) See Also Examples

View source: R/pairwise.R

Description

This function does a radial plot based on the vector of letters resulted from pairwise comparisons.

Usage

1
2
3
4
5
6
7
8
radial_cld(
  cld,
  labels = cld,
  col = NULL,
  means = NULL,
  perim = FALSE,
  legend = TRUE
)

Arguments

cld

Character vector with strings of letters that indicates which pair of treatment cells are not different.

labels

Vector of text to be annotated next each point.

col

Vector of colors to be used in the segments that joint points.

means

Numeric vector with the estimated means of treatment cells. It is used to place points at distances proportional to the differences on means.

perim

Logical value (default is FALSE) that indicates weather draw or not a circle in the perimeter passing by the points.

legend

Logical value (default is TRUE) that indicates weather daraw or not the legend.

Value

None is returned, only the plot is done.

Author(s)

Walmes Zeviani, walmes@ufpr.r.

See Also

cld2().

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
set.seed(4321)
td <- data.frame(trt = rep(sample(1:20), each = 5))
td$y <- rnorm(nrow(td), mean = 0.15 * sort(td$trt), sd = 1)

plot(y ~ trt, data = td)

# Fit the model.
td$trt <- factor(td$trt)
m0 <- lm(y ~ trt, data = td)
anova(m0)
summary(m0)

library(multcomp)
library(doBy)

X <- LE_matrix(m0, effect = "trt")
rownames(X) <- levels(td$trt)

ci <- apmc(X, m0, focus = "trt", test = "fdr")
ci$cld <- with(ci, ordered_cld(cld, fit))
ci <- ci[order(ci$fit, decreasing = TRUE), ]

library(latticeExtra)

segplot(reorder(trt, fit) ~ lwr + upr,
        centers = fit,
        data = ci,
        draw = FALSE,
        cld = ci$cld) +
    layer(panel.text(x = centers,
                     y = z,
                     labels = sprintf("%0.2f %s",
                                      centers,
                                      cld),
                     pos = 3))

radial_cld(cld = ci$cld)
radial_cld(cld = ci$cld, means = ci$fit, perim = TRUE)
radial_cld(cld = ci$cld, col = 1:3)
radial_cld(cld = ci$cld, col = 1:3)
radial_cld(cld = ci$cld, labels = sprintf("%0.2f %s", ci$fit, ci$cld))

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