MyNixOS website logo
Description

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.

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)
Metadata

Version

1.0

License

Unknown

Platforms (75)

    Darwin
    FreeBSD
    Genode
    GHCJS
    Linux
    MMIXware
    NetBSD
    none
    OpenBSD
    Redox
    Solaris
    WASI
    Windows
Show all
  • aarch64-darwin
  • aarch64-genode
  • aarch64-linux
  • aarch64-netbsd
  • aarch64-none
  • aarch64_be-none
  • arm-none
  • armv5tel-linux
  • armv6l-linux
  • armv6l-netbsd
  • armv6l-none
  • armv7a-darwin
  • armv7a-linux
  • armv7a-netbsd
  • armv7l-linux
  • armv7l-netbsd
  • avr-none
  • i686-cygwin
  • i686-darwin
  • i686-freebsd
  • i686-genode
  • i686-linux
  • i686-netbsd
  • i686-none
  • i686-openbsd
  • i686-windows
  • javascript-ghcjs
  • loongarch64-linux
  • m68k-linux
  • m68k-netbsd
  • m68k-none
  • microblaze-linux
  • microblaze-none
  • microblazeel-linux
  • microblazeel-none
  • mips-linux
  • mips-none
  • mips64-linux
  • mips64-none
  • mips64el-linux
  • mipsel-linux
  • mipsel-netbsd
  • mmix-mmixware
  • msp430-none
  • or1k-none
  • powerpc-netbsd
  • powerpc-none
  • powerpc64-linux
  • powerpc64le-linux
  • powerpcle-none
  • riscv32-linux
  • riscv32-netbsd
  • riscv32-none
  • riscv64-linux
  • riscv64-netbsd
  • riscv64-none
  • rx-none
  • s390-linux
  • s390-none
  • s390x-linux
  • s390x-none
  • vc4-none
  • wasm32-wasi
  • wasm64-wasi
  • x86_64-cygwin
  • x86_64-darwin
  • x86_64-freebsd
  • x86_64-genode
  • x86_64-linux
  • x86_64-netbsd
  • x86_64-none
  • x86_64-openbsd
  • x86_64-redox
  • x86_64-solaris
  • x86_64-windows