Functions to Plot Confidence Interval

Plot confidence interval from the objects of statistical tests such as t.test(), var.test(), cor.test(), prop.test() and fisher.test() ('htest' class), Tukey test [TukeyHSD()], Dunnett test [glht() in 'multcomp' package], logistic regression [glm()], and Tukey or Games-Howell test [posthocTGH() in 'userfriendlyscience' package]. Users are able to set the styles of lines and points. This package contains the function to calculate odds ratios and their confidence intervals from the result of logistic regression.


A function to plot confidential interval for such as 'htest', 'glm' (logistic regression only!) and 'posthocTGH' {userfriendlyscience} objects.

Usage

'htest' object

CIplot(x,
       log = FALSE,
       xlim = NULL, xlab = NULL, main = NULL,
       pch = 21, pcol = "black", pcolbg = "white", pcex = 1,
       cilty = 1, cilwd = 1, cicol = "black",
       v = NULL, vlty = 2, vlwd = 1,  vcol = "black",
       ...)

'glm' object (logistic regression only!)

CIplot(x,
       conf.level = 0.95,
       xlim = NULL, xlab = "Odds Ratio",
       main = NULL,
       pch = 21, pcol = "black",
       pcolbg = "white", pcex = 1, cilty = 1, cilwd = 1,
       cicol = "black", vlty = 2, vlwd = 1,  vcol = "black",
       las = NULL,
       ...)

'posthocTGH' object (Tukey or Games-Howell method)

CIplot(x,
       xlim = NULL, xlab = "Differences in mean", main = NULL,
       pch = 21, pcol = "black", pcolbg = "white", pcex = 1,
       cilty = 1, cilwd = 1, cicol = "black",
       vlty = 2, vlwd = 1,  vcol = "black",
       las = NULL,
       ...)

Arguments

  • x:
    • 'htest' object, typically result of 't.test', 'binom.test', or 'prop.test'.
    • 'glm' object (logistic regression only)
    • 'posthocTGH' object, result of 'posthocTGH' {userfriendlyscience}
  • log: (logical) if log is TRUE, the x axis is drawn logarithmically. 'htest' object only. Default is FALSE.
  • options of plot
    • xlim: the x limits (x1, x2) of the plot.
    • xlab: a title for the x axis: see 'title'.
    • main: a main title for the plot.
    • …: other options for x-axis.
  • options of point
    • pch: plotting 'character', i.e., symbol to use.
    • pcol: color code or name.
    • pcolgb: background (fill) color for the open plot symbols given by 'pch = 21:25'.
    • pcex: character (or symbol) expansion.
  • options of confidence interval line
    • cilty: line types.
    • cilwd: line width.
    • cicol: color code or name.
  • options of an additional line
    • v: the x-value(s) for vertical line. 'htest' object only.
    • lty: line types.
    • lwd: line width.
    • lcol: color code or name.
  • …: other options for x-axis.

Examples

'htest' object

Difference [log = FALSE (default)]

set.seed(1234)
x <- rnorm(10, 10, 2); y <- rnorm(10, 8, 2)
res <- t.test(x, y)
CIplot(res)

x <- binom.test(20, 100, 0.3)
CIplot(x)

x <- matrix(c(10, 7, 8, 9), 2, 2, byrow = TRUE)
res <- prop.test(x)
CIplot(res)

res <- chisq.test(x)
CIplot(x)                  ## Warning and no plot

set.seed(1234)
x <- cor.test(rnorm(10), rnorm(10))
CIplot(x, xlim = c(-1, 1))

Ratio (log = TRUE)

x <- var.test(1:10, (1:10)*1.5)
CIplot(x, log = TRUE)

x <- matrix(c(10, 7, 8, 9), 2, 2, byrow = TRUE)
res <- fisher.test(x)
CIplot(res, log = TRUE)

library(exact2x2)
x <- mcnemar.exact(dat)
CIplot(x, log = TRUE)

'glm' object

library(MASS)
data(birthwt)
x <- glm(low ~  age + lwt + smoke + ptl + ht + ui, data = birthwt,
         family = binomial)
CIplot(x, las = 1)

OR1 <- ORci(x)
CIplot(OR1, las = 1)

'posthocTGH' object

library(userfriendlyscience)
x <- posthocTGH(warpbreaks$breaks, warpbreaks$tension)
CIplot(x, las = 1)

News

Reference manual

It appears you don't have a PDF plugin for this browser. You can click here to download the reference manual.

install.packages("CIplot")

1.0 by Toshiaki Ara, 2 years ago


https://github.com/toshi-ara/CIplot


Report a bug at https://github.com/toshi-ara/CIplot/issues/


Browse source code at https://github.com/cran/CIplot


Authors: Toshiaki Ara


Documentation:   PDF Manual  


GPL (>= 2) license


Imports MASS, multcomp

Suggests BSDA, fmsb, userfriendlyscience


See at CRAN