Learn R Programming

DESCRIPTION

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)

Copy Link

Version

Install

install.packages('CIplot')

Monthly Downloads

210

Version

1.0

License

GPL (>= 2)

Issues

Pull Requests

Stars

Forks

Maintainer

Toshiaki Ara

Last Published

August 14th, 2017

Functions in CIplot (1.0)

CIplot

Plot Confidential Interval
ORci

Calculate odds ratios and their confidence intervals from glm object
print.ORci

Print Methods for Odds Ratios and their Confidence Intervals of ORci object