CIplot: Plot Confidential Interval

Description Usage Arguments Note See Also Examples

Description

A function to plot confidential interval for such as htest, TukeyHSD, glht (multcomp), glm (logistic regression only!) and posthocTGH (userfriendlyscience) objects.

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
CIplot(x, ...)

## Default S3 method:
CIplot(x, xlog = FALSE, xlim = NULL, xlab = NULL,
  yname = TRUE, las = 0, pch = 21, pcol = 1, pcolbg = "white",
  pcex = 1, conf.level = 0.95, cilty = 1, cilwd = 1, cicol = 1, v,
  vlty = 2, vlwd = 1, vcol = 1, main = NULL, ...)

## S3 method for class 'htest'
CIplot(x, xlog = FALSE, xlim = NULL, xlab = NULL,
  yname = FALSE, v = NULL, ...)

## S3 method for class 'TukeyHSD'
CIplot(x, xlab = "Differences in mean", v = 0, ...)

## S3 method for class 'glht'
CIplot(x, xlab = "Differences in mean", v = 0, ...)

## S3 method for class 'glm'
CIplot(x, conf.level = 0.95, xlog = TRUE,
  xlab = "Odds Ratio", v = 1, ...)

## S3 method for class 'ORci'
CIplot(x, xlog = TRUE, xlab = "Odds Ratio", v = 1, ...)

## S3 method for class 'posthocTGH'
CIplot(x, xlab = "Differences in mean", v = 0, ...)

Arguments

x

default: matrix or data.frame class with 3 columns ('any name', lwr, upr), or an object: htest, TukeyHSD, glht (multcomp), glm (logistic regression only!) or posthocTGH (userfriendlyscience).

...

other options for x-axis.

xlog

(logical) if log is TRUE, the x axis is drawn logarithmically. Default is FALSE.

xlim

the x limits (x1, x2) of the plot.

xlab

a title for the plot.

yname

If yname is TRUE, the name of comparison between groups are shown.

las

numeric in 0,1,2,3; the style of axis labels. Default is 0. see also par.

pch

plotting 'character', i.e., symbol to use.

pcol

color code or name of the points.

pcolbg

background (fill) color for the open plot symbols given by 'pch = 21:25'.

pcex

character (or symbol) expansion of points.

conf.level

default and glm object only. the confidence interval. Default is 0.95. see also ORci.

cilty

line types of conficence intervals.

cilwd

line width of conficence intervals.

cicol

color code or name of conficence intervals.

v

the x-value(s) for vertical line.

vlty

line types of vertical line.

vlwd

line width of vertical line.

vcol

color code or name of vertical line.

main

a main title for the plot.

Note

CIplot was made based on plot.TukeyHSD.

1
2
3
4
5
 #  File src/library/stats/R/TukeyHSD.R
 #  Part of the R package, https://www.R-project.org
 #
 #  Copyright (C) 2000-2001  Douglas M. Bates
 #  Copyright (C) 2002-2015  The R Core Team

See Also

plot, axis, points, par.

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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
##### default (matrix or data.frame)
require(graphics)
x <- matrix(c(3, 1, 5,
              4, 2, 6), 2, 3, byrow = TRUE)
colnames(x) <- c("esti", "lwr", "upr")
rownames(x) <- c("A", "B")
CIplot(x, xlab = "difference", v = 2, las = 1)

##### 'htest' objects
require(graphics)

## t test
set.seed(1234)
a <- rnorm(10, 10, 2); b <- rnorm(10, 8, 2)
x <- t.test(a, b)
CIplot(x)

## binomial test
x <- binom.test(5, 20)
CIplot(x, xlim = c(0, 1))

## Fisher's exact test
x <- matrix(c(10, 7, 8, 9), 2, 2, byrow = TRUE)
res <- fisher.test(x)
CIplot(res, xlog = TRUE)


##### 'TukeyHSD' objects
require(graphics)

## Tukey test
aov1 <- aov(breaks ~ tension + wool, data = warpbreaks)
x <- TukeyHSD(aov1)

oldpar <- par(no.readonly = TRUE)
par(mfrow = c(1, 2))
CIplot(x, las = 1)
par(oldpar)

## example of line type and color
aov1 <- aov(breaks ~ tension, data = warpbreaks)
x <- TukeyHSD(aov1)
CIplot(x, las = 1,
       pcol = 2:4, pcolbg = 2:4, cicol = 2:4,
       vlty = 1, vcol = "gray")

##### 'glht' objects
require(graphics)

## Tukey test
require(multcomp)
aov1 <- aov(breaks ~ tension, data = warpbreaks)
x <- glht(aov1, linfct = mcp(tension = "Tukey"))
CIplot(x, las = 1)

## Dunnett test
x <- glht(aov1, linfct = mcp(tension = "Dunnett"))
CIplot(x, las = 1)


##### 'glm' object: logistic regression only!
## odds ratio
require(graphics)
require(MASS)
data(birthwt)
x <- glm(low ~  age + lwt + smoke + ptl + ht + ui, data = birthwt,
         family = binomial)
CIplot(x, las = 1)


##### 'posthocTGH' object
## Tukey or Games-Howell methos
require(graphics)
if (require(userfriendlyscience)) {
    x <- posthocTGH(warpbreaks$breaks, warpbreaks$tension)
    CIplot(x, las = 1)
}

toshi-ara/CIplot documentation built on May 24, 2019, 2:54 p.m.